develooper Front page | perl.dbi.dev | Postings from March 2001

Re: DBI 1.14 doc patches and performance tests

Thread Previous
From:
Michael A. Chase
Date:
March 21, 2001 13:31
Subject:
Re: DBI 1.14 doc patches and performance tests
Message ID:
004f01c0b24e$248df450$6c30273f@ca.boeing.com
The only surprise for me is that there wasn't more gain using
bind_columns()/fetch().  The documentation does mention it as faster than
the other methods and I never use anything else.  The aliasing of fetch()
from fetchrow_arrayref() isn't important, but using bind_col() or
bind_columns() is.

Maybe there is some way to emphasize it more strongly in the documentation.
A lot of people seen enamored with fetchrow_array() and fetchrow_hashref()
and may not realize the performance penalty they are incurring.

From DBI.pm:

=item B<fetchrow_arrayref>

  $ary_ref = $sth->fetchrow_arrayref;
  $ary_ref = $sth->fetch;    # alias

Fetches the next row of data and returns a reference to an array
holding the field values.  Null field values are returned as undef.
This is the fastest way to fetch data, particularly if used with
$sth->bind_columns.

--
Mac :})
** I normally forward private database questions to the DBI mail lists. **
Give a hobbit a fish and he'll eat fish for a day.
Give a hobbit a ring and he'll eat fish for an age.
----- Original Message -----
From: "H.Merijn Brand" <h.m.brand@hccnet.nl>
To: "Tim Bunce" <Tim.Bunce@ig.co.uk>
Cc: "DBI developers" <dbi-dev@perl.org>
Sent: Wednesday, March 21, 2001 8:18 AM
Subject: DBI 1.14 doc patches and performance tests


> . . .
> Every percentage is the performance gain towards the previous (slower)
fetch
> method. What surprised my audience was the fact that using bind_columns
with
> fetch was faster along the line than fetch without bind_columns (everyone
using
> DBI in the audience seemed to use fetchrow_arrayref all the time, and they
were
> not aware of the fact that fetch was an alias. Noone was using
bind_columns).
> . . .


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About