There was a query that was posted few weeks back where the performance
of the application gradually deteriorated towards the end of the week but at
the beginning of the week it was working optimally.
What does this mean from a technical perspective?
Towards the end of the week the indexes gradually get
fragmented and during the weekend a optimization job reorganizes or rebuilds
the index. Even though, from database maintenance perspective we saved our
selves there seems to be room for improvement.
If we read between lines it does say the index get
fragmented fairly soon and that’s clear indication
1.) That there is notable amount of data written to the indexes and
1.) That there is notable amount of data written to the indexes and
- 2.) The index design is not optimal (or)
3 3.) The fill factor settings may need to be changed after monitoring
3 3.) The fill factor settings may need to be changed after monitoring
As we were not in a state to recommend any indexing strategy
to the client( due to vendor ownership) we needed to identify best fragmentation level for the indexes.
Currently there is no SQL native tool that’s offered by Microsoft to assist with this matter;
However with
1.) Sql server 2012, there is extended events to identify page splits
2.) The second best option is to use the undocumented function fn_dblog() ; which has been available since sql 2000
1.) Sql server 2012, there is extended events to identify page splits
2.) The second best option is to use the undocumented function fn_dblog() ; which has been available since sql 2000
As part of the solution
1.) A SQL job was created to schedule to collect the data for each database using the following
1.) A SQL job was created to schedule to collect the data for each database using the following
SELECT
DB_NAME()
,COUNT(1)
AS NumberOfSplits
,AllocUnitName
,Context
,GETDATE()
From fn_dblog(NULL,NULL)
Where operation = 'LOP_DELETE_SPLIT'
Group By AllocUnitName, Context
Order by NumberOfSplits desc
From fn_dblog(NULL,NULL)
Where operation = 'LOP_DELETE_SPLIT'
Group By AllocUnitName, Context
Order by NumberOfSplits desc
2 2.)
Collated the data to represent the page splits
in the a following format
Ex
dbo.sales.UC_Sales_SalesID_PK
The
rest of the results is fairly self-explanatory
3.) Monitored the page splits for the individual indexes after comparing the before and after image of the above result set, and after which further recommendations were suggested.
3.) Monitored the page splits for the individual indexes after comparing the before and after image of the above result set, and after which further recommendations were suggested.
Hope this tips help those in need.
Comments
Post a Comment