分析SQL語句性能3種方法分享
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
第三種方法:

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.
相關文章
一個函數(shù)解決SQLServer中bigint 轉 int帶符號時報錯問題
這篇文章主要介紹了解決SQLServer中bigint 轉 int帶符號時報錯問題的函數(shù),需要的朋友可以參考下2014-08-08
SQL?Server如何設置用戶只能訪問特定數(shù)據(jù)庫和訪問特定表或視圖
最近項目中需要限定特定的用戶只能查看并訪問特定的數(shù)據(jù)庫,防止多個用戶對數(shù)據(jù)庫操作時一些誤操作,所以這篇文章主要給大家介紹了關于SQL?Server如何設置用戶只能訪問特定數(shù)據(jù)庫和訪問特定表或視圖的相關資料,需要的朋友可以參考下2023-04-04
SQL Server數(shù)據(jù)庫文件過大而無法直接導出解決方案
這篇文章主要介紹了SQL Server數(shù)據(jù)庫文件過大而無法直接導出解決方案,文中通過代碼示例講解的非常詳細,對大家的學習或工作有一定的幫助,需要的朋友可以參考下2024-08-08
SQL一條語句統(tǒng)計記錄總數(shù)及各狀態(tài)數(shù)
這篇文章主要為大家介紹了SQL一條語句統(tǒng)計記錄總數(shù)及各狀態(tài)數(shù)的sql語句,需要的朋友可以參考下2013-12-12
Sql Server里刪除數(shù)據(jù)表中重復記錄的例子
這篇文章主要介紹了Sql Server里刪除數(shù)據(jù)表中重復記錄的例子,本文給出了3種操作方法,需要的朋友可以參考下2014-08-08
SQL Server通過重建方式還原master數(shù)據(jù)庫
這篇文章主要為大家詳細介紹了SQL Server通過重建方式還原master數(shù)據(jù)庫的相關資料,需要的朋友可以參考下2016-09-09

