Re: select question

From: Felipe Alvarez Harnecker <felipe(at)qlsoft(dot)cl>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: select question
Date: 2000-07-31 19:34:19
Message-ID: 14725.54459.316287.652212@Lakgo.ql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane writes:
> g <brian(at)wuwei(dot)govshops(dot)com> writes:
> > Use the limit clause.
> > SELECT message_text FROM messages ORDER BY creation_date LIMIT $limit,
> > $offset.
>
> > LIMIT 10, 0 gets you the first batch.
> > LIMIT 10, 10 gets you the second batch.
> > LIMIT 10, 20 gets you the third, etc.
>
> BTW, a little tip that a number of people have gotten burnt by not
> knowing: when you do this you *must* use an ORDER BY clause that's
> strong enough to order the result rows completely. Otherwise you
> are asking for slices out of an undefined ordering of the rows.
> You could get a different ordering on each request, leading to
> inconsistent slices --- in other words, missing or repeated rows.
>
> This does actually happen in Postgres 7.0, because the planner
> optimizes queries with small limit+offset differently from those
> without.
>
> regards, tom lane

Hi, I wonder if one must activate the LIMIT clause somewhere, bacause
for me it does nothing.

I'm using postgresql Version: 7.0.2 in a Debina potato system.

Thanx.

--
______________________________________________________

Felipe Alvarez Harnecker. QlSoftware.

Tel. 09.874.60.17 e-mail: felipe(dot)alvarez(at)qlsoft(dot)cl

Potenciado por Debian GNU/Linux http://www.qlsoft.cl/
______________________________________________________

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joseph Shraibman 2000-07-31 19:37:20 Re: How I can undelete recodes?
Previous Message Tom Lane 2000-07-31 19:17:58 Re: Corrupted Table