All,
I've got large amounts of data that I need to put into a database (a few 10M records).
My question is this:
If I connect to the database, cycle through each line and execute the SQL to add the line to the database, it takes a while to insert into the database across Unix sockets. What ways can I speed up the insertion so that I can batch most of it? It is conceivable that I can do one mass SQL string with multiple inserts at once? Will I gain any speed that way? Example:
my $SQL = "blah\;";
$SQL .= "blah\;";
$SQL .= "blah\;";
Or should I do it normally:
my $SQL = "blah";
<insert DBI code to execute here>
Any advice will be helpful...
J. J. Horner
CISSP,CCNA,CHSS,CHP,blah,blah,blah
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.