X-Original-To: pgsql-patches-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 980549FB292 for ; Fri, 11 Aug 2006 17:36:49 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 54454-01 for ; Fri, 11 Aug 2006 17:36:40 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id C1F1D9FB1E0 for ; Fri, 11 Aug 2006 17:36:39 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 9215330F32; Fri, 11 Aug 2006 22:36:38 +0200 (MET DST) From: Ron Mayer X-Newsgroups: pgsql.patches Subject: Re: [HACKERS] Maintaining cluster order on insert Date: Fri, 11 Aug 2006 13:36:42 -0700 Organization: Hub.Org Networking Services Lines: 27 Message-ID: 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> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Thunderbird 1.5.0.4 (X11/20060713) In-Reply-To: <9461.1155178183@sss.pgh.pa.us> X-Enigmail-Version: 0.94.0.0 To: pgsql-patches@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200608/155 X-Sequence-Number: 20671 Tom Lane wrote: > Gene writes: >> I have a table that inserts lots of rows (million+ per day) int8 as primary >> key, and I cluster by a timestamp which is approximately the timestamp of >> the insert... > > ISTM you should hardly need to worry about clustering that --- the data > will be in timestamp order pretty naturally. 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. If I understand Heikki's patch, it would help for this use case. > 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.