Re: "vacuum" and "cluster"

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Jimmy Choi <yhjchoi(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: "vacuum" and "cluster"
Date: 2008-04-16 16:01:26
Message-ID: 480622D6.3000202@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jimmy Choi wrote:
> Hello,
>
> Does running "cluster" remove the need to run "vacuum"?

My understanding is that `CLUSTER' creates a new table file, then swaps
it out for the old one.

http://www.postgresql.org/docs/8.3/static/sql-cluster.html

" During the cluster operation, a temporary copy of the table is created
that contains the table data in the index order. Temporary copies of
each index on the table are created as well. Therefore, you need free
space on disk at least equal to the sum of the table size and the index
sizes. "

It's not stated explicitly, but I'm pretty sure discussion here has
mentioned that too. Given that, VACUUM FULL on a just-CLUSTERed table
should be redundant.

The easy way to be sure is to use ANALYZE VERBOSE to examine the dead
row counts etc before and after each operation.

--
Craig Ringer

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2008-04-16 16:06:19 Re: "vacuum" and "cluster"
Previous Message Greg Sabino Mullane 2008-04-16 15:43:46 Re: Master-master replication with PostgreSQL