Subject Re: [firebird-support] Efficient update on small subset of LARGE table?
Author Kjell Rilbe
Kjell Rilbe skriver:
> What new approach are you referring to?
> 2 X time for natural scan would be fair enough. It took 1½ hour to
> execute an update using execute block with for select .... do update....
> where the select picked PK:s from a temporary table I filled with a
> select like the above. It did 2522142 updates.

Oh, I forgot to mention that the insert that filled the temp table took
about 1½ hour to execute as well. So, 3 hours in total.

The insert query and plan:

insert into "Tmp" ("ECO_ID")
select LrgTbl."ECO_ID"
from "LargeTable" LrgTbl
inner join "Uppgiftshållare" UH on UH."ECO_ID" = LrgTbl."Hållare"
inner join "Uppgiftshanterare" Uhant on Uhant."ECO_ID" = UH."Hanterare"
where LrgTbl."ÄrNull" = 0
and UH."Propertynamn" in ('This', 'That', 'Other', 'Extra')
and Uhant."ColX" = 'Whatever'

PLAN JOIN (UHANT INDEX (IX_ColX), UH INDEX (IX_UH_Uhant), LRGTBL INDEX
(IX_LrgTbl_UH))

Kjell