Select last n rows without use of order by clause
I want to fetch the last n rows from a table in a Postgres database. I don't want to use an ORDER BY clause as I want to have a generic query. Anyone has any suggestions? A single query will be appreciated as I don't want to use FETCH cursor of Postgres. That you get what you expect with Lukas' solution (as of Nov. 1st, 2011) is pure luck . There is no "natural order" in an RDBMS by definition. You depend on implementation details that could change with a new release without notice. Or a dump / restore could change that order. It can even change out of the blue when db statistics change and