• Be careful running a script like this that touches all indexes on all databases. Even though the LIMITED mode is only oging to read the level of the index above the leaf-level to get the logical fragmentation (I wrote the code inside SQL Server), running it over all indexes on all databases may do the equivalent of flushing out your buffer pool.

    A much better approach once you've got some knowledge of which indexes are your problem-children is to have a table with those indexes in and only check fragmentation on them - rather than everything in all databases. This does much less, and more targeted reads.

    If you don't have a clue about what the problem is though, this script is great.

    Thanks

    Paul Randal
    CEO, SQLskills.com: Check out SQLskills online training!
    Blog:www.SQLskills.com/blogs/paul Twitter: @PaulRandal
    SQL MVP, Microsoft RD, Contributing Editor of TechNet Magazine
    Author of DBCC CHECKDB/repair (and other Storage Engine) code of SQL Server 2005