ignite
ignite copied to clipboard
sql query use "in ..." is very slow
this is query very slow,aboult 1s: SELECT f1,f2,f3 FROM table_x WHERE f1IN (107,108) AND f2= 1 AND ydate = 20230616
this is query very fast,about 20ms: SELECT f1,f2,f3 FROM table_x WHERE f1=107 AND f2= 1 AND ydate = 20230616 UNION ALL SELECT f1,f2,f3 FROM table_x WHERE f1=108 AND f2 = 1 AND ydate = 20230616
this is why?
CREATE INDEX table_x_IDX ON PUBLIC.table_x (f1,f2 DESC,f3,f4);