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.
How can I fix this?
Best regards.
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...@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Thank you for your answer.
I have monitored the fragmentation and right now it is very high on
most of the indexes.
I've scheduled a rebuild for this weekend.
Thank you for your time.
Best regards.
[snip]
>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?
Sincerely,
Gene Wirchenko
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...@sommarskog.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
Greetings,
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%.
How is this possible?
Best regards.
How can I check the DETAILED mode?
Thanks in advance.
I was gonna add:
mode | NULL | DEFAULT
Is the name of the mode. mode specifies the scan level that is used
to obtain statistics. mode is sysname. Valid inputs are DEFAULT, NULL,
LIMITED, SAMPLED, or DETAILED. The default (NULL) is LIMITED.
But else, sys.dm_db_index_physical_stats is described in Books Online.
When you see something you have not seen before, it's often a better
alternative to look in Books Online than posting a question and wait
for someone to answer.
OK.
Thank you very much.
Best regards.
P.S.: I'm still working on the database, but performance has been
greatly improved in the last few days.