Re: Page access pattern in query plan using index scan - Mailing list pgsql-general

From Jack Orenstein
Subject Re: Page access pattern in query plan using index scan
Date
Msg-id 40BF1765.2040304@geophile.com
Whole thread Raw
In response to Re: Page access pattern in query plan using index scan  (Greg Stark <gsstark@mit.edu>)
Responses Re: Page access pattern in query plan using index scan  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Greg Stark wrote:

>>Can you recommend an application-level workaround that will access pages
>>in the right order?
>
>
> Well you could try CLUSTER-ing your table on that index.

For my application, the problem with CLUSTER is that it reclusters the entire
table. So as the table grows, the cost of CLUSTER goes up.

What would be really nice is something like "cluster recent". The idea is to
cluster only rows added since the last cluster. This amortizes the time and storage
costs of clustering across the invocations of cluster in a much more palatable way.
If such a command were used this wisely, (e.g. whenever the table grows by 20%) then
I suspect applications would obtain most of the benefit of a sort following an index
lookup. (And I'm guessing this is a much simpler development task.)

Admittedly, this would not work so well in cases where the index keys change in value.
But this would be a huge win in situations (like mine) where the keys never change.

Jack Orenstein


pgsql-general by date:

Previous
From: Hubert Fröhlich
Date:
Subject: again, invalid page header in block ...
Next
From: Terry Lee Tucker
Date:
Subject: A "linking" Question