Martin J. Evans wrote:
Of course, selectall/fetchall_arrayref retrieves all the rows in the
result-set so this will use that amount of memory up but given you are
already doing this I guess that won't bother you (unless Pg uses cursors
to navigate to the required row). To my knowledge, DBI does not support
fetching only a specific row via a cursor but I'm sure someone will
correct me if I'm wrong on that.
PostgreSQL does NOT provide any mechanism to navigate in the way bob
suggests. He is using a dataset driver and this is doing a
fetchall_arrayref (equivalent) under the covers.
The other things I would point out that recent versions of
PostgreSQL will often randomly order result sets that do not have an
explicit order by clause. This is good as it is a significant
performance boost but does catch the unwary (including myself when I had
a missing order by clause!).
If the past I have found people using code similar to bobs without
an order by clause - often random results and perfomance (as system
scales) instigate a complete redesign soon after.
Jacqui