Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3a675f7

Browse files
committed
Count heap tuples in non-SnapshotAny path in IndexBuildHeapRangeScan().
Brown-paper-bag bug in commit7c91a03: when we rearranged the placementof "reltuples += 1" statements, we missed including one in this code path.The net effect of that was that CREATE INDEX CONCURRENTLY would set thetable's pg_class.reltuples to zero, as would index builds done duringbootstrap mode. (It seems like parallel index builds ought to failsimilarly, but they don't, perhaps because reltuples is computed in someother way. You certainly couldn't figure that out from the abysmallyunderdocumented parallelism code in this area.)I was led to this by wondering why initdb seemed to have slowed down asa result of7c91a03, as is evident in the buildfarm's timing history.The reason is that every system catalog with indexes had pg_class.reltuples= 0 after bootstrap, causing the planner to make some terrible choices forqueries in the post-bootstrap steps. On my workstation, this fix causesthe runtime of "initdb -N" to drop from ~2.0 sec to ~1.4 sec, which isalmost though not quite back to where it was in v10. That's not much ofa deal for production use perhaps, but it makes a noticeable differencefor buildfarm and "make check-world" runs, which do a lot of initdbs.
1 parentd2c1512 commit3a675f7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

‎src/backend/catalog/index.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2850,6 +2850,7 @@ IndexBuildHeapRangeScan(Relation heapRelation,
28502850
{
28512851
/* heap_getnext did the time qual check */
28522852
tupleIsAlive= true;
2853+
reltuples+=1;
28532854
}
28542855

28552856
MemoryContextReset(econtext->ecxt_per_tuple_memory);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp