SQL Server 2008: Ordering by datetime is too slow

前端 未结 7 1956
鱼传尺愫
鱼传尺愫 2020-12-14 01:56

My table (SQL Server 2008) has 1 million+ records, when I try to order records by datetime, it takes 1 second, but when I order by ID (int), it only takes about 0.1 second.<

7条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-14 02:47

    Could it be that there is an index for your int column but not for your datetime column? Look at the execution plan.

提交回复
热议问题