Subject Re: [firebird-support] Better plan for delete statement
Author Daniel Rail

At October 4, 2004, 08:43, Christian Kaufmann wrote:

> Hi,

> I have a delete statement like this:

> delete from A where AID in
> (select AID from B where TYP = 3 and PARENTID = 51)

> The two tables are in a 1:1 relationship. On table A and B I have a
> unique index on AID.

> Is there a way, to speed up such a query? In the plan I see, that the
> table A is accessed "NATURAL".

Try this:
delete from A
where exist(select 1 from B
where (TYP = 3) and (PARENTID = 51) and (B.AID=A.AID))

There probably is a way to increase the performance for the DELETE
statement that you are trying, but it would most likely require some
changes in Firebird's engine.

Best regards,
Daniel Rail
Senior System Engineer
ACCRA Group Inc. (
ACCRA Med Software Inc. (