Re: slow query performance - Mailing list pgsql-general

From Mark Kirkwood
Subject Re: slow query performance
Date
Msg-id 3FA2D196.70702@paradise.net.nz
Whole thread Raw
In response to Re: slow query performance  ("Dave Weaver" <davew@wsieurope.com>)
Responses Re: slow query performance  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
List pgsql-general
Dave Weaver wrote:

>>- clustering the "obs" table on "station"
>>
>>
>
>Sorry, I don't understand what you mean by this - can you explain?
>
>
>
Supposing obs_pkey is on (station, valid_time):

cluster obs_pkey on obs

will re-order the rows in obs based on the index obs_pkey. (This is
clustering on 'station' and 'valid_time', to do just station you could
use an index on just 'station').

The down side is that the row ordering is slowly lost as rows are
updated, so periodic running of the cluster command is needed - this is
a pain as it will take a while for 13 million row table.

regards

Mark


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: duplicates rejected by index reports PGSQL_FATAL_ERROR
Next
From: Tom Lane
Date:
Subject: Re: Cartesian product bug?