Skip to content

Commit 71b6617

Browse files
committed
CREATE INDEX: do not update stats during binary upgrade.
During binary upgrade, indexes are created before the data is moved into place, so it will always be zero. This is not currently a major problem, but will be when we try to preserve statistics during upgrade. Author: Corey Huinker Discussion: https://postgr.es/m/CADkLM=daPdFB8V0tgFxK-dLowFsAEzWRWJHyxij7BG3kBjcouA@mail.gmail.com
1 parent 0628670 commit 71b6617

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/backend/catalog/index.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2874,7 +2874,11 @@ index_update_stats(Relation rel,
28742874
dirty = true;
28752875
}
28762876

2877-
if (reltuples >= 0)
2877+
/*
2878+
* Avoid updating statistics during binary upgrade, because the indexes
2879+
* are created before the data is moved into place.
2880+
*/
2881+
if (reltuples >= 0 && !IsBinaryUpgrade)
28782882
{
28792883
BlockNumber relpages = RelationGetNumberOfBlocks(rel);
28802884
BlockNumber relallvisible;

0 commit comments

Comments
 (0)