0
我有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
的問題是,當我執行下面的查詢,我認爲它確實Clusterd索引掃描[PK_archived_events]
SELECT *
FROM archived_events ae WITH(nolock)
WHERE (30 = ae.[account_id])
執行計劃見的原因是什麼,非聚集索引被忽略?
另外一個注意,這是SQL Azure,不知道它是否重要。
表中有多少行?多少匹配'30 = ae。[account_id]'? –
@MartinSmith 400萬行... – user1662812
@MartinSmith 717536匹配30 = ae。[account_id] – user1662812