Skip site navigation (1) Skip section navigation (2)

Re: VACUUM vs VACUUM ANALYZE vs CLUSTER

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sheldon Hearn <sheldonh(at)starjuice(dot)net>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: VACUUM vs VACUUM ANALYZE vs CLUSTER
Date: 2001-09-20 03:37:56
Message-ID: 1258.1000957076@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
Sheldon Hearn <sheldonh(at)starjuice(dot)net> writes:
> 1) Is VACUUM ANALYZE a complete superset of VACUUM?

Yes.  There used to be some documentation suggesting otherwise, but
I thought we'd fixed it all.  If you still see something unclear on
this, please cite chapter and verse.

> 2) VACUUM and CLUSTER both affect the arrangement of rows on disk.  Does
>    CLUSTER leave holes behind, and if so is there a run order for VACUUM
>    and CLUSTER that results in well-packed _and_ well-orderd rows on
>    disk?

CLUSTER should create a tightly-packed file; there's no need for VACUUM
afterwards.  (But VACUUM ANALYZE, or just ANALYZE in 7.2, would be
worthwhile to ensure that the planner has good data statistics for the
updated table.  It won't save you even one byte of table space, mind
you, only update pg_statistic entries.)

Conversely, VACUUM just before CLUSTER is a complete waste of time,
since any dead tuples that VACUUM might remove won't be copied by
CLUSTER anyway.

> I don't think I need to be spoonfed and am more than willing to read
> whole chapters to find my answer, but I'm pretty certain the PostgreSQL
> docs (as distributed with 7.1.3) don't resolve this confusion.

Feel free to submit suggested documentation patches... if you are
confused, so will be those who follow, so tell us how to make it
clearer!

			regards, tom lane

In response to

pgsql-novice by date

Next:From: Tom LaneDate: 2001-09-20 06:45:58
Subject: Re: Replace Old Table with New
Previous:From: David LeblingDate: 2001-09-19 20:58:36
Subject: Replace Old Table with New

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group