From: Dave [Hawk-Systems] <dave@hawk-systems.com>
To: pgsql-general@postgresql.org
Subject: Re: populate table with large csv file
Date: Fri, 26 Sep 2003 07:58:16 -0400
Message-ID: <DBEIKNMKGOBGNDHAAKGNIENDFBAC.dave@hawk-systems.com> (raw)
In-Reply-To: <3F731CF0.2090800@sonalysts.com>
>> aside from parsing the csv file through a PHP interface, what isthe
>easiest way
>> to get that csv data importted into the postgres database. thoughts?
>
>Assuming the CSV file data is well formed, use psql and
>the COPY command.
>
>In psql, create the table. Then issue command:
>
>copy <tablename> from 'filename' using delimiters ',';
perfect solution that was overlooked.
Unfortunately processing the 143mb file which would result in a database size of
approx 500mb takes an eternity. As luck would have it we can get away with just
dropping to an exec and doing a cat/grep for any data we need... takes 2-3
seconds.
the copy command is definately a keeper as I am not looking at replacing code
elsewhere with a simpler model using that.
Thanks
Dave
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: dave@hawk-systems.com, pgsql-general@postgresql.org
Subject: Re: populate table with large csv file
In-Reply-To: <DBEIKNMKGOBGNDHAAKGNIENDFBAC.dave@hawk-systems.com>
References: <3F731CF0.2090800@sonalysts.com> <DBEIKNMKGOBGNDHAAKGNIENDFBAC.dave@hawk-systems.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox