Skip site navigation (1) Skip section navigation (2)

Re: How do I detect End-of-table or End-of-limit ?

From: "Jan van der Weijde" <Jan(dot)van(dot)der(dot)Weijde(at)attachmate(dot)com>
To: <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: How do I detect End-of-table or End-of-limit ?
Date: 2007-01-12 13:35:08
Message-ID: 4B9C73D1EB78FE4A81475AE8A553B3C67DC530@exch-lei1.attachmate.com (view raw or flat)
Thread:
Lists: pgsql-interfaces
Thank you, however I need to use LIMIT. The table that is being accessed
has millions of records and a simple SELECT without LIMIT takes very
long.
Unless you have a solution to that performance problem I cannot leave
out LIMIT.

Regards,
Jan van der Weijde

-----Original Message-----
From: Alvaro Herrera [mailto:alvherre(at)commandprompt(dot)com] 
Sent: Friday, January 12, 2007 01:37
To: Jan van der Weijde
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [INTERFACES] How do I detect End-of-table or End-of-limit ?

Jan van der Weijde wrote:

> However I am looking for something more elegant like a status flag in 
> libpq that indicate EOF or End-Of-limit.

I don't think there's an actual "EOF".  What you see is an "end of
tuples in the result set".  Whether it is because you ran into the
LIMIT, or because you fell off the end of the table, you can't tell (nor
can the server actually).

Maybe it's more appropriate for you to open a cursor for the whole
table, and then do FETCH from it until it runs out of tuples; you will
know then that it's the end of the table.

-- 
Alvaro Herrera
http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

pgsql-interfaces by date

Next:From: Jim NasbyDate: 2007-01-15 03:00:42
Subject: Re: Oracle Streams to pgsql
Previous:From: L BayukDate: 2007-01-12 00:41:45
Subject: Re: How do I detect End-of-table or End-of-limit ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group