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

From: "Oliveiros Cristina" <oliveiros(dot)cristina(at)marktest(dot)pt>
To: "Andy Shellam" <andy-lists(at)networkmail(dot)eu>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Obtaining a limited number of records from a long query
Date: 2009-05-25 13:55:54
Message-ID: 025501c9dd40$86155440$ec5a3d0a@marktestcr.marktest.pt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice pgsql-sql

Thanks a million, Andy.

It's precisely what I needed, Indeed!

Best,
Oliveiros

----- Original Message -----
From: "Andy Shellam" <andy-lists(at)networkmail(dot)eu>
To: "Oliveiros Cristina" <oliveiros(dot)cristina(at)marktest(dot)pt>
Cc: <pgsql-sql(at)postgresql(dot)org>
Sent: Monday, May 25, 2009 2:45 PM
Subject: Re: [SQL] Obtaining a limited number of records from a long query

> Hi Oliveiros
>
> Certainly! What you're looking for is the LIMIT...OFFSET syntax.
>
> Some examples:
>
> SELECT ... LIMIT 10 - return the first 10 records only.
> SELECT ... LIMIT 10 OFFSET 10 - return 10 records, starting with record
> 11.
>
> Manual page:
>
> http://www.postgresql.org/docs/8.3/interactive/queries-limit.html
>
> Regards,
> Andy
>
> Oliveiros Cristina wrote:
>> Dear List,
>> Is there any way to force a query to return just a few records?
>> For ex, returning just the first ten rows from a long ORDER BY query ?
>> And then, eventually, obtaining the remaining records at a later time,
>> or in background?
>> Thanks in advance for your help,
>> Best,
>> Oliveiros
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2009-05-25 14:13:47 Re: Obtaining a limited number of records from a long query
Previous Message Andy Shellam 2009-05-25 13:45:30 Re: Obtaining a limited number of records from a long query

Browse pgsql-sql by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2009-05-25 14:13:47 Re: Obtaining a limited number of records from a long query
Previous Message Andy Shellam 2009-05-25 13:45:30 Re: Obtaining a limited number of records from a long query