On Wed, 19 Oct 2016 09:34:32 +0200 (CEST), [email protected] 
[firebird-support] <[email protected]> wrote:
>
> update orders o
> set o.something = 'something other'
> where o.delivery_date is null
>   and o.partid in (select p.partid from partners p where p.country='Spain')
>
> Would using EXISTS() help?
>

        IIRC Firebird will optimize IN to EXISTS anyway, if possible.
        Only way to really optimize this kind of update would be with
stored procedure or EXECUTE BLOCK. Like:

execute block as
declare variable partid integer;
begin
  for select p.partid 
  from partners p 
  where p.country='Spain' 
  into :partid do
  begin
    update orders o set o.something = 'something other'
    where o.delivery_date is null and o.partid = :partid; 
  end
end

-- 
Virgo Pärna 
[email protected]

Reply via email to