1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-19 04:21:08 +03:00

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
This commit is contained in:
Jeff Davis
2024-04-03 16:12:45 -07:00
parent 06286709ee
commit 71b66171d0

View File

@ -2874,7 +2874,11 @@ index_update_stats(Relation rel,
dirty = true; dirty = true;
} }
if (reltuples >= 0) /*
* Avoid updating statistics during binary upgrade, because the indexes
* are created before the data is moved into place.
*/
if (reltuples >= 0 && !IsBinaryUpgrade)
{ {
BlockNumber relpages = RelationGetNumberOfBlocks(rel); BlockNumber relpages = RelationGetNumberOfBlocks(rel);
BlockNumber relallvisible; BlockNumber relallvisible;