the best way insert, speed wise, is to write the digested data to a CSV and bulk load it. What I need help with is how to duplicate my PK violation logic with this method.

Er, um, the bulk loading method is for, well, bulk loading. This usually means loading a dumpfile from somewhere else (be it a backup of the database, or a big chunk from somewhere else, etc). The bulk loading facilities are fast because they avoid a lot of the work a normal insert does.

But most of the time, you want that work to be done. You want to let the database do this for you, so you don't have to. Having to do all the stuff you're skipping might end up costing as much as you're saving with the bulk loading, and it creates a lot of work, more potential bugs, and all manner of headaches. In short, only use bulk loading facilities when you're actually bulk loading.


In reply to Re: DBI vs Bulk Loading by revdiablo
in thread DBI vs Bulk Loading by jimbus

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.