![]() |
is it normal for mysql to take 14+ seconds to do 10k inserts?
is it normal for mysql to take 14+ seconds to do something simple like (pseudecode) for x = 10000 to 20000; mysql_query(insert into users (muser) values ($x)) ???
muser is varchar, length 5, non primary (it is the only column in the table) I am on a AMD Athlon 64 3500+ PC with 1gb ram.. this is all being done locally the exact code im using is below Code:
$dbcnx = mysql_connect('localhost','xxxxx', 'xxxxx'); |
You have to think spindles. What is your disk IO while doing this?
|
about 400KB while its inserting
the cpu mysql uses is around 30% during the inserts.. http://img61.imageshack.us/img61/6595/savelw3.jpg |
I'm a bit stymied on this one. It usually points to disk IO.
Anyone else with ideas out there? I must be missing something obvious. |
is it normally much faster?
|
I'm guessing by the code you're doing this in perl. Perl has always been very slow for me in doing basic sql operations such as adds/deletions. It's extremely fast to use mysql directly to import the data from a file if this is possible in your application.
WG |
wow.. it takes <2 seconds on a linux server
im using windows, and i am desperately trying to figure out why mysql is so 700% slower using the same code.. |
Quote:
|
Quote:
WG |
the problem is mysql commits after each insert so you're better running a combined insert:
Code:
$dbcnx = mysql_connect('localhost','xxxxx', 'xxxxx'); |
Quote:
|
figured it out =)
looks like it was the table structure.. INNODB is 7-8x faster than InnoDB (at least on windows anyway) |
Nice sig darksoul, lol.
WG |
windowz ?
edit ...
|
try this query instead, should be WAY faster... only hits MySQL once with a large insert
(note: that last substr just removes the trailing "," from the query so its valid) Code:
$dbcnx = mysql_connect('localhost','xxxxx', 'xxxxx'); |
Quote:
|
Bump for you lol :)
|
the thing is i will be doing many many single inserts, so i set it to do one at a time on purpose :)
the problem was the table structure INNODB is 7-8x faster than InnoDB (at least on windows anyway) |
| All times are GMT -7. The time now is 10:02 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123