Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VLTTG-0000EG-64 for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Sep 2013 07:43:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VLTTF-0007FT-E1 for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Sep 2013 07:43:45 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VLTTD-0007E7-Rf for pgsql-hackers@postgresql.org; Mon, 16 Sep 2013 07:43:44 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VLTT5-0000Nr-0B for pgsql-hackers@postgresql.org; Mon, 16 Sep 2013 07:43:42 +0000 Received: from sc9-mailhost1.vmware.com (sc9-mailhost1.vmware.com [10.113.161.71]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id EF16F28939; Mon, 16 Sep 2013 00:43:33 -0700 (PDT) Received: from zcs-prod-ext-mta-1.vmware.com (zcs-prod-ext-mta-1.vmware.com [10.113.62.223]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id EB75A18390; Mon, 16 Sep 2013 00:43:33 -0700 (PDT) Received: from zcs-prod-ext-mta-1.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTP id D3C86120032; Mon, 16 Sep 2013 00:50:24 -0700 (PDT) Received: from [192.168.1.90] (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTPSA; Mon, 16 Sep 2013 00:50:23 -0700 (PDT) Message-ID: <5236B6A2.8080607@vmware.com> Date: Mon, 16 Sep 2013 10:43:30 +0300 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: Alexander Korotkov CC: pgsql-hackers Subject: Re: GIN improvements part 1: additional information References: <51CEA13C.8040103@vmware.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -7.6 (-------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 15.09.2013 12:14, Alexander Korotkov wrote: > On Sat, Jun 29, 2013 at 12:56 PM, Heikki Linnakangas< > hlinnakangas@vmware.com> wrote: > >> There's a few open questions: >> >> 1. How are we going to handle pg_upgrade? It would be nice to be able to >> read the old page format, or convert on-the-fly. OTOH, if it gets too >> complicated, might not be worth it. The indexes are much smaller with the >> patch, so anyone using GIN probably wants to rebuild them anyway, sooner or >> later. Still, I'd like to give it a shot. >> >> 2. The patch introduces a small fixed 32-entry index into the packed >> items. Is that an optimal number? >> >> 3. I'd like to see some performance testing of insertions, deletions, and >> vacuum. I suspect that maintaining the 32-entry index might be fairly >> expensive, as it's rewritten on every update to a leaf page. > > It appears that maintaining 32-entry index is really expensive because it > required re-decoding whole page. This issue is fixed in attached version of > patch by introducing incremental updating of that index. Benchmarks will be > posted later today.. Great! Please also benchmark WAL replay; you're still doing non-incremental update of the 32-entry index in ginRedoInsert. A couple of quick comments after a quick glance (in addition to the above): The varbyte encoding stuff is a quite isolated piece of functionality. And potentially useful elsewhere, too. It would be good to separate that into a separate .c/.h files. I'm thinking of src/backend/access/gin/packeditemptr.c, which would contain ginDataPageLeafReadItemPointer, ginDataPageLeafWriteItemPointer and ginDataPageLeafGetItemPointerSize functions. A new typedef for varbyte-encoded things would probably be good too, something like "typedef char *PackedItemPointer". In the new .c file, please also add a file-header comment explaining the encoding. The README really needs to be updated. The posting tree page structure is a lot more complicated now, there needs to be a whole new section to explain it. A picture would be nice, similar to the one in bufpage.h. It's a bit funny that we've clumped together all different kinds of GIN insertions into one WAL record type. ginRedoInsert does completely different things depending on what kind of a page it is. And the ginXlogInsert struct also contains different kinds of things depending on what kind of an insertion it is. It would be cleaner to split it into three. (this isn't your patch's fault - it was like that before, too.) - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers