|
|
|
|
|
by citrons
1743 days ago
|
|
I'm currently having a similar issue where the query planner refuses to use the indexes on a search query (was fine for w hile, but one day it just started de-optimizing itself). Instead just does a seq-scan. Instead of the execution taking ~40ms with indexes the query planner thinks that the seq scan of ~1.5s is better... Re-indexes the db and run analyze the table. It gets better for max 30min then PG de-optimizes itself again. I'm kinda stuck on it, any ideas what can I do to resolve it? |
|
This solves many "it does a slow seq scan even though there's an index"-cases.
https://postgresqlco.nf/doc/en/param/random_page_cost/
There are some other query planner knobs you can tune as well; the https://postgresqlco.nf site is pretty good.