2009年2月20日星期五

[fw-db] large data insert (performance)

Hello,

My user is uploading every day a excel-file with about 6000 rows to his
website. The excel file is readed and the data is inserted in the
mysql-database. But that takes a lot of time (not even thinking about the
possible time-out). So is there a way that I could program it better?

Now I do:

$myModel = new MyModel();
for($i=0;$i<count(excelrows);$i) {
//get the excel row data

//prepare the data for insert
$data = array('col1'=>$value1,'col2'=>$value3);

// insert it
$myModel->insert($data);
}

Reading the excel-file doesn't take that mutch time. So it is those 6000
sql's that are executed that takes time. Is there a way that a could get all
the data in a array and do 1 insert?

-----
visit my website at http://www.phpscriptor.com/ http://www.phpscriptor.com/
--
View this message in context: http://www.nabble.com/large-data-insert-%28performance%29-tp22120411p22120411.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: