pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Greatest of a list of columns?
Date: Thu, 1 Jul 2021 08:26:25 -0500
Message-ID: <76af441a-c989-55d7-5e42-ed029ae256c8@gmail.com> (raw)

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.





view thread (3+ messages)  latest in thread

Message-ID: <76af441a-c989-55d7-5e42-ed029ae256c8@gmail.com>
Permalink:  ../76af441a-c989-55d7-5e42-ed029ae256c8@gmail.com/
Also on:    postgresql.org/message-id/76af441a-c989-55d7-5e42-ed029ae256c8@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ronljohnsonjr@gmail.com
  Subject: Re: Greatest of a list of columns?
  In-Reply-To: <76af441a-c989-55d7-5e42-ed029ae256c8@gmail.com>
  References: <76af441a-c989-55d7-5e42-ed029ae256c8@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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