Is auto-analyze as thorough as manual analyze?

From: Jack Christensen <jack(at)jackchristensen(dot)com>
To: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Is auto-analyze as thorough as manual analyze?
Date: 2017-09-23 22:10:42
Message-ID: 5ddd2617-66b0-a6e2-3af4-618e09a96647@jackchristensen.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Just had an issue where a prepared query would occasionally choose a
very bad plan in production. The same data set in a different
environment consistently would choose the index scan. As would be
expected, running analyze on that table in production resolved the issue.

However, before I ran the analyze I checked pg_stat_user_tables to see
last_autoanalyze for that table. It had run today. But the problem
existed before that. I would have expected that the auto-analyze would
have corrected this (or prevented it entirely if run enough).

So that leaves me wondering: is an auto-analyze the same as manually
running analyze or is a manual analyze more thorough? This is running
version 9.6.3 on Heroku.

Thanks,

Jack

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Melvin Davidson 2017-09-23 22:48:17 Re: Is auto-analyze as thorough as manual analyze?
Previous Message Paul A Jungwirth 2017-09-23 17:09:08 Re: Is float8 a reference type?