From: DeJuan Jackson <djackson@speedfc.com>
To: Joshua D. Drake <jd@commandprompt.com>
Cc: pgsql-php@postgresql.org
Subject: Re: PHP and COPY
Date: Fri, 15 Aug 2003 17:18:57 -0500
Message-ID: <3F3D5C51.9080407@speedfc.com> (raw)
In-Reply-To: <3F3D576D.2070309@commandprompt.com>
References: <3F3D235D.6090005@speedfc.com>
<3F3D2A42.7080500@commandprompt.com>
<3F3D2F91.9000200@speedfc.com>
<3F3D576D.2070309@commandprompt.com>
Not really, if I was using COPY I wouldn't need the transaction. The
reason I use the transaction is to make the inserts faster, not for any
integrity issues.
Joshua D. Drake wrote:
> > To answer your question. I have a order system on my local Postgres
> (for multiple clients 50+), and need to have an offsite independent
> database to drive orders for a website (for one client).
>
>> None of the replication solutions I have seen (at a resonable price)
>> allow me to limit the data being replicated by a specific field
>> (which I must do from a liability standpoint), so I'm rolling my own
>> replication using php as the scripting language. I've got the data
>> being transferred using inserts just fine, but I would suspect a
>> 50-300% improvement in transfer speed if I could resort to COPY
>> instead (I'm inserting records in transactions of 500 rows each for
>> testing). One of the tables that I need to replicate is a
>
>
>
> You would definatley see an improvement from using COPY but you could
> have other problems. COPY does not happen within a transaction block
> it just kind of shoves everything in there. You are going to be better
> served in
> the long run doing inserts.
>
> Sincerely,
>
>
> Joshua Drake
>
>
>
>> Multi-Gig table (which is about the same size as all the others
>> combined).
>>
>> Joshua D. Drake wrote:
>>
>>> Hello,
>>>
>>> Why in the world would you want to do this? It seems that there
>>> should be a better way.
>>>
>>> Sincerely,
>>>
>>> Joshua Drake
>>>
>>> DeJuan Jackson wrote:
>>>
>>>> Does anyone know how to execute a COPY from PHP?
>>>> I keep getting parse errors on all the data.
>>>>
>>>> PHP 4.3.2
>>>> PostgreSQL 7.3.4
>>>>
>>>> example:
>>>>
>>>> CREATE table tmp(data text);
>>>>
>>>> COPY tmp FROM STDIN;
>>>> test1
>>>> test2
>>>> test3
>>>> \.
>>>>
>>>>
>>>>
>>>> ---------------------------(end of
>>>> broadcast)---------------------------
>>>> TIP 7: don't forget to increase your free space map settings
>>>
>>>
>>>
>>>
>>>
>>
>
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-php@postgresql.org
Cc: djackson@speedfc.com, jd@commandprompt.com
Subject: Re: PHP and COPY
In-Reply-To: <3F3D5C51.9080407@speedfc.com>
References: <3F3D235D.6090005@speedfc.com> <3F3D2A42.7080500@commandprompt.com> <3F3D2F91.9000200@speedfc.com> <3F3D576D.2070309@commandprompt.com> <3F3D5C51.9080407@speedfc.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