pg_stat_all_tables not updated when VACUUM ANALYZE execution finishes

Поиск
Список
Период
Сортировка
От Sebastien Arod
Тема pg_stat_all_tables not updated when VACUUM ANALYZE execution finishes
Дата
Msg-id CADd42iFm8k_JvuoaY8kX+uZ5Hbgntpz=PYy0BfuyiNJiU552yg@mail.gmail.com
обсуждение исходный текст
Ответы Re: pg_stat_all_tables not updated when VACUUM ANALYZE executionfinishes  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
Hi,

I face a surprising behaviour with VACUUM ANALYZE.

For a table with a structure like like this (and few records):
create table my_table (
    my_column numeric
);

When I run the following:
VACUUM ANALYZE my_table;
SELECT relname, last_analyze, last_vacuum FROM pg_stat_all_tables where relname='my_table';

The select returns null values for last_analyze and last_vacuum.

However if I wait a little between the end of VACUUM command and the execution of the select the last_xxx columns have non null values.

So it looks like something is done asynchronously here but I'm not sure what?
* Is it the vacuum itself that run asyncrhonously or the update of or the content of the pg_stat_all_tables view?
* If I execute another query right after "VACUUM ANALYZE" is it expected that this other query will benefit from the analyze done in the VACUUM ANALYZE call?
* Is this a bug or a normal behaviour? (I'm using postgresql 9.6)
* Is there a way to wait for pg_stat_all_tables to be up to date? To give a bit of context I was planning to use this information in the assertion part of a test case I wrote to check vacuum were executed as expected but my test is flaky because of this behaviour.


-Seb


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

Предыдущее
От: Đỗ Ngọc Trí Cường
Дата:
Сообщение: Re: Conflict between JSON_AGG and COPY
Следующее
От: Alexandre Arruda
Дата:
Сообщение: Re: ERROR: found multixact from before relminmxid