Greatest of a list of columns?

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Greatest of a list of columns?
Date: 2021-07-01 13:26:25
Message-ID: 76af441a-c989-55d7-5e42-ed029ae256c8@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Postgresql 12.5

What's the canonical Postgresql method for doing, for example, this?
SELECT relname, MAXOF(last_vacuum, last_autovacuum)
FROM pg_stat_user_tables;

Seeing both last_vacuum and last_autovacuum is useful, of course, but
sometimes I only want to see the "really" last time it was vacuumed.

I can hard code a case statement, but a generic multi-column solution is
preferred.

Thanks

--
Angular momentum makes the world go 'round.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2021-07-01 13:27:40 Re: Greatest of a list of columns?
Previous Message David Rowley 2021-07-01 13:14:12 Re: Insert/Dump/Restore table with generated columns