Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
DBADave
Constraint Violating Yak Guru
366 Posts |
Posted - 2006-08-24 : 10:46:30
|
I'm writing a script to automate index defragmentation and trend fragmentation growth. Does my WHERE clause, checking SHOWCONTIG results, look correct.-- External Fragmentation - Candidates for INDEXDEFRAG and UPDATE STATISTICSFROM DBCC_SHOWCONTIGWHERE indexid Not In (0,255) -- Not a Heap and does not contain Text data AND ((LogicalFrag > 10 and LogicalFrag < 15) OR (Scandensity < 75 and Scandensity > 60))AND CountPages > 500 -- External Fragmentation - Candidates for DBREINDEXFROM DBCC_SHOWCONTIGWHERE indexid Not In (0,255) -- Not a Heap and does not contain Text data AND (LogicalFrag > 14 OR Scandensity < 60)AND CountPages > 500 -- Internal FragmentationFROM DBCC_SHOWCONTIGWHERE indexid > 0 -- Not a HeapAND indexid < 255 -- Does not contain Text data AND AvgPageDensity < 76AND CountPages > 100 -- More then 100 PagesThanks, Dave |
|
|
|
|