In our postgres db we historically have many similar indexes (e.g. is_deleted
boolean) that have quite bad selectivity value. Worse than that, sometimes query planner breaks and postgres starts to use some of them instead of much more efficient indexes so we need to call ANALYZE
manually to fix performance, so we decided to delete most of them.
Do we need to call ANALYZE
for each table after deleting index?
According to the answer in Is it necessary to ANALYZE a table after an index has been created? postgres collects stats about actual values in table (for simple indexes) without index-related info but I couldn't find proof in docs.