On Thu, Apr 23, 2009 at 11:21 PM, Michael Monnerie
> On Freitag 24 April 2009 Rafael Domiciano wrote:
>> this table has about 15 indexes...
>> How good are to Cluster table? Has any criteria to cluster table? How
>> can I do it?
> CLUSTER tablename [ USING indexname after which you want data to be
> sorted ]
> Postgres then rewrites the whole table, which creates a new file on the
> disk with the table entries written in the order of the index you chose.
> Don't forget the ANALYZE afterwards.
Note that cluster on a table with random ordering can be really slow.
I've found it's much faster to reorder to a temp table then truncate
the original and insert into ... select from temptable order by xyz
to refill it. Since either cluster or truncate select order by are
both gonna lock the table from users, you might as well use what's
faster for you.
> Question: This will not rewrite the indices for that table, right? Then
> a REINDEX could be interesting too.
Also, if you're doing the select into thing, you can drop the indexes
then recreate them. Usually also faster on a big table being
In response to
pgsql-admin by date
|Next:||From: Simon Riggs||Date: 2009-04-24 08:46:54|
|Subject: Re: postgres 8.2.9 can't drop database in single user mode|
|Previous:||From: Michael Monnerie||Date: 2009-04-24 05:21:43|
|Subject: Re: Updating a very large table|