Subject Re: [firebird-support] Execution speed with update query
Author setysvar
Den 06.01.2016 14:42, skrev Sonya Blade sonyablade2010@...
[firebird-support]:
> update elements E set E.END_I = (select n.node_num from nodes N
> where abs(E.X_I -N.XI)<0.001 and abs(E.Y_I - N.YI)<0.001 and abs(E.Z_I-N.ZI)<0.001 )
The above query cannot possibly use any index for the nodes table (well,
I'm a bit uncertain about indexes defined with COMPUTED BY, but I doubt
they can involve fields of several tables). Try changing to:

update elements E set E.END_I = (select n.node_num from nodes N
where N.XI between E.X_I - 0.001 and E.X_I + 0.001
and N.YI between E.Y_I - 0.001 and E.Y_I + 0.001
and N.ZI between E.Z_I - 0.001 and E.Z_I + 0.001 )

If you have indexes for N.XI, N.YI and/or N.ZI and the nodes table
contain a not too small number of records, you may observe a significant
performance improvement.

HTH,
Set