NYCPHP Meetup

NYPHP.org

[nycphp-talk] importing 650,000 records

Chris Shiflett shiflett at php.net
Sat Dec 31 15:02:30 EST 2005


Joseph Crawford wrote:
> $link = mysql_connect('localhost', 'root', '********');

You should change this password, even if you only allow local 
connections. You might also want to check to see if you use a similar 
password or naming convention in other places.

As for your question, does fgetcsv() perform better? It would require 
you to process your file a line at a time rather than load it all into 
memory, but the actual parsing should be much faster.

Another idea is to write out a file with your SQL statements. Executing 
each query, one at a time, sounds really slow. Regardless of how 
complicated your queries are, you can still process them in a single 
batch. This would probably be as simple as:

$sql .=

You can write $sql to a file and let MySQL slurp it up in one go.

Hope that helps.

Chris

-- 
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/



More information about the talk mailing list