分析SQL语句性能3种方法分享

来源:asp之家 时间:2012-06-06 20:09:30 

第一种方法:

代码如下:


Minimsdn.com为您提供的代码:
-- Turn ON [Display IO Info when execute SQL]
SET STATISTICS IO ON
-- Turn OFF [Display IO Info when execute SQL]
SET STATISTICS IO OFF


Link: http://msdn.microsoft.com/zh-cn/library/ms184361.aspx
第二种方法:

代码如下:


MINIMSDN.com为您提供的代码:
--Turn ON [Display detail info and the request for resources]
SET SHOWPLAN_ALL ON
-- Turn OFF [Display detail info and the request for resources]
SET SHOWPLAN_ALL OFF


Link: http://msdn.microsoft.com/zh-cn/library/ms187735
第三种方法:

Links: http://msdn.microsoft.com/zh-cn/library/ff650689.aspx ; http://msdn.microsoft.com/zh-cn/library/aa175244(v=SQL.80).aspx
Demo For three kinds of Method:
For SQL Script:

代码如下:


select * from dbEBMSStaging.dbo.MSSalesTxlatOrganizationMaster_Corg StagingOMC

v Its Execution plan: ()


v Its IO info: ()

- - You can try one table with 100/10000/1000000 rows but create/don't create Clustered/NONCLUSTERED Index.

v Its Detail info Etc.: ()


For SQL Script:


 代码如下:


select top 100 * from dbEBMSStaging.dbo.MSSalesTxlatOrganizationMaster_Corg StagingOMC


v Its Execution plan: ()

v Its IO info: ()

v Its Detail info Etc.: ()

For SQL Script:


代码如下:


select top 100 * from dbEBMSStaging.dbo.MSSalesTxlatOrganizationMaster_Corg StagingOMC
order by StagingOMC.COrgTPName


v Its Execution plan: ( )


v Its IO info: ()

v Its Detail info Etc.: ()

For SQL Script:


代码如下:


select top 100 StagingOMC.COrgTPName,COUNT(CorgID) from dbEBMSStaging.dbo.MSSalesTxlatOrganizationMaster_Corg StagingOMC
group by StagingOMC.COrgTPName
order by StagingOMC.COrgTPName


v Its Execution plan: ()


v Its IO info: ()

v Its Detail info Etc.: ()


- - By these three kinds of methods, you can try to check those words in the internet web are right or wrong about how to improve SQL Script performance.

标签:SQL语句,性能
0
投稿

猜你喜欢

  • asp如何去除HTML标签

    2010-06-07 20:47:00
  • Javascript 回调和事件(翻译)

    2009-03-28 11:47:00
  • 手写个小组件(组件入门)asp版

    2013-06-01 20:29:25
  • 如何使数据库中取出的数据保持原有格式

    2008-11-27 16:16:00
  • 《写给大家看的设计书》阅读笔记之亲密性原则

    2009-07-08 20:02:00
  • 百度百科中的asp词条:什么是asp

    2008-10-11 14:38:00
  • 解析:以mysql_开始的未定义引用错误

    2008-12-19 17:58:00
  • 怎样处理 MySQL中与文件许可有关的问题

    2008-11-27 16:12:00
  • Asp包含文件include动态包含方法(含变量)

    2010-01-14 20:12:00
  • 快速掌握ASP+Access数据库的18条安全法则

    2008-11-28 15:08:00
  • 5 个简单实用的 CSS 属性

    2010-03-10 11:00:00
  • 用户不需要信息快餐

    2009-02-25 12:34:00
  • Web开发的改良

    2009-06-25 14:34:00
  • Host localhost is not allowed to conn

    2011-02-23 12:41:00
  • 提高javascript的速度系列(序)

    2008-07-15 12:38:00
  • 用ASP读取/写入UTF-8编码格式的文件

    2007-08-20 09:29:00
  • CSS Menu导航菜单下载网站整理

    2007-10-21 19:49:00
  • Persits AspJpeg 1.8+ 轻松实现透明文字去锯齿水印

    2009-03-20 14:03:00
  • 如何使用 SQL Server 数据库查询累计值

    2008-12-03 15:27:00
  • sql server对字段的添加修改删除、以及字段的说明

    2012-01-05 18:50:52
  • asp之家 网络编程 m.aspxhome.com