FOLIO-2625 for a detailed description of the problem.
When an index is created PostgreSQL does not automatically create statistics. By default 10 % of the table plus 50 tuples need to be inserted/updated/deleted to make the autovacuum daemon start an ANALYZE run automatically.
- After index creation and after dropping and re-creating an index run ANALYZE.
Note: ANALYZE is 10 times faster than VACUUM and sufficient to collect statistics.