-
-
Save timgabrhel/d649074cbe82016e8a90f918c58c4764 to your computer and use it in GitHub Desktop.
messages indexes
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
CREATE NONCLUSTERED INDEX [ix_Messages_MessageThreadId] ON [dbo].[Messages] | |
( | |
[MessageThreadId] ASC | |
)WITH (STATISTICS_NORECOMPUTE = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [PRIMARY] | |
GO | |
CREATE NONCLUSTERED INDEX [ix_Messages_ToUserId_ReadDate_Deleted] ON [dbo].[Messages] | |
( | |
[ToUserId] ASC, | |
[ReadDate] ASC, | |
[Deleted] ASC | |
)WITH (STATISTICS_NORECOMPUTE = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [PRIMARY] | |
GO | |
CREATE NONCLUSTERED INDEX [IX_ToUserId_Deleted_Includes] ON [dbo].[Messages] | |
( | |
[ToUserId] ASC, | |
[Deleted] ASC | |
) | |
INCLUDE ( [MessageThreadId], | |
[FromUserId], | |
[Message], | |
[SendDate], | |
[ReadDate]) WITH (STATISTICS_NORECOMPUTE = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [PRIMARY] | |
GO | |
CREATE NONCLUSTERED INDEX [nci_wi_Messages_9AB8B9D5FFD025E77AAB65C886618783] ON [dbo].[Messages] | |
( | |
[FromUserId] ASC, | |
[Deleted] ASC | |
) | |
INCLUDE ( [Message], | |
[MessageThreadId], | |
[ReadDate], | |
[SendDate], | |
[ToUserId]) WITH (STATISTICS_NORECOMPUTE = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [PRIMARY] | |
GO | |
ALTER TABLE [dbo].[Messages] ADD CONSTRAINT [PK_Messages] PRIMARY KEY CLUSTERED | |
( | |
[MessageId] ASC | |
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] | |
GO | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment