pvinodp
asked on
optimizing a sql syntax
I have few tables under the database: CRMDB.
The table books is very huge, almost 13712821 rows [aprox].
I feel that the following sysntax would be very costly:
delete from CRMDB.books where custId not in (select custId from CRMDB.customers);
Is there any way to overcome the costly not in command??
The table books is very huge, almost 13712821 rows [aprox].
I feel that the following sysntax would be very costly:
delete from CRMDB.books where custId not in (select custId from CRMDB.customers);
Is there any way to overcome the costly not in command??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you missed =
DELETE FROM omcr.HistoricalAlarmNotification
WHERE NOT EXISTS (SELECT 1
FROM omcr.HistoricalAlarmLifecycle
WHERE omcr.HistoricalAlarmNotification.halcid = omcr.HistoricalAlarmLifecycle.halcid);
ASKER
I thank you all for your inputs
ASKER
I tried and getting this error:
delete from omcr.HistoricalAlarmNotifi
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'omcr.HistoricalAlarmLifec