Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 91C3CB5DBD1 for ; Mon, 25 Jul 2011 15:52:41 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 34541-02 for ; Mon, 25 Jul 2011 18:52:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og113.obsmtp.com (exprod7og113.obsmtp.com [64.18.2.179]) by mail.postgresql.org (Postfix) with ESMTP id B7117B5DBCB for ; Mon, 25 Jul 2011 15:52:33 -0300 (ADT) Received: from mail-fx0-f41.google.com ([209.85.161.41]) (using TLSv1) by exprod7ob113.postini.com ([64.18.6.12]) with SMTP ID DSNKTi27b1pTpEG6SiJj4ZC79JhBMIerm3mJ@postini.com; Mon, 25 Jul 2011 11:52:34 PDT Received: by fxg9 with SMTP id 9so8664592fxg.14 for ; Mon, 25 Jul 2011 11:52:30 -0700 (PDT) Received: by 10.223.159.8 with SMTP id h8mr7307584fax.3.1311619950591; Mon, 25 Jul 2011 11:52:30 -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 d6sm3951748fak.10.2011.07.25.11.52.22 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jul 2011 11:52:23 -0700 (PDT) Message-ID: <4E2DBB60.80604@enterprisedb.com> Date: Mon, 25 Jul 2011 21:52:16 +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: pgsql-hackers Subject: Re: WIP: Fast GiST index build References: <4E0894FF.8080202@enterprisedb.com> <26338.1310134685@sss.pgh.pa.us> <4E1DA4CB.9020209@enterprisedb.com> <4E1EABD9.5000308@enterprisedb.com> <4E1F5763.9090109@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: 201107/1351 X-Sequence-Number: 192450 On 22.07.2011 12:38, Alexander Korotkov wrote: > Patch with my try to detect ordered datasets is attached. The implemented > idea is desribed below. > Index tuples are divided by chunks of 128. On each chunk we measure how much > leaf pages where index tuples was inserted don't match those of previous > chunk. Based on statistics of several chunks we estimate distribution of > accesses between lead pages (exponential distribution law is accumed and > it's seems to be an error). After that we can estimate portion of index > tuples which can be processed without actual IO. If this estimate exceeds > threshold then we should switch to buffering build. > Now my implementation successfully detects randomly mixed datasets and well > ordered datasets, but it's seems to be too optimistic about intermediate > cases. I believe it's due to wrong assumption about distribution law. > Do you think this approach is acceptable? Probably there are some researches > about distribution law for such cases (while I didn't find anything relevant > in google scholar)? Great! It would be nice to find a more scientific approach to this, but that's probably fine for now. It's time to start cleaning up the patch for eventual commit. You got rid of the extra page pins, which is good, but I wonder why you still pre-create all the GISTLoadedPartItem structs for the whole subtree in loadTreePart() ? Can't you create those structs on-the-fly, when you descend the tree? I understand that it's difficult to update all the parent-pointers as trees are split, but it feels like there's way too much bookkeeping going on. Surely it's possible to simplify it somehow.. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com