SqlServer性能瓶颈分析 一.内存瓶颈分析--SQLServer:Buffer Manager SELECT TOP 312 * FROM sys.dm_os_performance_counterswhere object_name ='SQLServer:Buffer Manager' order by counter_name 1.Buffer cache hit ratio 平均值>=90% 缓冲区是创建数据页面的缓冲页面池,这一般是SQL server内存池中最大的部分.这个
CREATE Function Dbo.GetAge ( @birthday datetime, @now datetime ) Returns int As Begin Declare @Age int, @year int, @month int, @Day int Set @age = Set @year = Set @month = Set @day = Set @year = DatePart(Year,@Now) - DatePart(Year, @BirthDay) Set @mo
mark if exists (select * from dbo.sysobjects where id = object_id(N'UF_ETL_GetDistance') and xtype in (N'FN', N'IF', N'TF')) drop function UF_ETL_GetDistance GO CREATE FUNCTION UF_ETL_GetDistance ( ,), ,), ,), ,) ) ,) AS BEGIN ,) *PI())) END go
--@StartDate 本年度第一天 --@EndDate 本年度最后一天 , ) , DATEADD(yy, , , )) IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = OBJECT_ID('tempdb..#tb_work') ) BEGIN DROP TABLE #tb_work END CREATE TABLE #tb_work ( RN INT , WorkDate DATE ,--日期 DeWeek ) ,--星期几
/****** Script for SelectTopNRows command from SSMS ******/ SELECT [fdSequenceID] ,[fdInnerTime] ,[fdTime] ,[fdData] ,[fdState] ,[fdUpdateTime] ,[fdCreateTime] FROM [NewDBTest].[dbo].[tbDataMonthHG] WITH f AS ( SELECT ROW_NUMBER()OVER( partition by f