good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: benchmarking DBI bind columns vs. fetchrow_arrayrefby arturo (Vicar) |
on Mar 20, 2001 at 19:33 UTC ( [id://65704]=note: print w/replies, xml ) | Need Help?? |
bind_columns and fetchrow_arrayref do different things. You can, in fact, combine them, as it says right there in the DBI documentation: `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 fields are returned as `undef' values in the array. This is the fastest way to fetch data, particularly if used with `$sth-'>`bind_columns'. fetchall_arrayref determines how much data is fetched, and bind_columns affects how what is fetched ends up, so to speak. I'm not sure what you mean by execute being 'the bottleneck', exactly; sure it might be where the lion's share of the processing time gets spent, but notice that you're using DBD::CSV, so the engine that's hiding all the complexity of CSV from you is working hard when you call that (it's turning CSV separated data into table rows). You'd see very different results if you used a DBMS like MySQL or Informix (etc.) here. DBI just gives you a consistent *interface* to different data sources; what's going on under the hood with various data sources is going to be, in general, well, different. Philosophy can be made out of anything. Or less -- Jerry A. Fodor
In Section
Seekers of Perl Wisdom
|
|