<?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>indexes &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/indexes/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Wed, 23 May 2018 19:10:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.5</generator>
	<item>
		<title>SQL Server 2014: Examples of Table Variable with Indexes</title>
		<link>https://www.dbrnd.com/2018/06/sql-server-2014-examples-of-table-variable-with-indexes/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 11 Jun 2018 16:16:29 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[indexes]]></category>
		<category><![CDATA[SQL Programming]]></category>
		<category><![CDATA[sql queries]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[SQL Sever 2014]]></category>
		<category><![CDATA[sqlcode]]></category>
		<category><![CDATA[Table Variable]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=7653</guid>

					<description><![CDATA[I didn&#8217;t explore few features of SQL Server 2014. Recently, I got to know that in SQL Server 2014 we can create indexes on Table Variable. If you look into the differences between Temp Table and Table Variable, always you can find one difference like we can&#8217;t create an index on Table Variable and we [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F06%2Fsql-server-2014-examples-of-table-variable-with-indexes%2F&amp;linkname=SQL%20Server%202014%3A%20Examples%20of%20Table%20Variable%20with%20Indexes" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F06%2Fsql-server-2014-examples-of-table-variable-with-indexes%2F&amp;linkname=SQL%20Server%202014%3A%20Examples%20of%20Table%20Variable%20with%20Indexes" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F06%2Fsql-server-2014-examples-of-table-variable-with-indexes%2F&amp;linkname=SQL%20Server%202014%3A%20Examples%20of%20Table%20Variable%20with%20Indexes" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F06%2Fsql-server-2014-examples-of-table-variable-with-indexes%2F&amp;linkname=SQL%20Server%202014%3A%20Examples%20of%20Table%20Variable%20with%20Indexes" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F06%2Fsql-server-2014-examples-of-table-variable-with-indexes%2F&amp;linkname=SQL%20Server%202014%3A%20Examples%20of%20Table%20Variable%20with%20Indexes" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F06%2Fsql-server-2014-examples-of-table-variable-with-indexes%2F&amp;linkname=SQL%20Server%202014%3A%20Examples%20of%20Table%20Variable%20with%20Indexes" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F06%2Fsql-server-2014-examples-of-table-variable-with-indexes%2F&#038;title=SQL%20Server%202014%3A%20Examples%20of%20Table%20Variable%20with%20Indexes" data-a2a-url="https://www.dbrnd.com/2018/06/sql-server-2014-examples-of-table-variable-with-indexes/" data-a2a-title="SQL Server 2014: Examples of Table Variable with Indexes"></a></p><p>I didn&#8217;t explore few features of SQL Server 2014. Recently, I got to know that in SQL Server 2014 we can create indexes on Table Variable. </p>
<p>If you look into the differences between Temp Table and Table Variable, always you can find one difference like we can&#8217;t create an index on Table Variable and we can create an index on the Temp Table. </p>
<blockquote class="wp-embedded-content" data-secret="oa9njLGXKU"><p><a href="https://www.dbrnd.com/2016/02/sql-server-difference-between-temporary-table-and-table-variable/">SQL Server: Difference between Temporary Table and Table Variable</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/02/sql-server-difference-between-temporary-table-and-table-variable/embed/#?secret=oa9njLGXKU" data-secret="oa9njLGXKU" width="600" height="338" title="&#8220;SQL Server: Difference between Temporary Table and Table Variable&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p>In this post, I am sharing few examples of Table variable with Indexes.<br />
Please check the below samples:</p>
<p><strong>Define Table variable with Primary key and Unique key:</strong></p>
<pre class="crayon-plain-tag">DECLARE @dbrnd TABLE
(
	ID INT PRIMARY KEY
	,Name NVARCHAR(10) UNIQUE
)</pre> </p>
<p><strong>Define Table variable with Non-Clustered index:</strong></p>
<pre class="crayon-plain-tag">DECLARE @dbrnd TABLE
(
	ID INT PRIMARY KEY
	,Name NVARCHAR(20)
	,INDEX idx_dbrnd_Name NONCLUSTERED (Name)
)</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Script to find Unused Indexes of Database</title>
		<link>https://www.dbrnd.com/2018/01/sql-server-script-to-find-unused-indexes-of-database/</link>
					<comments>https://www.dbrnd.com/2018/01/sql-server-script-to-find-unused-indexes-of-database/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Tue, 30 Jan 2018 16:16:30 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[duplicate index]]></category>
		<category><![CDATA[index fragmentation]]></category>
		<category><![CDATA[Index Performance]]></category>
		<category><![CDATA[index usage]]></category>
		<category><![CDATA[indexes]]></category>
		<category><![CDATA[missing index]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<category><![CDATA[unused indexes]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4081</guid>

					<description><![CDATA[As I am preparing important scripts for SQL Server DBA, so here I am also sharing one more vital script for finding the unused indexes of SQL Server Database. The management and maintenance of database index is a day to day exercise for a Database Administrator. The wrong or unused index can create performance issues [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F01%2Fsql-server-script-to-find-unused-indexes-of-database%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20Unused%20Indexes%20of%20Database" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F01%2Fsql-server-script-to-find-unused-indexes-of-database%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20Unused%20Indexes%20of%20Database" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F01%2Fsql-server-script-to-find-unused-indexes-of-database%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20Unused%20Indexes%20of%20Database" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F01%2Fsql-server-script-to-find-unused-indexes-of-database%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20Unused%20Indexes%20of%20Database" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F01%2Fsql-server-script-to-find-unused-indexes-of-database%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20Unused%20Indexes%20of%20Database" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F01%2Fsql-server-script-to-find-unused-indexes-of-database%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20Unused%20Indexes%20of%20Database" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F01%2Fsql-server-script-to-find-unused-indexes-of-database%2F&#038;title=SQL%20Server%3A%20Script%20to%20find%20Unused%20Indexes%20of%20Database" data-a2a-url="https://www.dbrnd.com/2018/01/sql-server-script-to-find-unused-indexes-of-database/" data-a2a-title="SQL Server: Script to find Unused Indexes of Database"></a></p><p>As I am preparing important scripts for SQL Server DBA, so here I am also sharing one more vital script for finding the unused indexes of SQL Server Database.</p>
<blockquote><p>The management and maintenance of database index is a day to day exercise for a Database Administrator. The wrong or unused index can create performance issues for a frequently used table.
</p></blockquote>
<blockquote><p>At every insert and update, the data of an index are also changing, and it requires some IO operations. Better to find the unused index and delete it.<br />
I also added &#8220;DropStatement&#8221; column in script for dropping unused Indexes.</p></blockquote>
<pre class="crayon-plain-tag">SELECT 
	OBJECT_NAME(i.OBJECT_ID) AS ObjectName
	,i.name AS UnusedIndexName	
	,8 * SUM(au.used_pages) AS IndexSizeInKB
	,CASE
		WHEN i.type = 0 THEN 'Heap'  
		WHEN i.type= 1 THEN 'Clustered' 
		WHEN i.type=2 THEN 'Non-Clustered'   
		WHEN i.type=3 THEN 'XML'   
		WHEN i.type=4 THEN 'Spatial'  
		WHEN i.type=5 THEN 'Clustered columnstore index'   
		WHEN i.type=6 THEN 'Nonclustered columnstore index'  
		WHEN i.type=7 THEN 'Nonclustered hash index.'
	END index_type
	,'DROP INDEX ' + i.name + ' ON ' + OBJECT_NAME(i.OBJECT_ID) AS DropStatement
FROM sys.indexes AS i 
LEFT JOIN sys.dm_db_index_usage_stats AS dius 
	ON dius.OBJECT_ID = i.OBJECT_ID 
		AND i.index_id = dius.index_id 
		AND dius.database_id = DB_ID() 
INNER JOIN sys.partitions AS p 
	ON p.OBJECT_ID = i.OBJECT_ID 
		AND p.index_id = i.index_id 
INNER JOIN sys.allocation_units AS au 
	ON au.container_id = p.partition_id 
WHERE OBJECTPROPERTY(i.OBJECT_ID, 'IsIndexable') = 1 
	AND OBJECTPROPERTY(i.OBJECT_ID, 'IsIndexed') = 1 
	AND dius.index_id IS NULL
	OR (dius.user_updates &gt; 0 
		AND dius.user_seeks = 0 
		AND dius.user_scans = 0 
		AND dius.user_lookups = 0)
GROUP BY OBJECT_NAME(i.OBJECT_ID), i.name, i.type 
ORDER BY OBJECT_NAME(i.OBJECT_ID)</pre> </p>
<p><strong>Other SQL Server Index related DBA Scripts:</strong></p>
<blockquote class="wp-embedded-content" data-secret="S1i20bnCFt"><p><a href="https://www.dbrnd.com/2016/11/sql-server-script-to-find-redundant-and-duplicate-indexes/">SQL Server: Script to find Redundant and Duplicate Indexes</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/11/sql-server-script-to-find-redundant-and-duplicate-indexes/embed/#?secret=S1i20bnCFt" data-secret="S1i20bnCFt" width="600" height="338" title="&#8220;SQL Server: Script to find Redundant and Duplicate Indexes&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote class="wp-embedded-content" data-secret="ODjqcfmtkP"><p><a href="https://www.dbrnd.com/2016/03/sql-server-script-to-find-index-average-fragmentation-in-percentage/">SQL Server: Script to find Index Average Fragmentation in Percentage</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/03/sql-server-script-to-find-index-average-fragmentation-in-percentage/embed/#?secret=ODjqcfmtkP" data-secret="ODjqcfmtkP" width="600" height="338" title="&#8220;SQL Server: Script to find Index Average Fragmentation in Percentage&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote class="wp-embedded-content" data-secret="9sUF7xBYiV"><p><a href="https://www.dbrnd.com/2015/11/sql-server-script-to-find-missing-indexes/">SQL Server: Script to find Missing Indexes</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/11/sql-server-script-to-find-missing-indexes/embed/#?secret=9sUF7xBYiV" data-secret="9sUF7xBYiV" width="600" height="338" title="&#8220;SQL Server: Script to find Missing Indexes&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote class="wp-embedded-content" data-secret="LqPIXi45yO"><p><a href="https://www.dbrnd.com/2015/10/sql-server-script-to-find-index-operational-stats/">SQL Server: Script to find Index Operational Stats</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/10/sql-server-script-to-find-index-operational-stats/embed/#?secret=LqPIXi45yO" data-secret="LqPIXi45yO" width="600" height="338" title="&#8220;SQL Server: Script to find Index Operational Stats&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2018/01/sql-server-script-to-find-unused-indexes-of-database/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Server: Filtered Indexes &#8211; Improved the query performance</title>
		<link>https://www.dbrnd.com/2017/01/sql-server-filtered-indexes-improved-the-query-performance/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 04 Jan 2017 19:31:42 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Filtered Index]]></category>
		<category><![CDATA[indexes]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2596</guid>

					<description><![CDATA[SQL Server 2008 introduced the Filtered Indexes. In my current organization, I am taking many interviews of Database Developers and Database Administrators. Most of the people don&#8217;t know about the Filtered Indexes, so here, I would like to share a small note about Filtered Indexes and how it improves the query performance. The Filtered Indexes [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F01%2Fsql-server-filtered-indexes-improved-the-query-performance%2F&amp;linkname=SQL%20Server%3A%20Filtered%20Indexes%20%E2%80%93%20Improved%20the%20query%20performance" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F01%2Fsql-server-filtered-indexes-improved-the-query-performance%2F&amp;linkname=SQL%20Server%3A%20Filtered%20Indexes%20%E2%80%93%20Improved%20the%20query%20performance" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F01%2Fsql-server-filtered-indexes-improved-the-query-performance%2F&amp;linkname=SQL%20Server%3A%20Filtered%20Indexes%20%E2%80%93%20Improved%20the%20query%20performance" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F01%2Fsql-server-filtered-indexes-improved-the-query-performance%2F&amp;linkname=SQL%20Server%3A%20Filtered%20Indexes%20%E2%80%93%20Improved%20the%20query%20performance" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F01%2Fsql-server-filtered-indexes-improved-the-query-performance%2F&amp;linkname=SQL%20Server%3A%20Filtered%20Indexes%20%E2%80%93%20Improved%20the%20query%20performance" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F01%2Fsql-server-filtered-indexes-improved-the-query-performance%2F&amp;linkname=SQL%20Server%3A%20Filtered%20Indexes%20%E2%80%93%20Improved%20the%20query%20performance" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F01%2Fsql-server-filtered-indexes-improved-the-query-performance%2F&#038;title=SQL%20Server%3A%20Filtered%20Indexes%20%E2%80%93%20Improved%20the%20query%20performance" data-a2a-url="https://www.dbrnd.com/2017/01/sql-server-filtered-indexes-improved-the-query-performance/" data-a2a-title="SQL Server: Filtered Indexes – Improved the query performance"></a></p><p><em>SQL Server 2008 introduced the Filtered Indexes.<br />
In my current organization, I am taking many interviews of Database Developers and Database Administrators. </p>
<p>Most of the people don&#8217;t know about the Filtered Indexes, so here, I would like to share a small note about Filtered Indexes and how it improves the query performance. </em></p>
<blockquote><p>
The Filtered Indexes are recommended to create on a well defined subset of data because it is highly optimized non-clustered index. </p></blockquote>
<blockquote><p>You can create a non-clustered with desired filters which improve the query and index performance by storing and manipulating indexes only for a subset of the data.
</p></blockquote>
<blockquote><p>The Filtered Indexes can improve the execution plan quality, can reduce the index maintenance cost, can reduce the storage cost. </p></blockquote>
<blockquote><p>For example, I have one sample Students table which contains millions of data. </p>
<p>If I have only non-clustered index including Gender column and I am selecting records bases on Gender, it scans full index pages to find data for particular Gender. </p>
<p>If I create two separate Filtered Indexes for Male and Female, it scans and uses only one Gender index bases on a filter which improves the query performance. </p></blockquote>
<blockquote><p>Another example is, If your table column is allowing NULL and table has some NULL values, then you can create Filtered Indexes with NOT NULL on that table column which reduce the unnecessary cost to manage NULL values.</p></blockquote>
<blockquote><p>Another example is, There is one process table which contains 0 to 9 different process_id data, but a very less number of records with process_id 0 (10% only) and you need to fetch record for process_id 0. </p>
<p>In this situation, we can create Filtered Index for process_id 0 instead of search all the process_id. </p></blockquote>
<p><strong>Example to create Filtered Indexes: </strong></p>
<p><strong>Create a sample table:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE dbo.tbl_Students
(
	StudID INT IDENTITY(1,1)
	,FirstName VARCHAR(50)
	,LastName VARCHAR(50)
	,Gender CHAR(1)
	,DOB DATETIME
	,CONSTRAINT pk_tbl_Students_StudID PRIMARY KEY(StudID)
)
GO</pre> </p>
<p><strong>Create a Filtered Index for Male &#8211; Gender:</strong></p>
<pre class="crayon-plain-tag">CREATE NONCLUSTERED INDEX idx_tbl_Students_Gender_Male
ON dbo.tbl_Students(Gender)
WHERE Gender = 'M'
GO</pre> </p>
<p><strong>Create a Filtered Index for Femail &#8211; Gender:</strong></p>
<pre class="crayon-plain-tag">CREATE NONCLUSTERED INDEX idx_tbl_Students_Gender_Female
ON dbo.tbl_Students(Gender)
WHERE Gender = 'F'
GO</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PostgreSQL: Which Filter combinations and Operators can be used with Index?</title>
		<link>https://www.dbrnd.com/2016/11/postgresql-which-filter-combinations-and-operators-can-be-used-with-index-find-all-possible-where-clause-filters/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 14 Nov 2016 17:57:42 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Index Filter]]></category>
		<category><![CDATA[Index Operator]]></category>
		<category><![CDATA[Index Valid Filter Combination]]></category>
		<category><![CDATA[indexes]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3855</guid>

					<description><![CDATA[First of all, I found this useful script from PostgreSQL WIKI. For me, this is one of the very useful Index related script to find Which Filter combinations and Operators can be used with PostgreSQL Indexes. I have already shared a couple of articles on PostgreSQL Indexes which you can also access here. Before a [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F11%2Fpostgresql-which-filter-combinations-and-operators-can-be-used-with-index-find-all-possible-where-clause-filters%2F&amp;linkname=PostgreSQL%3A%20Which%20Filter%20combinations%20and%20Operators%20can%20be%20used%20with%20Index%3F" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F11%2Fpostgresql-which-filter-combinations-and-operators-can-be-used-with-index-find-all-possible-where-clause-filters%2F&amp;linkname=PostgreSQL%3A%20Which%20Filter%20combinations%20and%20Operators%20can%20be%20used%20with%20Index%3F" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F11%2Fpostgresql-which-filter-combinations-and-operators-can-be-used-with-index-find-all-possible-where-clause-filters%2F&amp;linkname=PostgreSQL%3A%20Which%20Filter%20combinations%20and%20Operators%20can%20be%20used%20with%20Index%3F" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F11%2Fpostgresql-which-filter-combinations-and-operators-can-be-used-with-index-find-all-possible-where-clause-filters%2F&amp;linkname=PostgreSQL%3A%20Which%20Filter%20combinations%20and%20Operators%20can%20be%20used%20with%20Index%3F" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F11%2Fpostgresql-which-filter-combinations-and-operators-can-be-used-with-index-find-all-possible-where-clause-filters%2F&amp;linkname=PostgreSQL%3A%20Which%20Filter%20combinations%20and%20Operators%20can%20be%20used%20with%20Index%3F" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F11%2Fpostgresql-which-filter-combinations-and-operators-can-be-used-with-index-find-all-possible-where-clause-filters%2F&amp;linkname=PostgreSQL%3A%20Which%20Filter%20combinations%20and%20Operators%20can%20be%20used%20with%20Index%3F" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F11%2Fpostgresql-which-filter-combinations-and-operators-can-be-used-with-index-find-all-possible-where-clause-filters%2F&#038;title=PostgreSQL%3A%20Which%20Filter%20combinations%20and%20Operators%20can%20be%20used%20with%20Index%3F" data-a2a-url="https://www.dbrnd.com/2016/11/postgresql-which-filter-combinations-and-operators-can-be-used-with-index-find-all-possible-where-clause-filters/" data-a2a-title="PostgreSQL: Which Filter combinations and Operators can be used with Index?"></a></p><p>First of all, I found this useful script from PostgreSQL WIKI.</p>
<blockquote><p>For me, this is one of the very useful Index related script to find Which Filter combinations and Operators can be used with PostgreSQL Indexes.<br />
I have already shared a couple of articles on PostgreSQL Indexes which you can also access here.
</p></blockquote>
<p><strong>Before a few days ago, one database developer asked about, How sequence of filter (In WHERE Clause) may affect the Index usage in any RDBMS?</strong></p>
<blockquote><p>My Simple answer was, a sequence of filter is very important for using Indexes and If we put the wrong sequence or we use filter with any function, It might not be used Index properly.
</p></blockquote>
<blockquote><p>Once we applied Indexes on Table, we are also responsible for applying proper filters, parameters, operators on that Table to utilize the maximum use of the Indexes. </p></blockquote>
<blockquote><p>Using below script, you can find all available different combinations of parameters, filters and operators for a specific Index of PostgreSQL.<br />
In this query, Just provide your Index Name and execute it. The DBA can use this script for performance tuning activity.
</p></blockquote>
<pre class="crayon-plain-tag">SELECT
	pg_get_indexdef(ss.indexrelid, (ss.iopc).n, TRUE) AS IndexColumn
	,amop.amopopr::regoperator AS IndexableOperators
FROM pg_opclass opc, pg_amop amop,
(SELECT indexrelid, information_schema._pg_expandarray(indclass) AS iopc
FROM pg_index
WHERE indexrelid = 'Your_Index_Name'::regclass) ss
WHERE amop.amopfamily = opc.opcfamily 
	AND opc.oid = (ss.iopc).x
ORDER BY IndexableOperators;</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Script to find a Table which has more than 10 Indexes</title>
		<link>https://www.dbrnd.com/2016/10/sql-server-script-to-find-a-table-which-has-more-than-10-indexes-improve-performance/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 29 Oct 2016 16:16:17 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[indexes]]></category>
		<category><![CDATA[SQL Developer]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[SYS.INDEXES]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3422</guid>

					<description><![CDATA[In this post, I am sharing one T-SQL script to find a Table which has more than 10 Indexes in SQL Server. More Indexes on a Table, are creating a performance issue because Indexes also require dedicated CPU I/O for writing it into the Index Pages. More Indexes will slow down the insertion or any [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-script-to-find-a-table-which-has-more-than-10-indexes-improve-performance%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20a%20Table%20which%20has%20more%20than%2010%20Indexes" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-script-to-find-a-table-which-has-more-than-10-indexes-improve-performance%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20a%20Table%20which%20has%20more%20than%2010%20Indexes" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-script-to-find-a-table-which-has-more-than-10-indexes-improve-performance%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20a%20Table%20which%20has%20more%20than%2010%20Indexes" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-script-to-find-a-table-which-has-more-than-10-indexes-improve-performance%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20a%20Table%20which%20has%20more%20than%2010%20Indexes" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-script-to-find-a-table-which-has-more-than-10-indexes-improve-performance%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20a%20Table%20which%20has%20more%20than%2010%20Indexes" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-script-to-find-a-table-which-has-more-than-10-indexes-improve-performance%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20a%20Table%20which%20has%20more%20than%2010%20Indexes" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-script-to-find-a-table-which-has-more-than-10-indexes-improve-performance%2F&#038;title=SQL%20Server%3A%20Script%20to%20find%20a%20Table%20which%20has%20more%20than%2010%20Indexes" data-a2a-url="https://www.dbrnd.com/2016/10/sql-server-script-to-find-a-table-which-has-more-than-10-indexes-improve-performance/" data-a2a-title="SQL Server: Script to find a Table which has more than 10 Indexes"></a></p><p>In this post, I am sharing one T-SQL script to find a Table which has more than 10 Indexes in SQL Server. </p>
<blockquote><p>More Indexes on a Table, are creating a performance issue because Indexes also require dedicated CPU I/O for writing it into the Index Pages.<br />
More Indexes will slow down the insertion or any other DML operation of that particular Table. </p></blockquote>
<p><strong>Below is a script to find out tables which are having more indexes:</strong><br />
You can change the value of @threshold.</p>
<pre class="crayon-plain-tag">DECLARE @threshold INT;
SET @threshold = 10;

SELECT
	[s].[name] + '.' + [t].[name] AS TableName
FROM sys.tables AS t
INNER JOIN sys.schemas AS s
	ON [t].[schema_id] = [s].[schema_id]
WHERE EXISTS
(
	SELECT 1 FROM sys.indexes AS i
    WHERE [i].[object_id] = [t].[object_id]
    GROUP BY [i].[object_id]
    HAVING COUNT(*) &gt; @threshold
)
GO</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Database Indexes Interview Questions and Answers (Day-4)</title>
		<link>https://www.dbrnd.com/2016/06/sql-server-database-indexes-interview-questions-and-answers-missing-index-online-index-enable-disable-index-day-4/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 11 Jun 2016 19:18:26 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[disable]]></category>
		<category><![CDATA[enable]]></category>
		<category><![CDATA[heap table]]></category>
		<category><![CDATA[indexes]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[missing index]]></category>
		<category><![CDATA[online index]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2953</guid>

					<description><![CDATA[SQL Server: Script to find Heap Table without having an Index SQL Server: Script to find Index Average Fragmentation in Percentage SQL Server: Script to find Missing Indexes SQL Server: Script to find usage of Database Indexes SQL Server: Script to find Index Operational Stats What is your best practice to perform large-scale Index operations? [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-missing-index-online-index-enable-disable-index-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-4%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-missing-index-online-index-enable-disable-index-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-4%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-missing-index-online-index-enable-disable-index-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-4%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-missing-index-online-index-enable-disable-index-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-4%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-missing-index-online-index-enable-disable-index-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-4%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-missing-index-online-index-enable-disable-index-day-4%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-4%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-missing-index-online-index-enable-disable-index-day-4%2F&#038;title=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-4%29" data-a2a-url="https://www.dbrnd.com/2016/06/sql-server-database-indexes-interview-questions-and-answers-missing-index-online-index-enable-disable-index-day-4/" data-a2a-title="SQL Server: Database Indexes Interview Questions and Answers (Day-4)"></a></p><blockquote class="wp-embedded-content" data-secret="uN8lRznyum"><p><a href="https://www.dbrnd.com/2016/03/sql-server-script-to-find-heap-table-without-index/">SQL Server: Script to find Heap Table without having an Index</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/03/sql-server-script-to-find-heap-table-without-index/embed/#?secret=uN8lRznyum" data-secret="uN8lRznyum" width="600" height="338" title="&#8220;SQL Server: Script to find Heap Table without having an Index&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote class="wp-embedded-content" data-secret="FcpzQ7b47t"><p><a href="https://www.dbrnd.com/2016/03/sql-server-script-to-find-index-average-fragmentation-in-percentage/">SQL Server: Script to find Index Average Fragmentation in Percentage</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/03/sql-server-script-to-find-index-average-fragmentation-in-percentage/embed/#?secret=FcpzQ7b47t" data-secret="FcpzQ7b47t" width="600" height="338" title="&#8220;SQL Server: Script to find Index Average Fragmentation in Percentage&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote class="wp-embedded-content" data-secret="FohiXLtXej"><p><a href="https://www.dbrnd.com/2015/11/sql-server-script-to-find-missing-indexes/">SQL Server: Script to find Missing Indexes</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/11/sql-server-script-to-find-missing-indexes/embed/#?secret=FohiXLtXej" data-secret="FohiXLtXej" width="600" height="338" title="&#8220;SQL Server: Script to find Missing Indexes&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote class="wp-embedded-content" data-secret="9LwtM8z0Sg"><p><a href="https://www.dbrnd.com/2015/10/sql-server-script-to-find-usage-of-database-indexes/">SQL Server: Script to find usage of Database Indexes</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/10/sql-server-script-to-find-usage-of-database-indexes/embed/#?secret=9LwtM8z0Sg" data-secret="9LwtM8z0Sg" width="600" height="338" title="&#8220;SQL Server: Script to find usage of Database Indexes&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote class="wp-embedded-content" data-secret="ENjEBOINfX"><p><a href="https://www.dbrnd.com/2015/10/sql-server-script-to-find-index-operational-stats/">SQL Server: Script to find Index Operational Stats</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/10/sql-server-script-to-find-index-operational-stats/embed/#?secret=ENjEBOINfX" data-secret="ENjEBOINfX" width="600" height="338" title="&#8220;SQL Server: Script to find Index Operational Stats&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>What is your best practice to perform large-scale Index operations?</strong></p>
<blockquote><p>Make sure the transaction log has been backed up and truncated before running large-scale index operations online, and that the log has sufficient space to store the projected index and user transactions.</p>
<p>Consider setting the SORT_IN_TEMPDB option to ON for the index operation. This separates the index transactions from the concurrent user transactions. The index transactions will be stored in the tempdb transaction log, and the concurrent user transactions will be stored in the transaction log of the user database.</p>
<p>This allows for the transaction log of the user database to be truncated during the index operation if it is required.</p></blockquote>
<p><strong>What is Online Indexing?</strong></p>
<blockquote><p>The ONLINE option allows concurrent user access to the underlying table or clustered index data and any associated nonclustered indexes during these index operations.</p>
<p>DBAs can create, rebuild, or drop indexes online. The index operations on the underlying table can be performed concurrently with update or query operations.</p>
<p>The Online indexing feature is very helpful for environments that run 24 hours a day, seven days a week. The Online Indexing feature is available only in the Enterprise Editions.</p></blockquote>
<p><strong>Can we create index on table variables?</strong></p>
<blockquote><p>Creating an index on a table variable can be done implicitly within the declaration of the table variable by defining a primary key and creating unique constraints. The primary key will represent a clustered index, while the unique constraint a non clustered index.</p></blockquote>
<p><strong>What are your best practices to create an Index?</strong></p>
<ul>
<li>Understand the characteristics of the database (OLTP / OLAP).</li>
<li>Keep indexes lean.</li>
<li>Understand the characteristics of the most frequently used columns and queries.</li>
<li>Choose the right index type.</li>
<li>Create the clustered index on every table.</li>
<li>Keep the length of the index key short for clustered indexes.</li>
<li>Columns that are of the ntext, text, image, varchar(max), nvarchar(max), and varbinary(max) data types cannot be specified as index key columns.</li>
<li>Consider using filtered indexes on columns that have well-defined subsets.</li>
<li>Be sure to eliminate duplicate indexes, that is, multiple indexes created on the same set of columns.</li>
<li>Consider the order of the columns if the index will contain multiple columns.</li>
<li>Determine the Fill Factor.</li>
</ul>
<p><strong>How more indexes makes your INSERT slower?</strong></p>
<blockquote><p>The number of indexes on a table is the most dominant factor for insert performance. The more indexes a table has, the slower the execution becomes. The insert statement is the only operation that cannot directly benefit from indexing because it has no where clause.</p>
<p>Adding a new row to a table involves several steps. First, the database must find a place to store the row.</p>
<p>If there are indexes on the table, the database must make sure the new entry is also found via these indexes. For this reason it has to add the new entry to each and every index on that table. The number of indexes is therefore a multiplier for the cost of an insert statement.</p>
<p>Moreover, adding an entry to an index is much more expensive than inserting one into a heap structure because the database has to keep the index order and tree balance. That means the new entry cannot be written to any block—it belongs to a specific leaf node.</p>
<p>Once the correct leaf node has been identified, the database confirms that there is enough free space left in this node. If not, the database splits the leaf node and distributes the entries between the old and a new node.</p></blockquote>
<p><strong>Generally, when you should perform your index tunning exercise?</strong></p>
<blockquote><p>Index tuning isn’t something you do once a year. It’s something that you need to do iteratively– that means every month. Over time, data sizes change, user activity changes, and the SQL Server optimizer changes. Each of these things mean that indexes that are best for an application will also change. As you tune indexes, your query plans will change and you’re very likely to see more opportunities to add, drop, and combine indexes emerge. Because of this, you want to do a few changes every month.</p></blockquote>
<p><strong>Has default Index created on foreign key columns?</strong></p>
<blockquote><p>When a foreign key constraint is defined for a table, an index is not created by default by SQL Server.</p>
<p>However, it&#8217;s not uncommon for developers and database administrators to add them manually.</p>
<p>Indexes on foreign keys can provide performance benefits for table joins involving the primary and foreign key, and they can impact performance when the primary key value is updated, or if the row is deleted.</p></blockquote>
<p><strong>In which columns, you should consider your indexes?</strong></p>
<blockquote><p>Indexes should be considered on all columns that are frequently accessed by the WHERE, ORDER BY, GROUP BY, TOP, and DISTINCT clauses. Without an index, each of these operations will require a table scan of your table, potentially hurting performance.</p></blockquote>
<p><strong>When index needs change and you want to test how removing an index will affect performance, you have two options – you can disable or drop the index. Which is better?</strong></p>
<blockquote><p>DISABLING AN INDEX is better than to drop an Index.</p>
<p>When we Disable an Index, The metadata about the index is retained, as are the usage statistics in sys.dm_db_index_usage_stats.</p>
<p>The index is not usable by the query optimizer.</p>
<p>Disabling a nonclustered index will deallocate the index pages – the space is freed in the database.</p>
<p>Disabling a clustered index has additional effects. The data in the table still exists, but will be inaccessible for anything other than a drop or rebuild operation.</p></blockquote>
<p><strong>T-SQL Script to DISABLE an INDEX?</strong></p><pre class="crayon-plain-tag">ALTER INDEX IX_IndexName ON Schema.TableName DISABLE;</pre><p>
<strong>How you can re-enable the disable index?</strong></p>
<p>If you want to re-enable the index, you need to rebuild it.</p><pre class="crayon-plain-tag">ALTER INDEX IX_IndexName ON Schema.TableName REBUILD;</pre><p>
<strong>As a DBA, share your checklists and best practice for performance tuning of Indexes.</strong></p>
<ul>
<li>Periodically, run the Database Engine Tuning Advisor against current Profiler traces to identify potentially missing indexes.</li>
<li>Remove indexes that are never used.</li>
<li>Don’t accidentally create redundant indexes.</li>
<li>As a rule of thumb, every table should have at least a clustered index. Generally, but not always, the clustered index should be on a column that monotonically increases — such as an identity column, or some other column where the value is increasing — and is unique. In many cases, the primary key is the ideal column for a clustered index.</li>
<li>Since you can only create one clustered index per table, take extra time to carefully consider how it will be used. Consider the type of queries that will be used against the table, and make an educated guess as to which query (the most common one run against the table, perhaps) is the most critical, and if this query will benefit most from having a clustered index.</li>
<li>If a column in a table is not at least 95% unique, then most likely the query optimizer will not use a non-clustered index based on that column. Because of this, you generally don&#8217;t want to add non-clustered indexes to columns that aren&#8217;t at least 95% unique.</li>
<li>Keep the &#8220;width&#8221; of your indexes as narrow as possible. This reduces the size of the index and reduces the number of disk I/O reads required to read the index, boosting performance.</li>
<li>If possible, avoid adding a clustered index to a GUID column (uniqueidentifier data type).</li>
<li>Indexes should be considered on all columns that are frequently accessed by the JOIN, WHERE, ORDER BY, GROUP BY, TOP, and DISTINCT clauses.</li>
<li>Don&#8217;t automatically add indexes on a table because it seems like the right thing to do. Only add indexes if you know that they will be used by queries run against the table.</li>
<li>When creating indexes, try to make them unique indexes if at all possible. SQL Server can often search through a unique index faster than a non-unique index because in a unique index, each row is unique, and once the needed record is found, SQL Server doesn&#8217;t have to look any further.</li>
<li>If you perform regular joins between two or more tables in your queries, performance will be optimized if each of the joined columns have appropriate indexes.</li>
<li>Don’t automatically accept the default value of 100 for the fill factor for your indexes. It may or may not best meet your needs. A high fill factor is good for seldom changed data, but highly modified data needs a lower fill factor to reduce page splitting.</li>
<li>Don&#8217;t over index your OLTP tables, as every index you add increases the time it takes to perform INSERTS, UPDATES, and DELETES. There is a fine line between having the ideal number of indexes (for SELECTs) and the ideal number to minimize the overhead that occurs with indexes during data modifications.</li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Database Indexes Interview Questions and Answers (Day-3)</title>
		<link>https://www.dbrnd.com/2016/06/sql-server-database-indexes-interview-questions-and-answers-unique-filtered-covered-index-scan-seek-day-3/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 10 Jun 2016 16:50:10 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[clustered index]]></category>
		<category><![CDATA[covered index]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Filtered Index]]></category>
		<category><![CDATA[indexes]]></category>
		<category><![CDATA[Interviews]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2950</guid>

					<description><![CDATA[What happened when we create a Primary Key constraint? When you create a PRIMARY KEY constraint, a unique clustered index on the column or columns is automatically created if a clustered index on the table does not already exist and you do not specify a unique nonclustered index. The primary key column cannot allow NULL [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-unique-filtered-covered-index-scan-seek-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-3%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-unique-filtered-covered-index-scan-seek-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-3%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-unique-filtered-covered-index-scan-seek-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-3%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-unique-filtered-covered-index-scan-seek-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-3%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-unique-filtered-covered-index-scan-seek-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-3%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-unique-filtered-covered-index-scan-seek-day-3%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-3%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-unique-filtered-covered-index-scan-seek-day-3%2F&#038;title=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-3%29" data-a2a-url="https://www.dbrnd.com/2016/06/sql-server-database-indexes-interview-questions-and-answers-unique-filtered-covered-index-scan-seek-day-3/" data-a2a-title="SQL Server: Database Indexes Interview Questions and Answers (Day-3)"></a></p><p><strong>What happened when we create a Primary Key constraint?</strong></p>
<blockquote><p>When you create a PRIMARY KEY constraint, a unique clustered index on the column or columns is automatically created if a clustered index on the table does not already exist and you do not specify a unique nonclustered index. The primary key column cannot allow NULL values.</p></blockquote>
<p><strong>What happened when we create a UNIQUE constraint?</strong></p>
<blockquote><p>When you create a UNIQUE constraint, a unique nonclustered index is created to enforce a UNIQUE constraint by default. You can specify a unique clustered index if a clustered index on the table does not already exist.</p></blockquote>
<p><strong>Can you create UNIQUE INDEX on a single column , which has NULL value in more than one row?</strong></p>
<blockquote><p>You cannot create a unique index on a single column if that column contains NULL in more than one row. Similarly, you cannot create a unique index on multiple columns if the combination of columns contains NULL in more than one row. These are treated as duplicate values for indexing purposes.</p></blockquote>
<p><strong>What are the benefits of a Unique Index?</strong></p>
<blockquote><p>Multicolumn unique indexes guarantee that each combination of values in the index key is unique. For example, if a unique index is created on a combination of LastName, FirstName, and MiddleName columns, no two rows in the table could have the same combination of values for these columns.</p>
<p>Provided that the data in each column is unique, you can create both a unique clustered index and multiple unique nonclustered indexes on the same table.</p>
<p>Unique indexes ensure the data integrity of the defined columns.</p>
<p>Unique indexes provide additional information helpful to the query optimizer that can produce more efficient execution plans.</p></blockquote>
<p><strong>When we should consider a Filtered Index in Designing?</strong></p>
<blockquote><p>When a column only has a small number of relevant values for queries, you can create a filtered index on the subset of values. For example, when the values in a column are mostly NULL and the query selects only from the non-NULL values, you can create a filtered index for the non-NULL data rows. The resulting index will be smaller and cost less to maintain than a full-table nonclustered index defined on the same key columns.</p>
<p>When a table has heterogeneous data rows, you can create a filtered index for one or more categories of data. This can improve the performance of queries on these data rows by narrowing the focus of a query to a specific area of the table. Again, the resulting index will be smaller and cost less to maintain than a full-table nonclustered index.</p></blockquote>
<p><strong>What are the benefits of the Filtered Index?</strong></p>
<ul>
<li>Improved query performance and plan quality.</li>
<li>Reduced index maintenance costs.</li>
<li>Reduced index storage costs.</li>
<li>Online index rebuilds.</li>
</ul>
<p><strong>What is the advantage of Covered Index?</strong></p>
<blockquote><p>There can be data types which not allowed as Index key columns called as a nonkey columns.</p>
<p>Using include keyword you can add nonkey columns in the primary index.</p>
<p>An index with nonkey columns can significantly improve query performance when all columns in the query are included in the index either as key or nonkey columns. Performance gains are achieved because the query optimizer can locate all the column values within the index; table or clustered index data is not accessed resulting in fewer disk I/O operations.</p></blockquote>
<p><strong>During an index reorganization operation, if the index spans multiple files, will pages be allowed to migrate between files.</strong></p>
<blockquote><p>No: pages will not migrate between files during an index reorganization.</p></blockquote>
<p><strong>How to make forcefully use an index in a query? Or What table hint needs to be specified to forcefully use an index in a query?</strong></p>
<p>We can specify “Index” table hint in a query to forcefully use an index.</p><pre class="crayon-plain-tag">SELECT Emp_ID, Name FROM tbl_Employee WITH(INDEX(idx_tbl_Employee_Name));</pre><p>
<strong>What kind of data structure is an index?</strong></p>
<blockquote><p>B- trees are the most commonly used data structures for indexes. The reason B- trees are the most popular data structure for indexes is due to the fact that they are time efficient because look-ups, deletions, and insertions can all be done in logarithmic time. And, another major reason B- trees are more commonly used is because the data that is stored inside the B- tree can be sorted.</p></blockquote>
<p><strong>Can you create Indexed Views?</strong></p>
<blockquote><p>The first index created on a view must be a unique clustered index. After the unique clustered index has been created, you can create more nonclustered indexes. Creating a unique clustered index on a view improves query performance because the view is stored in the database in the same way a table with a clustered index is stored. The query optimizer may use indexed views to speed up the query execution.</p></blockquote>
<p><strong>What is an Index Scan and Index Seek operation?</strong></p>
<blockquote class="wp-embedded-content" data-secret="A130fkGdes"><p><a href="https://www.dbrnd.com/2016/04/database-theory-table-scan-vs-index-scan-vs-index-seek/">Database Theory: Table Scan vs Index Scan vs Index Seek</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/04/database-theory-table-scan-vs-index-scan-vs-index-seek/embed/#?secret=A130fkGdes" data-secret="A130fkGdes" width="600" height="338" title="&#8220;Database Theory: Table Scan vs Index Scan vs Index Seek&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>What is a Database Engine Tuning Advisor in the SQL Server?</strong></p>
<blockquote><p>Microsoft SQL Server Database Engine Tuning Advisor helps you select and create an optimal set of indexes, indexed views, and partitions without requiring an expert understanding of the structure of the database or the internals of Microsoft SQL Server.</p>
<p>Database Engine Tuning Advisor analyzes a workload and the physical implementation of one or more databases. A workload is a set of Transact-SQL statements that execute against a database or databases that you want to tune. Database Engine Tuning Advisor uses trace files, trace tables, or Transact-SQL scripts as workload input when tuning databases.</p></blockquote>
<p><strong>How Index partitioning help in improving overall performance?</strong></p>
<blockquote><p>Although partitioned indexes can be implemented independently from their base tables, it generally makes sense to design a partitioned table and then create an index on the table. When you do this, SQL Server automatically partitions the index by using the same partition scheme and partitioning column as the table.</p>
<p>When a table and its indexes are in alignment, SQL Server can switch partitions quickly and efficiently while maintaining the partition structure of both the table and its indexes.</p></blockquote>
<p><strong>What is a Bookmark Lookup operator in SQL Server?</strong></p>
<blockquote><p>The Bookmark Lookup operator uses a bookmark (row ID or clustering key) to look up the corresponding row in the table or clustered index. The Argument column contains the bookmark label used to look up the row in the table or clustered index.</p></blockquote>
<p><strong>Which Index operations do not required additional Disk Space?</strong></p>
<ul>
<li>ALTER INDEX REORGANIZE; however, log space is required.</li>
<li>DROP INDEX when you are dropping a nonclustered index.</li>
<li>DROP INDEX when you are dropping a clustered index offline without specifying the MOVE TO clause and nonclustered indexes do not exist.</li>
<li>CREATE TABLE (PRIMARY KEY or UNIQUE constraints)</li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Database Indexes Interview Questions and Answers (Day-2)</title>
		<link>https://www.dbrnd.com/2016/06/sql-server-database-indexes-interview-questions-and-answers-column-store-index-fill-factor-pad-index-sort_in_tempdb-day-2/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 09 Jun 2016 17:47:29 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[column store index]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Fill Factor]]></category>
		<category><![CDATA[indexes]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[SORT_IN_TEMPDB]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2012]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<category><![CDATA[Unique Index]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2947</guid>

					<description><![CDATA[What is a Columnstore index of SQL Server 2012? A columnstore index is a technology for storing, retrieving and managing data by using a columnar data format, called a columnstore. A columnstore is data that is logically organized as a table with rows and columns, and physically stored in a column-wise data format. Columnstore indexes [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-column-store-index-fill-factor-pad-index-sort_in_tempdb-day-2%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-2%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-column-store-index-fill-factor-pad-index-sort_in_tempdb-day-2%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-2%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-column-store-index-fill-factor-pad-index-sort_in_tempdb-day-2%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-2%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-column-store-index-fill-factor-pad-index-sort_in_tempdb-day-2%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-2%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-column-store-index-fill-factor-pad-index-sort_in_tempdb-day-2%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-2%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-column-store-index-fill-factor-pad-index-sort_in_tempdb-day-2%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-2%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-column-store-index-fill-factor-pad-index-sort_in_tempdb-day-2%2F&#038;title=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-2%29" data-a2a-url="https://www.dbrnd.com/2016/06/sql-server-database-indexes-interview-questions-and-answers-column-store-index-fill-factor-pad-index-sort_in_tempdb-day-2/" data-a2a-title="SQL Server: Database Indexes Interview Questions and Answers (Day-2)"></a></p><p><strong>What is a Columnstore index of SQL Server 2012?</strong></p>
<blockquote><p>A columnstore index is a technology for storing, retrieving and managing data by using a columnar data format, called a columnstore.</p>
<p>A columnstore is data that is logically organized as a table with rows and columns, and physically stored in a column-wise data format.</p>
<p>Columnstore indexes work well for data warehousing workloads that primarily perform bulk loads and read-only queries. Use the columnstore index to achieve up to 10x query performance gains over traditional row-oriented storage, and up to 7x data compression over the uncompressed data size.</p></blockquote>
<p><strong>What are the advantages of Columnstore index?</strong></p>
<blockquote><p>Columns store values from the same domain and commonly have similar values, which results in high compression rates. This minimizes or eliminates IO bottleneck in your system while reducing the memory footprint significantly.</p>
<p>High compression rates improve query performance by using a smaller in-memory footprint. In turn, query performance can improve because SQL Server can perform more query and data operations in-memory.</p>
<p>Batch execution improves query performance, typically 2-4x, by processing multiple rows together.</p>
<p>Queries often select only a few columns from a table, which reduces total I/O from the physical media.</p></blockquote>
<p><strong>When I should use clustered column stored index?</strong></p>
<blockquote><p>Use a clustered columnstore index to store fact tables and large dimension tables for data warehousing workloads. This improves query performance and data compression by up to 10x.</p></blockquote>
<p><strong>When I should use non-clustered column stored index?</strong></p>
<blockquote><p>Use a nonclustered columnstore index to perform analysis in real-time on an OLTP workload.</p></blockquote>
<p><strong>How do I choose between a rowstore index and a columnstore index?</strong></p>
<blockquote><p>Rowstore indexes perform best on queries that seek into the data, searching for a particular value, or for queries on a small range of values. Use rowstore indexes with transactional workloads since they tend to require mostly table seeks instead of table scans.</p>
<p>Columnstore indexes give high performance gains for analytic queries that scan large amounts of data, especially on large tables. Use columnstore indexes on data warehousing and analytics workloads, especially on fact tables, since they tend to require full table scans rather than table seeks.</p></blockquote>
<p><strong>What do you know about the Column store Data compression?</strong></p>
<blockquote><p>Columnstore indexes read compressed data from disk, which means fewer bytes of data need to be read into memory.</p>
<p>Columnstore indexes store data in compressed form in memory which reduces IO by reducing the number of times the same data is read into memory.</p>
<p>Columnstore indexes compress data by columns instead of by rows which achieves high compression rates and reduces the size of the data stored on disk. Each column is compressed and stored independently.</p></blockquote>
<p><strong>What is fill factor and pad index?</strong></p>
<blockquote><p>A fill factor is a specification done during the creation of indexes so that a particular amount of space can be left on a leaf level page to decrease the occurrence of page splits when the data has to be accommodated in the future.</p>
<p>A pad index specifies index padding. When it is set to ON, then the free space percentage per the fill factor specification is applied to the intermediate-level pages of the index. When it is set to OFF, the fill factor is not specified and enough space is left for a maximum size row.</p></blockquote>
<p><strong>What is it unwise to create wide clustered index keys?</strong></p>
<blockquote><p>A clustered index is a good choice for searching over a range of values. After an indexed row is found, the remaining rows being adjacent to it can be found easily. However, using wide keys with clustered indexes is not wise because these keys are also used by the non-clustered indexes for look ups and are also stored in every non-clustered index leaf entry.</p></blockquote>
<p><strong>Explain the &#8216;Fill factor&#8217; concept in Indexes.</strong></p>
<ul>
<li>The fill factor option is provided for smoothening index data storage and performance.</li>
<li>The percentage of space on each leaf level page to be filled with data is determined by the fill factor value when an index is created.</li>
<li>This reserves a percentage of free space for future growth.</li>
<li>This option is provided for fine tuning index data storage and performance.</li>
<li>The fill factor value is a percentage from 1 to 100 and the server-wide default is 0 which means that the leaf-level pages are filled to capacity.</li>
</ul>
<p><strong>How do you maintain a fill factor in existing indexes?</strong></p>
<ul>
<li>Usually the data keeps getting added, deleted, or updated in the table due to which the fill factor is implemented during the index creation itself. Fill factor is not maintained after an index is created.</li>
<li>The changes in the future can be determined only when a new index is created on a table that has an existing data. It is beneficial to set the fill factor then itself.</li>
<li>Maintaining extra space on the data pages obviates the purpose of using the fill factor. The SQL Server would then have to split pages to maintain an amount of free space per the fill factor, on each page.</li>
<li>Thus, when data is added filling up the empty space, an index can be created and the fill factor can be re-specified distribute the data again.</li>
</ul>
<p><strong>Difference between Unique Index vs Unique Constraint.</strong></p>
<blockquote><p>Unique Index and Unique Constraint are the same and achieve same goal. SQL performance is same for both.</p></blockquote>
<p><strong>What are the primary differences between an index reorganization and an index rebuild?</strong></p>
<ul>
<li>Reorganization is an “online” operation by default; a rebuild is an “offline” operation by default</li>
<li>Reorganization only affects the leaf level of an index.</li>
<li>Reorganization swaps data pages in-place by using only the pages already allocated to the index; a rebuild uses new pages/allocations</li>
<li>Reorganization is always a fully-logged operation; a rebuild can be a minimally-logged operation.</li>
<li>Reorganization can be stopped mid-process and all completed work is retained; a rebuild is transactional and must be completed in entirety to keep changes.</li>
</ul>
<p><strong>If you need to REBUILD a non-clustered index that is 10GB in size and have 5GB of free data-file space available with no room to grow the data file(s), how can you accomplish the task?</strong></p>
<blockquote><p>When rebuilding an existing non-clustered index, you typically require free space that is approximately equivalent to 2.2 times the size of the existing index, since during a rebuild operation, the existing index is kept until the rebuilt structure is complete and an additional approximately 20% free space for temporary sorting structures used during the rebuild operation.</p>
<p>In this case, you would require at least an additional 10+ GB of free space for the rebuild operation to succeed, since the index itself is 10GB in size.</p>
<p>Using SORT_IN_TEMPDB would not suffice in this case, since only the temporary sort tables are stored in tempdb in this case, and at least 10 GB of free space would still be required in the database data files.</p></blockquote>
<p><strong>Why most of the DBAs recommended Index Reorganizing instead of Index Rebuilding?</strong></p>
<blockquote><p>Reorganizing an index uses minimal system resources. It defragments the leaf level of clustered and nonclustered indexes on tables and views by physically reordering the leaf-level pages to match the logical, left to right, order of the leaf nodes. Reorganizing also compacts the index pages.</p>
<p>Compaction is based on the existing fill factor value.</p>
<p>Reorganize a index after one or more data loads to achieve query performance benefits as quickly as possible. Reorganizing will initially require additional CPU resources to compress the data, which could slow overall system performance. However, as soon as the data is compressed, query performance can improve.</p></blockquote>
<p><strong>What is SORT_IN_TEMPDB option for Indexes?</strong></p>
<blockquote><p>When you create or rebuild an index, by setting the SORT_IN_TEMPDB option to ON you can direct the SQL Server Database Engine to use tempdb to store the intermediate sort results that are used to build the index.</p>
<p>When SORT_IN_TEMPDB is set to OFF, the default, the sort runs are stored in the destination filegroup.</p></blockquote>
<p><strong>Do you think, INDEX REORGANIZE operation requires additional free disk space?</strong></p>
<blockquote><p>No, INDEX REORGANIZE does not require additional free disk space, but related transaction log is required free space to log the operation information.</p></blockquote>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Database Indexes Interview Questions and Answers (Day-1)</title>
		<link>https://www.dbrnd.com/2016/06/sql-server-database-indexes-interview-questions-and-answers-clustered-non-clustered-hash-filtered-full-text-index-day-1/</link>
					<comments>https://www.dbrnd.com/2016/06/sql-server-database-indexes-interview-questions-and-answers-clustered-non-clustered-hash-filtered-full-text-index-day-1/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 08 Jun 2016 17:45:13 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answer]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[clustered index]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Filtered Index]]></category>
		<category><![CDATA[full text search index]]></category>
		<category><![CDATA[indexes]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[non clustered index]]></category>
		<category><![CDATA[question]]></category>
		<category><![CDATA[spatial index]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2944</guid>

					<description><![CDATA[What is a Clustered Index? Clustered Index stores a key value in the same data or row page. It is attached with data rows. Clustered indexes sort and store the data rows in the table or view based on their key values. For example, each and every book has attached one page number on each [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-clustered-non-clustered-hash-filtered-full-text-index-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-1%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-clustered-non-clustered-hash-filtered-full-text-index-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-1%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-clustered-non-clustered-hash-filtered-full-text-index-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-1%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-clustered-non-clustered-hash-filtered-full-text-index-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-1%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-clustered-non-clustered-hash-filtered-full-text-index-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-1%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-clustered-non-clustered-hash-filtered-full-text-index-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-1%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F06%2Fsql-server-database-indexes-interview-questions-and-answers-clustered-non-clustered-hash-filtered-full-text-index-day-1%2F&#038;title=SQL%20Server%3A%20Database%20Indexes%20Interview%20Questions%20and%20Answers%20%28Day-1%29" data-a2a-url="https://www.dbrnd.com/2016/06/sql-server-database-indexes-interview-questions-and-answers-clustered-non-clustered-hash-filtered-full-text-index-day-1/" data-a2a-title="SQL Server: Database Indexes Interview Questions and Answers (Day-1)"></a></p><p><strong>What is a Clustered Index?</strong></p>
<blockquote><p>Clustered Index stores a key value in the same data or row page. It is attached with data rows.</p>
<p>Clustered indexes sort and store the data rows in the table or view based on their key values.</p>
<p>For example, each and every book has attached one page number on each page so this called clustered index of that book.</p></blockquote>
<p><strong>How many clustered indexes there can be in one table?</strong></p>
<blockquote><p>You can create only one clustered index.</p></blockquote>
<p><strong>What is a Non-clustered Index?</strong></p>
<blockquote><p>Nonclustered indexes have a structure separate from the data rows. A nonclustered index contains the nonclustered index key values and each key value entry has a pointer to the data row that contains the key value.</p>
<p>The pointer from an index row in a nonclustered index to a data row is called a row locator. The structure of the row locator depends on whether the data pages are stored in a heap or a clustered table. For a heap, a row locator is a pointer to the row. For a clustered table, the row locator is the clustered index key.</p>
<p>You can add nonkey columns to the leaf level of the nonclustered index to by-pass existing index key limits, 900 bytes and 16 key columns, and execute fully covered, indexed, queries.</p></blockquote>
<p><strong>Can you make non-clustered indexes as unique index?</strong></p>
<blockquote><p>Yes, you can create unique non-clustered index in which no two rows can have the same value for the index key.</p></blockquote>
<p><strong>What is a Hash Index?</strong></p>
<blockquote><p>With a hash index, data is accessed through an in-memory hash table. Hash indexes consume a fixed amount of memory, which is a function of the bucket count.</p>
<p>hash indexes are used is because hash tables are extremely efficient when it comes to just looking up values. So, queries that compare for equality to a string can retrieve values very fast if they use a hash index.</p></blockquote>
<p><strong>What is the main disadvantage of the Hash Index?</strong></p>
<blockquote><p>Hash tables are not sorted data structures, and there are many types of queries which hash indexes can not even help with.</p>
<p>For instance, suppose you want to find out all of the employees who are less than 40 years old. How could you do that with a hash table index? Well, it’s not possible because a hash table is only good for looking up key value pairs – which means queries that check for equality condition.</p></blockquote>
<p><strong>What is a Unique Index?</strong></p>
<blockquote><p>A unique index ensures that the index key contains no duplicate values and therefore every row in the table or view is in some way unique.</p>
<p>Uniqueness can be a property of both clustered and nonclustered indexes.</p></blockquote>
<p><strong>Why CLUSTERED INDEX is a Special Index in the SQL Server?</strong></p>
<blockquote><p>The clustered index in any table has special uses and significance. This index is the data itself, and it will be used in every nonclustered index in the table. If you are defining a new clustered index or changing a clustered index, SQL Server will need to do IO on every nonclustered index on the table as well.</p></blockquote>
<p><strong>T-SQL Script to create a CLUSTERED INDEX.</strong></p><pre class="crayon-plain-tag">CREATE CLUSTERED INDEX Index_Name ON Schema.TableName(Column);</pre><p>
<strong>T-SQL Script to create a NONCLUSTERED INDEX.</strong></p><pre class="crayon-plain-tag">CREATE NONCLUSTERED INDEX Index_Name ON Schema.TableName(Column);</pre><p>
<strong>T-SQL Script to create a NONCLUSTERED INDEX with covered nonkey columns.</strong></p><pre class="crayon-plain-tag">CREATE NONCLUSTERED INDEX Index_Name ON Schema.TableName(Column) INCLUDE (ColumnA, ColumnB);</pre><p>
<strong>What is a Filtered Index?</strong></p>
<blockquote><p>An optimized nonclustered index, especially suited to cover queries that select from a well-defined subset of data. It uses a filter predicate to index a portion of rows in the table. A well-designed filtered index can improve query performance, reduce index maintenance costs, and reduce index storage costs compared with full-table indexes.</p></blockquote>
<p><strong>What is a Full-text Index?</strong></p>
<blockquote><p>A special type of token-based functional index that is built and maintained by the Microsoft Full-Text Engine for SQL Server. It provides efficient support for sophisticated word searches in character string data.</p></blockquote>
<p><strong>What is a Spatial Index?</strong></p>
<blockquote><p>A spatial index provides the ability to perform certain operations more efficiently on spatial objects (spatial data) in a column of the geometry data type. The spatial index reduces the number of objects on which relatively costly spatial operations need to be applied.</p></blockquote>
<p><strong>What are Covering Indexes and Covered Queries in SQL Server?</strong></p>
<blockquote><p>If all the columns requested in the select list of query, are available in the index, then the query engine doesn&#8217;t have to lookup the table again which can significantly increase the performance of the query. Since all the requested columns are available with in the index, the index is covering the query. So, the query is called a covering query and the index is a covering index.</p>
<p>A clustered index can always cover a query, if the columns in the select list are from the same table.</p></blockquote>
<p><strong>How Indexes are used by the Query Optimizer?</strong></p>
<blockquote><p>Well-designed indexes can reduce disk I/O operations and consume fewer system resources therefore improving query performance. Indexes can be helpful for a variety of queries that contain SELECT, UPDATE, DELETE, or MERGE statements.</p>
<p>When the query optimizer uses an index, it searches the index key columns, finds the storage location of the rows needed by the query and extracts the matching rows from that location. Generally, searching the index is much faster than searching the table because unlike a table, an index frequently contains very few columns per row and the rows are in sorted order.</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/06/sql-server-database-indexes-interview-questions-and-answers-clustered-non-clustered-hash-filtered-full-text-index-day-1/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>PostgreSQL: Script to check a Fillfactor value for Tables and Indexes</title>
		<link>https://www.dbrnd.com/2016/03/postgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes/</link>
					<comments>https://www.dbrnd.com/2016/03/postgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 31 Mar 2016 20:01:44 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[PostgreSQL DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Fillfactor]]></category>
		<category><![CDATA[indexes]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[tables]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2180</guid>

					<description><![CDATA[In this post, I am sharing a script to check a Fillfactor value, for tables or indexes of PostgreSQL Database Server. I have already published importance of Fillfactor in PostgreSQL. When we are working with the large database system, and we set Fillfactor value of multiple objects, sometimes it is required to check the value [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20check%20a%20Fillfactor%20value%20for%20Tables%20and%20Indexes" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20check%20a%20Fillfactor%20value%20for%20Tables%20and%20Indexes" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20check%20a%20Fillfactor%20value%20for%20Tables%20and%20Indexes" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20check%20a%20Fillfactor%20value%20for%20Tables%20and%20Indexes" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20check%20a%20Fillfactor%20value%20for%20Tables%20and%20Indexes" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20check%20a%20Fillfactor%20value%20for%20Tables%20and%20Indexes" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fpostgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes%2F&#038;title=PostgreSQL%3A%20Script%20to%20check%20a%20Fillfactor%20value%20for%20Tables%20and%20Indexes" data-a2a-url="https://www.dbrnd.com/2016/03/postgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes/" data-a2a-title="PostgreSQL: Script to check a Fillfactor value for Tables and Indexes"></a></p><p>In this post, I am sharing a script to check a Fillfactor value, for tables or indexes of PostgreSQL Database Server. </p>
<p><a href="https://www.dbrnd.com/2016/03/postgresql-the-awesome-table-fillfactor-to-speedup-update-and-select-statement/" target="_blank"><strong>I have already published importance of Fillfactor in PostgreSQL. </strong></a></p>
<blockquote><p>When we are working with the large database system, and we set Fillfactor value of multiple objects, sometimes it is required to check the value of current Fillfactor for those objects. </p></blockquote>
<p>I prepared one script with &#8220;reloptions&#8221; column in which you can find &#8220;{fillfactor=value}&#8221; if it is assigned then only otherwise it is NULL. </p>
<pre class="crayon-plain-tag">SELECT 
	pc.relname AS ObjectName 
       ,pc.reloptions AS ObjectOptions
FROM pg_class AS pc
INNER JOIN pg_namespace AS pns 
	ON pns.oid = pc.relnamespace
WHERE pns.nspname = 'public'
	AND pc.relname = 'Table_Name';</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/03/postgresql-script-to-check-a-fillfactor-value-for-tables-and-indexes/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
