X-Original-To: pgsql-patches-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 8A5499FB2FA for ; Fri, 11 Aug 2006 20:17:05 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 09561-04 for ; Fri, 11 Aug 2006 23:16:57 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from webmail.enterprisedb.com (edb04.managed.contegix.com [63.246.7.176]) by postgresql.org (Postfix) with ESMTP id C23329FB22F for ; Fri, 11 Aug 2006 20:16:56 -0300 (ADT) Received: from [192.168.1.76] (host86-130-26-100.range86-130.btcentralplus.com [86.130.26.100]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by webmail.enterprisedb.com (Postfix) with ESMTP id 98F82A24954; Fri, 11 Aug 2006 18:16:54 -0500 (CDT) Message-ID: <44DD0FEA.8070002@enterprisedb.com> Date: Sat, 12 Aug 2006 00:16:58 +0100 From: Heikki Linnakangas User-Agent: Thunderbird 1.5.0.4 (X11/20060713) MIME-Version: 1.0 To: Ron Mayer Cc: pgsql-patches@postgresql.org Subject: Re: [HACKERS] Maintaining cluster order on insert References: <44DA31B1.3090700@enterprisedb.com> <28914.1155154622@sss.pgh.pa.us> <36e682920608091347m4e075a8cv6a04e3c4d97ed6f4@mail.gmail.com> <430d92a20608091831w6e59da84k48a58110cb98e8d6@mail.gmail.com> <9461.1155178183@sss.pgh.pa.us> 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=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200608/157 X-Sequence-Number: 20673 Ron Mayer wrote: > In my case my biggest/slowest tables are clustered by zip-code (which > does a reasonable job at keeping counties/cities/etc on the > same pages too). Data comes in constantly (many records per minute, as > we ramp up), pretty uniformly across the country; but most queries > are geographically bounded. The data's pretty much insert-only. No deletes? If the tables grow over time, you probably would need to run CLUSTER every now and then to get the best performance, though the patch would alleviate that quite a lot. Do you have a development environment where you could test what effect the patch would have? It would be interesting to have a real-world use case, since I don't have one myself at the moment. > If I understand Heikki's patch, it would help for this use case. Yes, it would. > > Your best bet might be to partition the table into two subtables, one > > with "stable" data and one with the fresh data, and transfer rows from > > one to the other once they get stable. Storage density in the "fresh" > > part would be poor, but it should be small enough you don't care. > > Hmm... that should work well for me too. Not sure if the use-case > I mentioned above is still compelling anymore; since this seems like > it'd give me much of the benefit; and I don't need an excessive > fillfactor on the stable part of the table. Umm, if your inserts are uniformly distributed across the country, you wouldn't have a stable part, right? - Heikki