Re: newbie question for return date - Mailing list pgsql-general

From Tom Lane
Subject Re: newbie question for return date
Date
Msg-id 22753.1035915884@sss.pgh.pa.us
Whole thread Raw
In response to Re: newbie question for return date  (Medi Montaseri <medi.montaseri@intransa.com>)
List pgsql-general
Medi Montaseri <medi.montaseri@intransa.com> writes:
> Hey a suggestion, what if PG would support the negative limit as in
> select * from table limit -1 to mean limit it from the other end of
> list.....

You'd hardly want that, as it would necessarily be the slowest possible
way of retrieving the rows you're after.

Instead, reverse the sort order.  For example

    select * from table order by datecol desc limit 1;

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: command-line history (readline) fails
Next
From: Neil Conway
Date:
Subject: Re: EXPLAIN times