Re: Selecting table row with latest date

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Selecting table row with latest date
Date: 2021-08-19 14:47:40
Message-ID: alpine.LNX.2.20.2108190746270.15165@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 19 Aug 2021, Tom Lane wrote:

> The best way is usually like
>
> select * from mytable order by contact_date desc limit 1;
>
> If you have an index on contact_date this should work very well indeed.

Tom,

I don't have an index on that table. I'll add one and try you suggestion.

Thanks,

Rich

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2021-08-19 14:49:16 Selecting table row with latest date
Previous Message Rich Shepard 2021-08-19 14:45:58 Re: Selecting table row with latest date