View Single Post
Old 02-18-2007, 03:21 AM  
darksoul
Confirmed User
 
darksoul's Avatar
 
Join Date: Apr 2002
Location: /root/
Posts: 4,997
the problem is mysql commits after each insert so you're better running a combined insert:

Code:
$dbcnx = mysql_connect('localhost','xxxxx', 'xxxxx'); 
mysql_select_db("testtable", $dbcnx); 
$cmd = "insert into users (muser) values ";
for ($i = 10000; $i <= 20000; $i++) { 
$cmd .= "($i),"
}
$cmd .= "(20001)"
mysql_query($cmd);
should be blazing fast.
__________________
1337 5y54|)m1n: 157717888
BM-2cUBw4B2fgiYAfjkE7JvWaJMiUXD96n9tN
Cambooth
darksoul is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote