1
SET STATISTICS IO
查询SQL语句的读写代价.
可以用来查看sql语句的读和写的操作的代价,对完成同样功能的两个sql语句比较读写代价就能进行效率的初步比较奥.
SET STATISTICS IO ON
GO
SELECT COUNT(*) FROM NORTHWIND..EMPLOYEES
GO
SET STATISTICS IO OFF
GO
2通过执行系统存储过程SP_SPACEUSED可以查看表的物理空间
EXEC SP_SPACEUSED EMPLOYEES
3
SET STATISTICS TIME
查询SQL语句的执行时间
SET STATISTICS TIME ON
GO
SELECT COUNT(*) FROM NORTHWIND..EMPLOYEES
GO
SET STATISTICS TIME OFF
GO
4
SET SHOWPLAN_TEXT ON
查询sql语句的执行计划
SET SHOWPLAN_TEXT ON
GO
SELECT COUNT(*) FROM NORTHWIND..EMPLOYEES
GO
SET SHOWPLAN)TEXT OFF
GO
5
SET NOCOUNT ON
减少sql语句的网络流量
SET NOCOUNT ON
GO
SELECT COUNT(*) FROM NORTHWIND..EMPLOYEES
GO
SET NOCOUNT OFF
GO