pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
What's The Difference Between VACUUM and VACUUM ANALYZE?
6+ messages / 5 participants
[nested] [flat]

* What's The Difference Between VACUUM and VACUUM ANALYZE?
@ 2007-05-08 21:43  Y Sidhu <ysidhu@gmail.com>
  0 siblings, 2 replies; 6+ messages in thread

From: Y Sidhu @ 2007-05-08 21:43 UTC (permalink / raw)
  To: pgsql-performance

I am trying to follow a message thread. One guy says we should be running
vacuum analyze daily and the other says we should be running vacuum multiple
times a day. I have tried looking for what a vacuum analyze is to help me
understand but no luck.

-- 
Yudhvir Singh Sidhu
408 375 3134 cell

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: What's The Difference Between VACUUM and VACUUM ANALYZE?
@ 2007-05-08 21:46  david@lang.hm
  parent: Y Sidhu <ysidhu@gmail.com>
  1 sibling, 0 replies; 6+ messages in thread

From: david@lang.hm @ 2007-05-08 21:46 UTC (permalink / raw)
  To: Y Sidhu <ysidhu@gmail.com>; +Cc: pgsql-performance

On Tue, 8 May 2007, Y Sidhu wrote:

> I am trying to follow a message thread. One guy says we should be running
> vacuum analyze daily and the other says we should be running vacuum multiple
> times a day. I have tried looking for what a vacuum analyze is to help me
> understand but no luck.

vaccum frees tuples that are no longer refrenced
vaccum analyse does the same thing, but then does some additional 
information gathering about what data is in the tables Postgres uses this 
data to adjust it's estimates of how long various things will take 
(sequential scan, etc). if these estimates are off by a huge amount 
(especially if you have never done a vaccum analyse after loading your 
table) then it's very likely that postgres will be slow becouse it's doing 
expensive operations that it thinks are cheap.

David Lang



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: What's The Difference Between VACUUM and VACUUM ANALYZE?
@ 2007-05-08 21:52  Alvaro Herrera <alvherre@commandprompt.com>
  parent: Y Sidhu <ysidhu@gmail.com>
  1 sibling, 1 reply; 6+ messages in thread

From: Alvaro Herrera @ 2007-05-08 21:52 UTC (permalink / raw)
  To: Y Sidhu <ysidhu@gmail.com>; +Cc: pgsql-performance

Y Sidhu escribió:
> I am trying to follow a message thread. One guy says we should be running
> vacuum analyze daily and the other says we should be running vacuum multiple
> times a day. I have tried looking for what a vacuum analyze is to help me
> understand but no luck.

VACUUM ANALYZE is like VACUUM, except that it also runs an ANALYZE
afterwards.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: What's The Difference Between VACUUM and VACUUM ANALYZE?
@ 2007-05-08 22:06  Steinar H. Gunderson <sgunderson@bigfoot.com>
  parent: Alvaro Herrera <alvherre@commandprompt.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Steinar H. Gunderson @ 2007-05-08 22:06 UTC (permalink / raw)
  To: pgsql-performance

On Tue, May 08, 2007 at 05:52:13PM -0400, Alvaro Herrera wrote:
>> I am trying to follow a message thread. One guy says we should be running
>> vacuum analyze daily and the other says we should be running vacuum multiple
>> times a day. I have tried looking for what a vacuum analyze is to help me
>> understand but no luck.
> VACUUM ANALYZE is like VACUUM, except that it also runs an ANALYZE
> afterwards.

Shoot me if I'm wrong here, but doesn't VACUUM ANALYZE check _all_ tuples,
as compared to the random selection employed by ANALYZE?

/* Steinar */
-- 
Homepage: http://www.sesse.net/



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: What's The Difference Between VACUUM and VACUUM ANALYZE?
@ 2007-05-08 22:21  Alvaro Herrera <alvherre@commandprompt.com>
  parent: Steinar H. Gunderson <sgunderson@bigfoot.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Alvaro Herrera @ 2007-05-08 22:21 UTC (permalink / raw)
  To: pgsql-performance

Steinar H. Gunderson wrote:
> On Tue, May 08, 2007 at 05:52:13PM -0400, Alvaro Herrera wrote:
> >> I am trying to follow a message thread. One guy says we should be running
> >> vacuum analyze daily and the other says we should be running vacuum multiple
> >> times a day. I have tried looking for what a vacuum analyze is to help me
> >> understand but no luck.
> > VACUUM ANALYZE is like VACUUM, except that it also runs an ANALYZE
> > afterwards.
> 
> Shoot me if I'm wrong here, but doesn't VACUUM ANALYZE check _all_ tuples,
> as compared to the random selection employed by ANALYZE?

You are wrong, but it won't be me the one to shoot you.

There have been noises towards making the ANALYZE portion use the same
scan that VACUUM already does, but nobody has written the code (it would
be useful for some kinds of stats).

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: What's The Difference Between VACUUM and VACUUM ANALYZE?
@ 2007-05-09 11:31  Gregory Stark <stark@enterprisedb.com>
  parent: Alvaro Herrera <alvherre@commandprompt.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Gregory Stark @ 2007-05-09 11:31 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@commandprompt.com>; +Cc: pgsql-performance

"Alvaro Herrera" <alvherre@commandprompt.com> writes:

> Steinar H. Gunderson wrote:
>
>> Shoot me if I'm wrong here, but doesn't VACUUM ANALYZE check _all_ tuples,
>> as compared to the random selection employed by ANALYZE?
>
> You are wrong, but it won't be me the one to shoot you.
>
> There have been noises towards making the ANALYZE portion use the same
> scan that VACUUM already does, but nobody has written the code (it would
> be useful for some kinds of stats).

I think it does for the count of total records in the table. 
But not for the rest of the stats.

-- 
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com




^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2007-05-09 11:31 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-05-08 21:43 What's The Difference Between VACUUM and VACUUM ANALYZE? Y Sidhu <ysidhu@gmail.com>
2007-05-08 21:46 ` david@lang.hm
2007-05-08 21:52 ` Alvaro Herrera <alvherre@commandprompt.com>
2007-05-08 22:06   ` Steinar H. Gunderson <sgunderson@bigfoot.com>
2007-05-08 22:21     ` Alvaro Herrera <alvherre@commandprompt.com>
2007-05-09 11:31       ` Gregory Stark <stark@enterprisedb.com>

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