Re: [SQL] Update problem I cannot work out

From: M Simms <grim(at)argh(dot)demon(dot)co(dot)uk>
To: michael(dot)j(dot)davis(at)tvguide(dot)com (Michael J Davis)
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] Update problem I cannot work out
Date: 1999-05-02 12:24:16
Message-ID: 199905021224.NAA15135@argh.demon.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

>
> 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 1999-05-02 16:36:57 Re: [SQL] Update problem I cannot work out
Previous Message Chris Bitmead 1999-05-02 09:02:08 Re: [SQL] INSERT and UPDATE with non-atomic values