在客户决定切换后,我们从另一家公司接管了一个网站。
我们有一张表每天增长大约 25k 条记录,目前是 15MM 条记录。
该表看起来像:
id (PK, int, not null)
member_id (int, not null)
another_id (int, not null)
date (datetime, not null)
SELECT COUNT(id) FROM tbl
最多可能需要 15 秒。
'another_id' 上的简单内部连接需要 30 多秒。
我无法想象为什么要花这么长时间。有什么建议吗?
SQL Server 2005 速成版