<?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>Increase Index Performance &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/increase-index-performance/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>Sun, 02 Oct 2016 19:24:25 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>MySQL: Increase the Performance of CREATE INDEX and DROP INDEX for InnoDB</title>
		<link>https://www.dbrnd.com/2016/10/mysql-increase-the-performance-of-create-index-and-drop-index-for-innodb-merge-index-alter-table-command/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 14 Oct 2016 16:16:04 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[alter]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Increase Index Performance]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[MySQL Command]]></category>
		<category><![CDATA[MySQL Database Administrator]]></category>
		<category><![CDATA[MySQL Database Designing]]></category>
		<category><![CDATA[MySQL Database Programming]]></category>
		<category><![CDATA[MySQL Error]]></category>
		<category><![CDATA[MySQL Performance Tunning]]></category>
		<category><![CDATA[MySQL Query]]></category>
		<category><![CDATA[MySQL Tips and Tricks]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3741</guid>

					<description><![CDATA[In MySQL 5.5 and higher version, Index performance has improved a lot. MySQL InnoDB engine has basically two types of index, Primary clustered index and Secondary indexes. When we are adding or dropping a clustered index, It is copying the data, and creating a new copy of the table. Yes, this is the basic nature [&#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%2Fmysql-increase-the-performance-of-create-index-and-drop-index-for-innodb-merge-index-alter-table-command%2F&amp;linkname=MySQL%3A%20Increase%20the%20Performance%20of%20CREATE%20INDEX%20and%20DROP%20INDEX%20for%20InnoDB" 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%2Fmysql-increase-the-performance-of-create-index-and-drop-index-for-innodb-merge-index-alter-table-command%2F&amp;linkname=MySQL%3A%20Increase%20the%20Performance%20of%20CREATE%20INDEX%20and%20DROP%20INDEX%20for%20InnoDB" 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%2Fmysql-increase-the-performance-of-create-index-and-drop-index-for-innodb-merge-index-alter-table-command%2F&amp;linkname=MySQL%3A%20Increase%20the%20Performance%20of%20CREATE%20INDEX%20and%20DROP%20INDEX%20for%20InnoDB" 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%2Fmysql-increase-the-performance-of-create-index-and-drop-index-for-innodb-merge-index-alter-table-command%2F&amp;linkname=MySQL%3A%20Increase%20the%20Performance%20of%20CREATE%20INDEX%20and%20DROP%20INDEX%20for%20InnoDB" 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%2Fmysql-increase-the-performance-of-create-index-and-drop-index-for-innodb-merge-index-alter-table-command%2F&amp;linkname=MySQL%3A%20Increase%20the%20Performance%20of%20CREATE%20INDEX%20and%20DROP%20INDEX%20for%20InnoDB" 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%2Fmysql-increase-the-performance-of-create-index-and-drop-index-for-innodb-merge-index-alter-table-command%2F&amp;linkname=MySQL%3A%20Increase%20the%20Performance%20of%20CREATE%20INDEX%20and%20DROP%20INDEX%20for%20InnoDB" 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%2Fmysql-increase-the-performance-of-create-index-and-drop-index-for-innodb-merge-index-alter-table-command%2F&#038;title=MySQL%3A%20Increase%20the%20Performance%20of%20CREATE%20INDEX%20and%20DROP%20INDEX%20for%20InnoDB" data-a2a-url="https://www.dbrnd.com/2016/10/mysql-increase-the-performance-of-create-index-and-drop-index-for-innodb-merge-index-alter-table-command/" data-a2a-title="MySQL: Increase the Performance of CREATE INDEX and DROP INDEX for InnoDB"></a></p><p>In MySQL 5.5 and higher version, Index performance has improved a lot.<br />
MySQL InnoDB engine has basically two types of index, Primary clustered index and Secondary indexes. </p>
<blockquote><p>When we are adding or dropping a clustered index, It is copying the data, and creating a new copy of the table.<br />
Yes, this is the basic nature of any clustered index because It also contains the data value. </p></blockquote>
<p><strong>But, what about Secondary Index of MySQL InnoDB ?</strong></p>
<blockquote><p>When we are adding or dropping a secondary index, internally It scans the table, and sorts the rows using memory buffers in order by the values of the secondary index key columns.</p></blockquote>
<blockquote><p>Once a CREATE INDEX or ALTER TABLE statement starts to create InnoDB secondary index, we can only read the table, but cannot update the table. </p></blockquote>
<blockquote><p>Now Imagine, that we have a table with billions of data and now we require to add few more secondary indexes.<br />
I have noticed that, most of the database developers create individual CREATE INDEX statement and execute each for creating require indexes. </p></blockquote>
<blockquote><p>We should not do this way because every CREATE INDEX statement require clustered index scan and other sorting related operation which actually degrade the performance of CREATE or DROP secondary index. </p></blockquote>
<blockquote><p>If we are adding or dropping multiple Indexes at a time, We can increase the performance of CREATE INDEX and DROP INDEX by executing using one single ALTER TABLE command. </p></blockquote>
<blockquote><p>If we are dealing with bulk-insert operation, we should create require indexes after data insertion which increase the performance of bulk-insertion. </p></blockquote>
<p><strong>For you guys, small demonstration to add or drop multiple indexes using one ALTER COMMAND. </strong></p>
<p><strong>Create a sample table:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_Employees 
(
	EmpID INT PRIMARY KEY
	,EmpName VARCHAR(50)    
	,EmpSalary INT
	,EmpGrade CHAR(1)
);</pre> </p>
<p><strong>Insert few sample records:</strong></p>
<pre class="crayon-plain-tag">INSERT INTO tbl_Employees VALUES 
(1,'Anvesh',90000,'A'),(2,'Neevan',120000,'B')
,(3,'Roy',60000,'B'),(4,'Mahi',140000,'A')
,(5,'Martin',50000,'D'),(6,'Eric',80000,'C');</pre> </p>
<p><strong>One ALTER command to add multiple Indexes on Table:</strong></p>
<pre class="crayon-plain-tag">ALTER TABLE tbl_Employees 
ADD INDEX (EmpName), ADD INDEX (EmpGrade);</pre> </p>
<p><strong>One ALTER command to drop multiple Indexes on Table:</strong></p>
<pre class="crayon-plain-tag">ALTER TABLE tbl_Employees 
DROP INDEX EmpName, DROP INDEX EmpGrade;</pre> </p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
