Re: VACUUM ANALYZE is faster than ANALYZE? - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: VACUUM ANALYZE is faster than ANALYZE?
Date
Msg-id CA+U5nMJTjOb7+qJsrRaTjZsWPOAw26_iXD5cqPm-_vz5nQGxDQ@mail.gmail.com
Whole thread Raw
In response to VACUUM ANALYZE is faster than ANALYZE?  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: VACUUM ANALYZE is faster than ANALYZE?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Tue, Feb 21, 2012 at 2:00 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote:

> I had to reply to query about usage VACUUM ANALYZE or ANALYZE. I
> expected so ANALYZE should be faster then VACUUM ANALYZE.

VACUUM ANALYZE scans the whole table sequentially.

ANALYZE accesses a random sample of data blocks. Random access is
slower than sequential access, so at some threshold of sample size and
sequential/random I/O speed ratio ANALYZE could become slower.

So it depends upon the hardware and the setting of stats_target.

--
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: VACUUM ANALYZE is faster than ANALYZE?
Next
From: Sandro Santilli
Date:
Subject: [PATCH] typo fix