NYCPHP Meetup

NYPHP.org

[nycphp-talk] using PHP to import large-ish SQL into mysql

Jake McGraw jmcgraw1 at gmail.com
Tue Oct 20 20:14:23 EDT 2009


Modify your insert statements to take advantage of LOAD DATA INFILE:

http://dev.mysql.com/doc/refman/5.1/en/load-data.html

You should see a perf improvement.

- jake

On Tue, Oct 20, 2009 at 8:11 PM, Daniel Convissor
<danielc at analysisandsolutions.com> wrote:
> Hi Marc:
>
> FYI, in the future, when starting a new topic, make a whole new email, so
> it doesn't look like it's part of the thread you're replying to.  Now to
> your question...
>
>
>> Problem is, the PHP script is terminating with a PHP error; server's
>> support thinks it's out of memory.
>
> Why should anyone be guessing what the issue is?  PHP's error messages
> explain exactly what the problem is in plain English.  Please post the
> actual error message.
>
>
>> $cmd = "/path/to/mysql -h hostname -u username --password=password
>> db_name < sqlfile.sql";
>> exec( $cmd );
>
> Yeah, that shouldn't involve PHP's memory.
>
> Another thought, if this is (nearly) all you're doing, why involvine PHP
> at all?  Do it directly in a shell script.
>
> import.cgi
> ---------
> #! /bin/sh
>
> /path/to/mysql -h hostname -u username --password=password \
>    db_name < sqlfile.sql
> ---------
>
> --Dan
>
> --
>  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
>            data intensive web and database programming
>                http://www.AnalysisAndSolutions.com/
>  4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409
> _______________________________________________
> New York PHP Users Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> http://www.nyphp.org/Show-Participation
>



More information about the talk mailing list