Re: [HACKERS] Maintaining cluster order on insert - Mailing list pgsql-patches

From Ron Mayer
Subject Re: [HACKERS] Maintaining cluster order on insert
Date
Msg-id ebipoh$1538$1@news.hub.org
Whole thread Raw
In response to Re: [HACKERS] Maintaining cluster order on insert  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Maintaining cluster order on insert
List pgsql-patches
Tom Lane wrote:
> Gene <genekhart@gmail.com> 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.

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Allow commenting of variables in postgresql.conf to -
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] SO_SNDBUF size is small on win32?