Timeline for PostgreSQL: why does an extra WHERE clause make an index-only scan slow?
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 21, 2017 at 17:42 | comment | added | thehouse | With LIMIT 1 the beginning of the range is what I'm after (well, the end, technically) | |
| Nov 21, 2017 at 17:40 | comment | added | mustaccio | Since many of your predicates are range-based rather than equality, binary search is only applicable for finding the beginning of the range, from there index scan cannot be avoided. Table partitioning might be beneficial. | |
| Nov 21, 2017 at 10:52 | vote | accept | thehouse | ||
| Nov 21, 2017 at 10:51 | comment | added | thehouse | You're right! To confirm it I changed update_id to a value higher than MAX(update_id) and the query ran as fast as the one without an update_id clause. Is there some way I can speed up the process of searching for the right update_id? For example, if it's sequentially searching them, could it be made to do binary search using the index? | |
| Nov 20, 2017 at 19:01 | history | answered | mustaccio | CC BY-SA 3.0 |