Rick Welykochy wrote this and replies to hisself:

Howard Lowndes wrote:

I have a PHP script that inserts around 100K of records into a table on
each time that it runs.

It starts off at a good pace but gets progressively slower until it falls
over complaining that it cannot allocate sufficient memory.

When I need to do this in MySQL, I used a LOADDATA INFILE sql command
that loads the data from a CSV or TSV file. Completes very quickly,
with only one round trip to the server.

Is there a similar command in PostgresSQL?

Found it. It is called COPY in PostgreSQL.

<http://www.postgresql.org/docs/8.1/static/populate.html>

They recommend to turn AUTOCOMMIT off.

Then take Sonia's recommendation of enforcing a unique index
so the dupes are chucked out.

Fire off one single COPY command from PHP and see how that works.


cheers
rickw


--
________________________________________________________________
Rick Welykochy || Praxis Services || Internet Driving Instructor

Tis the dream of each programmer before his life is done,
To write three lines of APL and make the damn thing run.
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to