如何减少简单选择查询的响应时间?

2021-09-10 00:00:00 sql tsql sql-server-2008 sql-server

MarketPlane 表包含超过 6000 万行.

MarketPlane table contains more than 60 million rows.

当我需要特定日期的飞机总数时,我执行此查询需要超过 7 分钟.我怎样才能减少这个时间?

When I need the total number of plane from a particular date, I execute this query which takes more than 7 min. How can I reduce this time ?

SELECT COUNT(primaryKeyColumn) 
FROM   MarketPlan 
WHERE  LaunchDate > @date

我已经实现了您链接中提到的所有内容,即使现在我已经实现了 With(nolock),它将响应时间减少到 5 分钟.

I have implemented all things mentioned in your links even now I have implemented With(nolock) which reduce response time is to 5 min.

推荐答案

您必须在表上创建索引,或者按日期对表进行分区.

您可能还想看看

SQL Server 2000/2005 索引视图性能调整和优化技巧

SQL Server 索引视图

相关文章