Login or Sign Up to become a member!
LessThanDot Sit Logo

LessThanDot

Data Management

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot friendfeed Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Your profile

    Search

    XML Feeds

    Google Ads

    « SQL Advent 2011 Day 9: Dynamic TOPSQL Server Integration Services tools to have – Expression Editor & Tester »
    comments

    Today, Red Gate announced a new product in beta testing, SQL Index Manager.  The new tool will be used to analyze and recommend solutions to index fragmentation on a SQL Server Instance.  The first thing you may ask yourself is: another tool to fix fragmentation?  There are quite a few index scripts and tools out there to handle fragmentation.  Take a look at Michelle Ufford’s index maintenance script.  I’ve used Michelle’s script for quite some time now and it is really stable and does a great job.

    The one thing we will get by another index maintenance tool that comes from Red Gate is, quality and the name.  Red Gate is a well-respected company and known for providing us, SQL Server Professionals, with solid tools to help us get the job done efficiently.  I mean, who hates the Toolbelt bundles?  I’ve never heard many people say they hate it or haven’t used a Red Gate SQL Server product.

    First look at Index Manager

    Note: The SQL Index Manager is in Beta so anything I report here is just as much a suggestion to the product team as it is my first review.  This is not an RTM product yet.

    I do have to say, I didn’t like the first thing I saw about this tool.  You are presented with a Connect to server dialog and a Diagnose now…button.  Sorry but that would be a, No.  I’m not going to put a production instance or even highly active development instance in there and hit diagnose without being able to limit what is diagnosed.  So that was a big thing that wasn’t really great.

    There also seems to be a little bug on the initial loading of the tool in which it does not prepopulate the instances it finds.  Hit cancel and then FileàConnect to a server, the list populates then.

    Entering in a SQL Server 2012 RC0 instance, I quickly received a message stating, “No fragmented Indexes were found”.  Took me a minute to find the “Reanalyze” button so if you are looking up, look down. It is on the bottom menu strip, in the left corner.

    Internals

    What is this new tool doing in the background?  This is what I can see the tool is doing to my instances.

    One thing I noticed is, it does not seem to take into account if the edition of SQL Server is Enterprise.  So one has to ask the question if the tool is accounting for online operations with Enterprise Edition?

    I was happy to see the first thing Red Gate does is weed out system databases, but didn’t include databases like distribution or such that are used by replication.  Those system databases are often and commonly indexed and require analysis.  The tool is also filtering out databases that are in standby, offline and snapshots.  I think the query that is used could use some [ ] around name though (ok, now I’m being really picky)

    1. SELECT name AS databaseName
    2.      , database_id AS databaseId
    3. FROM master.sys.databases
    4. WHERE name NOT IN ('master', 'msdb', 'tempdb', 'model')  
    5.   AND is_in_standby <> 1                                
    6.   AND state_desc = 'ONLINE'                              
    7.   AND source_database_id IS NULL

     

    Once the list of databases has been grabbed, the tool moves onto retrieving a listing of all the tables and views by querying sys.obects and sys.schemas.  I won’t post those queries but they appear to be well formed, as are most of the queries that sit behind these types of Red Gate products.  I immediately looked for the handling of LOB and the tool is taking care of it.

    The next steps are to go into checking for all the indexes by querying sys.indexes and sys.partitions.  Of course, the first predicate is to ignore my sad HEAP tables that are cluster orphaned.

    It appears that the SQL Index Manager retrieves all the object and index metadata before doing any true analysis of fragmentation.  The first thought I have here is the cost in memory consumed locally by the machine running the SQL Index Manager.  Having one SQL Server database with enough returned resulted in memory is one thing but I could easily see an entire instance being able to return and fill a nasty chunk of memory with this method.  It reminds me of the documenting tool and it erroring out if you try to script too many objects in one database.

    On to the good stuff: SQL Index Manager is more than likely dynamic T-SQLing out the findings in both results from the objects set and the index set with some sort of merge there.  The tool proceeds to reply on the DMV sys.dm_db_index_physical_stats to retrieve the avg_fragmentation_in_percent and page_count.  Yes, page count does make a difference when asking, “Do we need to defrag something with 2 pages?”

    An example of that call

    1. exec sp_executesql N'
    2. SELECT index_id
    3.     , avg_fragmentation_in_percent
    4.     , page_count
    5. FROM sys.dm_db_index_physical_stats(@databaseId, @objectId, @indexId, @partitionNr, NULL)
    6. ',N'@databaseId int,@objectId int,@indexId int,@partitionNr int',@databaseId=6,@objectId=341576255,@indexId=1,@partitionNr=1

     

    This is all evaluated and then either the message I received is returned or the tool moves onto some more meaty decisions.

    I analyzed a much more utilized SQL Server instance next to go into how the tool results and lets me decide what to do.  The local databases consisted of 1240 indexes of varying sizes.  The total analysis took an estimated 5 minutes.  Now that in no way can be used as a gauge against how well the tool performs.  This is a first look.  I’ll do deep performance tests of the tool after beta.

    Analysis

    The Index Analysis report grid that is shown is extremely easy to read and quickly identifies highly fragmented indexes.  One thing I would like to see in the RTM is the ability to sort by Database.  Clicking the header does not sort the results this way.  This is another request to allow me, the DBA, to have the ability to restrict this to only the databases I want to analyze.

    I need to check the help documentation but I didn’t see how the page count was being calculated to provide either a low, medium or high level of fragmentation.  Since the page count and calculations look to be internal and without breaking laws to see them, I’m not sure what they are using for numbers.  I’m guessing it will be known though.  Again, this is a first look as I would give it without diving real deep into something.  First impressions are everything!

    Overall First Impression

    I’m hoping Red Gate adds the ability to restrict to only analyzing specific databases on an instance.  If they do that, I think it will add a good feature to the tool.  Overall, I think the new tool does a good job at making it easy to analyze and make a decision on what to defrag for indexes.  You have a simple grid that shows a bar of what is a highly fragmented index and simply check a box to fix it.  I just hope no one falls into an event where they analyze an entire instance and then leave everything checked and defragments them all during high activity times.  The other thing I was unable to determine is if the tool takes advantage of online operations if Enterprise is detected.

    About the Author

    Ted Krueger is a SQL Server MVP and has been working in development and database administration for 13+ years. Specialties range from High Availability and Disaster / Recovery setup and testing methods down to custom assembly development for SQL Server Reporting Services. Ted blogs and is also one of the founders of LessThanDot.com technology community. Some of the articles focused on are Backup / Recovery, Security, SSIS and working on SQL Server and using all of the SQL Server features available to create stable and scalable database services. @onpnt
    Social SitingsTwitterLinkedInLTD RSS Feed
    616 views
    Instapaper

    3 comments

    Comment from: David Forck (thirster42) [Member]
    Seems like the makings of another awesome tool by redgate. here's my first impressions:

    The very first thing that I noticed was that it wouldn’t let me run it as administrator. This is important to me because I have two separate accounts where I work, my every day privileges account and my elevated admin account. My admin account is what I use to connect to sql server so now I have to switch users to run this.

    Definitely don’t like it defaulting to having all indexes selected to fix.

    Clicking on the Fix column heading trying to either select all of them or sort broke the application for me :-D

    Clicking the other column headings do nothing.

    Hitting ctrl-a will select everything, but clicking on a “Fix” button only deselects or selects that specific one. Options to select or deselect all would be nice.

    Clicking Fix Indexes pop up a window, allowing you to let Redgate fix the index or to generate the script and let you run it. Awesome!

    The results don’t keep the list of indexes after closing and reopening the application. It would be nice if it kept the server, database, index name, and when it was fixed so that DBAs could determine how often they’re fixing an index (so they can either schedule the fix or reevaluate the need for the index).

    Fixing an index doesn’t take it off the index analysis list.

    Another nice to have is if it picked up the maintenance plans/jobs that reorg/build indexes.
    12/09/11 @ 09:26
    Daniel KJ Thank you for reviewing the first beta of SQL Index Manager.

    I’m pleased to announce that we have a second beta available. Based on user feedback made a few improvements in this latest version:

    • You can now select an individual database to analyse at a time
    • The index information is now sortable
    • The index fragmentation and size thresholds are now adjustable in the options dialog
    • The last connected to database instance is remembered for next time
    • We’ve fixed a few bugs and given the look and feel a bit more love

    The new version can be downloaded from:

    http://www.red-gate.com/products/dba/sql-index-manager/

    03/30/12 @ 03:08
    Comment from: Ted Krueger (onpnt) [Member]
    Ted Krueger (onpnt) Thanks, Daniel!
    03/30/12 @ 06:31

    Leave a comment


    Your email address will not be revealed on this site.

    Your URL will be displayed.
    (Line breaks become <br />)
    (Name, email & website)
    (Allow users to contact you through a message form (your email will not be revealed.)