consequent btree index scans optimizations ?
consequent btree index scans optimizations ?
От:
Oleg Bartunov <oleg@sai.msu.su>
Дата:
Hi there, I'm trying to understand if I have something to optimize in my query which is basically looks like a bunch of many intervals: (ipix >= 341288409261670400 AND ipix < 341358778005848064) OR (ipix >= 341710621726736384 AND ipix < 341728213912780800) OR (ipix >= 341728213912780800 AND ipix < 341745806098825216) OR (ipix >= 340531945261760512 AND ipix < 340549537447804928) OR (ipix >= 340567129633849344 AND ipix < 340584721819893760) ........................................................... Table is rather big (> 500 mln rows) and clustered by btree index on ipix. Generally I'm quite satisfied with performance, but I'm wondering if optimizer take order of intervals into account ? Looking into pg_stat_user_tables I see there were 168 index scans which is exactly the number of intervals and 98530 tuples fetched. Since table is clustered hit ratio is very good and execution time is < 0.5s. Regards, Oleg _____________________________________________________________ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83