![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm administering a SQL Server 2008 R2 and I have a daily maintenance plan that backs up a database and then reorganizes it's indexes and updates statistics. Lately the reorganize index task is taking over 8 hours to complete. This is not a normal behavior since the rebuild indexes task I run on weekends takes less then an hour. The database is almost 60 GB in size. |
#3
| |||
| |||
|
|
SGoncalves (goncalves.serg... (AT) gmail (DOT) com) writes: I'm administering a SQL Server 2008 R2 and I have a daily maintenance plan that backs up a database and then reorganizes it's indexes and updates statistics. Lately the reorganize index task is taking over 8 hours to complete. This is not a normal behavior since the rebuild indexes task I run on weekends takes less then an hour. The database is almost 60 GB in size. Stop reorganising the indexes. Monitor your fragmentation, to see whether any action is needed at all. Reorganisation uses a kind of bubble-sort algorithm, and in some situation it can take some time to handle a fairly small amount of fragmentation. -- Erland Sommarskog, SQL Server MVP, esq... (AT) sommarskog (DOT) se Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books... Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx |
#4
| |||
| |||
|
|
Reorganisation uses a kind of bubble-sort algorithm, and in some situation it can take some time to handle a fairly small amount of fragmentation. |
#5
| |||
| |||
|
|
On Fri, 6 May 2011 10:44:32 +0000 (UTC), Erland Sommarskog esquel (AT) sommarskog (DOT) se> wrote: Reorganisation uses a kind of bubble-sort algorithm, and in some situation it can take some time to handle a fairly small amount of fragmentation. Bubble sort? Why? |
#6
| |||
| |||
|
|
Gene Wirchenko (ge... (AT) ocis (DOT) net) writes: On Fri, 6 May 2011 10:44:32 +0000 (UTC), Erland Sommarskog esq... (AT) sommarskog (DOT) se> wrote: Reorganisation uses a kind of bubble-sort algorithm, and in some situation it can take some time to handle a fairly small amount of fragmentation. * * *Bubble sort? *Why? It may not be exactly bubble-sort. But what happens is that SQL Server swaps place of two pages at a time. The advantage with this is that REORGANIZE can be an online operation. But it may not always be the most efficient. REBUILD means a complete rebuild of the index, but this means that the table is unaccessible while the rebuild is running. (Although, in Enterprise Edition it is possible to do online rebuilds.) -- Erland Sommarskog, SQL Server MVP, esq... (AT) sommarskog (DOT) se Links for SQL Server Books Online: SQL 2008:http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005:http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx |
#7
| |||
| |||
|
|
I've been checking fragmentation levels in the production database, and I've encountered some curious (or not). When I select the sys.dm_db_index_physical_stats I have many indexes with 99% avg_fragmentation_in_percent, but when I go through the GUI into the same indexes and check the fragmentation it show 0,01%. |
#8
| |||
| |||
|
|
SGoncalves (goncalves.serg... (AT) gmail (DOT) com) writes: I've been checking fragmentation levels in the production database, and I've encountered some curious (or not). When I select the sys.dm_db_index_physical_stats I have many indexes with 99% avg_fragmentation_in_percent, but when I go through the GUI into the same indexes and check the fragmentation it show 0,01%. Not sure what you see, but beware that if you run with DETAILED mode, you will also get the intermediate levels in the index, and they are often quite fragmented. On the other hand that is no cause for alarm. -- Erland Sommarskog, SQL Server MVP, esq... (AT) sommarskog (DOT) se Links for SQL Server Books Online: SQL 2008:http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005:http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx |
#9
| |||
| |||
|
|
On May 9, 10:59 pm, Erland Sommarskog<esq... (AT) sommarskog (DOT) se> wrote: SGoncalves (goncalves.serg... (AT) gmail (DOT) com) writes: I've been checking fragmentation levels in the production database, and I've encountered some curious (or not). When I select the sys.dm_db_index_physical_stats I have many indexes with 99% avg_fragmentation_in_percent, but when I go through the GUI into the same indexes and check the fragmentation it show 0,01%. Not sure what you see, but beware that if you run with DETAILED mode, you will also get the intermediate levels in the index, and they are often quite fragmented. On the other hand that is no cause for alarm. -- Erland Sommarskog, SQL Server MVP, esq... (AT) sommarskog (DOT) se Links for SQL Server Books Online: SQL 2008:http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005:http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx How can I check the DETAILED mode? Thanks in advance. |
#10
| |||
| |||
|
|
SGoncalves schreef op 10-05-2011 12:44: On May 9, 10:59 pm, Erland Sommarskog<esq... (AT) sommarskog (DOT) se> wrote: SGoncalves (goncalves.serg... (AT) gmail (DOT) com) writes: I've been checking fragmentation levels in the production database, and I've encountered some curious (or not). When I select the sys.dm_db_index_physical_stats I have many indexes with 99% avg_fragmentation_in_percent, but when I go through the GUI into the same indexes and check the fragmentation it show 0,01%. Not sure what you see, but beware that if you run with DETAILED mode, you will also get the intermediate levels in the index, and they are often quite fragmented. On the other hand that is no cause for alarm. -- Erland Sommarskog, SQL Server MVP, esq... (AT) sommarskog (DOT) se Links for SQL Server Books Online: SQL 2008:http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005:http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx How can I check the DETAILED mode? Thanks in advance. http://msdn.microsoft.com/en-us/library/ms188917.aspx Oops, inadvertently hit ctrl-enter |
![]() |
| Thread Tools | |
| Display Modes | |
| |