pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: ken shaw <kshaw987@yahoo.com>
To: pgsql-performance@postgresql.org
Subject: How to determine whether to VACUUM or CLUSTER
Date: Thu, 16 Jun 2005 11:04:41 -0700 (PDT)
Message-ID: <20050616180442.8983.qmail@web33703.mail.mud.yahoo.com> (raw)


Hi All,

I have an app that updates a PostgreSQL db in a batch fashion. After each batch (or several batches), it issues VACUUM and ANALYZE calls on the updated tables. Now I want to cluster some tables for better performance. I understand that doing a VACUUM and a CLUSTER on a table is wasteful as the CLUSTER makes the VACUUM superfluous. The app does not have a built-in list of the tables and whether each is clustered or not. It looks to me as if the only way to determine whether to issue a VACUUM (on a non-clustered table) or a CLUSTER (on a clustered table) is to query the table "pg_index", much like view "pg_indexes" does, for the column "indisclustered". Is this right?

Also, how expensive is CLUSTER compared to VACUUM? Does CLUSTER read in the whole table, sort it, and write it back out? Or write out a completely new file? Is the time for a CLUSTER the same whether one row is out of place or the table is completely disordered?

Thanks,

Ken


		
---------------------------------
Discover Yahoo!
 Find restaurants, movies, travel & more fun for the weekend. Check it out!

view thread (4+ messages)  latest in thread

Message-ID: <20050616180442.8983.qmail@web33703.mail.mud.yahoo.com>
Permalink:  ../20050616180442.8983.qmail@web33703.mail.mud.yahoo.com/
Also on:    postgresql.org/message-id/20050616180442.8983.qmail@web33703.mail.mud.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: kshaw987@yahoo.com
  Subject: Re: How to determine whether to VACUUM or CLUSTER
  In-Reply-To: <20050616180442.8983.qmail@web33703.mail.mud.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox