Michael Fuhr wrote:
Right -- when you open a cursor PostgreSQL doesn't know how many
rows it will return. PostgreSQL selects a query plan based on an
*estimate* of how many rows the query will return, but until you
fetch all the rows you can't know for sure how many rows there will
be.
So if
Michael Fuhr wrote:
...which is the same reason a cursor doesn't know how many rows it will
fetch until you fetch them all (or MOVE to the end of the cursor,
which fetches the rows internally).
So, Postgresql is not hidding something for me, it just, like me, don't
know ?
/BL
Russell Simpkins wrote:
If you need a count, why not just execute one of the methods to get a
count. i.e.e select count(id) ...
The reason why i don't just make a count and then a selection of data
is performance.
/BL
---(end of broadcast)-
[EMAIL PROTECTED] wrote:
You cannot count the number of rows in a cursor, unfortunately. I recently ran
in to this problem.
How sad, then I have to repeat the query, first for counting and last
for data fetch :-(
/BL
---(end of broadcast)--
Thomas Borg Salling wrote:
Bo Lorentsen wrote:
Is it possible to get the total number of rows found in a cursor, or
must I make a count(*) and then a select ?
Perhaps:
GET DIAGNOSTICS rc = ROW_COUNT;
Ok, and when I use the C interface the "DECLARE .." function will return
the
Hi ...
Is it possible to get the total number of rows found in a cursor, or
must I make a count(*) and then a select ?
/BL
---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq