Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id C796BB5DBE5 for ; Tue, 16 Aug 2011 16:11:01 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 28377-04 for ; Tue, 16 Aug 2011 19:10:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og103.obsmtp.com (exprod7og103.obsmtp.com [64.18.2.159]) by mail.postgresql.org (Postfix) with ESMTP id 465E8B5DBE4 for ; Tue, 16 Aug 2011 16:10:54 -0300 (ADT) Received: from mail-fx0-f54.google.com ([209.85.161.54]) (using TLSv1) by exprod7ob103.postini.com ([64.18.6.12]) with SMTP ID DSNKTkrAvXkraL1Avqrpaz9hZNGKDdX0S0/d@postini.com; Tue, 16 Aug 2011 12:10:54 PDT Received: by mail-fx0-f54.google.com with SMTP id 4so369426fxe.27 for ; Tue, 16 Aug 2011 12:10:52 -0700 (PDT) Received: by 10.223.160.131 with SMTP id n3mr69409fax.111.1313521852800; Tue, 16 Aug 2011 12:10:52 -0700 (PDT) Received: from [192.168.1.183] (dsl-hkibrasgw2-ff7ac300-240.dhcp.inet.fi [88.195.122.240]) by mx.google.com with ESMTPS id b14sm254514fab.43.2011.08.16.12.10.50 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 16 Aug 2011 12:10:51 -0700 (PDT) Message-ID: <4E4AC0B9.8070203@enterprisedb.com> Date: Tue, 16 Aug 2011 22:10:49 +0300 From: Heikki Linnakangas User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; fi-FI; rv:1.9.2.18) Gecko/20110626 Icedove/3.1.11 MIME-Version: 1.0 To: Alexander Korotkov CC: Robert Haas , pgsql-hackers Subject: Re: WIP: Fast GiST index build References: <4E3977D8.1020506@enterprisedb.com> <4E3FAB1D.1060105@enterprisedb.com> <4E42DFCE.3050904@enterprisedb.com> <4E4AAC49.7070401@enterprisedb.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201108/793 X-Sequence-Number: 193548 On 16.08.2011 21:46, Alexander Korotkov wrote: > On Tue, Aug 16, 2011 at 9:43 PM, Heikki Linnakangas< > heikki.linnakangas@enterprisedb.com> wrote: > >> Why is there ever a buffer on the root node? It seems like a waste of time >> to load N tuples from the heap into the root buffer, only to empty the >> buffer after it fills up. You might as well pull tuples directly from the >> heap. >> > Yes, seems reasonable. Buffer on the root node was in the paper. But now I > don't see the need of it too. Here's an version of the patch with a bunch of minor changes: * No more buffer on root node. Aside from the root buffer being pointless, this simplifies gistRelocateBuildBuffersOnSplit slightly as it doesn't need the special case for root block anymore. * Moved the code to create new root item from gistplacetopage() to gistRelocateBuildBuffersOnSplit(). Seems better to keep the buffering-related code away from the normal codepath, for the sake of readability. * Changed the levelStep calculation to use the more accurate upper bound on subtree size that we discussed. * Changed the levelStep calculation so that it doesn't do just min(maintenance_work_mem, effective_cache_size) and calculate the levelStep from that. Maintenance_work_mem matters determines the max. number of page buffers that can be held in memory at a time, while effective_cache_size determines the max size of the subtree. Those are subtly different things. * Renamed NodeBuffer to GISTNodeBuffer, to avoid cluttering the namespace * Plus misc comment, whitespace, formatting and naming changes. I think this patch is in pretty good shape now. Could you re-run the performance tests you have on the wiki page, please, to make sure the performance hasn't regressed? It would also be nice to get some testing on the levelStep and pagesPerBuffer estimates, and the point where we switch to the buffering method. I'm particularly interested to know if there's any corner-cases with very skewed data distributions or strange GUC settings, where the estimates fails badly. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com