Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

The Ultimate Index Usage Reporter

By Jesse Roberge,

*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
Util_IndexUsage
By Jesse Roberge - YeshuaAgapao@Yahoo.com
Update - Fixed existance check for drop

Reports index stats, index size+rows, member seek + include columns as two comma separated output columns, and index usage stats for one or more tables and/or schemas. Flexible parameterized sorting.
Has all the output of Util_ListIndexes plus the usage stats.

Update 2009-01-14:
Added IndexDepth and FillFactor output columns
Added 'Last xxx' datetime columns to the result set
Added @Delimiter parameter for the column listing output (Defaults to ,) for accomodating export to csv files.
Rearranged collumn output to match the pattern in Util_MissingIndexes. Constistant and looks better with the dates.
Removed duplicate output of 'is_unique'

Required Input Parameters
none

Optional
@SchemaName sysname='' Filters schemas. Can use LIKE wildcards. All schemas if blank. Accepts LIKE Wildcards.
@TableName sysname='' Filters tables. Can use LIKE wildcards. All tables if blank. Accepts LIKE Wildcards.
@Sort Tinyint=5 Determines what to sort the results by:
Value Sort Columns
1 Score DESC, user_seeks DESC, user_scans DESC
2 Score ASC, user_seeks ASC, user_scans ASC
3 SchemaName ASC, TableName ASC, IndexName ASC
4 SchemaName ASC, TableName ASC, Score DESC
5 SchemaName ASC, TableName ASC, Score ASC
@Delimiter VarChar(1)=',' Delimiter for the horizontal delimited seek and include column listings.

Usage:
EXECUTE Util_IndexUsage 'dbo', 'order%', 5, '|'

Copyright:
Licensed under the L-GPL - a weak copyleft license - you are permitted to use this as a component of a proprietary database and call this from proprietary software.
Copyleft lets you do anything you want except plagarize, conceal the source, proprietarize modifications, or prohibit copying & re-distribution of this script/proc.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

see <http://www.fsf.org/licensing/licenses/lgpl.html> for the license text.

*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

Total article views: 7461 | Views in the last 30 days: 7
 
Related Articles
FORUM

How to get schemaname, tablename, identity column, foreign key constraints

How to get schemaname, tablename, identity column, foreign key constraints

FORUM

comma delimited name column

comma delimited name column

FORUM

Executing cmd file with isqlw command imbedded, want to change output file delimiter

Analyzer configured with TAB output delimiter want to dynamically change

SCRIPT

The Ultimate Column Searcher

Searches for columns with names containing @Colname that belong to tables with names containing @Tab...

FORUM

T-SQL code to group data into comma delimited column

T-SQL code to group data into comma delimited column

 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones