0 votes
41 views
Dear whom it may concern, I have excuted a simple query as shown below to search time-series data from NSC DR2 and DR1 by using TOPCAT. However, the query doesn't return any result for more than 12 hours. Is there any wrong with my query or the server? Thanks very much~ (the query: select * from nsc_dr1.meas where abs(ra-6.582959)<=0.00027778 and abs(dec+72.794643)<=0.00027778)
asked Nov 30, 2020 by anonymous | 41 views

1 Answer

0 votes
Hi,

thank you for your question.

This query will not use the indexes on ra and dec.  So it will be a full table scan of the billions of rows instead.

When you put a function around the indexed column (abs(ra-6.582959)), it has to calculate that expression for every row.

Try changing the query to not using the ABS function on the indexed columns.
answered Nov 30, 2020 by ascottdemo (940 points)
edited Nov 30, 2020 by ascottdemo
select * from nsc_dr1.meas where ra <= 6.582959+0.0002778  and ra >= 6.582959 - .00027778 and
dec <= 72.794643+0.00027778 and dec >= 72.794643-0.00027778;
I see. Thanks very much for your reply~

217 questions

215 answers

218 comments

1,497 users

Welcome to Data Lab Help Desk, where you can ask questions and receive answers from other members of the community.