X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 7A87FD1B8C1 for ; Fri, 15 Aug 2003 22:06:32 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 30203-10 for ; Fri, 15 Aug 2003 19:06:23 -0300 (ADT) Received: from hosting.commandprompt.com (unknown [207.173.200.209]) by svr1.postgresql.org (Postfix) with ESMTP id CA831D1B8BF for ; Fri, 15 Aug 2003 19:06:20 -0300 (ADT) Received: from commandprompt.com (USED-205-162-202-109.saw.net [64.146.135.109] (may be forged)) (authenticated) by hosting.commandprompt.com (8.11.6/8.11.6) with ESMTP id h7FM6Hp18868; Fri, 15 Aug 2003 15:06:19 -0700 Message-ID: <3F3D576D.2070309@commandprompt.com> Date: Fri, 15 Aug 2003 14:58:05 -0700 From: "Joshua D. Drake" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5b) Gecko/20030716 Thunderbird/0.1a X-Accept-Language: en-us, en MIME-Version: 1.0 To: DeJuan Jackson Cc: pgsql-php@postgresql.org Subject: Re: PHP and COPY References: <3F3D235D.6090005@speedfc.com> <3F3D2A42.7080500@commandprompt.com> <3F3D2F91.9000200@speedfc.com> In-Reply-To: <3F3D2F91.9000200@speedfc.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/64 X-Sequence-Number: 2241 > 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 >> >> >> >> >