Re: bulk insert using COPY and PHP code - Mailing list pgsql-general

From Scott Marlowe
Subject Re: bulk insert using COPY and PHP code
Date
Msg-id AANLkTim8Ej_mrmu59CAWfHnPUmLOiYn6etVQwNTd5dBR@mail.gmail.com
Whole thread Raw
In response to Re: bulk insert using COPY and PHP code  (Babu R <babu_4blog@yahoo.com>)
List pgsql-general
On Fri, Jul 2, 2010 at 1:28 PM, Babu R <babu_4blog@yahoo.com> wrote:
>
> Hi Pavel,
>
> Thanks.
>
> The situation is, I have the DB class which will return the connection object that is created using the PDO class.
Andam using that object to perform the db operations. ie: $DB->prepare("") 
>
> Further I have the data in a CSV file which has to be inserted into the table.
>
> Here is the command that I have used to import that data:
>
> $DB->exec("\COPY table1 FROM data.csv WITH DELIMITERS ','");

As mentioned earlier just use copy, also look into using copy from
stdin and then just feeding the lines to pgsql through php instead of
having pgsql get it from a system file.  This way the php script and
the db don't have to be on the same machine.

pgsql-general by date:

Previous
From: Rikard Bosnjakovic
Date:
Subject: New DB-design - help and documentation pointers appreciated
Next
From: Geoffrey
Date:
Subject: Re: pgpool-II (max_pool and num_init_children)