X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BFEAB529AE for ; Tue, 19 Jul 2005 18:14:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64009-06 for ; Tue, 19 Jul 2005 21:14:05 +0000 (GMT) Received: from smtp-gw-cl-c.dmv.com (smtp-gw-cl-c.dmv.com [216.240.97.41]) by svr1.postgresql.org (Postfix) with ESMTP id 943215280C for ; Tue, 19 Jul 2005 18:14:03 -0300 (ADT) Received: from lanshark.dmv.com (lanshark.dmv.com [216.240.97.46]) by smtp-gw-cl-c.dmv.com (8.12.10/8.12.10) with ESMTP id j6JLE4YY035074; Tue, 19 Jul 2005 17:14:04 -0400 (EDT) (envelope-from sven@dmv.com) Subject: Re: Looking for tips From: Sven Willenberger To: Oliver Crosby Cc: pgsql-performance@postgresql.org In-Reply-To: <1efd553a050719140462d41468@mail.gmail.com> References: <1efd553a0507191308219a098b@mail.gmail.com> <758d5e7f0507191319636afaa3@mail.gmail.com> <1efd553a050719132836c31b78@mail.gmail.com> <1121805961.3674.25.camel@lanshark.dmv.com> <1efd553a050719140462d41468@mail.gmail.com> Content-Type: text/plain Date: Tue, 19 Jul 2005 17:15:08 -0400 Message-Id: <1121807708.3673.47.camel@lanshark.dmv.com> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1.1 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.39 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.328 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_WHOIS X-Spam-Level: X-Archive-Number: 200507/329 X-Sequence-Number: 13570 On Tue, 2005-07-19 at 17:04 -0400, Oliver Crosby wrote: > > since triggers work with COPY, you could probably write a trigger that > > looks for this condition and does the ID processsing you need; you could > > thereby enjoy the enormous speed gain resulting from COPY and maintain > > your data continuity. > > So... (bear with me here.. trying to make sense of this).. > With triggers there's a way I can do the parsing I need to on a log > file and react to completed events in non-sequential order (you can > ignore that part.. it's just how we piece together different related > events) and then have perl/DBD::Pg invoke a copy command (which, from > what I can tell, has to operate on a file...) and the copy command can > feed the ID I need back to perl so I can work with it... > If that doesn't hurt my brain, then I'm at least kinda confused... > Anyway. Heading home now. I'll think about this more tonight/tomorrow. > Well without knowing the specifics of what you are actually trying to accomplish I cannot say yes or no to your question. I am not sure from where this data is coming that you are inserting into the db. However, if the scenario is this: a) attempt to insert a row b) if row exists already, grab the ID and do other db selects/inserts/deletes based on that ID, then there is no need to feed this information back to the perlscript. Is your perlscript parsing a file and then using the parsed information to insert rows? If so, how is the ID that is returned used? Can you have the trigger use the ID that may be returned to perform whatever it is that your perlscript is trying to accomplish with that ID? It's all kind of vague so my answers may or may not help, but based on the [lack of] specifics you have provided, I fear that is the best suggestion that I can offer at this point. Sven