ORDER BY索引列仍然很慢

Ric*_*cky 7 sql sql-server asp.net performance sql-server-2008

我有以下查询时考虑<1秒ORDER BY b.Price时,和10s以上时ORDER BY b.Price DESC使用

select * from
(
    select  
        /* When changed to ORDER BY b.Price DESC it's 10x slower! */
        (row_number() over (ORDER BY b.Price)) as RowNumber,
        b.*     
    from
        Books b (nolock) 
        inner join BookPublishRegions p (nolock)
          on b.BookKey = bp.BookKey
    where       
        contains(p.PublishRegionName, 'France')
) as t1
where t1.RowNumber between 100 and 110
Run Code Online (Sandbox Code Playgroud)

有什么想法吗?

我有一个升序和降序索引b.Price.我不确定我还能在这做什么......

作为参考,我在下面的两个索引中都包含了CREATE脚本:

CREATE NONCLUSTERED INDEX [IX_Books_PriceDesc] ON [dbo].[Books] 
(
    [Price] DESC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]


CREATE NONCLUSTERED INDEX [IX_Books_Price] ON [dbo].[Books] 
(
    [Price] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
Run Code Online (Sandbox Code Playgroud)

Jas*_*ner 0

我会查看 SSMS 中的估计查询计划(Ctrl+L)。我怀疑它没有使用任何一个索引,因为它们没有覆盖。

此外,在较慢的降序选项的情况下,它引入了另一个排序选项,因为数据可能已经按照所选连接策略进行排序。

在不查看实际查询计划的情况下,这只是疯狂的猜测