Solved

SQL 2000 defrag index's

Posted on 2006-12-01
3
652 Views
Last Modified: 2008-03-06
I have a script to defrag some indexes however after building a list an a temp table it does the following to select which indexes to defrag:

SELECT ObjectName, ObjectId, IndexId, LogicalFrag
   FROM #fraglist
   WHERE LogicalFrag >= 25
     AND INDEXPROPERTY (ObjectId, IndexName, 'IndexDepth') > 0

This only returns one row but on inspection there are loads of indexes with a crap scan density, my question is this:

If i remove :

 AND INDEXPROPERTY (ObjectId, IndexName, 'IndexDepth') > 0

And just defrag all of the indexes with fragmentation > 25 will this cause any problems or will this work with out issue. In summary do I need to do the second check on the index properties and if I remove it am I safe to defrag all the indexes?

Cheers
0
Comment
Question by:Netstore
3 Comments
 
LVL 11

Accepted Solution

by:
lluthien earned 500 total points
ID: 18053044
if you remove the indexdepth check,
you will _not_ skip the systemtables.

so you'd have to figure out another away around that,

   WHERE LogicalFrag >= 25

are you sure you're checking the right fragmentation percentage?

this link has some background info:
http://www.sql-server-performance.com/tp_automatic_reindexing.asp
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now