Обсуждение: Transaction Wraparound Help-Understanding

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

Transaction Wraparound Help-Understanding

От
Jerome Talbert
Дата:

Hello,

I'm trying to understand why autovacuum runs to prevent wraparound on tables that should be static and don't change. For example, we have tables, in one of our databases, that get created every day. Those tables are then actively updated throughout the day. Once a new day begins, a new table is created for that days data. The previous days table is no longer changed or updated and used for historical queries only.


So, the way I understand transaction wrap around, I would think the only table needing vacuuming to prevent wraparound, would be the active table? But, I also notice the older
tables getting vacuumed to prevent wrap around as well. Can someone help me understand this?

Here is an example:

30551  tracks    None            local    2.6  0.1   31.81M    0.00B  01:51.58  N    N             active   autovacuum: VACUUM public.fused_xyz20191222 (to prevent wraparound)
34151  tracks    None            local    5.5  0.1   29.96M    2.61K  01:13.31  N    N             active   autovacuum: VACUUM public.fused_xyz20191119 (to prevent wraparound)
34613  tracks    None            local    2.3  0.1   29.67M    0.00B  01:07.83  N    N             active   autovacuum: VACUUM public.fused_xyz20191128 (to prevent wraparound)
39686  tracks    None            local    2.9  0.0   29.67M    0.00B  00:09.00  N    N             active   autovacuum: VACUUM public.fused_xyz20200112 (to prevent wraparound)

The tables listed above are static at this point, but as you can see, they are actively being vacuumed to prevent wraparound.

Thanks,

Jay


--

Jerome Talbert

Senior IT Infrastructure Engineer

PASSUR Aerospace, Inc.

O: 407-205-0688

C: 407-619-9868

jtalbert@passur.com

Re: Transaction Wraparound Help-Understanding

От
Laurenz Albe
Дата:
On Mon, 2020-07-13 at 10:40 -0400, Jerome Talbert wrote:
> I'm trying to understand why autovacuum runs to prevent wraparound on tables that should
> be static and don't change. For example, we have tables, in one of our databases, that
> get created every day. Those tables are then actively updated throughout the day.
> Once a new day begins, a new table is created for that days data. The previous days
> table is no longer changed or updated and used for historical queries only.
> 
> So, the way I understand transaction wrap around, I would think the only table needing
> vacuuming to prevent wraparound, would be the active table? But, I also notice the older
> tables getting vacuumed to prevent wrap around as well. Can someone help me understand this?

Every table row that is not frozen contains transaction IDs that determine if it is
visible or not.  So even an insert-only static table hast te be vacuumed once,
unless it has been loaded with COPY (FREEZE).

You can do that yourself with VACUUM (FREEZE) or wait for the anti-wraparound vacuum.

Once that has happened, the table will still reveive anti-wraparound vacuum runs,
but these won't do anything.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com