Preserve index data in pg_statistic across REINDEX CONCURRENTLY
Michael Paquier <michael@paquier.xyz>
Preserve index data in pg_statistic across REINDEX CONCURRENTLY Statistics associated to an index got lost after running REINDEX CONCURRENTLY, while the non-concurrent case preserves these correctly. The concurrent and non-concurrent operations need to be consistent for the end-user, and missing statistics would force to wait for a new analyze to happen, which could take some time depending on the activity of the existing autovacuum workers. This issue is fixed by copying any existing entries in pg_statistic associated to the old index to the new one. Note that this copy is already done with the data of the index in the stats collector. Reported-by: Fabrízio de Royes Mello Author: Michael Paquier, Fabrízio de Royes Mello Reviewed-by: Justin Pryzby Discussion: https://postgr.es/m/CAFcNs+qpFPmiHd1oTXvcPdvAHicJDA9qBUSujgAhUMJyUMb+SA@mail.gmail.com Backpatch-through: 12
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/catalog/heap.c | modified | +41 −0 |
| src/backend/catalog/index.c | modified | +3 −0 |
| src/include/catalog/heap.h | modified | +1 −0 |
| src/test/regress/expected/create_index.out | modified | +22 −0 |
| src/test/regress/sql/create_index.sql | modified | +12 −0 |
Discussion
- Add important info about ANALYZE after create Functional Index 40 messages · 2020-10-26 → 2020-11-16