Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

perl DBI performance of a massive amount of inserts

Status
Not open for further replies.

travs69

MIS
Dec 21, 2006
1,431
US
I have been tweaking some code I have to minimize the time in which it runs.. I am currently doing about 2200 inserts in 53 seconds and I don't know if I am using the best DBI method to do it. I am currently using "do" but was wondering if preparing the statement once and then executing it would help out.
my query looks like this (real variable names taken out for readability)
Code:
$query2 = "insert into trapd_statistics (alarm_time, source, trapd_server, real_alarm, logonly_alarm, unknown_alarm) values ('$var1', '$var2', '$var3', '$var4', '$var5', '$var6')";
$dbh->do($query2)
For the 2253 entries there are 807 distinct alarm_time, 30 distinct source, 1 distinct trapd_server, and the alarms are pretty varied.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
Ignore ignore.. for some reason I didn't realize I could do all the inserts in one big statement.. The insert statement now takes 1 sec to insert all 2200 rows.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top