CREATE TABLE [dbo].[Notifications](
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[AlertId] [int] NOT NULL,
[ChannelId] [int] NOT NULL,
[Status] [int] NOT NULL,
[Identifier] [nvarchar](1024) NOT NULL,
[CreatedAt] [datetimeoffset](7) NOT NULL,
[CanBeRetried] [bit] NULL,
[RetryCount] [int] NOT NULL,
...
CONSTRAINT [PK_Notifications] PRIMARY KEY CLUSTERED
(
[Id] ASC
) WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
CREATE NONCLUSTERED INDEX [IX_Notifications_CreatedAt] ON [dbo].[Notifications]
(
[CreatedAt] ASC
)
CREATE NONCLUSTERED INDEX [IX_Notifications_AlertId_ChannelId_CreatedAt_Include_Identifier_Status_CanBeRetried_RetryCount] ON [dbo].[Notifications]
(
[AlertId] ASC,
[ChannelId] ASC,
[CreatedAt] ASC
)
INCLUDE([Identifier],[Status],[CanBeRetried],[RetryCount])
CREATE NONCLUSTERED INDEX [IX_Notifications_AlertId_ChannelId_Identifier] ON [dbo].[Notifications]
(
[AlertId] ASC,
[ChannelId] ASC,
[Identifier] ASC
)
CREATE NONCLUSTERED INDEX [IX_Notifications_CreatedAt_Status_Include_AlertId] ON [dbo].[Notifications]
(
[CreatedAt] ASC,
[Status] ASC
)
INCLUDE([AlertId])
Became Hot Network Question