Re: Obtaining a limited number of records from a long query - Mailing list pgsql-sql

From Andy Shellam
Subject Re: Obtaining a limited number of records from a long query
Date
Msg-id 4A1AA0FA.1070507@networkmail.eu
Whole thread Raw
In response to Obtaining a limited number of records from a long query  ("Oliveiros Cristina" <oliveiros.cristina@marktest.pt>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: "Oliveiros Cristina"
Date:
Subject: Obtaining a limited number of records from a long query
Next
From: "Oliveiros Cristina"
Date:
Subject: Re: Obtaining a limited number of records from a long query