Comment

Comment by adeel_siddiqui

set `enable_seqscan` = 'off' or set local `enable_seqscan` = 'off'. This will force the pg query planner to use indexes. Experiment with it until you figure out why your query performance deteriorates. Maybe you are doing a lot of updates/deletes? Increase the statistics sampling size? Autovacuum more frequently?

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton