All Forums Database
KVB 124 posts Joined 09/12
12 May 2014
Delete taking more time

Hi

Any clueon the below code.

Old code:

DELETE FROM TRANSACTION_ T1
WHERE EXISTS (
SELECT 1
FROM POS_DETAILS T2
WHERE T1.HDR_ID=T2.HDR_ID
AND T1.CNTL_ID<>40
);
takes 6 mins

New code:
DELETE T1 FROM TRANSACTIONT1, POS_DETAILS T2
WHERE T1.HDR_ID=T2.HDR_ID AND T1.CNTL_ID<>40;

takes 7 mins

Any clue on this?

Raja_KT 1246 posts Joined 07/09
12 May 2014

You can check  your explain . Exists usually is faster like in other databases too.

Raja K Thaw
My wiki: http://en.wikipedia.org/wiki/User:Kt_raj1
Street Children suffer not by their fault. We can help them if we want.

You must sign in to leave a comment.