Lesson learned the hard way: Do not do mlutiple inserts unless you have all day to wait...
Use "LOAD DATA INFILE ". This is an sql utility specifically for importing csv data into tables. It's very very fast. Example? My linewise-insert programming that strangely ressembled yours was working at ~300 file lines per hour with a complex line-analysis intermediate step on a ~1.5m line file (650Mb). Once I had completed the intermediate line-wise analysis with another program so the data was pre-formatted ready for importation, it took about a half hour for LOAD DATA INFILE to import it all.
In your case this is going to be childishly simple, since it appears you have only one table to insert to:
There are options available for field terminators and line terminators. Check out$sql = 'LOAD DATA INFILE $filename.csv INTO TABLE T_$;';
http://dev.mysql.com/doc/mysql/en/LOAD_DATA.html
In reply to Re: Implementing a buffered read-and-insert algorithm
by punch_card_don
in thread Implementing a buffered read-and-insert algorithm
by radiantmatrix
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |