DELETE
statements?:Delete by primary key:
DELETE FROM dbo.Users WHERE Id IN (1,2,3,4,5)
Delete by some foreign key:
DELETE FROM dbo.Users WHERE Email_Id IN (454,851,909)
Suppose we're talking about ~30 million rows dbo.Users
table, and IN()
clause contains about 5-200K items.
The following recommendations will help you in your SQL tuning process.
You'll find 3 sections below:
ALTER TABLE `Users` ADD INDEX `users_idx_id` (`Id`);
SELECT
1
FROM
dbo.Users
WHERE
dbo.Users.Id IN (
1, 2, 3, 4, 5
)