pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedThe age() of a column?
3+ messages / 3 participants
[nested] [flat]
* The age() of a column?
@ 2018-11-29 03:32 Ron <ronljohnsonjr@gmail.com>
0 siblings, 2 replies; 3+ messages in thread
From: Ron @ 2018-11-29 03:32 UTC (permalink / raw)
To: pgsql-general
What does it mean, and where is it documented? The only place in the docs I
see reference to age() is
https://www.postgresql.org/docs/9.6/functions-datetime.html and this doesn't
seem to fit that use case.
Thanks
TAPb=# select COALESCE(ta.schemaname, 'pg_toast') || '.' || cl.relname,
cl.relfrozenxid,
age(cl.relfrozenxid)
from pg_class cl FULL JOIN pg_tables ta
ON ta.tablename = cl.relname
where not cl.relfrozenxid = xid '0'
--and age(cl.relfrozenxid) > 4000000
order by 1
limit 30;
?column? | relfrozenxid | age
-------------------------------+--------------+---------
cds.ach_return_batch | 58569152 | 2111005
cds.ach_return_detail | 58569152 | 2111005
cds.all_day_event | 58569152 | 2111005
cds.all_day_event_trigger | 58569152 | 2111005
[snip]
cds.bank_ftp | 58569152 | 2111005
cds.bank_health_care_job | 58569152 | 2111005
cds.bank_inbound_file | 58569152 | 2111005
cds.bank_input_format | 58569152 | 2111005
(30 rows)
--
Angular momentum makes the world go 'round.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: The age() of a column?
@ 2018-11-29 04:05 Tom Lane <tgl@sss.pgh.pa.us>
parent: Ron <ronljohnsonjr@gmail.com>
1 sibling, 0 replies; 3+ messages in thread
From: Tom Lane @ 2018-11-29 04:05 UTC (permalink / raw)
To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-general
Ron <ronljohnsonjr@gmail.com> writes:
> What does it mean, and where is it documented?
age(xid) returns the difference between the given xid and the current xid.
It's not terribly well documented, but psql's \df gives some info:
regression=# \df+ age
Schema | Name | Result data type | Argument data types | Type | Volatility | Parallel | Owner | Security | Access privileges | Language | Source code | Description
...
pg_catalog | age | integer | xid | func | stable | restricted | postgres | invoker | | internal | xid_age | age of a transaction ID, in transactions before current transaction
The only reference I could find in the SGML docs is in the maintenance
chapter.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: The age() of a column?
@ 2018-11-29 05:21 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Ron <ronljohnsonjr@gmail.com>
1 sibling, 0 replies; 3+ messages in thread
From: Adrian Klaver @ 2018-11-29 05:21 UTC (permalink / raw)
To: Ron <ronljohnsonjr@gmail.com>; pgsql-general
On 11/28/18 7:32 PM, Ron wrote:
> What does it mean, and where is it documented? The only place in the
https://www.postgresql.org/docs/10/routine-vacuuming.html
"The age column measures the number of transactions from the cutoff XID
to the current transaction's XID."
> docs I see reference to age() is
> https://www.postgresql.org/docs/9.6/functions-datetime.html and this
> doesn't seem to fit that use case.
>
> Thanks
>
> TAPb=# select COALESCE(ta.schemaname, 'pg_toast') || '.' || cl.relname,
> cl.relfrozenxid,
> age(cl.relfrozenxid)
> from pg_class cl FULL JOIN pg_tables ta
> ON ta.tablename = cl.relname
> where not cl.relfrozenxid = xid '0'
> --and age(cl.relfrozenxid) > 4000000
> order by 1
> limit 30;
> ?column? | relfrozenxid | age
> -------------------------------+--------------+---------
> cds.ach_return_batch | 58569152 | 2111005
> cds.ach_return_detail | 58569152 | 2111005
> cds.all_day_event | 58569152 | 2111005
> cds.all_day_event_trigger | 58569152 | 2111005
> [snip]
> cds.bank_ftp | 58569152 | 2111005
> cds.bank_health_care_job | 58569152 | 2111005
> cds.bank_inbound_file | 58569152 | 2111005
> cds.bank_input_format | 58569152 | 2111005
> (30 rows)
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2018-11-29 05:21 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29 03:32 The age() of a column? Ron <ronljohnsonjr@gmail.com>
2018-11-29 04:05 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-11-29 05:21 ` Adrian Klaver <adrian.klaver@aklaver.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox