Re: GIN improvements part 1: additional information

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: Tomas Vondra <tv(at)fuzzy(dot)cz>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: GIN improvements part 1: additional information
Date: 2014-01-17 18:38:22
Message-ID: 52D9789E.3030202@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 01/17/2014 01:05 PM, Alexander Korotkov wrote:
> Seems to be fixed in the attached version of patch.
> Another improvement in this version: only left-most segments and further
> are re-encoded. Left part of page are left untouched.

I'm looking into this now. A few quick notes:

* Even when you don't re-encode the whole page, you still WAL-log the
whole page. While correct, it'd be a pretty obvious optimization to only
WAL-log the modified part.

* When new items are appended to the end of the page so that only the
last existing compressed segment is re-encoded, and the page has to be
split, the items aren't divided 50/50 on the pages. The loop that moves
segments destined for the left page to the right won't move any
existing, untouched, segments.

> ! /*
> ! * Didn't fit uncompressed. We'll have to encode them. Check if both
> ! * new items and uncompressed items can be placed starting from last
> ! * segment of page. Then re-encode only last segment of page.
> ! */
> ! minNewItem = newItems[0];
> ! if (nolduncompressed == 0 &&
> ! ginCompareItemPointers(&olduncompressed[0], &minNewItem) < 0)
> ! minNewItem = olduncompressed[0];

That looks wrong. If I'm understanding it right, it's trying to do
minNewItem = Min(newItems[0], olduncompressed[0]). The test should be
"nolduncompressed > 0 && ..."

No need to send a new patch, I'll just fix those while reviewing...

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2014-01-17 18:49:37 Re: GIN improvements part 1: additional information
Previous Message Mel Gorman 2014-01-17 18:34:25 Re: [Lsf-pc] Re: Linux kernel impact on PostgreSQL performance (summary v2 2014-1-17)