>> After declaring a cursor, one way of obtaining the length of the
>resultset
>> is to perform a "MOVE 0" and read the PQcmdStatus which returns a
>"MOVE nn"
>> where nn is the length of the resultset. (A negative MOVE can then be
>used
>> to allow starting to fetch records from the beginning of
>
> >> After declaring a cursor, one way of obtaining the length of the
> >resultset
> >> is to perform a "MOVE 0" and read the PQcmdStatus which returns a
> >"MOVE nn"
> >> where nn is the length of the resultset. (A negative MOVE can then
be
> >used
> >> to allow starting to fetch records
Yes, a move takes less time, but can still a significant amount of time.
Do you need to know exactly what to expect? Run ANALYZE recently?
A cheat I've used before is to parse the EXPLAIN (not EXPLAIN ANALYZE)
output for the expected number of records involved. If that number was
less than 2000
>
> After declaring a cursor, one way of obtaining the length of the
resultset
> is to perform a "MOVE 0" and read the PQcmdStatus which returns a
"MOVE nn"
> where nn is the length of the resultset. (A negative MOVE can then be
used
> to allow starting to fetch records from the beginning of the
re
After declaring a cursor, one way of obtaining the length of the resultset
is to perform a "MOVE 0" and read the PQcmdStatus which returns a "MOVE nn"
where nn is the length of the resultset. (A negative MOVE can then be used
to allow starting to fetch records from the beginning of the resultse