我有archived_events
以下索引的表。
CREATE NONCLUSTERED INDEX [IX_archived_events_5] ON [dbo].[archived_events]
(
[account_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
GO
ALTER TABLE [dbo].[archived_events] ADD CONSTRAINT [PK_archived_events] PRIMARY KEY CLUSTERED
(
[event_type] DESC,
[id] DESC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
GO
问题是,当我执行以下查询时,我在执行计划中看到它对 [PK_archived_events] 进行聚集索引扫描
SELECT *
FROM archived_events ae WITH(nolock)
WHERE ( 30 = ae.[account_id] )
非聚集索引被忽略的原因是什么?
另请注意,这是 SQL Azure,不确定是否重要。