Received: from argh.demon.co.uk (IDENT:grim@argh.demon.co.uk [193.237.6.55]) by hub.org (8.9.3/8.9.3) with ESMTP id IAA48254 for ; Sun, 2 May 1999 08:40:24 -0400 (EDT) (envelope-from grim@argh.demon.co.uk) Received: (from grim@localhost) by argh.demon.co.uk (8.8.7/8.8.7) id NAA15135; Sun, 2 May 1999 13:24:16 +0100 From: M Simms Message-Id: <199905021224.NAA15135@argh.demon.co.uk> Subject: Re: [SQL] Update problem I cannot work out To: michael.j.davis@tvguide.com (Michael J Davis) Date: Sun, 2 May 1999 13:24:16 +0100 (BST) Cc: pgsql-sql@postgreSQL.org In-Reply-To: <93C04F1F5173D211A27900105AA8FCFC145461@lambic.prevuenet.com> from "Michael J Davis" at May 1, 99 10:13:16 pm Content-Type: text > > Try something like: > > Create function new_function(value_data_type) > 'Select sum(t1.var1) from t1 where t1.var2 = $1' LANGUAGE > 'sql'; > > update t2 set var1=t2.var1+new_function(t2.var2); > *snip* Hi, thanks for replying. My reply to this is the question, that as each function contains a select, is this technically a single pass. I get the feeling there will be tremendous overhead on this theory with a large dataset, in comparison to a single query that does the update. Can anyone comment on how much slower this could be (although obviously if there is no way to do it in a single query then there is no choice)? Thanks M Simms