Sorry, I was too busy looking at the content.Has the size / # rows changed recently? If the planner thinks it can load all the rows faster, it will use a seqscan regardless if you have an index.If that is the case, you can force index use by doing a SET enable_seqscan = off before executing the query.Hmm... ok... but the situation is:1 - I dropped the index2 - Found a very slow query3 - The "WHERE" clause was using the index that I've just dropped4 - I ran the query in my test environment (Same DB as prod) with explain analyze to see if the query was indeed using the index I've dropped5 - Yes, the query was using the index6 - re-created the index7 - The total time went from 2000ms to 200msSo, I don't think the index was indeed not being used.I believe the stats are not working, just don't know how to confirm that, as I have nothing on my logs
Sorry, I was too busy looking at the content.Has the size / # rows changed recently? If the planner thinks it can load all the rows faster, it will use a seqscan regardless if you have an index.If that is the case, you can force index use by doing a SET enable_seqscan = off before executing the query.
pgsql-general by date:
Соглашаюсь с условиями обработки персональных данных