Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 07AEE9FB26A for ; Tue, 3 Oct 2006 14:09:47 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 52234-08 for ; Tue, 3 Oct 2006 17:09:43 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from wolff.to (wolff.to [66.93.197.194]) by postgresql.org (Postfix) with SMTP id E15CF9FA4F4 for ; Tue, 3 Oct 2006 14:09:42 -0300 (ADT) Received: (qmail 8818 invoked by uid 500); 3 Oct 2006 17:19:56 -0000 Date: Tue, 3 Oct 2006 12:19:56 -0500 From: Bruno Wolff III To: paallen@attglobal.net Cc: pgsql-sql@postgresql.org Subject: Re: Update 3 columns w/ 1 function calc 3 values? Message-ID: <20061003171956.GB5744@wolff.to> Mail-Followup-To: Bruno Wolff III , paallen@attglobal.net, pgsql-sql@postgresql.org References: <20061003145559.C55369FB26B@postgresql.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20061003145559.C55369FB26B@postgresql.org> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200610/26 X-Sequence-Number: 26415 On Tue, Oct 03, 2006 at 14:55:55 +0000, paallen@attglobal.net wrote: > My function was made to return coordinates, X,Y,Z > for a point along a curved line. So it is not the > fastest of functions because it has to call and > query data from 3 different tables. I used to > > What should I do to speed this up. What is the > best way to update 3 columns from one function > call. In MSACCESS I once rig the function to > cycle through the records with a curser but that > was slow and would crap out due to the shear number. Why is the data in three different tables? It is unusual to not have all coordinates in the same table using one column per coordinate. If you need to update 3 tables, you will need 3 update statements. Doing all of the updates in a single transaction will help. If possible doing all of the updates for each coordinate table in one command will help. To do that you would need the data to be coming from data already in the database. Chnaging the design of your database so that the coordinates are all in the same table (assuming that is possible) would be a good idea.