Re: Obtaining a limited number of records from a long query

From: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Obtaining a limited number of records from a long query
Date: 2009-05-25 14:56:17
Message-ID: 20090525165617.02d1658a@dawn.webthatworks.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice pgsql-sql

On Mon, 25 May 2009 15:20:57 +0100
"Oliveiros Cristina" <oliveiros(dot)cristina(at)marktest(dot)pt> wrote:

> Thank you for pointing it out, Ivan.
> The query I am trying to restrict output for happens to be an
> ORDER BY query.
> Actually I wasn't aware of this detail.
> I'll leave a mental note for myself that results might be
> unexpected for not ORDER BY queries

a bit more about "unexpected":

- if people insert other rows... and by chance they happen to fall
before the ones you already retrieved... no matter of the ORDER
BY, you may "miss" them in the "paginated result".
- without an order by there is no "granted" order. This is not a
deficiency of PostgreSQL, it is not mandated by sql standard and
it offers chances for optimisation

The fact that without an order by clause they may return in the same
order... is implementation dependent and Postgresql don't behave
that way or it happens just by chance.

--
Ivan Sergio Borgonovo
http://www.webthatworks.it

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Edward Vanden Berghe 2009-05-25 15:10:45 Re: Tool for modeling
Previous Message Edward Vanden Berghe 2009-05-25 14:51:39 Re: Tool for modeling

Browse pgsql-sql by date

  From Date Subject
Next Message John Dizaro 2009-05-25 16:21:24 Pgadmin hotkeys?
Previous Message Oliveiros Cristina 2009-05-25 14:20:57 Re: Obtaining a limited number of records from a long query