Re: [HACKERS] Maintaining cluster order on insert

From: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] Maintaining cluster order on insert
Date: 2006-08-11 20:36:42
Message-ID: ebipoh$1538$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Gene <genekhart(at)gmail(dot)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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2006-08-11 20:44:23 Re: [HACKERS] SO_SNDBUF size is small on win32?
Previous Message Bruce Momjian 2006-08-11 20:16:59 Re: Allow commenting of variables in postgresql.conf to -

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2006-08-11 20:44:23 Re: [HACKERS] SO_SNDBUF size is small on win32?
Previous Message Bruce Momjian 2006-08-11 20:16:59 Re: Allow commenting of variables in postgresql.conf to -