sql server 执行速度提速

iamduo 2010-08-18 05:16:23
declare @begin datetime
set @begin=getdate()
select count(*) from MyTable
select [花费时间(毫秒)]=datediff(ms,@begin,getdate())

该表已经有主键。
请问,我再多见几个索引(当然是非聚集的)能提速吗?
...全文
151 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
obuntu 2010-08-18
  • 打赏
  • 举报
回复
如果有unique 约束就更好了。
sanny_txx 2010-08-18
  • 打赏
  • 举报
回复
count(特定列名)比 * 快一点。试试吧
albert_sky 2010-08-18
  • 打赏
  • 举报
回复

declare @begin datetime
set @begin=getdate()
select count(1) from MyTable
select [花费时间(毫秒)]=datediff(ms,@begin,getdate())


使用count(1)或count(列名) 在试试
liangCK 2010-08-18
  • 打赏
  • 举报
回复
能的.
zhifengfeng 2010-08-18
  • 打赏
  • 举报
回复
应该可以

34,588

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧