Re: huge file to insert into postgres db

From: Date: Tue, 22 Apr 2003 10:37:36 +0000
Subject: Re: huge file to insert into postgres db
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-144801@lists.php.net to get a copy of this message
Create a CSV file, upload it, set time limit to infinity: set_time_limit(0); open the csv file: $f=fopen($csvfile,'r'); read it in a while loop: while($values=fgetcsv($f, 500000, $delimiter, $enclosure)) { now $value is an array containing the fields } Matt MacLeod wrote:
Mark, Thanks for your help. I am a relative newbie though, so I am not sure how to do this. Any pointers would be gratefully received. Thanks, Matt -----Original Message----- Why not have the ASP file generate a delimited .txt file that a php script could read in a while loop... this might save you from crashing. Or do I have things all wrong? -----Original Message ------ I have a large CSV file containing UK postcodes with their n/e co-ordinates which I need to put into a postgresql database. Its become very hard to handle as my machine cannot handle the whole CSV file so I've been chopping it into more manageable pieces and creating PHP insert scripts with the 'chopped bits'. Unfortunately, my PC can only handle about 10000 records at a time and there are 2 million+. I don't have time to do 200 scripts, so does anybody have any further ideas.


« previous php.general (#144801) next »