diff options
| author | Michael Paquier | 2020-11-01 12:22:07 +0000 |
|---|---|---|
| committer | Michael Paquier | 2020-11-01 12:22:07 +0000 |
| commit | b17ff07aa3eb142d2cde2ea00e4a4e8f63686f96 (patch) | |
| tree | 4a0e8b7b6f6584f0776963da80f072b4b7249363 /src/include | |
| parent | aecaa04418f39c32adb3dbf91c4aa7f6e175f01c (diff) | |
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
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/catalog/heap.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/catalog/heap.h b/src/include/catalog/heap.h index d31141c1a21..f94defff3ce 100644 --- a/src/include/catalog/heap.h +++ b/src/include/catalog/heap.h @@ -134,6 +134,7 @@ extern void RemoveAttributeById(Oid relid, AttrNumber attnum); extern void RemoveAttrDefault(Oid relid, AttrNumber attnum, DropBehavior behavior, bool complain, bool internal); extern void RemoveAttrDefaultById(Oid attrdefId); +extern void CopyStatistics(Oid fromrelid, Oid torelid); extern void RemoveStatistics(Oid relid, AttrNumber attnum); extern const FormData_pg_attribute *SystemAttributeDefinition(AttrNumber attno); |
