From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Ron <ronljohnsonjr(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Greatest of a list of columns? |
Date: | 2021-07-01 13:28:27 |
Message-ID: | CAFj8pRA1G=qKnQsmHGHXuRXhcJj9bhgm-cNRDEy0hw8ne-TU6g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
čt 1. 7. 2021 v 15:27 odesílatel Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
napsal:
>
>
> čt 1. 7. 2021 v 15:26 odesílatel Ron <ronljohnsonjr(at)gmail(dot)com> napsal:
>
>> 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.
>>
>
> postgres=# select greatest(current_date, current_date + 1);
> ┌────────────┐
> │ greatest │
> ╞════════════╡
> │ 2021-07-02 │
> └────────────┘
> (1 row)
>
>
https://www.postgresql.org/docs/current/functions-conditional.html
> Pavel
>
>
>
>> Thanks
>>
>> --
>> Angular momentum makes the world go 'round.
>>
>>
>>
From | Date | Subject | |
---|---|---|---|
Next Message | Laurenz Albe | 2021-07-01 14:19:25 | Re: Damaged (during upgrade?) table, how to repair? |
Previous Message | Pavel Stehule | 2021-07-01 13:27:40 | Re: Greatest of a list of columns? |