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

Commitec28808

Browse files
committed
Fix ginEntryInsert's counting of GIN leaf tuples.
As the code stands, nEntries counts the number of ginEntryInsert()calls, so that's what you end up with at the end of a GIN index build.However, ginvacuumcleanup() recomputes nEntries as the number ofsurviving leaf tuples, and that's generally consistent with the way thatgincostestimate() uses the value. So let's clearly define nEntriesas the number of leaf tuples, and therefore adjust ginEntryInsert() toincrement it only when we make a new one, not when we add TIDs into anexisting tuple or posting tree.In practice this inconsistency probably has little impact, so I don'tfeel a need to back-patch.Insung Moon and Keisuke KurodaDiscussion:https://postgr.es/m/CAEMmqBuH_O-oXL+3_ArQ6F5cJ7kXVow2SGQB3HRacku_T+xkmA@mail.gmail.com
1 parenta63c84e commitec28808

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

‎src/backend/access/gin/gininsert.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,6 @@ ginEntryInsert(GinState *ginstate,
190190

191191
insertdata.isDelete= false;
192192

193-
/* During index build, count the to-be-inserted entry */
194-
if (buildStats)
195-
buildStats->nEntries++;
196-
197193
ginPrepareEntryScan(&btree,attnum,key,category,ginstate);
198194
btree.isBuild= (buildStats!=NULL);
199195

@@ -234,6 +230,13 @@ ginEntryInsert(GinState *ginstate,
234230
/* no match, so construct a new leaf entry */
235231
itup=buildFreshLeafTuple(ginstate,attnum,key,category,
236232
items,nitem,buildStats,stack->buffer);
233+
234+
/*
235+
* nEntries counts leaf tuples, so increment it only when we make a
236+
* new one.
237+
*/
238+
if (buildStats)
239+
buildStats->nEntries++;
237240
}
238241

239242
/* Insert the new or modified leaf tuple */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp