Re: vacuumdb --analyze-in-stages

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: vacuumdb --analyze-in-stages
Дата
Msg-id 202110182353.6lbwp4redjd2@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: vacuumdb --analyze-in-stages  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: vacuumdb --analyze-in-stages  ("Euler Taveira" <euler@eulerto.com>)
Список pgsql-docs
On 2021-Oct-18, David G. Johnston wrote:

> On Mon, Oct 18, 2021 at 4:02 PM Alvaro Herrera <alvherre@alvh.no-ip.org>
> wrote:

> > Given that the first stage uses statistic target=1, running this option
> > in a database with any stats at all is probably a bad idea.
>
> Add the word "only"?
> 
> This option is only useful to analyze a database...

Maybe this is sufficient, since it would drive people away from trying
to do anything else than help upgrades with it.

> Beyond that maybe adjust the procedure description to include a comment
> that we don't actually skip tables that already have a higher statistics
> target than the current pass would apply. (can we do this?)

Hmm, vacuumdb can certainly query the catalogs to see what we have and
skip tables for which we have more than that number, perhaps with a
query based on this number

select tablename,
    max(coalesce(cardinality(histogram_bounds), cardinality(most_common_freqs))) - 1
from pg_stats
group by tablename;

(and of course *don't* skip tables in the final stage, since the stored
stats could be obsolete.)

> "Run several (currently three) stages of analyze with different
> configuration settings, to produce usable statistics faster.  The first of
> these stages will remove any existing statistics even if they use a larger
> statistic target configuration."

.. yeah, this is another option.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/



В списке pgsql-docs по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: vacuumdb --analyze-in-stages
Следующее
От: "Euler Taveira"
Дата:
Сообщение: Re: vacuumdb --analyze-in-stages