Phil Endecott <spam_from_postgresql_general(at)chezphil(dot)org> writes:
> Naively I imagined that ANALYSE looks at each table in turn,
> independently. So why does it need more locks when there are more
> tables?
7.4 runs a database-wide ANALYZE as a single transaction, so the locks
accumulate. This was recognized to be a bad idea :-(. 8.0 is a bit
smarter.
The best bet in 7.4 is probably to use VACUUM ANALYZE rather than
analyzing separately. That will force it to use a transaction per
table.
regards, tom lane