in reply to Parse Logfile and Bulk Insert

MySQL has its own bulk insert syntax, others may have such things too but of course you lose portaility if you depend on that.

Make sure you have AutoCommit turned off (but remember to issue a commit when you're done!). This can significantly speed things up :-)

Replies are listed 'Best First'.
Re^2: Parse Logfile and Bulk Insert
by Grygonos (Chaplain) on Jul 26, 2004 at 14:41 UTC

    Be mindful of maintaining integrity in your data. If you decide to drop the indices for importing (which does increase the speed) then the responsibility of integrity falls to you the importer.

    Turning Autocommit off is a great idea, which also speeds things up. However , unless you are certain your data is clean you may well want to turn autocommit off but commit on every valid transaction and rollback on invalid ones like so

    eval{$sth->execute("BLAH")} if($@) { $dbh->rollback(); } else { $dbh->commit(); }
    but with bulk insert I don't know if that's so much an option... so in other words you've gotta make sure that data is clean at some point in the process. your data importation method helps determine when this cleaning takes place.

    MS-SQL does have a BULK INSERT command that I'm aware of, check your docs, they are actually pretty good

    Best of luck on your problem,