3 ms·
This sounds like what I described yesterday: https://news.ycombinator.com/item?id=39713239 https://news.ycombinator.com/item?id=39713239 In addition to what I
by Izkata 3y ago
This sounds like what I described yesterday: https://news.ycombinator.com/item?id=39713239 https://news.ycombinator.com/item?id=39713239
In addition to what I described there, the way you described it, it sounds like you don't have a single index that covers both columns. That may also help if I understood right.
- zac23or 3y ago> it sounds like you don't have a single index that covers both columns. Yes. But other databases (SQLlite, etc.) select the correct index, without the need to create an index with both columns.
- franckpachot 3y agoIn all databases you will avoid bad plans (and the unpredictable performance related to plan changes) by providing the right index. You have two selective filters: WHERE and LIMIT so the right index have both
- franckpachot 3y agoMaybe it is not the planner. On difference between those other databases and PostgreSQL is that their plan do not depend on how freshly the table was vacuumed. The cost of your "correct index" may becomes worse when the rows are updated until they are vacuumed.