﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Administering / SQL Server 2005  / Index Rebuilds Still Leave Fragmentation / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 18 Jun 2013 16:28:41 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Index Rebuilds Still Leave Fragmentation</title><link>http://www.sqlservercentral.com/Forums/Topic448556-146-1.aspx</link><description>Please note: 4 year old thread.</description><pubDate>Wed, 07 Nov 2012 23:46:25 GMT</pubDate><dc:creator>GilaMonster</dc:creator></item><item><title>RE: Index Rebuilds Still Leave Fragmentation</title><link>http://www.sqlservercentral.com/Forums/Topic448556-146-1.aspx</link><description>Check the MDOP (Max Degree of Parallelism) setting. In the past, I have seen improvement when MDOP is 1 instead of default 0. My understanding was, when parallel threads try to rebuild an index, there would still be fragmentation simply because more people at work, however if there is only 1 thread doing the work, then we would get the optimum results out of ALTER INDEX...REBUILDALTER INDEX &amp;lt;index-name&amp;gt; ON &amp;lt;table-name&amp;gt; REBUILD WITH (MAXDOP = 1)The details are explained in detail in the blog post: http://www.sqlservergeeks.com/blogs/Parikshit/personal/427/does-parallel-plan-for-rebuild-index-impact-the-fragmentation-of-index</description><pubDate>Wed, 07 Nov 2012 13:42:11 GMT</pubDate><dc:creator>graghunair</dc:creator></item><item><title>RE: Index Rebuilds Still Leave Fragmentation</title><link>http://www.sqlservercentral.com/Forums/Topic448556-146-1.aspx</link><description>[quote][b]Adam Bean (1/29/2008)[/b] Two different SQL Server support techs informed me that issuing a DBCC DBREINDEX, ALTER INDEX REBUILD/REORGANIZE, will NOT update the statistics with fullscan. They recommended having a separate task in our maintenance scripts to update the statistics.[/quote][quote][b]Paul Randal (1/29/2008)[/b][hr] Trust me - I used to own all that code. Reorganize doesn't but rebuild does update stats.[/quote]And it's very easy to prove, if you want to see for yourself Adam.Run DBCC Show_statistics on an index. Check the date the stats were updates. Rebuild the index, then run show statistics again.</description><pubDate>Wed, 30 Jan 2008 13:36:00 GMT</pubDate><dc:creator>GilaMonster</dc:creator></item><item><title>RE: Index Rebuilds Still Leave Fragmentation</title><link>http://www.sqlservercentral.com/Forums/Topic448556-146-1.aspx</link><description>I also face the similar kind of problem:When the table size is very small and contain a few rows only at that time this kind of problem happen. In addition to this when there is heavy insert/update/delete happen to the database i.e. few transactions per second at that time also you won't get Scan Density 100%.One shouldn't bother much about the Scan Density on the small table.</description><pubDate>Wed, 30 Jan 2008 00:05:31 GMT</pubDate><dc:creator>free_mascot</dc:creator></item><item><title>RE: Index Rebuilds Still Leave Fragmentation</title><link>http://www.sqlservercentral.com/Forums/Topic448556-146-1.aspx</link><description>The quality of support has gone way down - I used to constantly battle incorrect support engineers (a lot easier to do when you're running one of the dev teams they're giving incorrect info about).They're wrong - and that's pretty annoying. Trust me - I used to own all that code. Reorganize doesn't but rebuild does update stats.</description><pubDate>Tue, 29 Jan 2008 16:34:02 GMT</pubDate><dc:creator>Paul Randal</dc:creator></item><item><title>RE: Index Rebuilds Still Leave Fragmentation</title><link>http://www.sqlservercentral.com/Forums/Topic448556-146-1.aspx</link><description>[quote][b]GilaMonster (1/28/2008)[/b][hr]How big are the tables in question? How many pages do the indexes take up (visible in sys.dm_db_index_physical_stats)Edit: btw, a separate update statistics is not necessary (and may even be counter productive) if you're doing an index rebuild. When the index gets rebuilt, the stats get updated as if an update stats with full scan was run.[/quote]Gila, I was always under the same impression until I had several phone conversations with Microsoft revolving around performance issues we experienced. Two different SQL Server support techs informed me that issuing a DBCC DBREINDEX, ALTER INDEX REBUILD/REORGANIZE, will NOT update the statistics with fullscan. They recommended having a separate task in our maintenance scripts to update the statistics.Now I'm curious ... It wouldn't be the first time Microsoft has given me faulty information.</description><pubDate>Tue, 29 Jan 2008 14:19:11 GMT</pubDate><dc:creator>Adam Bean</dc:creator></item><item><title>RE: Index Rebuilds Still Leave Fragmentation</title><link>http://www.sqlservercentral.com/Forums/Topic448556-146-1.aspx</link><description>Thanks, yeah I wasn't worried about performance reasons, as your right there isn't much to the table.  It was a curiosity question, as there must be a reason ie size of table, total number of data pages why they were not being touched.  The ones that are critical were being rebuilt..The reason we do the statistics FULL SCAN afterwards is to catch the other statistics that were user created or auto created by the engine in some situations that were not part of an index column.  On our databases we have a good maintance window so time is no issue and it really only takes 5-10 min for rebuilds and statistics as a high number.  Sometimes we find that one of those statistics should be made into an index and other times they are better served as just statistical info for the engine.</description><pubDate>Tue, 29 Jan 2008 08:47:13 GMT</pubDate><dc:creator>SQL Dude-467553</dc:creator></item><item><title>RE: Index Rebuilds Still Leave Fragmentation</title><link>http://www.sqlservercentral.com/Forums/Topic448556-146-1.aspx</link><description>These indexes aren't getting touched - you basically shouldn't bother with index fragmentation unless your index has more than 1000 pages as it'll most probably be entirely contained in cache already and so fragmentation is irrelevant. I thought I'd put that into BOL for DBCC SHOWCONTIG and index_physical_stats but it looks like I didn't.Checkout this blog post on rebuilds and stats updates - [url]http://www.sqlskills.com/blogs/paul/2008/01/27/SearchEngineQA10RebuildingIndexesAndUpdatingStatistics.aspx[/url]. Weird how questions seem to come up in clusters - this week it's index rebuilds.Hope this helps.</description><pubDate>Mon, 28 Jan 2008 19:45:35 GMT</pubDate><dc:creator>Paul Randal</dc:creator></item><item><title>RE: Index Rebuilds Still Leave Fragmentation</title><link>http://www.sqlservercentral.com/Forums/Topic448556-146-1.aspx</link><description>See if this helps...http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/ss2kidbp.mspx</description><pubDate>Mon, 28 Jan 2008 16:46:38 GMT</pubDate><dc:creator>Eric Desch</dc:creator></item><item><title>RE: Index Rebuilds Still Leave Fragmentation</title><link>http://www.sqlservercentral.com/Forums/Topic448556-146-1.aspx</link><description>Hi Gail,There are quite a few examples but I will stick to one or two. The others are very similar, and / or only average 1 fragment per page.  Stats from the DMV[b]EXAMPLE[/b]Table Data Size .516 MBIndex Space .719 MBTable record count : 7012# of Pages : 14# of Fragments 8Avg Frag 50%[b]EXAMPLE[/b]Table Data Size .039 MBIndex Space .016 MBTable record count : 568# of Pages : 5# of Fragments 5Avg Frag 80%</description><pubDate>Mon, 28 Jan 2008 13:50:50 GMT</pubDate><dc:creator>SQL Dude-467553</dc:creator></item><item><title>RE: Index Rebuilds Still Leave Fragmentation</title><link>http://www.sqlservercentral.com/Forums/Topic448556-146-1.aspx</link><description>How big are the tables in question? How many pages do the indexes take up (visible in sys.dm_db_index_physical_stats)Edit: btw, a separate update statistics is not necessary (and may even be counter productive) if you're doing an index rebuild. When the index gets rebuilt, the stats get updated as if an update stats with full scan was run.</description><pubDate>Mon, 28 Jan 2008 13:38:45 GMT</pubDate><dc:creator>GilaMonster</dc:creator></item><item><title>Index Rebuilds Still Leave Fragmentation</title><link>http://www.sqlservercentral.com/Forums/Topic448556-146-1.aspx</link><description>Hello All,I am running SQL Server 2005 SP2 Standard Edition on a few servers.  I run SQL Agent Jobs every week that REBUILD all of the user table indexes  i.e. (ALTER INDEX ALL ON [Table] REBUILD)  I also run another job that UPDATES STATISTICS.  The jobs complete without error and rebuild most all of the indexes removing fragmentation then updating any statistics.  Though, there are quite a few indexes that even after running the rebuild script still have the same fragmentation % i/e 67% or fragments as prior to the REBUILD command.  Are there some reasons why indexes will remain fragmented even after rebuilding them?  I've tried as a test on some tables to rebuild the index in question from SSMS, SQL Agent Job, and the GUI point and click "Rebuild", all results are the same, command competed successfully, but fragmentation remains the same, no change.Any tips or pointers would be greatly appreciated!  There must be some caveat I'm not thinking of..</description><pubDate>Mon, 28 Jan 2008 13:34:13 GMT</pubDate><dc:creator>SQL Dude-467553</dc:creator></item></channel></rss>