Re: (Fwd) DBI's method for reading [row x,field y]



On Feb 28, 5:59 am, Jacqui.Ca...@xxxxxxxx (Jacqui Caren) wrote:
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

Jacqui, if I understand your point, I think you have skipped one of my
messages. The result sets are ordered in my case; so much that I use
extensively queries of the type ->getvalue($r+$i,$f-$j), where the
record and field number are displaced by variables while traversing
the database. The structure of the result sets is of paramount
importance for the getvalue calls to succeed.

However, I fail with the more general statement that unordered result
sets will "instigate a complete redesign". Sets are unordered by
definition, in mathematics, and are legal objects in databases.

Bob

.



Relevant Pages

  • Re: Decouple SQL queries from class in OOP design
    ... > when mixing SQL queries directly with the client classes. ... > Some of my database tables are not stable during the development ... That is done for a reason. ... or leaks cursors this is the way to catch it. ...
    (comp.object)
  • Re: Data Comparison
    ... the missing and the different records have to be ... The database being used is Oracle 9i. ... Cursors - For each of the tables, cursors can be opened and then the ... Is there a primary key? ...
    (comp.databases.oracle.misc)
  • Re: XE cursor handling
    ... a 9i database and an XE database, he can complete a certain operation ... but runs out of cursors when he does ... Sybrand Bakker ... Senior Oracle DBA ...
    (comp.databases.oracle.misc)
  • Re: Multiple problems with a running job
    ... SQL Server MVP ... > database that I know is unchanging), making it impossible for me to run ... I'm declaring the cursors as LOCAL STATIC. ... > to prevent locks. ...
    (microsoft.public.sqlserver.programming)
  • Data Comparison
    ... the missing and the different records have to be ... The database being used is Oracle 9i. ... Cursors - For each of the tables, cursors can be opened and then the ... the BULK COLLECT LIMIT option), since different records can be fetched ...
    (comp.databases.oracle.misc)