On Wed, 19 Oct 2016 09:34:32 +0200 (CEST), ehmmm.firebird@seznam.cz [firebird-support] <firebird-support@yahoogroups.com> 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
virgo.parna@mail.ee
Posted by: Virgo =?UTF-8?Q?P=C3=A4rna?= <virgo.parna@mail.ee>
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (27) |
Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu. Try FAQ and other links from the left-side menu there.
Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
No comments:
Post a Comment