Re: Fillfactor for GIN indexes

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fillfactor for GIN indexes
Date: 2015-07-10 01:54:31
Message-ID: CAB7nPqT0BL1RZHD+TgWzZXmY2Gj4=CSD=zQjY_Hrw-pT+iNXTg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 9, 2015 at 10:33 PM, Alexander Korotkov wrote:
> [...]

+ /* Caclculate max data size on page according to fillfactor */
s/Caclculate/Calculate

When creating a simple gin index, I am seeing that GinGetMaxDataSize gets
called with ginEntryInsert:
* frame #0: 0x000000010a49d72e
postgres`GinGetMaxDataSize(index=0x0000000114168378, isBuild='\x01') + 14
at gindatapage.c:436
frame #1: 0x000000010a49ecbe
postgres`createPostingTree(index=0x0000000114168378,
items=0x0000000114a9c038, nitems=35772, buildStats=0x00007fff55787350) +
302 at gindatapage.c:1754
frame #2: 0x000000010a493423
postgres`buildFreshLeafTuple(ginstate=0x00007fff55784d90, attnum=1,
key=2105441, category='\0', items=0x0000000114a9c038, nitem=35772,
buildStats=0x00007fff55787350) + 339 at gininsert.c:158
frame #3: 0x000000010a492f84
postgres`ginEntryInsert(ginstate=0x00007fff55784d90, attnum=1, key=2105441,
category='\0', items=0x0000000114a9c038, nitem=35772,
buildStats=0x00007fff55787350) + 916 at gininsert.c:228

And as far as I can see GinGetMaxDataSize uses isBuild:
+ int
+ GinGetMaxDataSize(Relation index, bool isBuild)
+ {
+ int fillfactor, result;
+
+ /* Grab option value which affects only index build */
+ if (!isBuild)
However isBuild is not set in this code path, see
http://www.postgresql.org/message-id/CAB7nPqSc4VQ9mHKqm_YvAfcTEhO-iUY8SKbXYdnMGnAi1XnPaw@mail.gmail.com
where I reported the problem. So this code is somewhat broken, no? I am
attaching to this email the patch in question that should be applied on top
of Alexander's latest version.

+ #define GIN_MIN_FILLFACTOR 20
+ #define GIN_DEFAULT_FILLFACTOR 90
I am still worrying about using a default fillfactor at 90, as we did a lot
of promotion about compression of GIN indexes in 9.4. Feel free to ignore
this comment if you think that 90 is a good default. The difference is
visibly in order of MBs even for large indexes still, this is changing the
default of 9.4 and 9.5.
Regards,
--
Michael

Attachment Content-Type Size
20141120_gin_entry_build_fix.patch text/x-diff 468 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2015-07-10 04:31:18 Re: [PATCH] Generalized JSON output functions
Previous Message Michael Paquier 2015-07-09 23:52:17 Re: Improving log capture of TAP tests with IPC::Run