Обсуждение: The return of the auto-vacuum

Поиск
Список
Период
Сортировка

The return of the auto-vacuum

От
"Nestor A. Diaz"
Дата:
Hello Everybody,

This is the scenario:

I have a postgres 8.4, debian packages installed from pgdg repository
and version equal to: 8.4.21-1.pgdg70+1

I have a GPS database that insert about 4 million records on some tables
every week, the database is partitioned per week, I do a manual vacuum
every week and when we start the week then we 'vacuum analyze' the last
week tables.

However sometimes we have autovacuum running on older tables and I don't
know why, something like this:

autovacuum: VACUUM partitions.device_event_2015w05 (to prevent wraparound)

Those tables are almost read only, they are just involved in select
queries, but the system sometimes autovacuum them.

Any guess on why is the autovacuum daemon starting the process on those
tables ? It doesn't matter if they have been vacuumend before and
nothing have changed on those tables ?

Sorry, I still don't understand how the 'prevent wraparound' works, I
thought that 'vacuum to prevent wraparound' only got fired on tables
that were highly modified.

Thanks.

--
Nestor.



Re: The return of the auto-vacuum

От
Adrian Klaver
Дата:
On 02/11/2015 07:49 AM, Nestor A. Diaz wrote:
> Hello Everybody,
>
> This is the scenario:
>
> I have a postgres 8.4, debian packages installed from pgdg repository
> and version equal to: 8.4.21-1.pgdg70+1
>
> I have a GPS database that insert about 4 million records on some tables
> every week, the database is partitioned per week, I do a manual vacuum
> every week and when we start the week then we 'vacuum analyze' the last
> week tables.
>
> However sometimes we have autovacuum running on older tables and I don't
> know why, something like this:
>
> autovacuum: VACUUM partitions.device_event_2015w05 (to prevent wraparound)
>
> Those tables are almost read only, they are just involved in select
> queries, but the system sometimes autovacuum them.
>
> Any guess on why is the autovacuum daemon starting the process on those
> tables ? It doesn't matter if they have been vacuumend before and
> nothing have changed on those tables ?
>
> Sorry, I still don't understand how the 'prevent wraparound' works, I
> thought that 'vacuum to prevent wraparound' only got fire
d on tables
> that were highly modified.

http://www.postgresql.org/docs/8.4/static/routine-vacuuming.html

"VACUUM normally skips pages that don't have any dead row versions, but
those pages might still have row versions with old XID values. To ensure
all old XIDs have been replaced by FrozenXID, a scan of the whole table
is needed. vacuum_freeze_table_age controls when VACUUM does that: a
whole table sweep is forced if the table hasn't been fully scanned for
vacuum_freeze_table_age minus vacuum_freeze_min_age transactions.
Setting it to 0 forces VACUUM to always scan all pages, effectively
ignoring the visibility map."

>
> Thanks.
>
> --
> Nestor.
>
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com