Subject Re: [IBO] Correct Plans ?
Author Lele Gaifax
>>>>> On Sat, 18 Aug 2001 15:38:20 -0600, hans@... said:

h> update ta set ta.b = (select tb.b from tb where tb.a = ta.a)

h> generates

h> PLAN (TB NATURAL) PLAN (TA NATURAL)

h> Of course without any indexes this could take some time, but
h> why ?

AFAICT, IB isn't able to perform such update in an efficient
way. Creating a simple SP that does the same will let you get there
*much* faster!

CREATE PROCEDURE myupdate AS
DECLARE VARIABLE v_tba INTEGER;
DECLARE VARIABLE v_tbb INTEGER;
BEGIN
FOR SELECT tb.a, tb.b
FROM tb
INTO :v_tba, :v_tbb DO
BEGIN
UPDATE ta
SET b = :v_tbb
WHERE a = :v_tba;
END
END

hth, ciao, lele.
--
nickname: Lele Gaifax | Hold on, hold on - They put you in a box so you
real: Emanuele Gaifas | can't get heard - Let your spirit stay unbroken,
email: lele@... | may you not be deterred - P.Gabriel "Wallflower"