Maybe you can try:

Delete from tableA Where Exists(Select 1 from tableB where someval=’x’ and
tableA.ID=tableB.ID)

Michael

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Gordon Niessen
Sent: Monday, September 26, 2011 8:53 PM
To: [email protected]
Subject: [firebird-support] Delete Performance Issue

 

  

I am using FB 1.5 and doing a delete from a large table using the 
primary key as a reference from a sub select

delete from tableA where ID in (select ID from tableB where someval = 'x')
The subquery is fast and looks like it uses the index. But the plan for 
the delete is (ID NATURAL) and take a minute to run.

Other then creating a stored procedure to do this, how can I improve the 
query?

-- 
Thanks,

Gordon





[Non-text portions of this message have been removed]

Reply via email to