Re: BUG #16098: unexplained autovacuum to prevent wraparound

From: Alessandro Ferraresi <alessandro(dot)ferraresi1(at)gmail(dot)com>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: PG Bug reporting form <noreply(at)postgresql(dot)org>, pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #16098: unexplained autovacuum to prevent wraparound
Date: 2019-11-07 16:39:12
Message-ID: CAEPCv7JHaSxAN0TvVvPYNKESvGY5AB9BCrFyOF4Da1vS9qW4AQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

That's the output of the following query to check the progress of XID to
autovacuum_freeze_max_age:

WITH max_age AS (
SELECT 2000000000 as max_old_xid
, setting AS autovacuum_freeze_max_age
FROM pg_catalog.pg_settings
WHERE name = 'autovacuum_freeze_max_age' ), per_database_stats AS (
SELECT datname
, m.max_old_xid::int
, m.autovacuum_freeze_max_age::int
, age(d.datfrozenxid) AS oldest_current_xid
FROM pg_catalog.pg_database d
JOIN max_age m ON (true)
WHERE d.datallowconn ) SELECT max(oldest_current_xid) AS oldest_current_xid
, max(ROUND(100*(oldest_current_xid/max_old_xid::float))) AS
percent_towards_wraparound
, max(ROUND(100*(oldest_current_xid/autovacuum_freeze_max_age::float)))
AS percent_towards_emergency_autovac FROM per_database_stats

Thanks
Alessandro

Il giorno gio 7 nov 2019 alle ore 15:46 Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
ha scritto:

>
>
>
>>
>> oldest_current_xid | percent_towards_wraparound |
>> percent_towards_emergency_autovac
>>
>> --------------------+----------------------------+-----------------------------------
>> 3210 | 0 |
>>
>> 0
>>
>
> What is this the output of? This doesn't look like any of the built-in
> system views.
>
> Cheers,
>
> Jeff
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeff Janes 2019-11-07 17:00:44 Re: BUG #16098: unexplained autovacuum to prevent wraparound
Previous Message Tom Lane 2019-11-07 16:35:55 Re: BUG #16099: Segmentation fault with - triggers and procedures