(imported topic written by SystemAdmin)
In 6.0 and 7.0, a default maintenance plan is created that will re-index the QUESTIONRESULTS, FIXLETRESULTS and ACTIONRESULTS tables every 6 hours. These tables each have a primary key constraint and a clustered index on them.
As an optimization, its possible to perform an index defragment operation instead of reindexing. There are some subtle differences between these operations:
-
Defragmenting will not lock the database when it runs. BES Consoles, FillDB and any other database operations that are running will continue to run normally even while database defragmenting is occuring. Reindex a database table lcoks all other processes from using that table.
-
Defragmenting will usually take longer to run than a reindex (estamate 1-2x longer). Defragmentation run time is proportional to the amount of fragmentation and the size of the table while reindex is proportional to the size of the table.
-
Defragmenting does not update statistical counters in the database, reindexing will.
-
Defragmenting isn’t able to defragment the index structure itself (only leaf nodes are defragmented) while reindex will defragment all structures on the table. Reindexing actually drops the clustered index and rebuilds it as well as defragment the leaf nodes.
-
Defragmenting will skip pages if they are in use and not defragment them.
-
Defragmenting may fail occasionally if the database is under heavy load or blocked at the time. Once a week failures are ok but if you see failures regularly there is likely a problem with the job.
Given the trade-offs between these two operations, you can optimize the database performance by performing the defragment operation during operational hours of BES (since it doesn’t lock the database) and run re-indexing operations in the off-hours to ensure the tables eventually get completely defragmented and statistics are updated.
I’ll attach a sql query which will create the following schedule. You should disable the default ‘BFEnterprise Results Table Reindexing Job’ prior to creating the new schedule as the old maintenance task is not needed and will collide with the new plan. You should also disable/delete the staggered windows described in this post (http://forum.bigfix.com/viewtopic.php?id=1153) if you made those modifications (the non-results table weekly re-index job can stay though).
Schedule created by ‘BFEnterprise daily reindex and defragging.sql’:
Midnight - Reindex QUESTIONRESULTS
2am - Reindex FIXLETRESULTS
4am - Reindex ACTIONRESULTS
6am, Noon, 6pm - Defragment QUESTIONRESULTS
8am, 2pm, 8pm - Defragment FIXLETRESULTS
10am, 4pm, 10pm - Defragment ACTIONRESULTS
A total of 6 maintenance jobs are created to implement the above schedule.
Finally, an important note for implementing this policy in 6.0. It’s possible for the defragment query to cause deadlocks to occur unless you update two stored procedures. I’ll attach the sql queries to update these stored procedures in the next post. This change made is included in BES 7.0 and you should not update these stored procedures if you are already using BES 7.0.