Answered by:
Identifying cause of index fragmentation

Question
-
Is it possible to identify when an index becomes fragmented or what causes the fragmentation?
I'm trying to identify the cause of an issue I'm having with a particular index.
Wednesday, November 16, 2016 8:01 AM
Answers
-
SELECT avg_fragmentation_in_percent FROM sys.dm_db_index_physical_stats
(
DB_ID('testdb'),
OBJECT_ID('dbo.T1'),
1,
NULL,
NULL
);I got the result 97.488, meaning that there are over 97
percents of out-of-order pages.It is possible the pages splits or DBCC SHINKDATABASE cause the fragmentation
http://logicalread.solarwinds.com/fix-sql-server-index-fragmentation-mc11/#.WCxEzvl96Uk
Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting: Large scale of database and data cleansing
Remote DBA Services: Improves MS SQL Database Performance
SQL Server Integration Services: Business Intelligence
- Edited by Uri DimantMVP, Editor Wednesday, November 16, 2016 11:37 AM
- Proposed as answer by Naomi N Wednesday, November 16, 2016 11:41 AM
- Marked as answer by Ed Price - MSFTMicrosoft employee Thursday, December 15, 2016 3:16 AM
Wednesday, November 16, 2016 11:36 AMAnswerer -
you can go through this excellent blog post by Jonathan of SQLSkills;
https://www.sqlskills.com/blogs/jonathan/tracking-problematic-pages-splits-in-sql-server-2012-extended-events-no-really-this-time/
- Edited by Debdutta Nath Wednesday, November 16, 2016 1:02 PM
- Marked as answer by Ed Price - MSFTMicrosoft employee Thursday, December 15, 2016 3:16 AM
Wednesday, November 16, 2016 1:01 PM -
Check fillfactor for the index.
Read this blog post by Brad Schultz
http://bradsruminations.blogspot.co.il/2010/09/t-sql-tuesday-010-little-known-index.html
if you want to relax a bit and have a good laugh as well as learn something.
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles- Marked as answer by Ed Price - MSFTMicrosoft employee Thursday, December 15, 2016 3:16 AM
Wednesday, November 16, 2016 1:17 PM
All replies
-
SELECT avg_fragmentation_in_percent FROM sys.dm_db_index_physical_stats
(
DB_ID('testdb'),
OBJECT_ID('dbo.T1'),
1,
NULL,
NULL
);I got the result 97.488, meaning that there are over 97
percents of out-of-order pages.It is possible the pages splits or DBCC SHINKDATABASE cause the fragmentation
http://logicalread.solarwinds.com/fix-sql-server-index-fragmentation-mc11/#.WCxEzvl96Uk
Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting: Large scale of database and data cleansing
Remote DBA Services: Improves MS SQL Database Performance
SQL Server Integration Services: Business Intelligence
- Edited by Uri DimantMVP, Editor Wednesday, November 16, 2016 11:37 AM
- Proposed as answer by Naomi N Wednesday, November 16, 2016 11:41 AM
- Marked as answer by Ed Price - MSFTMicrosoft employee Thursday, December 15, 2016 3:16 AM
Wednesday, November 16, 2016 11:36 AMAnswerer -
you can go through this excellent blog post by Jonathan of SQLSkills;
https://www.sqlskills.com/blogs/jonathan/tracking-problematic-pages-splits-in-sql-server-2012-extended-events-no-really-this-time/
- Edited by Debdutta Nath Wednesday, November 16, 2016 1:02 PM
- Marked as answer by Ed Price - MSFTMicrosoft employee Thursday, December 15, 2016 3:16 AM
Wednesday, November 16, 2016 1:01 PM -
Is it possible to identify when an index becomes fragmented or what causes the fragmentation?
I'm trying to identify the cause of an issue I'm having with a particular index.
Cheers,
Shashank
Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
My TechNet Wiki Articles
MVPWednesday, November 16, 2016 1:13 PM -
Check fillfactor for the index.
Read this blog post by Brad Schultz
http://bradsruminations.blogspot.co.il/2010/09/t-sql-tuesday-010-little-known-index.html
if you want to relax a bit and have a good laugh as well as learn something.
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles- Marked as answer by Ed Price - MSFTMicrosoft employee Thursday, December 15, 2016 3:16 AM
Wednesday, November 16, 2016 1:17 PM