<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Finding Unused Index - MSSQL Query</title>
	<atom:link href="https://mssqlquery.com/tag/finding-unused-index/feed" rel="self" type="application/rss+xml" />
	<link>https://mssqlquery.com</link>
	<description>MSSQL and TSQL Programming and TSQL Examples</description>
	<lastBuildDate>Fri, 07 Apr 2023 19:01:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.3.1</generator>

<image>
	<url>https://mssqlquery.com/wp-content/uploads/2023/06/cropped-mssql-query-icon-32x32.png</url>
	<title>Finding Unused Index - MSSQL Query</title>
	<link>https://mssqlquery.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Finding Unused Index in SQL Server</title>
		<link>https://mssqlquery.com/finding-unused-index-in-sql-server</link>
		
		<dc:creator><![CDATA[Yavuz Selim Kart]]></dc:creator>
		<pubDate>Sun, 27 Feb 2022 21:06:19 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Finding Unused Index]]></category>
		<category><![CDATA[SQL Server Index]]></category>
		<category><![CDATA[Unused Index in SQL Server]]></category>
		<guid isPermaLink="false">https://mssqlquery.com/?p=725</guid>

					<description><![CDATA[<p>Hello everyone, In this article, I will try to give information about finding Unused Index values in SQL Server. In SQL Server you may want to find unused Index values in some cases. You can easily do this by using the script below. SELECT TOP 25 o.name AS ObjectName, i.name&#46;&#46;&#46;</p>
<p>The post <a href="https://mssqlquery.com/finding-unused-index-in-sql-server">Finding Unused Index in SQL Server</a> first appeared on <a href="https://mssqlquery.com">MSSQL Query</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Hello everyone,</p>
<p>In this article, I will try to give information about finding Unused Index values in SQL Server.</p>
<p>In SQL Server you may want to find unused Index values in some cases.</p>
<p>You can easily do this by using the script below.</p>
<pre class="line-numbers"><code class="language-sql">SELECT TOP 25
       o.name AS ObjectName,
       i.name AS IndexName,
       i.index_id AS IndexID,
       dm_ius.user_seeks AS UserSeek,
       dm_ius.user_scans AS UserScans,
       dm_ius.user_lookups AS UserLookups,
       dm_ius.user_updates AS UserUpdates,
       p.TableRows,
       'DROP INDEX ' + QUOTENAME(i.name) + ' ON ' + QUOTENAME(s.name) + '.' + QUOTENAME(OBJECT_NAME(dm_ius.object_id)) AS 'drop statement'
FROM sys.dm_db_index_usage_stats dm_ius
    INNER JOIN sys.indexes i
        ON i.index_id = dm_ius.index_id
           AND dm_ius.object_id = i.object_id
    INNER JOIN sys.objects o
        ON dm_ius.object_id = o.object_id
    INNER JOIN sys.schemas s
        ON o.schema_id = s.schema_id
    INNER JOIN
    (
        SELECT SUM(p.rows) TableRows,
               p.index_id,
               p.object_id
        FROM sys.partitions p
        GROUP BY p.index_id,
                 p.object_id
    ) p
        ON p.index_id = dm_ius.index_id
           AND dm_ius.object_id = p.object_id
WHERE OBJECTPROPERTY(dm_ius.object_id, 'IsUserTable') = 1
      AND dm_ius.database_id = DB_ID()
      AND i.type_desc = 'nonclustered'
      AND i.is_primary_key = 0
      AND i.is_unique_constraint = 0
ORDER BY (dm_ius.user_seeks + dm_ius.user_scans + dm_ius.user_lookups) ASC;</code></pre>
<p><strong>Note:</strong> It goes without saying, please test all the script on your development server and after they pass your test, deploy them on production server.</p>
<p>Good luck to everyone in business and life.</p>
<div class='epvc-post-count'><span class='epvc-eye'></span>  <span class="epvc-count"> 179</span><span class='epvc-label'> Views</span></div><p>The post <a href="https://mssqlquery.com/finding-unused-index-in-sql-server">Finding Unused Index in SQL Server</a> first appeared on <a href="https://mssqlquery.com">MSSQL Query</a>.</p>]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
