Subject Efficient update on small subset of LARGE table?
Author Kjell Rilbe
Hi,

I have a table "LargeTable" with ~170 million records. I need to update
a single column on a "small" subset (maybe a million records or so), but
the subset selection requires references to other tables.

Unfortunately, Firebird does not support joins in update or delete
queries, resulting in natural scan of "LargeTable" and consequently 170
million executions of each correlated subquery (required to form my
desired selection).

So, is there a better way?

I'm thinking execute block that would iterate over primary keys from a
select query, with joins rather than subqueries, that gives my subset.
Then for each PK execute the update. But how do I write such a thing?

And what other solutions might exist?

Note: I tried a "straightforward" update with correlated subqueries. It
took 17 hours. I think a natural scan takes about an hour...

Firebird 2.1.

Thanks,
Kjell

--
--------------------------------------
Kjell Rilbe
DataDIA AB
E-post:kjell@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64