Re: VACUUM vs VACUUM ANALYZE vs CLUSTER - Mailing list pgsql-novice

From Tom Lane
Subject Re: VACUUM vs VACUUM ANALYZE vs CLUSTER
Date
Msg-id 1258.1000957076@sss.pgh.pa.us
Whole thread Raw
In response to VACUUM vs VACUUM ANALYZE vs CLUSTER  (Sheldon Hearn <sheldonh@starjuice.net>)
Responses Re: VACUUM vs VACUUM ANALYZE vs CLUSTER  (Sheldon Hearn <sheldonh@starjuice.net>)
List pgsql-novice
Sheldon Hearn <sheldonh@starjuice.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

pgsql-novice by date:

Previous
From: Sheldon Hearn
Date:
Subject: VACUUM vs VACUUM ANALYZE vs CLUSTER
Next
From: Tom Lane
Date:
Subject: Re: Replace Old Table with New