.code
{
border:1px solid #E1E1E1;
color:#333344;
background:#FAFAFA;
font-family:monospace;
overflow:auto;
font-size:11px;
padding:0.5em;
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap !important;
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}
Tips and scripts relating to database administration. Mainly SQL Server but some MySQL and every now and again something different. Posts are brief and to the point.It's as much a place to make notes for my own use as anything else.
Tuesday, 18 October 2011
CSS For Code Blocks
The code blocks on this blog are formatted using the following CSS.
Wednesday, 5 October 2011
SQL Server 2008 Index Usage
The following code can be used to determine index usage. It may then be possible to drop unnecessary indexes.
SELECT
object_name(s.[object_id]) as [object name]
,i.[name] as [index name]
,user_seeks
,user_scans
,user_lookups
,user_updates
FROM
sys.dm_db_index_usage_stats as s
INNER JOIN sys.indexes as i on i.[object_id] = s.[object_id]
AND i.index_id = s.index_id
WHERE
s.database_id = db_id('dbname')
AND
objectproperty(s.[object_id],'IsUserTable') = 1
AND
s.object_id = object_id('dbo.table_name')
Subscribe to:
Comments (Atom)