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 reply to Re: benchmarking DBI bind columns vs. fetchrow_arrayref by arturo
in thread benchmarking DBI bind columns vs. fetchrow_arrayref by coolmichael

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.