Skip to content

Instantly share code, notes, and snippets.

@sqldeployhelmet
Created October 4, 2018 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sqldeployhelmet/797b1bfd78aae1ca5fef64abaad60a5a to your computer and use it in GitHub Desktop.
Save sqldeployhelmet/797b1bfd78aae1ca5fef64abaad60a5a to your computer and use it in GitHub Desktop.
ALTER TABLE dbo.superbusytable DROP CONSTRAINT PK_BestKeyEver
GO
ALTER TABLE dbo.superbusytable
ADD CONSTRAINT PK_BestKeyEver
PRIMARY KEY CLUSTERED (id, insertdate ) ON ps_MonthlyWindow(insertdate); -- insertdate is an ever increasing date, we'll never be inserting "old" records
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment