Entry
How can I limit the number of records returned by PostgreSQL ?
Dec 9th, 2002 08:48
Jonathan Ellis, Nathan Wallace, Eric van der Vlist, Gareth Cantrell
With any reasonably current version of PG, you can use the
SELECT...LIMIT statement.
eg: SELECT * FROM class LIMIT 200;
To get the next 200 entries use:
SELECT * FROM class LIMIT 200 OFFSET 201;
You can also use the "set query_limit" statement. It will be valid for the
connection until you reset it.
eg: pg_Exec ($conn, "set QUERY_LIMIT='200'");