<?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>MySQL Performance Tunning &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/mysql-performance-tunning/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>Sat, 01 Apr 2017 18:41:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>MySQL: Simplest way to move your InnoDB table from one Database to another Database</title>
		<link>https://www.dbrnd.com/2017/04/mysql-simplest-way-to-move-your-innodb-table-from-one-database-to-another-database-move-ibd-file-frm-file/</link>
					<comments>https://www.dbrnd.com/2017/04/mysql-simplest-way-to-move-your-innodb-table-from-one-database-to-another-database-move-ibd-file-frm-file/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 02 Apr 2017 16:16:04 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[.frm file]]></category>
		<category><![CDATA[.ibd file]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[InnoDB Move Table]]></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>
		<category><![CDATA[Rename Table]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3767</guid>

					<description><![CDATA[In this post, I am sharing a simple solution to move your InnoDB table from one database to another database in MySQL. Before a few days ago, one of my team members was looking for this solution, and I found that many of Database Administrators do not know about this simple solution. The solution is, [&#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%2F04%2Fmysql-simplest-way-to-move-your-innodb-table-from-one-database-to-another-database-move-ibd-file-frm-file%2F&amp;linkname=MySQL%3A%20Simplest%20way%20to%20move%20your%20InnoDB%20table%20from%20one%20Database%20to%20another%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%2F2017%2F04%2Fmysql-simplest-way-to-move-your-innodb-table-from-one-database-to-another-database-move-ibd-file-frm-file%2F&amp;linkname=MySQL%3A%20Simplest%20way%20to%20move%20your%20InnoDB%20table%20from%20one%20Database%20to%20another%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%2F2017%2F04%2Fmysql-simplest-way-to-move-your-innodb-table-from-one-database-to-another-database-move-ibd-file-frm-file%2F&amp;linkname=MySQL%3A%20Simplest%20way%20to%20move%20your%20InnoDB%20table%20from%20one%20Database%20to%20another%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%2F2017%2F04%2Fmysql-simplest-way-to-move-your-innodb-table-from-one-database-to-another-database-move-ibd-file-frm-file%2F&amp;linkname=MySQL%3A%20Simplest%20way%20to%20move%20your%20InnoDB%20table%20from%20one%20Database%20to%20another%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%2F2017%2F04%2Fmysql-simplest-way-to-move-your-innodb-table-from-one-database-to-another-database-move-ibd-file-frm-file%2F&amp;linkname=MySQL%3A%20Simplest%20way%20to%20move%20your%20InnoDB%20table%20from%20one%20Database%20to%20another%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%2F2017%2F04%2Fmysql-simplest-way-to-move-your-innodb-table-from-one-database-to-another-database-move-ibd-file-frm-file%2F&amp;linkname=MySQL%3A%20Simplest%20way%20to%20move%20your%20InnoDB%20table%20from%20one%20Database%20to%20another%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%2F2017%2F04%2Fmysql-simplest-way-to-move-your-innodb-table-from-one-database-to-another-database-move-ibd-file-frm-file%2F&#038;title=MySQL%3A%20Simplest%20way%20to%20move%20your%20InnoDB%20table%20from%20one%20Database%20to%20another%20Database" data-a2a-url="https://www.dbrnd.com/2017/04/mysql-simplest-way-to-move-your-innodb-table-from-one-database-to-another-database-move-ibd-file-frm-file/" data-a2a-title="MySQL: Simplest way to move your InnoDB table from one Database to another Database"></a></p><p>In this post, I am sharing a simple solution to move your InnoDB table from one database to another database in MySQL.</p>
<blockquote><p>Before a few days ago, one of my team members was looking for this solution, and I found that many of Database Administrators do not know about this simple solution.<br />
The solution is, we have to just rename the table name by specifying a database name. </p></blockquote>
<blockquote><p>The MySQL InnoDB engine has two types of tablespaces, one is a shared table space and second is an individual tablespace for each table.<br />
This solution works for both the types of tablespaces. </p></blockquote>
<p><strong>Important Note:</strong> ibdata1 file or all .ibd file should be in one MySQL Data Directory at the same location.</p>
<p>After this demonstration, you can visit InnoDB Tablespace related articles. </p>
<p><strong>Create TWO Sample Databases:</strong></p>
<pre class="crayon-plain-tag">CREATE DATABASE ABC;
CREATE DATABASE XYZ;</pre> </p>
<p><strong>Create a sample table in database ABC:</strong></p>
<pre class="crayon-plain-tag">USE ABC;

CREATE TABLE tbl_Students
(
	RNO INT 
	,StudName VARCHAR(20)
);

INSERT INTO tbl_Students
VALUES 
(1,'Anvesh'),(2,'Neevan')
,(3,'Jeeny'),(4,'Roy');</pre> </p>
<p><strong>Simplest way to move tbl_Students from database ABC to XYZ:</strong></p>
<pre class="crayon-plain-tag">RENAME TABLE ABC.tbl_Students TO XYZ.tbl_Students;</pre> </p>
<p><strong>Check tbl_Students in XYZ database:</strong></p>
<pre class="crayon-plain-tag">USE XYZ;

SELECT *FROM tbl_Students;
+------+----------+
| RNO  | StudName |
+------+----------+
|    1 | Anvesh   |
|    2 | Neevan   |
|    3 | Jeeny    |
|    4 | Roy      |
+------+----------+</pre> </p>
<blockquote data-secret="2T366N3Jfm" class="wp-embedded-content"><p><a href="https://www.dbrnd.com/2016/09/mysql-why-innodb-engine-stores-all-databases-in-one-file-ibdata1/">MySQL: Why InnoDB Engine stores all databases in one file (ibdata1)?</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/09/mysql-why-innodb-engine-stores-all-databases-in-one-file-ibdata1/embed/#?secret=2T366N3Jfm" data-secret="2T366N3Jfm" width="600" height="338" title="&#8220;MySQL: Why InnoDB Engine stores all databases in one file (ibdata1)?&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote data-secret="BVWsETOBrf" class="wp-embedded-content"><p><a href="https://www.dbrnd.com/2016/09/mysql-the-truth-about-innodb-file-per-table-tablespaces/">MySQL: The Truth about InnoDB File Per Table Tablespaces</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/09/mysql-the-truth-about-innodb-file-per-table-tablespaces/embed/#?secret=BVWsETOBrf" data-secret="BVWsETOBrf" width="600" height="338" title="&#8220;MySQL: The Truth about InnoDB File Per Table Tablespaces&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2017/04/mysql-simplest-way-to-move-your-innodb-table-from-one-database-to-another-database-move-ibd-file-frm-file/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>MySQL: InnoDB Table Compression, How we can Compressed Table?</title>
		<link>https://www.dbrnd.com/2017/04/mysql-innodb-table-compression-how-we-can-compressed-table-using-row_format-compressed/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 01 Apr 2017 16:16:50 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[Barracuda]]></category>
		<category><![CDATA[compression]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[InnoDB Compressed Table]]></category>
		<category><![CDATA[innodb_file_per_table]]></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>
		<category><![CDATA[reduce size]]></category>
		<category><![CDATA[zlib]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3752</guid>

					<description><![CDATA[MySQL InnoDB Engine Table Compression, which reduces the size of database size, reduces the CPU I/O and improve overall throughput time. The compressed data requires the small size of pages, compare to uncompressed data. MySQL implements compression with the help of the well-known zlib library, which implements the LZ77 compression algorithm. This compression algorithm is [&#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%2F04%2Fmysql-innodb-table-compression-how-we-can-compressed-table-using-row_format-compressed%2F&amp;linkname=MySQL%3A%20InnoDB%20Table%20Compression%2C%20How%20we%20can%20Compressed%20Table%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%2F2017%2F04%2Fmysql-innodb-table-compression-how-we-can-compressed-table-using-row_format-compressed%2F&amp;linkname=MySQL%3A%20InnoDB%20Table%20Compression%2C%20How%20we%20can%20Compressed%20Table%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%2F2017%2F04%2Fmysql-innodb-table-compression-how-we-can-compressed-table-using-row_format-compressed%2F&amp;linkname=MySQL%3A%20InnoDB%20Table%20Compression%2C%20How%20we%20can%20Compressed%20Table%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%2F2017%2F04%2Fmysql-innodb-table-compression-how-we-can-compressed-table-using-row_format-compressed%2F&amp;linkname=MySQL%3A%20InnoDB%20Table%20Compression%2C%20How%20we%20can%20Compressed%20Table%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%2F2017%2F04%2Fmysql-innodb-table-compression-how-we-can-compressed-table-using-row_format-compressed%2F&amp;linkname=MySQL%3A%20InnoDB%20Table%20Compression%2C%20How%20we%20can%20Compressed%20Table%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%2F2017%2F04%2Fmysql-innodb-table-compression-how-we-can-compressed-table-using-row_format-compressed%2F&amp;linkname=MySQL%3A%20InnoDB%20Table%20Compression%2C%20How%20we%20can%20Compressed%20Table%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%2F2017%2F04%2Fmysql-innodb-table-compression-how-we-can-compressed-table-using-row_format-compressed%2F&#038;title=MySQL%3A%20InnoDB%20Table%20Compression%2C%20How%20we%20can%20Compressed%20Table%3F" data-a2a-url="https://www.dbrnd.com/2017/04/mysql-innodb-table-compression-how-we-can-compressed-table-using-row_format-compressed/" data-a2a-title="MySQL: InnoDB Table Compression, How we can Compressed Table?"></a></p><p>MySQL InnoDB Engine Table Compression, which reduces the size of database size, reduces the CPU I/O and improve overall throughput time. </p>
<blockquote><p>The compressed data requires the small size of pages, compare to uncompressed data.<br />
MySQL implements compression with the help of the well-known zlib library, which implements the LZ77 compression algorithm. </p></blockquote>
<blockquote><p>This compression algorithm is mature, robust, and efficient in both CPU utilization and in a reduction of data size.
</p></blockquote>
<blockquote><p>Because of compressed data, processors and cache memories increases the speed of execution.<br />
Internally buffer pool fetches the compressed data, uncompressed that data, perform the operation and again write compressed data into Disk. </p></blockquote>
<blockquote><p>The default uncompressed size of InnoDB data pages is 16KB.
</p></blockquote>
<blockquote><p>If innodb_file_per_table variable enable, only we can create compressed table.</p></blockquote>
<blockquote><p>For InnoDB system tablespace, we cannot create compressed table because the single InnoDB ibdata1 file also contains other metadata information which we cannot compress.</p></blockquote>
<p>You can access below articles for more details on InnoDB data files. </p>
<blockquote data-secret="Ssd4fANOAm" class="wp-embedded-content"><p><a href="https://www.dbrnd.com/2016/09/mysql-why-innodb-engine-stores-all-databases-in-one-file-ibdata1/">MySQL: Why InnoDB Engine stores all databases in one file (ibdata1)?</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/09/mysql-why-innodb-engine-stores-all-databases-in-one-file-ibdata1/embed/#?secret=Ssd4fANOAm" data-secret="Ssd4fANOAm" width="600" height="338" title="&#8220;MySQL: Why InnoDB Engine stores all databases in one file (ibdata1)?&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote data-secret="DLuloQYMoV" class="wp-embedded-content"><p><a href="https://www.dbrnd.com/2016/09/mysql-the-truth-about-innodb-file-per-table-tablespaces/">MySQL: The Truth about InnoDB File Per Table Tablespaces</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/09/mysql-the-truth-about-innodb-file-per-table-tablespaces/embed/#?secret=DLuloQYMoV" data-secret="DLuloQYMoV" width="600" height="338" title="&#8220;MySQL: The Truth about InnoDB File Per Table Tablespaces&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote><p>Mostly, we should enable compression for a read-intensive type of application where RAM frequently uses data.<br />
The default uncompressed size of InnoDB data pages is 16KB and Depending on the combination of option values, MySQL uses a page size of 1KB, 2KB, 4KB, 8KB, or 16KB for the tablespace data file (.ibd file).</p></blockquote>
<p><strong>How to create an InnoDB Compressed Table?</strong><br />
First In my.cnf or my.ini, innodb_file_per_table required to enable and innodb_file_format must be set to Barracuda.</p>
<pre class="crayon-plain-tag">SET GLOBAL innodb_file_per_table=1;
SET GLOBAL innodb_file_format=Barracuda;</pre> </p>
<p>We can create a table with an ROW_FORMAT=COMPRESSED option, which set compressed value half of the innodb_page_size variable.<br />
Explicitly, we can also set a KEY_BLOCK_SIZE value to give a hint.<br />
Here, You can check the size of innodb_page_size. (default 16KB)</p>
<pre class="crayon-plain-tag">SHOW VARIABLES LIKE 'innodb_page_size';</pre> </p>
<p><strong>Create Sample InnoDB Compress Table (Set to 8KB):</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_CompressedTable
(
	CID INT PRIMARY KEY
	,CName VARCHAR(50)
)
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=8;</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>MySQL: Script to find Long Running Queries and Transactions</title>
		<link>https://www.dbrnd.com/2017/01/mysql-script-to-find-long-running-queries-and-transactions-information_schema-innodb_trx-processlist-performance_schema/</link>
					<comments>https://www.dbrnd.com/2017/01/mysql-script-to-find-long-running-queries-and-transactions-information_schema-innodb_trx-processlist-performance_schema/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 25 Jan 2017 23:16:31 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[MySQL 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[information_schema.innodb_trx]]></category>
		<category><![CDATA[INFORMATION_SCHEMA.PROCESSLIST]]></category>
		<category><![CDATA[long running query]]></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>
		<category><![CDATA[performance schema]]></category>
		<category><![CDATA[performance_schema.events_statements_history]]></category>
		<category><![CDATA[processlist]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3736</guid>

					<description><![CDATA[Don&#8217;t you think so that finding Long Running Queries are a very common requirement for a Database Administrator? &#8216; Yes, Database Administrators are always looking for a list of Long Running Queries. In this post, I am sharing scripts to find Long Running Queries or Transactions of MySQL Database Server. MySQL DBA can use this [&#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%2Fmysql-script-to-find-long-running-queries-and-transactions-information_schema-innodb_trx-processlist-performance_schema%2F&amp;linkname=MySQL%3A%20Script%20to%20find%20Long%20Running%20Queries%20and%20Transactions" 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%2Fmysql-script-to-find-long-running-queries-and-transactions-information_schema-innodb_trx-processlist-performance_schema%2F&amp;linkname=MySQL%3A%20Script%20to%20find%20Long%20Running%20Queries%20and%20Transactions" 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%2Fmysql-script-to-find-long-running-queries-and-transactions-information_schema-innodb_trx-processlist-performance_schema%2F&amp;linkname=MySQL%3A%20Script%20to%20find%20Long%20Running%20Queries%20and%20Transactions" 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%2Fmysql-script-to-find-long-running-queries-and-transactions-information_schema-innodb_trx-processlist-performance_schema%2F&amp;linkname=MySQL%3A%20Script%20to%20find%20Long%20Running%20Queries%20and%20Transactions" 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%2Fmysql-script-to-find-long-running-queries-and-transactions-information_schema-innodb_trx-processlist-performance_schema%2F&amp;linkname=MySQL%3A%20Script%20to%20find%20Long%20Running%20Queries%20and%20Transactions" 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%2Fmysql-script-to-find-long-running-queries-and-transactions-information_schema-innodb_trx-processlist-performance_schema%2F&amp;linkname=MySQL%3A%20Script%20to%20find%20Long%20Running%20Queries%20and%20Transactions" 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%2Fmysql-script-to-find-long-running-queries-and-transactions-information_schema-innodb_trx-processlist-performance_schema%2F&#038;title=MySQL%3A%20Script%20to%20find%20Long%20Running%20Queries%20and%20Transactions" data-a2a-url="https://www.dbrnd.com/2017/01/mysql-script-to-find-long-running-queries-and-transactions-information_schema-innodb_trx-processlist-performance_schema/" data-a2a-title="MySQL: Script to find Long Running Queries and Transactions"></a></p><p>Don&#8217;t you think so that finding Long Running Queries are a very common requirement for a Database Administrator? &#8216;</p>
<blockquote><p>Yes, Database Administrators are always looking for a list of Long Running Queries. </p></blockquote>
<blockquote><p>In this post, I am sharing scripts to find Long Running Queries or Transactions of MySQL Database Server. </p></blockquote>
<blockquote><p>MySQL DBA can use this script to take necessary steps against the bad and long running queries which increase the overall performance of MySQL Database Server.</p></blockquote>
<p>In below script, I set 59 seconds internal to find long running query since last 59 seconds.<br />
As per your requirement, you can change this value. </p>
<p>Here, You can also visit few related articles.</p>
<blockquote data-secret="AeA5F0w02e" class="wp-embedded-content"><p><a href="https://www.dbrnd.com/2015/11/mysql-how-to-log-general-and-long-running-queries-into-log-table/">MySQL: How to Log General and Long Running Queries into Log Table</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/11/mysql-how-to-log-general-and-long-running-queries-into-log-table/embed/#?secret=AeA5F0w02e" data-secret="AeA5F0w02e" width="600" height="338" title="&#8220;MySQL: How to Log General and Long Running Queries into Log Table&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote data-secret="I52mPLNNBx" class="wp-embedded-content"><p><a href="https://www.dbrnd.com/2016/07/mysql-using-sql-query-profiler-finds-total-execution-time-and-cpu-information-of-the-queries/">MySQL: Using SQL Query Profiler finds total execution time and CPU information of the Queries</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/07/mysql-using-sql-query-profiler-finds-total-execution-time-and-cpu-information-of-the-queries/embed/#?secret=I52mPLNNBx" data-secret="I52mPLNNBx" width="600" height="338" title="&#8220;MySQL: Using SQL Query Profiler finds total execution time and CPU information of the Queries&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>Script without using Performance_schema:</strong></p>
<pre class="crayon-plain-tag">SELECT 
	trx.trx_id
	,trx.trx_started
	,trx.trx_mysql_thread_id
FROM INFORMATION_SCHEMA.INNODB_TRX AS trx
INNER JOIN INFORMATION_SCHEMA.PROCESSLIST AS pl 
	ON trx.trx_mysql_thread_id = pl.id
WHERE trx.trx_started &lt; CURRENT_TIMESTAMP - INTERVAL 59 SECOND
  AND pl.user &lt;&gt; 'system_user';</pre> </p>
<p><strong>Script using Performance_schema:</strong></p>
<pre class="crayon-plain-tag">SELECT 
	pl.id 'PROCESS ID'
	,trx.trx_started
	,esh.event_name 'EVENT NAME'
	,esh.sql_text 'SQL'
FROM information_schema.innodb_trx AS trx
INNER JOIN information_schema.processlist pl 
	ON trx.trx_mysql_thread_id = pl.id
INNER JOIN performance_schema.threads th 
	ON th.processlist_id = trx.trx_mysql_thread_id
INNER JOIN performance_schema.events_statements_history esh 
	ON esh.thread_id = th.thread_id
WHERE trx.trx_started &lt; CURRENT_TIME - INTERVAL 59 SECOND
  AND pl.user &lt;&gt; 'system_user'
ORDER BY esh.EVENT_ID;</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2017/01/mysql-script-to-find-long-running-queries-and-transactions-information_schema-innodb_trx-processlist-performance_schema/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>MySQL: The ARCHIVE Storage Engine, store large amounts of unindexed DATA</title>
		<link>https://www.dbrnd.com/2017/01/mysql-the-archive-storage-engine-store-large-amounts-of-unindexed-data-increase-performance-bulk-insert-update/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 22 Jan 2017 08:08:38 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[ARCHIVE Storage Engine]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Improve Bluk Insertion]]></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>
		<category><![CDATA[Optimize bulk operation]]></category>
		<category><![CDATA[store unindex data]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3774</guid>

					<description><![CDATA[MySQL also supported ARCHIVE Storage Engine which is basically used for storing large amounts of unindexed DATA. It does not support any type of Indexes, Foreign keys, Concurrency Control and Transactions. The performance of ARCHIVE Storage Engine is excellent for storing and supporting billions of data. For any RDBMS system, Bulk Insertion and other Bulk [&#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%2Fmysql-the-archive-storage-engine-store-large-amounts-of-unindexed-data-increase-performance-bulk-insert-update%2F&amp;linkname=MySQL%3A%20The%20ARCHIVE%20Storage%20Engine%2C%20store%20large%20amounts%20of%20unindexed%20DATA" 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%2Fmysql-the-archive-storage-engine-store-large-amounts-of-unindexed-data-increase-performance-bulk-insert-update%2F&amp;linkname=MySQL%3A%20The%20ARCHIVE%20Storage%20Engine%2C%20store%20large%20amounts%20of%20unindexed%20DATA" 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%2Fmysql-the-archive-storage-engine-store-large-amounts-of-unindexed-data-increase-performance-bulk-insert-update%2F&amp;linkname=MySQL%3A%20The%20ARCHIVE%20Storage%20Engine%2C%20store%20large%20amounts%20of%20unindexed%20DATA" 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%2Fmysql-the-archive-storage-engine-store-large-amounts-of-unindexed-data-increase-performance-bulk-insert-update%2F&amp;linkname=MySQL%3A%20The%20ARCHIVE%20Storage%20Engine%2C%20store%20large%20amounts%20of%20unindexed%20DATA" 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%2Fmysql-the-archive-storage-engine-store-large-amounts-of-unindexed-data-increase-performance-bulk-insert-update%2F&amp;linkname=MySQL%3A%20The%20ARCHIVE%20Storage%20Engine%2C%20store%20large%20amounts%20of%20unindexed%20DATA" 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%2Fmysql-the-archive-storage-engine-store-large-amounts-of-unindexed-data-increase-performance-bulk-insert-update%2F&amp;linkname=MySQL%3A%20The%20ARCHIVE%20Storage%20Engine%2C%20store%20large%20amounts%20of%20unindexed%20DATA" 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%2Fmysql-the-archive-storage-engine-store-large-amounts-of-unindexed-data-increase-performance-bulk-insert-update%2F&#038;title=MySQL%3A%20The%20ARCHIVE%20Storage%20Engine%2C%20store%20large%20amounts%20of%20unindexed%20DATA" data-a2a-url="https://www.dbrnd.com/2017/01/mysql-the-archive-storage-engine-store-large-amounts-of-unindexed-data-increase-performance-bulk-insert-update/" data-a2a-title="MySQL: The ARCHIVE Storage Engine, store large amounts of unindexed DATA"></a></p><p>MySQL also supported ARCHIVE Storage Engine which is basically used for storing large amounts of unindexed DATA.<br />
It does not support any type of Indexes, Foreign keys, Concurrency Control and Transactions. </p>
<blockquote><p>The performance of ARCHIVE Storage Engine is excellent for storing and supporting billions of data.<br />
For any RDBMS system, Bulk Insertion and other Bulk Operations are common.<br />
To increase the performance of BULK Operation, DBA can disable the indexes, can remove the constraints, can compress the table. </p></blockquote>
<blockquote><p>But this all are the default settings of the MySQL ARCHIVE Storage Engine.<br />
When you create an ARCHIVE table, the server creates a table format file in the database directory. </p></blockquote>
<blockquote><p>The file begins with the table name and has an .frm extension. The storage engine creates other files, all having names beginning with the table name.<br />
The data file has an extension of .ARZ. And .ARN file may appear during optimization operations.
</p></blockquote>
<blockquote><p>The ARCHIVE engine also uses zlib lossless data compression, so rows are compressed as they are inserted.<br />
We can use OPTIMIZE TABLE to analyze the table and pack it into a smaller format.</p></blockquote>
<p><strong>Create a sample table using ARCHIVE Storage Engine:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_Students
(
	RNO INT NOT NULL
	,StudName VARCHAR(20) NOT NULL
)ENGINE = ARCHIVE ;</pre> </p>
<p><strong>Insert few sample records:</strong></p>
<pre class="crayon-plain-tag">INSERT INTO tbl_Students
VALUES 
(1,'Anvesh'),(2,'Neevan')
,(3,'Jeeny'),(4,'Roy');</pre> </p>
<p><strong>Check the result:</strong></p>
<pre class="crayon-plain-tag">SELECT *FROM tbl_Students;
+------+----------+
| RNO  | StudName |
+------+----------+
|    1 | Anvesh   |
|    2 | Neevan   |
|    3 | Jeeny    |
|    4 | Roy      |
+------+----------+</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>MySQL: CSV Storage Engine, Store Table data into CSV File</title>
		<link>https://www.dbrnd.com/2017/01/mysql-csv-storage-engine-store-table-data-into-csv-file-import-data-export-data-comma-separated-value/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 21 Jan 2017 19:15:36 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[Comma Separated Value]]></category>
		<category><![CDATA[CSV Storage Engine]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[export csv]]></category>
		<category><![CDATA[import csv]]></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>
		<category><![CDATA[store data in csv]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3771</guid>

					<description><![CDATA[One of the most things that I liked about MySQL RDBMS is, It supported different types of Storage Engine for different types of requirement. I have also published one related article, How to import and export CSV data in MySQL. MySQL: Import and Export CSV data with Headers Additionally, MySQL has a wonderful CSV (Comma [&#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%2Fmysql-csv-storage-engine-store-table-data-into-csv-file-import-data-export-data-comma-separated-value%2F&amp;linkname=MySQL%3A%20CSV%20Storage%20Engine%2C%20Store%20Table%20data%20into%20CSV%20File" 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%2Fmysql-csv-storage-engine-store-table-data-into-csv-file-import-data-export-data-comma-separated-value%2F&amp;linkname=MySQL%3A%20CSV%20Storage%20Engine%2C%20Store%20Table%20data%20into%20CSV%20File" 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%2Fmysql-csv-storage-engine-store-table-data-into-csv-file-import-data-export-data-comma-separated-value%2F&amp;linkname=MySQL%3A%20CSV%20Storage%20Engine%2C%20Store%20Table%20data%20into%20CSV%20File" 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%2Fmysql-csv-storage-engine-store-table-data-into-csv-file-import-data-export-data-comma-separated-value%2F&amp;linkname=MySQL%3A%20CSV%20Storage%20Engine%2C%20Store%20Table%20data%20into%20CSV%20File" 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%2Fmysql-csv-storage-engine-store-table-data-into-csv-file-import-data-export-data-comma-separated-value%2F&amp;linkname=MySQL%3A%20CSV%20Storage%20Engine%2C%20Store%20Table%20data%20into%20CSV%20File" 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%2Fmysql-csv-storage-engine-store-table-data-into-csv-file-import-data-export-data-comma-separated-value%2F&amp;linkname=MySQL%3A%20CSV%20Storage%20Engine%2C%20Store%20Table%20data%20into%20CSV%20File" 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%2Fmysql-csv-storage-engine-store-table-data-into-csv-file-import-data-export-data-comma-separated-value%2F&#038;title=MySQL%3A%20CSV%20Storage%20Engine%2C%20Store%20Table%20data%20into%20CSV%20File" data-a2a-url="https://www.dbrnd.com/2017/01/mysql-csv-storage-engine-store-table-data-into-csv-file-import-data-export-data-comma-separated-value/" data-a2a-title="MySQL: CSV Storage Engine, Store Table data into CSV File"></a></p><p>One of the most things that I liked about MySQL RDBMS is, It supported different types of Storage Engine for different types of requirement. </p>
<p>I have also published one related article, How to import and export CSV data in MySQL. </p>
<blockquote class="wp-embedded-content" data-secret="oU7HXZcykq"><p><a href="https://www.dbrnd.com/2015/09/mysql-import-and-export-csv-data-with-headers/">MySQL: Import and Export CSV data with Headers</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/09/mysql-import-and-export-csv-data-with-headers/embed/#?secret=oU7HXZcykq" data-secret="oU7HXZcykq" width="600" height="338" title="&#8220;MySQL: Import and Export CSV data with Headers&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote><p>Additionally, MySQL has a wonderful CSV (Comma Separated Value) storage engine to store table data directly into CSV file. </p></blockquote>
<blockquote><p>When you create any table with CSV storage engine, It creates table_name.frm file and table_name.csv file into /../MySQL/Data/Database directory. </p></blockquote>
<blockquote><p>You can easily open that table_name.csv file and You can also SELECT that CSV table data using MySQL Query Window. </p></blockquote>
<p><strong>Few Important Points:</strong></p>
<blockquote><p>CSV storage engine does not support NULL columns, all columns must be NOT NULL.<br />
CSV storage engine does not support any type of Indexing.<br />
CSV storage engine does not support Table Partitioning. </p></blockquote>
<p><strong>Create a sample table using CSV Stroage Engine:<br />
 </strong></p><pre class="crayon-plain-tag">CREATE TABLE tbl_Students
(
	RNO INT NOT NULL
	,StudName VARCHAR(20) NOT NULL
)ENGINE = CSV;</pre><p> </p>
<p><strong>Insert few records:</strong></p>
<pre class="crayon-plain-tag">INSERT INTO tbl_Students
VALUES 
(1,'Anvesh'),(2,'Neevan')
,(3,'Jeeny'),(4,'Roy');</pre> </p>
<p><strong>Check the result of table and also check .csv file which is created in /../MySQL/Data/Database directory. </strong></p>
<pre class="crayon-plain-tag">SELECT *FROM tbl_Students;
+------+----------+
| RNO  | StudName |
+------+----------+
|    1 | Anvesh   |
|    2 | Neevan   |
|    3 | Jeeny    |
|    4 | Roy      |
+------+----------+</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>MySQL 5.5: How to configure and enable Performance Schema Engine?</title>
		<link>https://www.dbrnd.com/2017/01/mysql-5-5-how-to-configure-and-enable-performance-schema-engine-performance_schema-on/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 20 Jan 2017 19:10:48 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[MySQL 5.5]]></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>
		<category><![CDATA[PERFORMANCE_SCHEMA]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3763</guid>

					<description><![CDATA[In the previous article, I have shared basic about the Performance Schema of MySQL. MySQL 5.5: Introduced PERFORMANCE_SCHEMA storage engine to inspect the performance data In this post, I am sharing basic command and configuration of Performance Schema. Using below command, You can find performance_schema is enabled or disabled. [crayon-6ab560e20310d224077294/] It is enabled by default, [&#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%2Fmysql-5-5-how-to-configure-and-enable-performance-schema-engine-performance_schema-on%2F&amp;linkname=MySQL%205.5%3A%20How%20to%20configure%20and%20enable%20Performance%20Schema%20Engine%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%2F2017%2F01%2Fmysql-5-5-how-to-configure-and-enable-performance-schema-engine-performance_schema-on%2F&amp;linkname=MySQL%205.5%3A%20How%20to%20configure%20and%20enable%20Performance%20Schema%20Engine%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%2F2017%2F01%2Fmysql-5-5-how-to-configure-and-enable-performance-schema-engine-performance_schema-on%2F&amp;linkname=MySQL%205.5%3A%20How%20to%20configure%20and%20enable%20Performance%20Schema%20Engine%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%2F2017%2F01%2Fmysql-5-5-how-to-configure-and-enable-performance-schema-engine-performance_schema-on%2F&amp;linkname=MySQL%205.5%3A%20How%20to%20configure%20and%20enable%20Performance%20Schema%20Engine%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%2F2017%2F01%2Fmysql-5-5-how-to-configure-and-enable-performance-schema-engine-performance_schema-on%2F&amp;linkname=MySQL%205.5%3A%20How%20to%20configure%20and%20enable%20Performance%20Schema%20Engine%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%2F2017%2F01%2Fmysql-5-5-how-to-configure-and-enable-performance-schema-engine-performance_schema-on%2F&amp;linkname=MySQL%205.5%3A%20How%20to%20configure%20and%20enable%20Performance%20Schema%20Engine%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%2F2017%2F01%2Fmysql-5-5-how-to-configure-and-enable-performance-schema-engine-performance_schema-on%2F&#038;title=MySQL%205.5%3A%20How%20to%20configure%20and%20enable%20Performance%20Schema%20Engine%3F" data-a2a-url="https://www.dbrnd.com/2017/01/mysql-5-5-how-to-configure-and-enable-performance-schema-engine-performance_schema-on/" data-a2a-title="MySQL 5.5: How to configure and enable Performance Schema Engine?"></a></p><p>In the previous article, I have shared basic about the Performance Schema of MySQL. </p>
<blockquote class="wp-embedded-content" data-secret="UeRGCz62gU"><p><a href="https://www.dbrnd.com/2017/01/mysql-5-5-introduced-performance_schema-storage-engine-to-inspect-the-performance-data/">MySQL 5.5: Introduced PERFORMANCE_SCHEMA storage engine to inspect the performance data</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2017/01/mysql-5-5-introduced-performance_schema-storage-engine-to-inspect-the-performance-data/embed/#?secret=UeRGCz62gU" data-secret="UeRGCz62gU" width="600" height="338" title="&#8220;MySQL 5.5: Introduced PERFORMANCE_SCHEMA storage engine to inspect the performance data&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p>In this post, I am sharing basic command and configuration of Performance Schema. </p>
<p><strong>Using below command, You can find performance_schema is enabled or disabled.</strong></p>
<pre class="crayon-plain-tag">SHOW VARIABLES LIKE 'performance_schema';
+--------------------+-------+
| Variable_name      | Value |
+--------------------+-------+
| performance_schema | ON    |
+--------------------+-------+</pre> </p>
<p>It is enabled by default, but in the case of any reason if it is not enabled, open your my.cnf or my.ini file and put below parameter value. </p>
<pre class="crayon-plain-tag">[mysqld]
performance_schema=ON</pre> </p>
<p><strong>Now It requires restarting the MySQL service because this server parameter enables at server startup. </strong><br />
Using below query, You can also check MySQL database engine information.</p>
<pre class="crayon-plain-tag">SELECT * 
FROM INFORMATION_SCHEMA.ENGINES;</pre> </p>
<p><strong>After enable, You can use this schema:</strong></p>
<pre class="crayon-plain-tag">USE performance_schema;</pre> </p>
<p><strong>Find out all tables of the Performance Schema:</strong></p>
<pre class="crayon-plain-tag">SHOW TABLES;</pre> </p>
<p><strong>Some of the important tables are: </strong></p>
<pre class="crayon-plain-tag">SELECT * FROM events_waits_current; -- To see what the server is doing at the moment
SELECT * FROM file_instances; --  To get instances of instruments for file I/O operations and their associated files</pre> </p>
<p><strong>Performance schema has also few parameter tables like instruments and staging:</strong></p>
<blockquote><p>The Performance Schema instruments stages, which are steps during the statement-execution process, such as parsing a statement, opening a table, or performing a file sort operation. </p></blockquote>
<blockquote><p>Stages correspond to the thread states displayed by SHOW PROCESSLIST or that are visible in the INFORMATION_SCHEMA.PROCESSLIST table. Stages begin and end when state values change.</p></blockquote>
<p><strong>Performance schema setup_instruments table:</strong></p>
<pre class="crayon-plain-tag">SELECT * FROM setup_instruments 
WHERE NAME RLIKE 'stage/sql/[a-c]';</pre> </p>
<p><strong>Example to enable one of parameter:</strong></p>
<pre class="crayon-plain-tag">UPDATE setup_instruments SET ENABLED = 'YES', TIMED = 'YES'
WHERE NAME = 'stage/sql/altering table';</pre> </p>
<p><strong>Peformance schema setup_consumers table:</strong></p>
<pre class="crayon-plain-tag">SELECT * FROM setup_consumers 
WHERE NAME LIKE '%stages%';</pre> </p>
<p><strong>Example to enable one parameter:</strong></p>
<pre class="crayon-plain-tag">UPDATE setup_consumers SET ENABLED ='YES' 
WHERE NAME = 'events_stages_current';</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>MySQL 5.5: Introduced PERFORMANCE_SCHEMA storage engine to inspect the performance data</title>
		<link>https://www.dbrnd.com/2017/01/mysql-5-5-introduced-performance_schema-storage-engine-to-inspect-the-performance-data/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 19 Jan 2017 19:03:42 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[monitor performance data]]></category>
		<category><![CDATA[MySQL 5.5]]></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>
		<category><![CDATA[PERFORMANCE_SCHEMA]]></category>
		<category><![CDATA[storage engine]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3759</guid>

					<description><![CDATA[Before starting to database performance tuning activities, Database Administrator requires different types of statistics like wait events, connection time, instance information, lock tables. MySQL 5.5 introduced a PERFORMANCE_SCHEMA storage engine to monitor the performance of data and different types of server events. One performance_schema database is created under the PERFORMANCE_SCHEMA storage engine. An INFORMATION_SCHEMA focuses [&#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%2Fmysql-5-5-introduced-performance_schema-storage-engine-to-inspect-the-performance-data%2F&amp;linkname=MySQL%205.5%3A%20Introduced%20PERFORMANCE_SCHEMA%20storage%20engine%20to%20inspect%20the%20performance%20data" 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%2Fmysql-5-5-introduced-performance_schema-storage-engine-to-inspect-the-performance-data%2F&amp;linkname=MySQL%205.5%3A%20Introduced%20PERFORMANCE_SCHEMA%20storage%20engine%20to%20inspect%20the%20performance%20data" 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%2Fmysql-5-5-introduced-performance_schema-storage-engine-to-inspect-the-performance-data%2F&amp;linkname=MySQL%205.5%3A%20Introduced%20PERFORMANCE_SCHEMA%20storage%20engine%20to%20inspect%20the%20performance%20data" 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%2Fmysql-5-5-introduced-performance_schema-storage-engine-to-inspect-the-performance-data%2F&amp;linkname=MySQL%205.5%3A%20Introduced%20PERFORMANCE_SCHEMA%20storage%20engine%20to%20inspect%20the%20performance%20data" 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%2Fmysql-5-5-introduced-performance_schema-storage-engine-to-inspect-the-performance-data%2F&amp;linkname=MySQL%205.5%3A%20Introduced%20PERFORMANCE_SCHEMA%20storage%20engine%20to%20inspect%20the%20performance%20data" 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%2Fmysql-5-5-introduced-performance_schema-storage-engine-to-inspect-the-performance-data%2F&amp;linkname=MySQL%205.5%3A%20Introduced%20PERFORMANCE_SCHEMA%20storage%20engine%20to%20inspect%20the%20performance%20data" 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%2Fmysql-5-5-introduced-performance_schema-storage-engine-to-inspect-the-performance-data%2F&#038;title=MySQL%205.5%3A%20Introduced%20PERFORMANCE_SCHEMA%20storage%20engine%20to%20inspect%20the%20performance%20data" data-a2a-url="https://www.dbrnd.com/2017/01/mysql-5-5-introduced-performance_schema-storage-engine-to-inspect-the-performance-data/" data-a2a-title="MySQL 5.5: Introduced PERFORMANCE_SCHEMA storage engine to inspect the performance data"></a></p><p>Before starting to database performance tuning activities, Database Administrator requires different types of statistics like wait events, connection time, instance information, lock tables.</p>
<blockquote><p>MySQL 5.5 introduced a PERFORMANCE_SCHEMA storage engine to monitor the performance of data and different types of server events.<br />
One performance_schema database is created under the PERFORMANCE_SCHEMA storage engine.</p></blockquote>
<blockquote><p>An INFORMATION_SCHEMA focuses on METADATA information, but PERFORMANCE_SCHEMA primary focuses on MySQL Database Performance related Data.</p></blockquote>
<blockquote><p>The Performance Schema is also collecting different types of MySQL Server event with the related time information.<br />
It stores all collected information in the table so that we can easily access it.</p></blockquote>
<blockquote><p>The Performance Schema events are specific to an instance of MySQL Server and changes are not written to the binary log.</p></blockquote>
<blockquote><p>We can set enable or disable PERFORMANCE_SCHEMA storage engine. Once it enables, it collects and monitors the different performance related event stats.</p></blockquote>
<blockquote><p>The main advantage of Performance Schema is, it never changes the server behaviour and never disturb to Query Planner for making a Query Execution Plan.</p>
<p>The execution of server proceeds normally even if the Performance Schema fails internally.</p></blockquote>
<p><strong>Please visit the next article about, How to configure Performance Schema and basic usage of it. </strong></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>MySQL: How Query Optimizer Read and Update the Index Statistics</title>
		<link>https://www.dbrnd.com/2017/01/mysql-how-query-optimizer-read-and-update-the-index-statistics-using-innodb_stats_on_metadata-information_schema-statistics/</link>
					<comments>https://www.dbrnd.com/2017/01/mysql-how-query-optimizer-read-and-update-the-index-statistics-using-innodb_stats_on_metadata-information_schema-statistics/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 08 Jan 2017 15:29:33 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Index Statistics]]></category>
		<category><![CDATA[INFORMATION_SCHEMA.STATISTICS]]></category>
		<category><![CDATA[innodb_stats_on_metadata]]></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>
		<category><![CDATA[Query Execution Plan]]></category>
		<category><![CDATA[Query Optimizer]]></category>
		<category><![CDATA[Query Planner]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3733</guid>

					<description><![CDATA[For all the RDBMS, Database Statistics are playing the main role to generate an accurate Query Execution Plan. A Database Administrator is also very much responsible to make sure that Database Statistics is updated. MySQL query optimizer is also preparing Query Execution Plan with the help of Statistics Information. The auto-update Statistics configuration is also [&#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%2Fmysql-how-query-optimizer-read-and-update-the-index-statistics-using-innodb_stats_on_metadata-information_schema-statistics%2F&amp;linkname=MySQL%3A%20How%20Query%20Optimizer%20Read%20and%20Update%20the%20Index%20Statistics" 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%2Fmysql-how-query-optimizer-read-and-update-the-index-statistics-using-innodb_stats_on_metadata-information_schema-statistics%2F&amp;linkname=MySQL%3A%20How%20Query%20Optimizer%20Read%20and%20Update%20the%20Index%20Statistics" 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%2Fmysql-how-query-optimizer-read-and-update-the-index-statistics-using-innodb_stats_on_metadata-information_schema-statistics%2F&amp;linkname=MySQL%3A%20How%20Query%20Optimizer%20Read%20and%20Update%20the%20Index%20Statistics" 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%2Fmysql-how-query-optimizer-read-and-update-the-index-statistics-using-innodb_stats_on_metadata-information_schema-statistics%2F&amp;linkname=MySQL%3A%20How%20Query%20Optimizer%20Read%20and%20Update%20the%20Index%20Statistics" 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%2Fmysql-how-query-optimizer-read-and-update-the-index-statistics-using-innodb_stats_on_metadata-information_schema-statistics%2F&amp;linkname=MySQL%3A%20How%20Query%20Optimizer%20Read%20and%20Update%20the%20Index%20Statistics" 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%2Fmysql-how-query-optimizer-read-and-update-the-index-statistics-using-innodb_stats_on_metadata-information_schema-statistics%2F&amp;linkname=MySQL%3A%20How%20Query%20Optimizer%20Read%20and%20Update%20the%20Index%20Statistics" 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%2Fmysql-how-query-optimizer-read-and-update-the-index-statistics-using-innodb_stats_on_metadata-information_schema-statistics%2F&#038;title=MySQL%3A%20How%20Query%20Optimizer%20Read%20and%20Update%20the%20Index%20Statistics" data-a2a-url="https://www.dbrnd.com/2017/01/mysql-how-query-optimizer-read-and-update-the-index-statistics-using-innodb_stats_on_metadata-information_schema-statistics/" data-a2a-title="MySQL: How Query Optimizer Read and Update the Index Statistics"></a></p><p>For all the RDBMS, Database Statistics are playing the main role to generate an accurate Query Execution Plan.<br />
A Database Administrator is also very much responsible to make sure that Database Statistics is updated.</p>
<blockquote><p>MySQL query optimizer is also preparing Query Execution Plan with the help of Statistics Information.<br />
The auto-update Statistics configuration is also very important to keep Statistics updated.</p></blockquote>
<p><strong>How to enable auto-update Statistics for InnoDB engine?</strong></p>
<blockquote><p>We can configure innodb_stats_on_metadata variable to enable auto-update Statistics.</p></blockquote>
<blockquote><p>When this variable is enabled InnoDB updates statistics when metadata statements such as SHOW TABLE STATUS or SHOW INDEX are run, or when accessing the INFORMATION_SCHEMA.TABLES or INFORMATION_SCHEMA.STATISTICS tables.
</p></blockquote>
<p><strong>Check innodb_stats_on_metadata is ON or OFF:</strong></p>
<pre class="crayon-plain-tag">SHOW VARIABLES LIKE 'innodb_stats_on_metadata';</pre> </p>
<p><strong>If innodb_stats_on_metadata is OFF, make it ON:</strong></p>
<pre class="crayon-plain-tag">SET GLOBAL innodb_stats_on_metadata=ON;</pre> </p>
<p>When you perform command like SHOW INDEX, Statisitcs will be update.<br />
Accuracy of statistics is depends on MySQL Server Load.</p>
<pre class="crayon-plain-tag">SHOW INDEXES FROM SchemaName.TableName;</pre> </p>
<p><strong>You can use below query to check the Index Statistics:</strong></p>
<pre class="crayon-plain-tag">SELECT 
    Table_Schema
    ,Table_Name
    ,Non_Unique
    ,Index_Schema
    ,Seq_In_Index
    ,Column_Name
    ,Collation
    ,Cardinality
    ,Index_Type
FROM information_schema.statistics 
WHERE TABLE_SCHEMA='SchemaName';</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2017/01/mysql-how-query-optimizer-read-and-update-the-index-statistics-using-innodb_stats_on_metadata-information_schema-statistics/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>MySQL: The BLACKHOLE Storage Engine, Perform Dummy Insert on Table</title>
		<link>https://www.dbrnd.com/2016/12/mysql-the-blackhole-storage-engine-perform-dummy-insert-on-table-empty-insert/</link>
					<comments>https://www.dbrnd.com/2016/12/mysql-the-blackhole-storage-engine-perform-dummy-insert-on-table-empty-insert/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 24 Dec 2016 13:25:00 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[blackhole storage engine]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[dummy insert]]></category>
		<category><![CDATA[empty set]]></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>
		<category><![CDATA[skip data insert]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3782</guid>

					<description><![CDATA[Have you ever wished that you do not want to insert any data, but want to execute INSERT command ? This is looking like a very strange requirement, but this is possible in MySQL. MySQL has a BLACKHOLE Storage Engine which we can use for the empty or the dummy INSERT on Table. When 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%2F2016%2F12%2Fmysql-the-blackhole-storage-engine-perform-dummy-insert-on-table-empty-insert%2F&amp;linkname=MySQL%3A%20The%20BLACKHOLE%20Storage%20Engine%2C%20Perform%20Dummy%20Insert%20on%20Table" 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%2F12%2Fmysql-the-blackhole-storage-engine-perform-dummy-insert-on-table-empty-insert%2F&amp;linkname=MySQL%3A%20The%20BLACKHOLE%20Storage%20Engine%2C%20Perform%20Dummy%20Insert%20on%20Table" 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%2F12%2Fmysql-the-blackhole-storage-engine-perform-dummy-insert-on-table-empty-insert%2F&amp;linkname=MySQL%3A%20The%20BLACKHOLE%20Storage%20Engine%2C%20Perform%20Dummy%20Insert%20on%20Table" 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%2F12%2Fmysql-the-blackhole-storage-engine-perform-dummy-insert-on-table-empty-insert%2F&amp;linkname=MySQL%3A%20The%20BLACKHOLE%20Storage%20Engine%2C%20Perform%20Dummy%20Insert%20on%20Table" 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%2F12%2Fmysql-the-blackhole-storage-engine-perform-dummy-insert-on-table-empty-insert%2F&amp;linkname=MySQL%3A%20The%20BLACKHOLE%20Storage%20Engine%2C%20Perform%20Dummy%20Insert%20on%20Table" 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%2F12%2Fmysql-the-blackhole-storage-engine-perform-dummy-insert-on-table-empty-insert%2F&amp;linkname=MySQL%3A%20The%20BLACKHOLE%20Storage%20Engine%2C%20Perform%20Dummy%20Insert%20on%20Table" 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%2F12%2Fmysql-the-blackhole-storage-engine-perform-dummy-insert-on-table-empty-insert%2F&#038;title=MySQL%3A%20The%20BLACKHOLE%20Storage%20Engine%2C%20Perform%20Dummy%20Insert%20on%20Table" data-a2a-url="https://www.dbrnd.com/2016/12/mysql-the-blackhole-storage-engine-perform-dummy-insert-on-table-empty-insert/" data-a2a-title="MySQL: The BLACKHOLE Storage Engine, Perform Dummy Insert on Table"></a></p><p><strong>Have you ever wished that you do not want to insert any data, but want to execute INSERT command ?</strong></p>
<p>This is looking like a very strange requirement, but this is possible in MySQL. </p>
<blockquote><p>MySQL has a BLACKHOLE Storage Engine which we can use for the empty or the dummy INSERT on Table.</p></blockquote>
<blockquote><p>When we created a BLACKHOLE table, It creates with only .frm table format file and It has no any other file associated with it. </p></blockquote>
<blockquote><p>When you execute your INSERT on BLACKHOLE Table, It stores only binary log and It does not store any kind of data.</p></blockquote>
<p><strong>When we should use BLACKHOLE Storage Engine?</strong></p>
<blockquote><p>When we require to measure the performance only on the binary logging process. Mostly we require to test binary logging performance for bulk operations. </p></blockquote>
<blockquote><p>When we require to find performance bottlenecks not related to disk-storage.</p></blockquote>
<blockquote><p>When we require slave-side data validation and filtering, we can create a dummy BLACKHOLE table at the master-side which reduces the overall traffic. </p></blockquote>
<p><strong>Check the status of BLACKHOLE Engine:</strong></p>
<pre class="crayon-plain-tag">SHOW ENGINES;</pre> </p>
<p><strong>Create BLACKHOLE table:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_Students
(
    RNO INT NOT NULL
    ,StudName VARCHAR(20) NOT NULL
)ENGINE = BLACKHOLE;</pre> </p>
<p><strong>Try to insert few records:</strong></p>
<pre class="crayon-plain-tag">INSERT INTO tbl_Students
VALUES 
(1,'Anvesh'),(2,'Neevan')
,(3,'Jeeny'),(4,'Roy');</pre> </p>
<p><strong>Check inserted data, which return Empty Set:</strong></p>
<pre class="crayon-plain-tag">SELECT *FROM tbl_Students;
Empty set (0.00 sec)</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/12/mysql-the-blackhole-storage-engine-perform-dummy-insert-on-table-empty-insert/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>MySQL: How to create a SQL Job or Event Scheduler for scheduling the Database Task</title>
		<link>https://www.dbrnd.com/2016/11/mysql-how-to-create-a-sql-job-or-event-scheduler-for-scheduling-the-database-task-to-execute-automatically/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 17 Nov 2016 18:28:12 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Event Scheduler]]></category>
		<category><![CDATA[event_scheduler]]></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>
		<category><![CDATA[Schedule Database Task]]></category>
		<category><![CDATA[SQL Job]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3864</guid>

					<description><![CDATA[In this post, I am sharing one of important and basic article about, How to create a SQL Job or scheduler in the MySQL Database Server. For scheduling the database tasks are very common exercise for all Database Developers and Database Administrators. The SQL Agent is available in SQL Server and The PG Agent is [&#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%2Fmysql-how-to-create-a-sql-job-or-event-scheduler-for-scheduling-the-database-task-to-execute-automatically%2F&amp;linkname=MySQL%3A%20How%20to%20create%20a%20SQL%20Job%20or%20Event%20Scheduler%20for%20scheduling%20the%20Database%20Task" 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%2Fmysql-how-to-create-a-sql-job-or-event-scheduler-for-scheduling-the-database-task-to-execute-automatically%2F&amp;linkname=MySQL%3A%20How%20to%20create%20a%20SQL%20Job%20or%20Event%20Scheduler%20for%20scheduling%20the%20Database%20Task" 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%2Fmysql-how-to-create-a-sql-job-or-event-scheduler-for-scheduling-the-database-task-to-execute-automatically%2F&amp;linkname=MySQL%3A%20How%20to%20create%20a%20SQL%20Job%20or%20Event%20Scheduler%20for%20scheduling%20the%20Database%20Task" 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%2Fmysql-how-to-create-a-sql-job-or-event-scheduler-for-scheduling-the-database-task-to-execute-automatically%2F&amp;linkname=MySQL%3A%20How%20to%20create%20a%20SQL%20Job%20or%20Event%20Scheduler%20for%20scheduling%20the%20Database%20Task" 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%2Fmysql-how-to-create-a-sql-job-or-event-scheduler-for-scheduling-the-database-task-to-execute-automatically%2F&amp;linkname=MySQL%3A%20How%20to%20create%20a%20SQL%20Job%20or%20Event%20Scheduler%20for%20scheduling%20the%20Database%20Task" 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%2Fmysql-how-to-create-a-sql-job-or-event-scheduler-for-scheduling-the-database-task-to-execute-automatically%2F&amp;linkname=MySQL%3A%20How%20to%20create%20a%20SQL%20Job%20or%20Event%20Scheduler%20for%20scheduling%20the%20Database%20Task" 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%2Fmysql-how-to-create-a-sql-job-or-event-scheduler-for-scheduling-the-database-task-to-execute-automatically%2F&#038;title=MySQL%3A%20How%20to%20create%20a%20SQL%20Job%20or%20Event%20Scheduler%20for%20scheduling%20the%20Database%20Task" data-a2a-url="https://www.dbrnd.com/2016/11/mysql-how-to-create-a-sql-job-or-event-scheduler-for-scheduling-the-database-task-to-execute-automatically/" data-a2a-title="MySQL: How to create a SQL Job or Event Scheduler for scheduling the Database Task"></a></p><p>In this post, I am sharing one of important and basic article about, How to create a SQL Job or scheduler in the MySQL Database Server.</p>
<blockquote><p>For scheduling the database tasks are very common exercise for all Database Developers and Database Administrators.</p></blockquote>
<p>The SQL Agent is available in SQL Server and The PG Agent is available in PostgreSQL.<img loading="lazy" decoding="async" class="wp-image-3867 size-medium alignright" title="mysql event scheduler sql job" src="https://www.dbrnd.com/wp-content/uploads/2016/11/MySQLEventSchedulerSQLJob-300x300.png" alt="mysqleventschedulersqljob" width="300" height="300" /></p>
<blockquote><p>If you want to schedule your database task in MySQL, You should use default Event Scheduler of MySQL Database Server.</p></blockquote>
<blockquote><p>You can define event using CREATE EVENT statement and It requires the EVENT privilege for the schema in which the event is to be created.</p></blockquote>
<blockquote><p>It might also require the SUPER privilege.</p></blockquote>
<p>You can access below full demonstration step by step.</p>
<p><strong>Create a sample table:<br />
</strong><br />
<pre class="crayon-plain-tag">CREATE TABLE tbl_Students 
(
	StudID INT 
    ,StudName VARCHAR(50)
);</pre>
<strong>Check the status of Event Variable:<br />
</strong><br />
<pre class="crayon-plain-tag">SET GLOBAL event_scheduler = ON;</pre>
<strong>If it is not enabled, enable it:</strong><br />
<pre class="crayon-plain-tag">SET GLOBAL event_scheduler = ON;</pre>
<strong>Check the running processes:</strong><br />
<pre class="crayon-plain-tag">SHOW PROCESSLIST;
-- event_scheduler User is running under command "Daemon"</pre>
<strong>Create an event to insert in tbl_Students at every minute:<br />
</strong><br />
<pre class="crayon-plain-tag">CREATE EVENT Eve_tbl_Students_Temp_Insert
ON SCHEDULE EVERY 1 MINUTE
DO
  INSERT INTO tbl_Students 
  VALUES (1,'Anvesh');</pre>
<strong>Create one more event to test the Delete operation:<br />
</strong><br />
<pre class="crayon-plain-tag">CREATE EVENT Eve_tbl_Students_Temp_Delete
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 MINUTE
DO
  DELETE FROM tbl_Students;</pre>
<strong>You can also alter the created events:<br />
</strong><br />
<pre class="crayon-plain-tag">ALTER EVENT Eve_tbl_Students_Temp_Insert ON SCHEDULE EVERY 2 MINUTE;</pre>
<strong>You can also disable the events:</strong><br />
<pre class="crayon-plain-tag">ALTER EVENT Eve_tbl_Students_Temp_Insert DISABLE; 
ALTER EVENT Eve_tbl_Students_Temp_Delete DISABLE;</pre>
<strong>You can also drop the events:</strong><br />
<pre class="crayon-plain-tag">DROP EVENT Eve_tbl_Students_Temp_Insert;
DROP EVENT Eve_tbl_Students_Temp_Delete;</pre>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
