I asked:
>>Naively I imagined that ANALYSE looks at each table in turn,
>>independently. So why does it need more locks when there are more
>>tables?
Tom replied:
> 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.
Thanks Tom. I will upgrade to 8.0 one day but not soon. In the
meantime, is there a way to judge a suficient setting for
max_locks_per_transaction so that a global ANALYZE will work? It
doesn't seem to be one lock per table or anything as simple as that.
> 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.
That's another possibility.
Thanks.
--Phil.