Last active
July 20, 2022 10:31
-
-
Save philip-paolo/1c49f25ae1129a1ca3fa4f86b57d9084 to your computer and use it in GitHub Desktop.
Performance tuning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Dropping PK and creating new PK with CompanyID, ID to align with policy | |
ALTER TABLE [dbo].[ContactLists] DROP CONSTRAINT [PK_ContactLists] WITH ( ONLINE = OFF ) | |
GO | |
ALTER TABLE [dbo].[ContactLists] ADD CONSTRAINT PK_ContactLists PRIMARY KEY CLUSTERED ([CompanyID] ASC, [ID] ASC) | |
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Preserve fast lookup on ID | |
CREATE UNIQUE INDEX [IX_ContactLists_ID] ON [dbo].[ContactLists] ([ID]) | |
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Performance tuning - missing index | |
CREATE NONCLUSTERED INDEX [IX_ContactNotifications_Processed] ON [dbo].[ContactNotifications] ([Processed]) INCLUDE ([ListID]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment