<?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 Blog &#187; tools</title>
	<atom:link href="http://www.mysqlperformanceblog.com/category/tools/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com</link>
	<description>Everything about MySQL Performance</description>
	<lastBuildDate>Sat, 21 Nov 2009 03:11:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Tokyo Tyrant -The Extras Part III : Write Bottleneck</title>
		<link>http://www.mysqlperformanceblog.com/2009/11/12/tokyo-tyrant-%e2%80%93-the-extras-part-iii-write-bottleneck/</link>
		<comments>http://www.mysqlperformanceblog.com/2009/11/12/tokyo-tyrant-%e2%80%93-the-extras-part-iii-write-bottleneck/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 14:00:39 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[NOSQL]]></category>
		<category><![CDATA[benchmarks]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=1669</guid>
		<description><![CDATA[This is part 3 of my Tyrant extra&#8217;s, part 1 focused on durability, part 2 focused on the perceived performance wall.
#3.  Tokyo Cabinet Can have only a single writer thread, bottlenecking performance
When writing an application using Tokyo Cabinet only one connection can be opened as a “writer”  while the rest are readers.  Tyrant allows for [...]]]></description>
			<content:encoded><![CDATA[<p>This is part 3 of my Tyrant extra&#8217;s, part 1 focused on durability, part 2 focused on the perceived performance wall.</p>
<p>#3.  Tokyo Cabinet Can have only a single writer thread, bottlenecking performance</p>
<p>When writing an application using Tokyo Cabinet only one connection can be opened as a “writer”  while the rest are readers.  Tyrant allows for multiple “writes”  to be sent in from multiple applications but it still single threads them when writing out to disk.   If you run several threads all just inserting into Tyrant your will see tyrant hit 100% Cpu on 1 core, and your writes will start to peter out quickly.</p>
<p><img class="aligncenter size-full wp-image-1670" title="Single Threaded Writes" src="http://www.mysqlperformanceblog.com/wp-content/uploads/2009/11/TC_PART_2_html_m5c0e618c.gif" alt="Single Threaded Writes" width="676" height="276" /></p>
<p>In my tests when I was not disk bound (FS Cache writes) I was able to complete 4Million inserts in a little over 91 seconds using 8 threads.  I actually averaged 43896.98 inserts per second during my 8 thread test.  Moving to 10 threads doing the same 4Million inserts I completed the test in 96 seconds and averaged 41649.42 inserts per second.    Compare this to 4 Million rows using 4 threads which averaged  40933.86 and you start to see that around 40K inserts per second is the most this particular server is capable of ( single threaded ).  Hopefully this is something that maybe able to be fixed internally in the near future.  Until then you may consider breaking up your data into multiple tables each with there own cache.  This limit is per TC DB so this should work.  I had an idea about using the memcached client to distribute the data accross multiple TC database files in the back end.  This should work, I just need to test it <img src='http://www.mysqlperformanceblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Ever notice how as my multi-part posts go on they get shorter and shorter:)  This will be the last Tyrant related post for a little bit.  The 4th &amp; 5th posts were supposed to deal with replication and scaling&#8230; this may take a little while.  Thanks for reading!</p>
    <hr noshade style="margin:0;height:1px" />
    <p>Entry posted by matt |
      <a href="http://www.mysqlperformanceblog.com/2009/11/12/tokyo-tyrant-%e2%80%93-the-extras-part-iii-write-bottleneck/#comments">3 comments</a></p>
    <p>Add to: <a href="http://del.icio.us/post?url=http://www.mysqlperformanceblog.com/2009/11/12/tokyo-tyrant-%e2%80%93-the-extras-part-iii-write-bottleneck/&amp;title=Tokyo Tyrant -The Extras Part III : Write Bottleneck" title="Bookmark this post on del.icio.us"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/delicious.png" alt="delicious" /></a> | <a href="http://digg.com/submit?phase=2&amp;url=http://www.mysqlperformanceblog.com/2009/11/12/tokyo-tyrant-%e2%80%93-the-extras-part-iii-write-bottleneck/&amp;title=Tokyo Tyrant -The Extras Part III : Write Bottleneck" title="Digg this post on Digg.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/digg.png" alt="digg" /></a> | <a href="http://reddit.com/submit?url=http://www.mysqlperformanceblog.com/2009/11/12/tokyo-tyrant-%e2%80%93-the-extras-part-iii-write-bottleneck/&amp;title=Tokyo Tyrant -The Extras Part III : Write Bottleneck" title="Submit this post on reddit.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/reddit.png" alt="reddit" /></a> | <a href="http://www.netscape.com/submit/?U=http://www.mysqlperformanceblog.com/2009/11/12/tokyo-tyrant-%e2%80%93-the-extras-part-iii-write-bottleneck/&amp;T=Tokyo Tyrant -The Extras Part III : Write Bottleneck" title="Vote for this article on Netscape"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/netscape.gif" alt="netscape" /></a> | <a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mysqlperformanceblog.com/2009/11/12/tokyo-tyrant-%e2%80%93-the-extras-part-iii-write-bottleneck/&amp;title=Tokyo Tyrant -The Extras Part III : Write Bottleneck" title="Add to Google Bookmarks"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/google.png" alt="Google Bookmarks" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlperformanceblog.com/2009/11/12/tokyo-tyrant-%e2%80%93-the-extras-part-iii-write-bottleneck/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Tokyo Tyrant &#8211; The Extras Part II :  The Performance Wall</title>
		<link>http://www.mysqlperformanceblog.com/2009/11/11/tokyo-tyrant-the-extras-part-ii-the-performance-wall/</link>
		<comments>http://www.mysqlperformanceblog.com/2009/11/11/tokyo-tyrant-the-extras-part-ii-the-performance-wall/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 15:00:41 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[NOSQL]]></category>
		<category><![CDATA[benchmarks]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=1662</guid>
		<description><![CDATA[Continuing my look at Tokyo Tyrant/Cabinet and addressing some of the concerns I have seen people have brought up this is post #2.
#2.  As your data grows does  Tokyo Cabinet slow down?
Yes your performance can degrade. One obvious performance decrease with a larger dataset  is you start to increase the likelihood that your data no [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing my look at Tokyo Tyrant/Cabinet and addressing some of the concerns I have seen people have brought up this is post #2.</p>
<p>#2.  As your data grows does  Tokyo Cabinet slow down?</p>
<p>Yes your performance can degrade. One obvious performance decrease with a larger dataset  is you start to increase the likelihood that your data no longer fits into memory.  This decreases the number of memory operations and trades them for more expensive disk based operations.    As fast as any application is, as you read off disk opposed to memory performance is going to drop off substantially.  One of the more difficult things to test with Tyrant is disk bound performance.  The FS Cache can make Tyrant seem like small amounts of memory will still make it scream.  Once your data set is larger then that, people start to claim they hit the performance “wall”.</p>
<p>In order to help test this I went ahead an mounted the FS with my data files with the sync option which effectively disables the FS cache.  This should help show the real performance of the hash engine.  Here performance dips substantially, as expected :</p>
<p><img class="aligncenter size-full wp-image-1663" title="FS Mounted As Sync" src="http://www.mysqlperformanceblog.com/wp-content/uploads/2009/11/TC_PART_2_html_144b51c.gif" alt="FS Mounted As Sync" width="610" height="332" /></p>
<p>Look at the IO rate:<br />
NoSync:  31 MB/s<br />
Sync:  3.2 MB/s</p>
<p>As one would expect the IO goes crazy when the drive is mounted with the sync option hitting 99% IO wait.  The interesting this here is we are actually bottlenecking on writes and not reads.  You see without the FS cache to buffer the writes when we need to remove data from memory we now have to rely on the internal Tyrant cache and when that is exhausted have to then really write to disk not the FS Cache.  Now Tyrant starts to take on the same characteristics as your classic DB, the bigger the buffer pool the faster the performance:</p>
<p><img class="aligncenter size-full wp-image-1664" title="Difference Memory Sizes for Tyrant" src="http://www.mysqlperformanceblog.com/wp-content/uploads/2009/11/TC_PART_2_html_1bdc78f4.gif" alt="Difference Memory Sizes for Tyrant" width="585" height="372" /><br />
Even here the performance drop-off once you exhaust memory is relative.  The focus here should be the drop off versus other solutions with the same configuration, not the drop off versus a completely cached version.  In this case ask yourself given similar datasets and similar memory requirements what is the performance?  Take the above sync test, when I use 256M of memory and run my test with writes going directly to disk I hit 964 TPS, in previous MySQL tests the same setup (256M BP) netted ~160 TPS.  So 5x improvement all things being equal.  Of course this is a far drop off from the 13K I was getting when everything was effectively in the file system cache or in memory, but 5x is still a very solid improvement.</p>
<p>Next up is looking at Tyrant&#8217;s and Cabinet&#8217;s write bottleneck.</p>
    <hr noshade style="margin:0;height:1px" />
    <p>Entry posted by matt |
      <a href="http://www.mysqlperformanceblog.com/2009/11/11/tokyo-tyrant-the-extras-part-ii-the-performance-wall/#comments">3 comments</a></p>
    <p>Add to: <a href="http://del.icio.us/post?url=http://www.mysqlperformanceblog.com/2009/11/11/tokyo-tyrant-the-extras-part-ii-the-performance-wall/&amp;title=Tokyo Tyrant &#8211; The Extras Part II :  The Performance Wall" title="Bookmark this post on del.icio.us"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/delicious.png" alt="delicious" /></a> | <a href="http://digg.com/submit?phase=2&amp;url=http://www.mysqlperformanceblog.com/2009/11/11/tokyo-tyrant-the-extras-part-ii-the-performance-wall/&amp;title=Tokyo Tyrant &#8211; The Extras Part II :  The Performance Wall" title="Digg this post on Digg.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/digg.png" alt="digg" /></a> | <a href="http://reddit.com/submit?url=http://www.mysqlperformanceblog.com/2009/11/11/tokyo-tyrant-the-extras-part-ii-the-performance-wall/&amp;title=Tokyo Tyrant &#8211; The Extras Part II :  The Performance Wall" title="Submit this post on reddit.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/reddit.png" alt="reddit" /></a> | <a href="http://www.netscape.com/submit/?U=http://www.mysqlperformanceblog.com/2009/11/11/tokyo-tyrant-the-extras-part-ii-the-performance-wall/&amp;T=Tokyo Tyrant &#8211; The Extras Part II :  The Performance Wall" title="Vote for this article on Netscape"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/netscape.gif" alt="netscape" /></a> | <a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mysqlperformanceblog.com/2009/11/11/tokyo-tyrant-the-extras-part-ii-the-performance-wall/&amp;title=Tokyo Tyrant &#8211; The Extras Part II :  The Performance Wall" title="Add to Google Bookmarks"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/google.png" alt="Google Bookmarks" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlperformanceblog.com/2009/11/11/tokyo-tyrant-the-extras-part-ii-the-performance-wall/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Tokyo Tyrant &#8211; The Extras Part I :  Is it Durable?</title>
		<link>http://www.mysqlperformanceblog.com/2009/11/10/tokyo-tyrant-the-extras-part-i-is-it-durable/</link>
		<comments>http://www.mysqlperformanceblog.com/2009/11/10/tokyo-tyrant-the-extras-part-i-is-it-durable/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 14:00:11 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[NOSQL]]></category>
		<category><![CDATA[benchmarks]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=1650</guid>
		<description><![CDATA[You know how in addition to the main movie you have extras on the DVD.  Extra commentary, bloopers, extra scenes, etc? Well welcome the Tyrant extras.  With my previous blog posts I was trying to set-up a case for looking at NOSQL tools, and not meant to be a decision making tool.  Each solution has [...]]]></description>
			<content:encoded><![CDATA[<p>You know how in addition to the main movie you have extras on the DVD.  Extra commentary, bloopers, extra scenes, etc? Well welcome the Tyrant extras.  With my<a href="http://www.mysqlperformanceblog.com/2009/10/19/mysql_memcached_tyrant_part3/"> previous blog posts</a> I was trying to set-up a case for looking at NOSQL tools, and not meant to be a decision making tool.  Each solution has pros and cons that will impact how well the technology works for you.  Based on some of the comments and questions to the other blogs, I thought I would put together a little more detail into some of the deficiencies and strengths of Tokyo Tyrant.</p>
<p>#1.  How durable is Tokyo Tyrant?</p>
<p>Well I went ahead and built a quick script that just inserted data into a TC table ( an id, and a timestamp) and did a kill -9 on the  the server in the middle of it.</p>
<p style="padding-left: 30px;"><code>Insert:<br />
159796,1256131127.17329<br />
159797,1256131127.17338<br />
159798,1256131127.17345<br />
159799,1256131127.17355<br />
put error: recv error<br />
159800,1256131127.17364</code></p>
<p>Here we failed at a time of 1256131127.17355 , before the next record was inserted.</p>
<p>After bringing the server up from a crash:</p>
<p style="padding-left: 30px;"><code>159795,1256131127.1732<br />
159796,1256131127.17329<br />
159797,1256131127.17338<br />
159798,1256131127.17345<br />
159799,1256131127.17355</code></p>
<p>All the records are still there.  So we are good right?  Looking in the code,  Tokyo Cabinet actually utilizes memory mapped files.  I personally have not using mmaped files, so feel free to correct me if you know better then I.  Using mmap here and performing a kill -9 seems to preserve the changes in memory, while powering down the server does not:</p>
<p style="padding-left: 30px;"><code>163,1257780699.10123<br />
164,1257780699.35172<br />
165,1257780699.60209<br />
166,1257780699.85246</code></p>
<p>insert yanking of power cord here&#8230; gives us Post crash data of:</p>
<p style="padding-left: 30px;"><code>142,1257780693.84303<br />
143,1257780694.09345</code></p>
<p>So we basically lost 5 secondish of data.</p>
<p>Looking at the Tyrant &amp; Cabinet  documentation you will see mention of a  SYNC command which they say does the following:</p>
<p>“The function `tcrdbsync&#8217; is used in order to synchronize updated contents of a remote database object with the file and the device.”</p>
<p>Let&#8217;s dig a little deeper into the code and see what&#8217;s going on:</p>
<p style="padding-left: 30px;"><code>/* Synchronize updated contents of a hash database object with the file and the device. */<br />
bool tchdbsync(TCHDB *hdb){<br />
assert(hdb);<br />
if(!HDBLOCKMETHOD(hdb, true)) return false;<br />
if(hdb-&gt;fd &lt; 0 || !(hdb-&gt;omode &amp; HDBOWRITER) || hdb-&gt;tran){<br />
tchdbsetecode(hdb, TCEINVALID, __FILE__, __LINE__, __func__);<br />
HDBUNLOCKMETHOD(hdb);<br />
return false;<br />
}<br />
if(hdb-&gt;async &amp;&amp; !tchdbflushdrp(hdb)){<br />
HDBUNLOCKMETHOD(hdb);<br />
return false;<br />
}<br />
bool rv = tchdbmemsync(hdb, true);<br />
HDBUNLOCKMETHOD(hdb);<br />
return rv;<br />
}</code></p>
<p>If it first checks if the file descriptor for the database is less then 0, or your not operating as a writer&#8230;  in which case it errors.  Then if checks if your running in async io mode.  If your running async it flushes the records from the delayed record pool.  If your running async and you do not flush your records, then your at the mercy of Tokyo cabinet, or your application to call one of the numerous operations that flushes the delayed record pool ( i.e.  all regular sync operations like tchdbput will flush it ).  I did not test with async, in fact to the best of my knowledge it does not look like tyrant supports async, even though cabinet does.   Which means the meat of the sync command coming from tyrant is tchdbmemsync.</p>
<p style="padding-left: 30px;"><code>/* Synchronize updating contents on memory of a hash database object. */<br />
bool tchdbmemsync(TCHDB *hdb, bool phys){<br />
assert(hdb);<br />
if(hdb-&gt;fd &lt; 0 || !(hdb-&gt;omode &amp; HDBOWRITER)){<br />
tchdbsetecode(hdb, TCEINVALID, __FILE__, __LINE__, __func__);<br />
return false;<br />
}<br />
bool err = false;<br />
char hbuf[HDBHEADSIZ];<br />
tchdbdumpmeta(hdb, hbuf);<br />
memcpy(hdb-&gt;map, hbuf, HDBOPAQUEOFF);<br />
if(phys){<br />
size_t xmsiz = (hdb-&gt;xmsiz &gt; hdb-&gt;msiz) ? hdb-&gt;xmsiz : hdb-&gt;msiz;<br />
if(msync(hdb-&gt;map, xmsiz, MS_SYNC) == -1){<br />
tchdbsetecode(hdb, TCEMMAP, __FILE__, __LINE__, __func__);<br />
err = true;<br />
}<br />
if(fsync(hdb-&gt;fd) == -1){<br />
tchdbsetecode(hdb, TCESYNC, __FILE__, __LINE__, __func__);<br />
err = true;<br />
}<br />
}<br />
return !err;<br />
}</code></p>
<p>Here you see the call to msync.  What does msync do?  The man page says:</p>
<p>“The msync() function writes all modified data to permanent storage locations, if any, in those whole pages containing any part of the address space of the process starting at address addr and continuing for len bytes.”</p>
<p>Basically in the Tokyo Tyrant context msync will flush all the changes to a memory mapped object to disk.  This msync is crucial as you can not guarantee data ever makes it to disk if its not called.  (more below)</p>
<p>The tchdbmemsync function is the only place I saw calling msync. What calls  tchdbmemsync?</p>
<p style="padding-left: 30px;">tchdbmemsync Called via:<br />
<code>tchdboptimize<br />
tchdbsync<br />
tchdbtranbegin<br />
tchdbtrancommit<br />
tchdbtranabort<br />
tchdbcloseimpl<br />
tchdbcopyimpl</code></p>
<p>The commands that will indirectly call an msync are : running the optimize command, calling a sync directly, closing a connection to the db, or starting,commiting, or aborting a transaction.  Note a transaction in TC is actually a global transaction and locks all write operations ( used for maintenance ).  What is missing here is a scheduled call to msync.  I looked and traced back the calls from Tyrant into Cabinet and could not find anything that is called by automatically.</p>
<p>The documentation on msync actually says without calling msync there is no guarantee of the data making it to disk.  This implies that it may eventually get written without a direct msync call ( When you purge/lru old data from memory ).    Testing this theory I crashed my server several times and found that data written out to disk without calling msync was very flaky indeed.  I had anywhere from 5 seconds of missing data to 60 seconds post crash.</p>
<p>This means for durability you really need to directly call the sync command.  In my previous post someone pointed out a flaw in this approach saying that they had seen that calling a sync after writes ruined performance.  Looking at the code you can see why calling a sync after each write can severely degrade performance.  Before I explain lets look at the performance hit:</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-1680" title="Sync After every Call" src="http://www.mysqlperformanceblog.com/wp-content/uploads/2009/11/TC_PART_2_html_m33bce6bb1.gif" alt="Sync After every Call" width="621" height="325" /></p>
<p>Saying there is a performance hit here is an understatement.  The reason for this however is really how msync works and how its used in Tokyo Cabinet.  In a sense it is implemented as a global sync, not a record sync. i.e.  all changes  to the underlying database are flushed at once.  So instead of sync the record you just changed, all of the changed records in the DB will be flushed and synced.  In order to perform this operation a lock is required, which blocks other SYNC calls.   So if you have 32 threads, you could have 1 sync running and 31 others blocked.  This means calling a sync after every call is going to severely degrade performance.</p>
<p>So what can we do to Make Cabinet more durable?   Well the best option in my opinion is to steal a trick from Innodb:</p>
<p>We can easily write a a script that calls a background sync every second ( i.e. like innodb_flush_log_at_trx_commit = 0/2).  I have tested this and I see almost 0 impact on my gaming benchmark from when this is running to when it is not.</p>
<p style="text-align: center;"><img class="size-full wp-image-1655 aligncenter" title="Once a Second Sync" src="http://www.mysqlperformanceblog.com/wp-content/uploads/2009/11/TC_PART_2_html_m16b3bee4.gif" alt="Once a Second Sync" width="642" height="304" /></p>
<p>You can write this and cron the script or TTSERVER actually provides you a method to call functions periodically:</p>
<p><code>-ext path : specify the script language extension file.<br />
-extpc name period : specify the function name and the calling period of a periodic command.</code></p>
<p>Now while I did not see a drop in my benchmark, heavy write operations will see a drop in performance&#8230; for instance with 8 threads simply update/inserting data is saw this:</p>
<p style="text-align: center;"><img class="size-full wp-image-1656 aligncenter" title="heavy insert sync once a second" src="http://www.mysqlperformanceblog.com/wp-content/uploads/2009/11/TC_PART_2_html_m458df6c3.gif" alt="heavy insert sync once a second" width="641" height="320" /></p>
<p>Ouch, a 2X hit.  But you can configure the frequency of the sync  up or down as needed to ensure you have the proper recovery -vs- performance setting.</p>
    <hr noshade style="margin:0;height:1px" />
    <p>Entry posted by matt |
      <a href="http://www.mysqlperformanceblog.com/2009/11/10/tokyo-tyrant-the-extras-part-i-is-it-durable/#comments">3 comments</a></p>
    <p>Add to: <a href="http://del.icio.us/post?url=http://www.mysqlperformanceblog.com/2009/11/10/tokyo-tyrant-the-extras-part-i-is-it-durable/&amp;title=Tokyo Tyrant &#8211; The Extras Part I :  Is it Durable?" title="Bookmark this post on del.icio.us"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/delicious.png" alt="delicious" /></a> | <a href="http://digg.com/submit?phase=2&amp;url=http://www.mysqlperformanceblog.com/2009/11/10/tokyo-tyrant-the-extras-part-i-is-it-durable/&amp;title=Tokyo Tyrant &#8211; The Extras Part I :  Is it Durable?" title="Digg this post on Digg.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/digg.png" alt="digg" /></a> | <a href="http://reddit.com/submit?url=http://www.mysqlperformanceblog.com/2009/11/10/tokyo-tyrant-the-extras-part-i-is-it-durable/&amp;title=Tokyo Tyrant &#8211; The Extras Part I :  Is it Durable?" title="Submit this post on reddit.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/reddit.png" alt="reddit" /></a> | <a href="http://www.netscape.com/submit/?U=http://www.mysqlperformanceblog.com/2009/11/10/tokyo-tyrant-the-extras-part-i-is-it-durable/&amp;T=Tokyo Tyrant &#8211; The Extras Part I :  Is it Durable?" title="Vote for this article on Netscape"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/netscape.gif" alt="netscape" /></a> | <a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mysqlperformanceblog.com/2009/11/10/tokyo-tyrant-the-extras-part-i-is-it-durable/&amp;title=Tokyo Tyrant &#8211; The Extras Part I :  Is it Durable?" title="Add to Google Bookmarks"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/google.png" alt="Google Bookmarks" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlperformanceblog.com/2009/11/10/tokyo-tyrant-the-extras-part-i-is-it-durable/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to generate per-database traffic statistics using mk-query-digest</title>
		<link>http://www.mysqlperformanceblog.com/2009/09/16/how-to-generate-per-database-traffic-statistics-using-mk-query-digest/</link>
		<comments>http://www.mysqlperformanceblog.com/2009/09/16/how-to-generate-per-database-traffic-statistics-using-mk-query-digest/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 18:47:42 +0000</pubDate>
		<dc:creator>Ryan Lowe</dc:creator>
				<category><![CDATA[tips]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[Maatkit]]></category>
		<category><![CDATA[sharding]]></category>

		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=1162</guid>
		<description><![CDATA[We often encounter customers who have partitioned their applications among a number of databases within the same instance of MySQL (think application service providers who have a separate database per customer organization &#8230; or wordpress-mu type of apps).  For example, take the following single MySQL instance with multiple (identical) databases:

SHOW DATABASES;
+----------+
&#124; Database &#124;
+----------+
&#124; db1 [...]]]></description>
			<content:encoded><![CDATA[<p>We often encounter customers who have partitioned their applications among a number of databases within the same instance of MySQL (think application service providers who have a separate database per customer organization &#8230; or wordpress-mu type of apps).  For example, take the following single MySQL instance with multiple (identical) databases:</p>
<pre>
SHOW DATABASES;
+----------+
| Database |
+----------+
| db1      |
| db2      |
| db3      |
| db4      |
| mysql    |
+----------+
</pre>
<p>Separating the data in this manner is a great setup for being able to scale by simply migrating a subset of the databases to a different physical host when the existing host begins to get overloaded.  But MySQL doesn&#8217;t allow us to examine statistics on a per-database basis.  </p>
<p>Enter Maatkit.</p>
<p>There is an often-ignored gem in <a href="http://maatkit.org/">Maatkit</a>&#8217;s mk-query-digest, and that is the &#8211;group-by argument.  This can be used to aggregate information by tables, hosts, users, or databases (full documentation is available via perldoc).</p>
<pre>
%> perl mk-query-digest --limit 100% --group-by db slow.log
...
# Rank Query ID Response time Calls R/Call Item
# ==== ======== ============= ===== ====== ====
#    1 0x       6000 60.0%    6000  0.5124 db3
#    2 0x       2000 20.0%    2000  0.0112 db1
#    3 0x       1500 15.0%    1500  0.1665 db2
#    4 0x        500  5.0%     500  0.0022 db4
</pre>
<p>So here, we can see that the majority (60%, to be exact) of execution time is spent in db3.  If the server is reaching it&#8217;s capacity and the next most useful performance optimization is to migrate a database to a different server, you know exactly which database to move (db3) and how much room that will give you on the original host (60% growth) and on the new host (40% growth), which may have a direct bearing on your hardware selection.</p>
<p>Let Baron know how awesome you think this is by getting him a gift from his <a href="http://www.amazon.com/wishlist/LOE4ZUTKFU39">Amazon Wish List</a>!</p>
    <hr noshade style="margin:0;height:1px" />
    <p>Entry posted by Ryan Lowe |
      <a href="http://www.mysqlperformanceblog.com/2009/09/16/how-to-generate-per-database-traffic-statistics-using-mk-query-digest/#comments">No comment</a></p>
    <p>Add to: <a href="http://del.icio.us/post?url=http://www.mysqlperformanceblog.com/2009/09/16/how-to-generate-per-database-traffic-statistics-using-mk-query-digest/&amp;title=How to generate per-database traffic statistics using mk-query-digest" title="Bookmark this post on del.icio.us"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/delicious.png" alt="delicious" /></a> | <a href="http://digg.com/submit?phase=2&amp;url=http://www.mysqlperformanceblog.com/2009/09/16/how-to-generate-per-database-traffic-statistics-using-mk-query-digest/&amp;title=How to generate per-database traffic statistics using mk-query-digest" title="Digg this post on Digg.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/digg.png" alt="digg" /></a> | <a href="http://reddit.com/submit?url=http://www.mysqlperformanceblog.com/2009/09/16/how-to-generate-per-database-traffic-statistics-using-mk-query-digest/&amp;title=How to generate per-database traffic statistics using mk-query-digest" title="Submit this post on reddit.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/reddit.png" alt="reddit" /></a> | <a href="http://www.netscape.com/submit/?U=http://www.mysqlperformanceblog.com/2009/09/16/how-to-generate-per-database-traffic-statistics-using-mk-query-digest/&amp;T=How to generate per-database traffic statistics using mk-query-digest" title="Vote for this article on Netscape"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/netscape.gif" alt="netscape" /></a> | <a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mysqlperformanceblog.com/2009/09/16/how-to-generate-per-database-traffic-statistics-using-mk-query-digest/&amp;title=How to generate per-database traffic statistics using mk-query-digest" title="Add to Google Bookmarks"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/google.png" alt="Google Bookmarks" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlperformanceblog.com/2009/09/16/how-to-generate-per-database-traffic-statistics-using-mk-query-digest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SystemTap &#8211; DTrace for Linux ?</title>
		<link>http://www.mysqlperformanceblog.com/2009/09/14/systemtap-dtrace-for-linux/</link>
		<comments>http://www.mysqlperformanceblog.com/2009/09/14/systemtap-dtrace-for-linux/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 04:24:30 +0000</pubDate>
		<dc:creator>Vadim</dc:creator>
				<category><![CDATA[operating systems]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=1115</guid>
		<description><![CDATA[Since DTrace was released for Solaris I am missing it on Linux systems... It can't be included in Linux by the same reason why ZFS can't be - it's licensing issue. Both ZFS and DTrace are under CDDL, which is incompatible with GPL. So you can see DTrace and ZFS on Solaris, FreeBSD, MacOS, but [...]]]></description>
			<content:encoded><![CDATA[<p>Since DTrace was released for Solaris I am missing it on Linux systems... It can't be included in Linux by the same reason why ZFS can't be - it's licensing issue. Both ZFS and DTrace are under CDDL, which is incompatible with GPL. So you can see DTrace and ZFS on Solaris, FreeBSD, MacOS, but not on Linux.</p>
<p>However I follow the project <a href="http://sourceware.org/systemtap/">SystemTap</a> for couple of years (it was started in 2005), which is supposed to provide similar to DTrace functionality.</p>
<p>Why I am interested in this tool, because there is no simple way under Linux to profile not CPU-bound load (for CPU-bound there is OProfile, see for example<br />
<a href="http://mysqlinsights.blogspot.com/2009/08/oprofile-for-io-bound-apps.html">http://mysqlinsights.blogspot.com/2009/08/oprofile-for-io-bound-apps.html</a>). I.e. for IO-bound or for mutex contention problems OProfile is not that useful.</p>
<p>SystemTap is included in RedHat 5 releases, but I was not able to get it running even in CentOS 5.3 (it crashed and hung every so often). Latest updated RedHat 5.4 promised some more fixes to SystemTap, so I decided to give it more try as soon as I got RedHat 5.4 on hands.</p>
<p>Surprising, but now it runs much more stable. I was able to get profiling of kernel and system calls.<br />
Here is simple script to <a href="http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/SystemTap_Beginners_Guide/mainsect-disk.html#disktop">show IO activity per disk per process</a> (well, it is similar to iotop, but iotop is not available in RedHat / CentOS)</p>
<p>with output like this</p>
<div class="igBar"><span id="lcode-4"><a href="#" onclick="javascript:showPlainTxt('code-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-4">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Mon Sep <span style="color:#800000;color:#800000;">14</span> <span style="color:#800000;color:#800000;">05</span>:<span style="color:#800000;color:#800000;">22</span>:<span style="color:#800000;color:#800000;">14</span> <span style="color:#800000;color:#800000;">2009</span> , Average:20353Kb/sec, Read:&nbsp; &nbsp; 4337Kb, Write:&nbsp; 97428Kb</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;UID&nbsp; &nbsp; &nbsp; PID&nbsp; &nbsp; &nbsp;PPID&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CMD&nbsp; &nbsp;DEVICE&nbsp; &nbsp; T&nbsp; &nbsp; &nbsp; &nbsp; BYTES</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">27</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">3701</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">3651</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mysqld&nbsp; &nbsp; &nbsp;dm-<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; W&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">99766272</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">27</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">3701</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">3651</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mysqld&nbsp; &nbsp; &nbsp;dm-<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; R&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">4440064</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">2324</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">2296</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;hald-addon-stor&nbsp; &nbsp; &nbsp;dm-<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; R&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">1242</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Mon Sep <span style="color:#800000;color:#800000;">14</span> <span style="color:#800000;color:#800000;">05</span>:<span style="color:#800000;color:#800000;">22</span>:<span style="color:#800000;color:#800000;">19</span> <span style="color:#800000;color:#800000;">2009</span> , Average:21756Kb/sec, Read:&nbsp; &nbsp; 4263Kb, Write: 104521Kb</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;UID&nbsp; &nbsp; &nbsp; PID&nbsp; &nbsp; &nbsp;PPID&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CMD&nbsp; &nbsp;DEVICE&nbsp; &nbsp; T&nbsp; &nbsp; &nbsp; &nbsp; BYTES</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">27</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">3701</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">3651</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mysqld&nbsp; &nbsp; &nbsp;dm-<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; W&nbsp; &nbsp; <span style="color:#800000;color:#800000;">107029504</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">27</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">3701</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">3651</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mysqld&nbsp; &nbsp; &nbsp;dm-<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; R&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">4358144</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">2883</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">2879</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pam_timestamp_c&nbsp; &nbsp; &nbsp;dm-<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; R&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">6528</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">2324</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">2296</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;hald-addon-stor&nbsp; &nbsp; &nbsp;dm-<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; R&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">828</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This example maybe is simple, but the point is that there is rich scripting language with tons<br />
of probes you can intersect ( kernel functions,  FS drivers functions,  any other drives and modules)</p>
<p>What else I see very useful in SystemTap it can work in userspace. That is you can use it to profile your and any application that has -debuginfo packages ( all -debuginfo for standard RedHat RPMS you can download from RedHat FTP), but basically it is info you get compiling with <code>gcc -g</code>.</p>
<p>Well, there seems another war story going on. To profile userspace application with SystemTap your kernel should be patches with <code>uprobes</code> patch, which fortunately is included in RedHat based kernels, but not included in vanilla kernel yet. So I am not sure if you can get userspace profiling running in another distributives.</p>
<p>There is quite simple script that I tried to hack around MySQL &reg;</p>
<div class="igBar"><span id="lcode-5"><a href="#" onclick="javascript:showPlainTxt('code-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-5">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">probe process<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"/usr/libexec/mysqld"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">function</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"*innobase*"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">printf<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"s(%s)<span style="color:#000099; font-weight:bold;">\n</span>"</span>, probefunc<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>, $$parms<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>with output which I get running simple SELECT against InnoDB table:</p>
<div class="igBar"><span id="lcode-6"><a href="#" onclick="javascript:showPlainTxt('code-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-6">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">stap -v lsprob.<span style="">stp</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Pass <span style="color:#800000;color:#800000;">1</span>: parsed user script and <span style="color:#800000;color:#800000;">52</span> library script<span style="color:#006600; font-weight:bold;">&#40;</span>s<span style="color:#006600; font-weight:bold;">&#41;</span> in 240usr/10sys/261real ms.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">Pass</span> <span style="color:#800000;color:#800000;">2</span>: analyzed script: <span style="color:#800000;color:#800000;">107</span> probe<span style="color:#006600; font-weight:bold;">&#40;</span>s<span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#800000;color:#800000;">22</span> function<span style="color:#006600; font-weight:bold;">&#40;</span>s<span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#800000;color:#800000;">1</span> embed<span style="color:#006600; font-weight:bold;">&#40;</span>s<span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#800000;color:#800000;">0</span> global<span style="color:#006600; font-weight:bold;">&#40;</span>s<span style="color:#006600; font-weight:bold;">&#41;</span> in 540usr/20sys/554real ms.</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">Pass</span> <span style="color:#800000;color:#800000;">3</span>: using cached /root/.<span style="">systemtap</span>/cache/4f/stap_4f8b8738f58ff78e294c62765ac83d91_36925.<span style="">c</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Pass <span style="color:#800000;color:#800000;">4</span>: using cached /root/.<span style="">systemtap</span>/cache/4f/stap_4f8b8738f58ff78e294c62765ac83d91_36925.<span style="">ko</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Pass <span style="color:#800000;color:#800000;">5</span>: starting run.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">innobase_register_trx_and_stmt</span><span style="color:#006600; font-weight:bold;">&#40;</span>thd=? <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innobase_register_stmt<span style="color:#006600; font-weight:bold;">&#40;</span>thd=? <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innobase_map_isolation_level<span style="color:#006600; font-weight:bold;">&#40;</span>iso=? <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innobase_release_stat_resources<span style="color:#006600; font-weight:bold;">&#40;</span>trx=0x2aaaaaddb8b8 <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">convert_search_mode_to_innobase<span style="color:#006600; font-weight:bold;">&#40;</span>find_flag=? <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innodb_srv_conc_enter_innodb<span style="color:#006600; font-weight:bold;">&#40;</span>trx=? <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">srv_conc_enter_innodb<span style="color:#006600; font-weight:bold;">&#40;</span>trx=0x2aaaaaddb8b8 <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innodb_srv_conc_exit_innodb<span style="color:#006600; font-weight:bold;">&#40;</span>trx=? <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">srv_conc_exit_innodb<span style="color:#006600; font-weight:bold;">&#40;</span>trx=0x2aaaaaddb8b8 <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innobase_release_temporary_latches<span style="color:#006600; font-weight:bold;">&#40;</span>thd=0x1a6aced0 <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innobase_release_stat_resources<span style="color:#006600; font-weight:bold;">&#40;</span>trx=? <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">srv_conc_force_exit_innodb<span style="color:#006600; font-weight:bold;">&#40;</span>trx=0x2aaaaaddb8b8 <span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Again, this case is maybe too simple, but basically you can intersect internal MySQL function and script (measure time, count of call, statistics) what you what. I did not figure out yet how to intersect C++ style function (i.e. <code>ha_innobase::index_read</code>), so there is area to investigate.</p>
<p>So I am going to play with it more and do some useful scripting to get profiling of MySQL.</p>
<p>And it seems SystemTap can re-use DTrace probes available in application, as you may know DTrace-probes were added into MySQL 5.4, so interesting how it works.</p>
<p>I should mention that there is second alternative of DTrace... It's .... <a href="http://www.crisp.demon.co.uk/">DTrace port</a>.  Looking on <a href="http://www.crisp.demon.co.uk/blog/">blog</a> it seems one-man project and currently author is fighting with resolving userspace issues.  I gave to this a try, but on my current RedHat 5.4 after several runs I got "Kernel panic", so it's enough for now.</p>
    <hr noshade style="margin:0;height:1px" />
    <p>Entry posted by Vadim |
      <a href="http://www.mysqlperformanceblog.com/2009/09/14/systemtap-dtrace-for-linux/#comments">5 comments</a></p>
    <p>Add to: <a href="http://del.icio.us/post?url=http://www.mysqlperformanceblog.com/2009/09/14/systemtap-dtrace-for-linux/&amp;title=SystemTap &#8211; DTrace for Linux ?" title="Bookmark this post on del.icio.us"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/delicious.png" alt="delicious" /></a> | <a href="http://digg.com/submit?phase=2&amp;url=http://www.mysqlperformanceblog.com/2009/09/14/systemtap-dtrace-for-linux/&amp;title=SystemTap &#8211; DTrace for Linux ?" title="Digg this post on Digg.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/digg.png" alt="digg" /></a> | <a href="http://reddit.com/submit?url=http://www.mysqlperformanceblog.com/2009/09/14/systemtap-dtrace-for-linux/&amp;title=SystemTap &#8211; DTrace for Linux ?" title="Submit this post on reddit.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/reddit.png" alt="reddit" /></a> | <a href="http://www.netscape.com/submit/?U=http://www.mysqlperformanceblog.com/2009/09/14/systemtap-dtrace-for-linux/&amp;T=SystemTap &#8211; DTrace for Linux ?" title="Vote for this article on Netscape"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/netscape.gif" alt="netscape" /></a> | <a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mysqlperformanceblog.com/2009/09/14/systemtap-dtrace-for-linux/&amp;title=SystemTap &#8211; DTrace for Linux ?" title="Add to Google Bookmarks"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/google.png" alt="Google Bookmarks" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlperformanceblog.com/2009/09/14/systemtap-dtrace-for-linux/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Statistics of InnoDB tables and indexes available in xtrabackup</title>
		<link>http://www.mysqlperformanceblog.com/2009/09/14/statistics-of-innodb-tables-and-indexes-available-in-xtrabackup/</link>
		<comments>http://www.mysqlperformanceblog.com/2009/09/14/statistics-of-innodb-tables-and-indexes-available-in-xtrabackup/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 16:52:53 +0000</pubDate>
		<dc:creator>Vadim</dc:creator>
				<category><![CDATA[Backups]]></category>
		<category><![CDATA[Innodb]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=1095</guid>
		<description><![CDATA[If you ever wondered how big is that or another index in InnoDB ... you had to calculate it yourself by multiplying size of row (which I should add is harder in the case of a VARCHAR - since you need to estimate average length) on count of records. And it still would be quite [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever wondered how big is that or another index in InnoDB ... you had to calculate it yourself by multiplying size of row (which I should add is harder in the case of a VARCHAR - since you need to estimate average length) on count of records. And it still would be quite inaccurate as secondary indexes  tend to take more space. So we added more detailed index statistics into our xtrabackup utility.  The thanks for this feature goes to a well known Social Network who sponsored the development.</p>
<p>We chose to put this into xtrabackup for a couple of reasons - the first is that running statistics on your backup database does not need to hurt production servers, and the second reason is that running statistic on a stopped database is more accurate than with online (although online is also supported, but you may have inexact results).</p>
<p>Let's see how it works. I have one table with size 13Gb what was filled during about 2.5 years.<br />
The table is:</p>
<div class="igBar"><span id="lcode-12"><a href="#" onclick="javascript:showPlainTxt('code-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-12">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">CREATE TABLE `link_out104` <span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; `domain_id` int<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">10</span><span style="color:#006600; font-weight:bold;">&#41;</span> unsigned NOT NULL,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; `link_id` int<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">10</span><span style="color:#006600; font-weight:bold;">&#41;</span> unsigned NOT NULL auto_increment,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; `url_from` varchar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">255</span><span style="color:#006600; font-weight:bold;">&#41;</span> NOT NULL,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; `url_to` varchar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">255</span><span style="color:#006600; font-weight:bold;">&#41;</span> NOT NULL,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; `anchor` varchar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">255</span><span style="color:#006600; font-weight:bold;">&#41;</span> NOT NULL,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; `from_site_id` int<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">10</span><span style="color:#006600; font-weight:bold;">&#41;</span> unsigned NOT NULL,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; `from_forum_id` int<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">10</span><span style="color:#006600; font-weight:bold;">&#41;</span> unsigned NOT NULL,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; `from_author_id` int<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">10</span><span style="color:#006600; font-weight:bold;">&#41;</span> unsigned NOT NULL,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; `from_message_id` bigint<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">20</span><span style="color:#006600; font-weight:bold;">&#41;</span> unsigned NOT NULL,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; `message_published` timestamp NOT NULL default CURRENT_TIMESTAMP,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; `kind` enum<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'link'</span>,<span style="color:#CC0000;">'img'</span><span style="color:#006600; font-weight:bold;">&#41;</span> NOT NULL,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; `url_title` varchar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">255</span><span style="color:#006600; font-weight:bold;">&#41;</span> NOT NULL,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; `isexternal` tinyint<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">3</span><span style="color:#006600; font-weight:bold;">&#41;</span> unsigned NOT NULL,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; `revert_domain` varchar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">255</span><span style="color:#006600; font-weight:bold;">&#41;</span> NOT NULL,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; `url_prefix` varchar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">255</span><span style="color:#006600; font-weight:bold;">&#41;</span> NOT NULL,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; `from_domain_id` int<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">10</span><span style="color:#006600; font-weight:bold;">&#41;</span> unsigned NOT NULL,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; `ext` varchar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">25</span><span style="color:#006600; font-weight:bold;">&#41;</span> NOT NULL,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; `linktype` enum<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'html'</span>,<span style="color:#CC0000;">'video'</span>,<span style="color:#CC0000;">'mp3'</span>,<span style="color:#CC0000;">'image'</span>,<span style="color:#CC0000;">'pdf'</span>,<span style="color:#CC0000;">'other'</span><span style="color:#006600; font-weight:bold;">&#41;</span> NOT NULL,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; `message_day` date NOT NULL,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; `mod_is` tinyint<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">3</span><span style="color:#006600; font-weight:bold;">&#41;</span> unsigned NOT NULL default <span style="color:#CC0000;">'0'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; `is_adult` tinyint<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">3</span><span style="color:#006600; font-weight:bold;">&#41;</span> unsigned NOT NULL default <span style="color:#CC0000;">'0'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; PRIMARY KEY&nbsp; <span style="color:#006600; font-weight:bold;">&#40;</span>`link_id`<span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; UNIQUE KEY `domain_id_2` <span style="color:#006600; font-weight:bold;">&#40;</span>`domain_id`,`link_id`<span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; KEY `domain_id` <span style="color:#006600; font-weight:bold;">&#40;</span>`domain_id`,`from_site_id`,`message_published`<span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; KEY `revert_domain` <span style="color:#006600; font-weight:bold;">&#40;</span>`revert_domain`,`url_prefix`<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">80</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; KEY `from_site_id` <span style="color:#006600; font-weight:bold;">&#40;</span>`from_site_id`,`message_published`<span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; KEY `site_message` <span style="color:#006600; font-weight:bold;">&#40;</span>`from_site_id`,`message_day`,`isexternal`<span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; KEY `from_message_id` <span style="color:#006600; font-weight:bold;">&#40;</span>`from_message_id`,`link_id`<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span> ENGINE=InnoDB AUTO_INCREMENT=<span style="color:#800000;color:#800000;">26141165</span> DEFAULT CHARSET=utf8; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>And size of file is about 12.88 GB<br />
<code><br />
-rw-r--r-- 1 root root 13832814592 Sep 10 14:41 link_out104.ibd<br />
</code></p>
<p>So to get statistics we run:</p>
<p><code>xtrabackup --stats --tables=art.link* --datadir=/mnt/data/mysql/</code></p>
<p>which will show something like this:</p>
<div class="igBar"><span id="lcode-13"><a href="#" onclick="javascript:showPlainTxt('code-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-13">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;INDEX STATISTICS&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; table: art/link_out104, index: PRIMARY, space id: <span style="color:#800000;color:#800000;">12</span>, root page <span style="color:#800000;color:#800000;">3</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; estimated statistics in dictionary:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; key vals: <span style="color:#800000;color:#800000;">25265338</span>, leaf pages <span style="color:#800000;color:#800000;">497839</span>, size pages <span style="color:#800000;color:#800000;">498304</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; real statistics:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;level <span style="color:#800000;color:#800000;">2</span> pages: pages=<span style="color:#800000;color:#800000;">1</span>, data=<span style="color:#800000;color:#800000;">5395</span> bytes, data/pages=<span style="color:#800000;color:#800000;">32</span>%</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;level <span style="color:#800000;color:#800000;">1</span> pages: pages=<span style="color:#800000;color:#800000;">415</span>, data=<span style="color:#800000;color:#800000;">6471907</span> bytes, data/pages=<span style="color:#800000;color:#800000;">95</span>%</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; leaf pages: recs=<span style="color:#800000;color:#800000;">25958413</span>, pages=<span style="color:#800000;color:#800000;">497839</span>, data=<span style="color:#800000;color:#800000;">7492026403</span> bytes, data/pages=<span style="color:#800000;color:#800000;">91</span>%</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; table: art/link_out104, index: domain_id_2, space id: <span style="color:#800000;color:#800000;">12</span>, root page <span style="color:#800000;color:#800000;">4</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; estimated statistics in dictionary:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; key vals: <span style="color:#800000;color:#800000;">27755790</span>, leaf pages <span style="color:#800000;color:#800000;">23125</span>, size pages <span style="color:#800000;color:#800000;">26495</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; real statistics:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;level <span style="color:#800000;color:#800000;">2</span> pages: pages=<span style="color:#800000;color:#800000;">1</span>, data=<span style="color:#800000;color:#800000;">510</span> bytes, data/pages=<span style="color:#800000;color:#800000;">3</span>%</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;level <span style="color:#800000;color:#800000;">1</span> pages: pages=<span style="color:#800000;color:#800000;">30</span>, data=<span style="color:#800000;color:#800000;">393125</span> bytes, data/pages=<span style="color:#800000;color:#800000;">79</span>%</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; leaf pages: recs=<span style="color:#800000;color:#800000;">25958413</span>, pages=<span style="color:#800000;color:#800000;">23125</span>, data=<span style="color:#800000;color:#800000;">337459369</span> bytes, data/pages=<span style="color:#800000;color:#800000;">89</span>%</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; table: art/link_out104, index: domain_id, space id: <span style="color:#800000;color:#800000;">12</span>, root page <span style="color:#800000;color:#800000;">5</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; estimated statistics in dictionary:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; key vals: <span style="color:#800000;color:#800000;">3006231</span>, leaf pages <span style="color:#800000;color:#800000;">43255</span>, size pages <span style="color:#800000;color:#800000;">49600</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; real statistics:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;level <span style="color:#800000;color:#800000;">2</span> pages: pages=<span style="color:#800000;color:#800000;">1</span>, data=<span style="color:#800000;color:#800000;">2850</span> bytes, data/pages=<span style="color:#800000;color:#800000;">17</span>%</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;level <span style="color:#800000;color:#800000;">1</span> pages: pages=<span style="color:#800000;color:#800000;">114</span>, data=<span style="color:#800000;color:#800000;">1081375</span> bytes, data/pages=<span style="color:#800000;color:#800000;">57</span>%</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; leaf pages: recs=<span style="color:#800000;color:#800000;">25953873</span>, pages=<span style="color:#800000;color:#800000;">43255</span>, data=<span style="color:#800000;color:#800000;">545031333</span> bytes, data/pages=<span style="color:#800000;color:#800000;">76</span>%</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; table: art/link_out104, index: revert_domain, space id: <span style="color:#800000;color:#800000;">12</span>, root page <span style="color:#800000;color:#800000;">6</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; estimated statistics in dictionary:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; key vals: <span style="color:#800000;color:#800000;">1204830</span>, leaf pages <span style="color:#800000;color:#800000;">133869</span>, size pages <span style="color:#800000;color:#800000;">153984</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; real statistics:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;level <span style="color:#800000;color:#800000;">3</span> pages: pages=<span style="color:#800000;color:#800000;">1</span>, data=<span style="color:#800000;color:#800000;">373</span> bytes, data/pages=<span style="color:#800000;color:#800000;">2</span>%</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;level <span style="color:#800000;color:#800000;">2</span> pages: pages=<span style="color:#800000;color:#800000;">6</span>, data=<span style="color:#800000;color:#800000;">58143</span> bytes, data/pages=<span style="color:#800000;color:#800000;">59</span>%</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;level <span style="color:#800000;color:#800000;">1</span> pages: pages=<span style="color:#800000;color:#800000;">832</span>, data=<span style="color:#800000;color:#800000;">9146283</span> bytes, data/pages=<span style="color:#800000;color:#800000;">67</span>%</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; leaf pages: recs=<span style="color:#800000;color:#800000;">25839414</span>, pages=<span style="color:#800000;color:#800000;">133869</span>, data=<span style="color:#800000;color:#800000;">1566961607</span> bytes, data/pages=<span style="color:#800000;color:#800000;">71</span>%</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; table: art/link_out104, index: from_site_id, space id: <span style="color:#800000;color:#800000;">12</span>, root page <span style="color:#800000;color:#800000;">7</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; estimated statistics in dictionary:</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; key vals: <span style="color:#800000;color:#800000;">330426</span>, leaf pages <span style="color:#800000;color:#800000;">33889</span>, size pages <span style="color:#800000;color:#800000;">38848</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; real statistics:</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;level <span style="color:#800000;color:#800000;">2</span> pages: pages=<span style="color:#800000;color:#800000;">1</span>, data=<span style="color:#800000;color:#800000;">1764</span> bytes, data/pages=<span style="color:#800000;color:#800000;">10</span>%</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;level <span style="color:#800000;color:#800000;">1</span> pages: pages=<span style="color:#800000;color:#800000;">84</span>, data=<span style="color:#800000;color:#800000;">711669</span> bytes, data/pages=<span style="color:#800000;color:#800000;">51</span>%</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; leaf pages: recs=<span style="color:#800000;color:#800000;">25956416</span>, pages=<span style="color:#800000;color:#800000;">33889</span>, data=<span style="color:#800000;color:#800000;">441259072</span> bytes, data/pages=<span style="color:#800000;color:#800000;">79</span>%</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; table: art/link_out104, index: site_message, space id: <span style="color:#800000;color:#800000;">12</span>, root page <span style="color:#800000;color:#800000;">8</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; estimated statistics in dictionary:</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; key vals: <span style="color:#800000;color:#800000;">1399286</span>, leaf pages <span style="color:#800000;color:#800000;">32260</span>, size pages <span style="color:#800000;color:#800000;">36992</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; real statistics:</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;level <span style="color:#800000;color:#800000;">2</span> pages: pages=<span style="color:#800000;color:#800000;">1</span>, data=<span style="color:#800000;color:#800000;">1680</span> bytes, data/pages=<span style="color:#800000;color:#800000;">10</span>%</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;level <span style="color:#800000;color:#800000;">1</span> pages: pages=<span style="color:#800000;color:#800000;">80</span>, data=<span style="color:#800000;color:#800000;">677460</span> bytes, data/pages=<span style="color:#800000;color:#800000;">51</span>%</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; leaf pages: recs=<span style="color:#800000;color:#800000;">25956043</span>, pages=<span style="color:#800000;color:#800000;">32260</span>, data=<span style="color:#800000;color:#800000;">441252731</span> bytes, data/pages=<span style="color:#800000;color:#800000;">83</span>%</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; table: art/link_out104, index: from_message_id, space id: <span style="color:#800000;color:#800000;">12</span>, root page <span style="color:#800000;color:#800000;">9</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; estimated statistics in dictionary:</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; key vals: <span style="color:#800000;color:#800000;">25964521</span>, leaf pages <span style="color:#800000;color:#800000;">27979</span>, size pages <span style="color:#800000;color:#800000;">28160</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; real statistics:</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;level <span style="color:#800000;color:#800000;">2</span> pages: pages=<span style="color:#800000;color:#800000;">1</span>, data=<span style="color:#800000;color:#800000;">798</span> bytes, data/pages=<span style="color:#800000;color:#800000;">4</span>%</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;level <span style="color:#800000;color:#800000;">1</span> pages: pages=<span style="color:#800000;color:#800000;">38</span>, data=<span style="color:#800000;color:#800000;">587559</span> bytes, data/pages=<span style="color:#800000;color:#800000;">94</span>%</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; leaf pages: recs=<span style="color:#800000;color:#800000;">25958413</span>, pages=<span style="color:#800000;color:#800000;">27979</span>, data=<span style="color:#800000;color:#800000;">441293021</span> bytes, data/pages=<span style="color:#800000;color:#800000;">96</span>% </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The output is  intensive, let me highlight some points:</p>
<div class="igBar"><span id="lcode-14"><a href="#" onclick="javascript:showPlainTxt('code-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-14">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">table: art/link_out104, index: PRIMARY, space id: <span style="color:#800000;color:#800000;">12</span>, root page <span style="color:#800000;color:#800000;">3</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; leaf pages: recs=<span style="color:#800000;color:#800000;">25958413</span>, pages=<span style="color:#800000;color:#800000;">497839</span>, data=<span style="color:#800000;color:#800000;">7492026403</span> bytes, data/pages=<span style="color:#800000;color:#800000;">91</span>% </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>It says that PRIMARY key (which is the table by itself, as InnoDB is clustering data by primary key) takes <strong>497839</strong> pages ( 16KB each) and size of data <strong>7492026403</strong> bytes or (6.98 GB). And density ( fitting data into pages) is quite good - 91%. But it was expected, as table is really mostly inserted in, updates and deletes are rare).</p>
<p>And let's take index <strong>domain_id</strong></p>
<div class="igBar"><span id="lcode-15"><a href="#" onclick="javascript:showPlainTxt('code-15'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-15">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">table: art/link_out104, index: domain_id, space id: <span style="color:#800000;color:#800000;">12</span>, root page <span style="color:#800000;color:#800000;">5</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; leaf pages: recs=<span style="color:#800000;color:#800000;">25953873</span>, pages=<span style="color:#800000;color:#800000;">43255</span>, data=<span style="color:#800000;color:#800000;">545031333</span> bytes, data/pages=<span style="color:#800000;color:#800000;">76</span>% </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>you can see the allocated pages (43255 pages or 708689920 bytes) are filled only by 76% ( data takes 545031333 bytes). And that means that 150MB are just waste of space. Which is really even worse for key <strong>revert_domain</strong></p>
<p><code>   leaf pages: recs=25839414, pages=133869, data=1566961607 bytes, data/pages=71%<br />
</code>.</p>
<p>For this key about 600MB is empty. </p>
<p>This needs a bit of explaining:<br />
This does not have as good efficiency as the primary key, but a lot of this is to be expected.  In a lot of cases we insert into the primary key in order which makes things very predictable, but the inserts into the secondary key index are random - which leads to a lot of page splits.</p>
<p>One helpful new feature to address this is in XtraDB/InnoDB plugin - fast index creation.  With this feature, InnoDB creates indexes by sort, so page fill factor should be quite good.</p>
<p>To check that, there is xtrabackup --stats for index  <strong>domain_id</strong> created for table in Barracuda format with Fast creation method:</p>
<div class="igBar"><span id="lcode-16"><a href="#" onclick="javascript:showPlainTxt('code-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-16">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">table: art/link_out104, index: domain_id, space id: <span style="color:#800000;color:#800000;">15</span>, root page <span style="color:#800000;color:#800000;">49160</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; estimated statistics in dictionary:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; key vals: <span style="color:#800000;color:#800000;">5750565</span>, leaf pages <span style="color:#800000;color:#800000;">34383</span>, size pages <span style="color:#800000;color:#800000;">34496</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; real statistics:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;level <span style="color:#800000;color:#800000;">2</span> pages: pages=<span style="color:#800000;color:#800000;">1</span>, data=<span style="color:#800000;color:#800000;">1375</span> bytes, data/pages=<span style="color:#800000;color:#800000;">8</span>%</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;level <span style="color:#800000;color:#800000;">1</span> pages: pages=<span style="color:#800000;color:#800000;">55</span>, data=<span style="color:#800000;color:#800000;">859575</span> bytes, data/pages=<span style="color:#800000;color:#800000;">95</span>%</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; leaf pages: recs=<span style="color:#800000;color:#800000;">25958413</span>, pages=<span style="color:#800000;color:#800000;">34383</span>, data=<span style="color:#800000;color:#800000;">545126673</span> bytes, data/pages=<span style="color:#800000;color:#800000;">96</span>% </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>As you see this time it takes 34383 pages (compare to 43255 in previous statistics).</p>
<p>Though it would be interesting to see how it will grow with further inserts, and I also suspect random INSERTS into so dense space going to be slower than in previous case.</p>
<p>The --stats is not in xtrabackup release yet, only in source code repository, but should be released quite soon.</p>
<p>And the last point of the post - if you are badly missing some features in MySQL, InnoDB, InnoDB-plugin, XtraDB, XtraBackup - you know whom ask for!</p>
    <hr noshade style="margin:0;height:1px" />
    <p>Entry posted by Vadim |
      <a href="http://www.mysqlperformanceblog.com/2009/09/14/statistics-of-innodb-tables-and-indexes-available-in-xtrabackup/#comments">5 comments</a></p>
    <p>Add to: <a href="http://del.icio.us/post?url=http://www.mysqlperformanceblog.com/2009/09/14/statistics-of-innodb-tables-and-indexes-available-in-xtrabackup/&amp;title=Statistics of InnoDB tables and indexes available in xtrabackup" title="Bookmark this post on del.icio.us"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/delicious.png" alt="delicious" /></a> | <a href="http://digg.com/submit?phase=2&amp;url=http://www.mysqlperformanceblog.com/2009/09/14/statistics-of-innodb-tables-and-indexes-available-in-xtrabackup/&amp;title=Statistics of InnoDB tables and indexes available in xtrabackup" title="Digg this post on Digg.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/digg.png" alt="digg" /></a> | <a href="http://reddit.com/submit?url=http://www.mysqlperformanceblog.com/2009/09/14/statistics-of-innodb-tables-and-indexes-available-in-xtrabackup/&amp;title=Statistics of InnoDB tables and indexes available in xtrabackup" title="Submit this post on reddit.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/reddit.png" alt="reddit" /></a> | <a href="http://www.netscape.com/submit/?U=http://www.mysqlperformanceblog.com/2009/09/14/statistics-of-innodb-tables-and-indexes-available-in-xtrabackup/&amp;T=Statistics of InnoDB tables and indexes available in xtrabackup" title="Vote for this article on Netscape"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/netscape.gif" alt="netscape" /></a> | <a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mysqlperformanceblog.com/2009/09/14/statistics-of-innodb-tables-and-indexes-available-in-xtrabackup/&amp;title=Statistics of InnoDB tables and indexes available in xtrabackup" title="Add to Google Bookmarks"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/google.png" alt="Google Bookmarks" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlperformanceblog.com/2009/09/14/statistics-of-innodb-tables-and-indexes-available-in-xtrabackup/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Is DRBD the right choice for me?</title>
		<link>http://www.mysqlperformanceblog.com/2009/07/07/is-drbd-the-right-choice-for-me/</link>
		<comments>http://www.mysqlperformanceblog.com/2009/07/07/is-drbd-the-right-choice-for-me/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 18:00:32 +0000</pubDate>
		<dc:creator>Morgan Tocker</dc:creator>
				<category><![CDATA[High Availability]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[drbd]]></category>
		<category><![CDATA[mmm]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[replication]]></category>

		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=716</guid>
		<description><![CDATA[It seems pretty common to find customers install DRBD for the wrong reasons.  There are many pros/cons to compare DRBD to replication, but I've managed to cut down my spiel I give to customers to these two points:

DRBD's aim (assuming replication mode C) is to provide 100% consistency, and then as much uptime as [...]]]></description>
			<content:encoded><![CDATA[<p>It seems pretty common to find customers install DRBD for the wrong reasons.  There are many pros/cons to compare DRBD to replication, but I've managed to cut down my spiel I give to customers to these two points:</p>
<ul>
<li>DRBD's aim (assuming replication mode C) is to provide 100% consistency, and then as much uptime as possible.</li>
<li>MySQL Replication (with a manager such as <a href="http://code.google.com/p/mysql-master-master/">MMM</a>) aims to have 100% availability, at the potential loss of some data surrounding a failure.</li>
</ul>
<p>So if you are installing DRBD with the aim of purely "availability", and are not worried about losing that last write on the crash to your master database that (hopefully) happens only once every few years, you may be using the wrong technology.</p>
<p>While the prized "1 minute failover" is possible in DRBD, it doesn't really explain the full picture. The typical crash recovery process in DRBD is a lot longer:</p>
<ul>
<li>After resource transfer, a filesystem check runs (0-5 seconds).</li>
<li>mysqld is started (1-5 seconds)</li>
<li>InnoDB runs through crash recovery (1 minute - several hours).  Peter wrote about this <a href="http://www.mysqlperformanceblog.com/2006/07/03/choosing-proper-innodb_log_file_size/">here</a>.</li>
<li>The server is then ready to accept connections.</li>
</ul>
<p>Now, having said that:  If you have an application that requires 100% consistency, then DRBD is one of your best choices on the mysql-market today.</p>
    <hr noshade style="margin:0;height:1px" />
    <p>Entry posted by Morgan Tocker |
      <a href="http://www.mysqlperformanceblog.com/2009/07/07/is-drbd-the-right-choice-for-me/#comments">16 comments</a></p>
    <p>Add to: <a href="http://del.icio.us/post?url=http://www.mysqlperformanceblog.com/2009/07/07/is-drbd-the-right-choice-for-me/&amp;title=Is DRBD the right choice for me?" title="Bookmark this post on del.icio.us"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/delicious.png" alt="delicious" /></a> | <a href="http://digg.com/submit?phase=2&amp;url=http://www.mysqlperformanceblog.com/2009/07/07/is-drbd-the-right-choice-for-me/&amp;title=Is DRBD the right choice for me?" title="Digg this post on Digg.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/digg.png" alt="digg" /></a> | <a href="http://reddit.com/submit?url=http://www.mysqlperformanceblog.com/2009/07/07/is-drbd-the-right-choice-for-me/&amp;title=Is DRBD the right choice for me?" title="Submit this post on reddit.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/reddit.png" alt="reddit" /></a> | <a href="http://www.netscape.com/submit/?U=http://www.mysqlperformanceblog.com/2009/07/07/is-drbd-the-right-choice-for-me/&amp;T=Is DRBD the right choice for me?" title="Vote for this article on Netscape"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/netscape.gif" alt="netscape" /></a> | <a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mysqlperformanceblog.com/2009/07/07/is-drbd-the-right-choice-for-me/&amp;title=Is DRBD the right choice for me?" title="Add to Google Bookmarks"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/google.png" alt="Google Bookmarks" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlperformanceblog.com/2009/07/07/is-drbd-the-right-choice-for-me/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Gathering queries from a server with Maatkit and tcpdump</title>
		<link>http://www.mysqlperformanceblog.com/2009/07/01/gathering-queries-from-a-server-with-maatkit-and-tcpdump/</link>
		<comments>http://www.mysqlperformanceblog.com/2009/07/01/gathering-queries-from-a-server-with-maatkit-and-tcpdump/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 04:10:24 +0000</pubDate>
		<dc:creator>Baron Schwartz</dc:creator>
				<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=710</guid>
		<description><![CDATA[For the last couple of months, we've been quietly developing a MySQL protocol parser for Maatkit.  It isn't an implementation of the protocol: it's an observer of the protocol.  This lets us gather queries from servers that don't have a slow query log enabled, at very high time resolution.
With this new functionality, it [...]]]></description>
			<content:encoded><![CDATA[<p>For the last couple of months, we've been quietly developing a MySQL protocol parser for Maatkit.  It isn't an implementation of the protocol: it's an observer of the protocol.  This lets us gather queries from servers that don't have a slow query log enabled, at very high time resolution.</p>
<p>With this new functionality, it becomes possible for mk-query-digest to stand on the sidelines and watch queries fly by over TCP.  It is only an observer on the sidelines: it is NOT a man in the middle like mysql-proxy, so it has basically zero impact on the running server (tcpdump is very efficient) and <a href="http://www.mysqlperformanceblog.com/2009/06/09/mysql-proxy-urgh-performance-and-scalability/">zero impact on the query latency</a>.  There are some unique challenges to watching an entire server's traffic, but we've found ways to solve those.  Some of them are harder than others, such as making sense of a conversation when you start listening in the middle.  In general, it's working very well.  We can gather just about every bit of information about queries that mysql-proxy can, making this a viable way to monitor servers without the disadvantages of a proxy.  In theory, we can gather ALL the same information, but in practice we are going for the 95% case.</p>
<p>As always with Maatkit, this has minimal dependencies.  It doesn't require any Net::Pcap or other modules from CPAN.  It's written in pure Perl, and it parses the output of tcpdump, rather than watching the network traffic directly.  This might sound useless, but it's not.  It means you can go tcpdump some traffic on a machine without Perl installed, and copy it to another machine for analysis, or send it via email to your friendly consultant, or do any of a number of other things.  Decoupling things is very helpful sometimes.</p>
<p>Let's see how to gather queries and do something useful with them.  I'll just watch the queries on a sandbox server on my laptop, and print out the profile synopsis so you can see how it works.</p>
<div class="igBar"><span id="lcode-21"><a href="#" onclick="javascript:showPlainTxt('code-21'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-21">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sudo tcpdump -i lo port <span style="color:#800000;color:#800000;">3306</span> -s <span style="color:#800000;color:#800000;">65535</span> -x -n -q -tttt&gt; tcpdump.<span style="">out</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>I run a few queries, quit, and cancel tcpdump.  Now I've got a file and I'm ready to analyze it.  Let's see:</p>
<div class="igBar"><span id="lcode-22"><a href="#" onclick="javascript:showPlainTxt('code-22'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-22">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mk-query-digest --type=tcpdump --report-format=profile tcpdump.<span style="">out</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Rank Query ID&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Response time&nbsp; &nbsp; Calls&nbsp; &nbsp;R/Call&nbsp; &nbsp; &nbsp;Item</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># ==== ================== ================ ======= ========== ====</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#&nbsp; &nbsp; <span style="color:#800000;color:#800000;">1</span> 0x088084BF139954D8&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">1009</span> <span style="color:#800000;color:#800000;">90</span>.<span style="color:#800000;color:#800000;">2</span>%&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">1</span>&nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">100881</span> SELECT dual</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#&nbsp; &nbsp; <span style="color:#800000;color:#800000;">2</span> 0x261703E684370D2C&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">0110</span>&nbsp; <span style="color:#800000;color:#800000;">9</span>.<span style="color:#800000;color:#800000;">8</span>%&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">1</span>&nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">011017</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>I'm kind of showing off the summary profile here to illustrate that you can get really compact results to see what's going on inside your server.  What do you suppose that one query was that took a tenth of a second?  We can find out.</p>
<div class="igBar"><span id="lcode-23"><a href="#" onclick="javascript:showPlainTxt('code-23'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-23">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mk-query-digest --type=tcpdump --limit <span style="color:#800000;color:#800000;">1</span> tcpdump.<span style="">out</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># 460ms user time, 30ms system time, <span style="color:#800000;color:#800000;">8</span>.88M rss, <span style="color:#800000;color:#800000;">11</span>.79M vsz</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Overall: <span style="color:#800000;color:#800000;">8</span> total, <span style="color:#800000;color:#800000;">6</span> unique, <span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">15</span> QPS, <span style="color:#800000;color:#800000;">0</span>.00x concurrency ________________</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; total&nbsp; &nbsp; &nbsp;min&nbsp; &nbsp; &nbsp;max&nbsp; &nbsp; &nbsp;avg&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">95</span>%&nbsp; stddev&nbsp; median</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Exec time&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 114ms&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp;101ms&nbsp; &nbsp; 14ms&nbsp; &nbsp;100ms&nbsp; &nbsp; 33ms&nbsp; &nbsp;737us</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Hosts&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">8</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Time range&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">2009</span>-<span style="color:#800000;color:#800000;">07</span>-<span style="color:#800000;color:#800000;">01</span> <span style="color:#800000;color:#800000;">23</span>:<span style="color:#800000;color:#800000;">55</span>:<span style="color:#800000;color:#800000;">41</span>.<span style="color:#800000;color:#800000;">334082</span> to <span style="color:#800000;color:#800000;">2009</span>-<span style="color:#800000;color:#800000;">07</span>-<span style="color:#800000;color:#800000;">01</span> <span style="color:#800000;color:#800000;">23</span>:<span style="color:#800000;color:#800000;">56</span>:<span style="color:#800000;color:#800000;">33</span>.<span style="color:#800000;color:#800000;">929945</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># bytes&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">215</span>&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">14</span>&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">49</span>&nbsp; &nbsp;<span style="color:#800000;color:#800000;">26</span>.<span style="color:#800000;color:#800000;">88</span>&nbsp; &nbsp;<span style="color:#800000;color:#800000;">46</span>.<span style="color:#800000;color:#800000;">83</span>&nbsp; &nbsp; <span style="color:#800000;color:#800000;">9</span>.<span style="color:#800000;color:#800000;">76</span>&nbsp; &nbsp;<span style="color:#800000;color:#800000;">26</span>.<span style="color:#800000;color:#800000;">08</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Errors&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">8</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Rows affe&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Warning c&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#&nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>% No_good_index_used</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#&nbsp; <span style="color:#800000;color:#800000;">12</span>% No_index_used</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Query <span style="color:#800000;color:#800000;">1</span>: <span style="color:#800000;color:#800000;">0</span> QPS, 0x concurrency, ID 0x088084BF139954D8 at byte <span style="color:#800000;color:#800000;">7517</span> _____</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># This item is included in the report because it matches --limit.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pct&nbsp; &nbsp;total&nbsp; &nbsp; &nbsp;min&nbsp; &nbsp; &nbsp;max&nbsp; &nbsp; &nbsp;avg&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">95</span>%&nbsp; stddev&nbsp; median</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Count&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">12</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Exec time&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">88</span>&nbsp; &nbsp;101ms&nbsp; &nbsp;101ms&nbsp; &nbsp;101ms&nbsp; &nbsp;101ms&nbsp; &nbsp;101ms&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp;101ms</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Users&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">1</span> msandbox</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Hosts&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">1</span> <span style="color:#800000;color:#800000;">127</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">1</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Databases&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Time range <span style="color:#800000;color:#800000;">2009</span>-<span style="color:#800000;color:#800000;">07</span>-<span style="color:#800000;color:#800000;">01</span> <span style="color:#800000;color:#800000;">23</span>:<span style="color:#800000;color:#800000;">56</span>:<span style="color:#800000;color:#800000;">31</span>.<span style="color:#800000;color:#800000;">022602</span> to <span style="color:#800000;color:#800000;">2009</span>-<span style="color:#800000;color:#800000;">07</span>-<span style="color:#800000;color:#800000;">01</span> <span style="color:#800000;color:#800000;">23</span>:<span style="color:#800000;color:#800000;">56</span>:<span style="color:#800000;color:#800000;">31</span>.<span style="color:#800000;color:#800000;">022602</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># bytes&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">22</span>&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">49</span>&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">49</span>&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">49</span>&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">49</span>&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">49</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">49</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Errors&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">1</span>&nbsp; &nbsp; none</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Rows affe&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Warning c&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#&nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>% No_good_index_used</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#&nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>% No_index_used</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Query_time distribution</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#&nbsp; &nbsp;1us</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#&nbsp; 10us</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># 100us</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#&nbsp; &nbsp;1ms</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#&nbsp; 10ms</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># 100ms&nbsp; ################################################################</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#&nbsp; &nbsp; 1s</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#&nbsp; 10s+</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Tables</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#&nbsp; &nbsp; SHOW TABLE STATUS LIKE <span style="color:#CC0000;">'dual'</span>\G</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#&nbsp; &nbsp; SHOW CREATE TABLE `dual`\G</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># EXPLAIN</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">select <span style="color:#800000;color:#800000;">1</span> from <span style="color:#006600; font-weight:bold;">&#40;</span> select sleep<span style="color:#006600; font-weight:bold;">&#40;</span>.<span style="color:#800000;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span> from dual <span style="color:#006600; font-weight:bold;">&#41;</span> as x\G </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Indeed, it's no surprise the query took a tenth of a second to execute, and now you see where "SELECT dual" comes from.</p>
<p>Notice that it is inspecting the protocol enough to see the flags set in the protocol, indicating the warning count, error count, rows affected, and whether no index or no good index was available.  Look at the top of the report -- what is up with the 12% of queries that say No_index_used?  If we increase --limit a bit, we can see </p>
<div class="igBar"><span id="lcode-24"><a href="#" onclick="javascript:showPlainTxt('code-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-24">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#&nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>% No_good_index_used</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># <span style="color:#800000;color:#800000;">100</span>% No_index_used</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Query_time distribution</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">... <span style="">snip</span> ...</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">show</span> databases\G </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>I did not know that SHOW DATABASES sets the "no index used" flag, did you?  Now we both do!</p>
<p>This is just a brief introduction to what the protocol parser can do.  Of course, in real life it's much more useful than just seeing a query or two -- it has all the power of mk-query-digest for filtering, aggregating, printing and so forth.</p>
    <hr noshade style="margin:0;height:1px" />
    <p>Entry posted by Baron Schwartz |
      <a href="http://www.mysqlperformanceblog.com/2009/07/01/gathering-queries-from-a-server-with-maatkit-and-tcpdump/#comments">21 comments</a></p>
    <p>Add to: <a href="http://del.icio.us/post?url=http://www.mysqlperformanceblog.com/2009/07/01/gathering-queries-from-a-server-with-maatkit-and-tcpdump/&amp;title=Gathering queries from a server with Maatkit and tcpdump" title="Bookmark this post on del.icio.us"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/delicious.png" alt="delicious" /></a> | <a href="http://digg.com/submit?phase=2&amp;url=http://www.mysqlperformanceblog.com/2009/07/01/gathering-queries-from-a-server-with-maatkit-and-tcpdump/&amp;title=Gathering queries from a server with Maatkit and tcpdump" title="Digg this post on Digg.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/digg.png" alt="digg" /></a> | <a href="http://reddit.com/submit?url=http://www.mysqlperformanceblog.com/2009/07/01/gathering-queries-from-a-server-with-maatkit-and-tcpdump/&amp;title=Gathering queries from a server with Maatkit and tcpdump" title="Submit this post on reddit.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/reddit.png" alt="reddit" /></a> | <a href="http://www.netscape.com/submit/?U=http://www.mysqlperformanceblog.com/2009/07/01/gathering-queries-from-a-server-with-maatkit-and-tcpdump/&amp;T=Gathering queries from a server with Maatkit and tcpdump" title="Vote for this article on Netscape"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/netscape.gif" alt="netscape" /></a> | <a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mysqlperformanceblog.com/2009/07/01/gathering-queries-from-a-server-with-maatkit-and-tcpdump/&amp;title=Gathering queries from a server with Maatkit and tcpdump" title="Add to Google Bookmarks"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/google.png" alt="Google Bookmarks" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlperformanceblog.com/2009/07/01/gathering-queries-from-a-server-with-maatkit-and-tcpdump/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>check-unused-keys: A tool to interact with INDEX_STATISTICS</title>
		<link>http://www.mysqlperformanceblog.com/2009/06/26/check-unused-keys-a-tool-to-interact-with-index_statistics/</link>
		<comments>http://www.mysqlperformanceblog.com/2009/06/26/check-unused-keys-a-tool-to-interact-with-index_statistics/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 21:53:12 +0000</pubDate>
		<dc:creator>Ryan Lowe</dc:creator>
				<category><![CDATA[community]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[MySQL Indexes]]></category>
		<category><![CDATA[Percona Patched MySQL]]></category>

		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=707</guid>
		<description><![CDATA[With the growing adoption of Google's User Statistics Patch**, the need for supporting scripts has become clear.  To that end, we've created check-unused-keys, a Perl script to provide a nicer interface than directly querying the INFORMATION_SCHEMA database.
check-unused-keys can be invoked and used as follows:

%&#62; check-unused-keys --help
Usage:
     check-unused-keys [OPTIONS]

   [...]]]></description>
			<content:encoded><![CDATA[<p>With the growing adoption of <a href="http://www.mysqlperformanceblog.com/2008/09/12/googles-user_statistics-v2-port-and-changes/" target="#">Google's User Statistics Patch</a>**, the need for supporting scripts has become clear.  To that end, we've created <a href="http://code.google.com/p/check-unused-keys/" target="#">check-unused-keys</a>, a Perl script to provide a nicer interface than <a href="http://www.mysqlperformanceblog.com/2008/09/12/unused-indexes-by-single-query/" target="#">directly querying the INFORMATION_SCHEMA database</a>.</p>
<p>check-unused-keys can be invoked and used as follows:</p>
<pre>
%&gt; check-unused-keys --help
Usage:
     check-unused-keys [OPTIONS]

     Options:
       -d, --databases=&lt;dbname&gt;  Comma-separated list of databases to check
       -h, --help                Display this message and exit
       -H, --hostname=&lt;hostname&gt; The target MySQL server host
       --ignore-databases        Comma-separated list of databases to ignore
       --ignore-indexes          Comma-separated list of indexes to ignore
                                     db_name.tbl_name.index_name
       --ignore-tables           Comma-separated list of tables to ignore
                                     db_name.tbl_name
       --options-file            The options file to use
       -p, --password=&lt;password&gt; The password of the MySQL user
       -i, --port=&lt;portnum&gt;      The port MySQL is listening on
       -s, --socket=&lt;sockfile&gt;   Use the specified mysql unix socket to connect
       -t, --tables=&lt;tables&gt;     Comma-separated list of tables to evaluate
                                     db_name.tbl_name
       --[no]summary             Display summary information
       -u, --username=&lt;username&gt; The MySQL user used to connect
       -v, --verbose             Increase verbosity level
       -V, --version             Display version information and exit

     Defaults are:

     ATTRIBUTE                  VALUE
     -------------------------- ------------------
     databases                  ALL databases
     help                       FALSE
     hostname                   localhost
     ignore-databases           No default value
     ignore-indexes             No default value
     ignore-tables              No default value
     options-file               ~/.my.cnf
     password                   No default value
     port                       3306
     socket                     No default value
     summary                    TRUE
     tables                     No Default Value
     username                   No default value
     verbose                    0 (out of 2)
     version                    FALSE
</pre>
<p>** FULLTEXT indexes are not taken into account by this patch, so be wary.  And, as always, sanity check the suggestions and test thoroughly before making changes to production.</p>
    <hr noshade style="margin:0;height:1px" />
    <p>Entry posted by Ryan Lowe |
      <a href="http://www.mysqlperformanceblog.com/2009/06/26/check-unused-keys-a-tool-to-interact-with-index_statistics/#comments">7 comments</a></p>
    <p>Add to: <a href="http://del.icio.us/post?url=http://www.mysqlperformanceblog.com/2009/06/26/check-unused-keys-a-tool-to-interact-with-index_statistics/&amp;title=check-unused-keys: A tool to interact with INDEX_STATISTICS" title="Bookmark this post on del.icio.us"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/delicious.png" alt="delicious" /></a> | <a href="http://digg.com/submit?phase=2&amp;url=http://www.mysqlperformanceblog.com/2009/06/26/check-unused-keys-a-tool-to-interact-with-index_statistics/&amp;title=check-unused-keys: A tool to interact with INDEX_STATISTICS" title="Digg this post on Digg.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/digg.png" alt="digg" /></a> | <a href="http://reddit.com/submit?url=http://www.mysqlperformanceblog.com/2009/06/26/check-unused-keys-a-tool-to-interact-with-index_statistics/&amp;title=check-unused-keys: A tool to interact with INDEX_STATISTICS" title="Submit this post on reddit.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/reddit.png" alt="reddit" /></a> | <a href="http://www.netscape.com/submit/?U=http://www.mysqlperformanceblog.com/2009/06/26/check-unused-keys-a-tool-to-interact-with-index_statistics/&amp;T=check-unused-keys: A tool to interact with INDEX_STATISTICS" title="Vote for this article on Netscape"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/netscape.gif" alt="netscape" /></a> | <a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mysqlperformanceblog.com/2009/06/26/check-unused-keys-a-tool-to-interact-with-index_statistics/&amp;title=check-unused-keys: A tool to interact with INDEX_STATISTICS" title="Add to Google Bookmarks"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/google.png" alt="Google Bookmarks" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlperformanceblog.com/2009/06/26/check-unused-keys-a-tool-to-interact-with-index_statistics/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Converting Character Sets</title>
		<link>http://www.mysqlperformanceblog.com/2009/03/17/converting-character-sets/</link>
		<comments>http://www.mysqlperformanceblog.com/2009/03/17/converting-character-sets/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 23:38:23 +0000</pubDate>
		<dc:creator>Ryan Lowe</dc:creator>
				<category><![CDATA[community]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=636</guid>
		<description><![CDATA[The web is going the way of utf8.  Drizzle has chosen it as the default character set, most back-ends to websites use it to store text data, and those who are still using latin1 have begun to migrate their databases to utf8.  Googling for "mysql convert charset to utf8" results in a plethora of sites, [...]]]></description>
			<content:encoded><![CDATA[<p>The web is going the way of utf8.  Drizzle has chosen it as the default character set, most back-ends to websites use it to store text data, and those who are still using latin1 have begun to migrate their databases to utf8.  Googling for "mysql convert charset to utf8" results in a plethora of sites, each with a slightly different approach, and each broken in some respect.  I'll outline those approaches here and show why they don't work, and then present a script that can generically be used to convert a database (or set of tables) to a target character set and collation.</p>
<p>Approach #1:</p>
<div class="igBar"><span id="lsql-30"><a href="#" onclick="javascript:showPlainTxt('sql-30'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-30">
<div class="sql">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`t1`</span> CONVERT <span style="color: #993333; font-weight: bold;">TO</span> CHARACTER <span style="color: #993333; font-weight: bold;">SET</span> utf8 COLLATE utf8_general_ci; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Take the following table as an example why this approach will not work:</p>
<div class="igBar"><span id="lsql-31"><a href="#" onclick="javascript:showPlainTxt('sql-31'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-31">
<div class="sql">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mysql&gt; <span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`t1`</span> <span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">-&gt;   <span style="color: #ff0000;">`c1`</span> text <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">-&gt; <span style="color:#006600; font-weight:bold;">&#41;</span> ENGINE=MyISAM <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET=latin1;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Query OK, <span style="color: #cc66cc;color:#800000;">0</span> rows affected <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">02</span> sec<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mysql&gt; <span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`t1`</span> CONVERT <span style="color: #993333; font-weight: bold;">TO</span> CHARACTER <span style="color: #993333; font-weight: bold;">SET</span> utf8 COLLATE utf8_general_ci;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Query OK, <span style="color: #cc66cc;color:#800000;">0</span> rows affected <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">02</span> sec<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Records: <span style="color: #cc66cc;color:#800000;">0</span>  Duplicates: <span style="color: #cc66cc;color:#800000;">0</span>  Warnings: <span style="color: #cc66cc;color:#800000;">0</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mysql&gt; <span style="color: #993333; font-weight: bold;">SHOW</span> <span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`t1`</span>\G</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">*************************** <span style="color: #cc66cc;color:#800000;">1</span>. row ***************************</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">TABLE</span>: t1</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span>: <span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`t1`</span> <span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">`c1`</span> mediumtext <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span> ENGINE=MyISAM <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET=utf8</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc66cc;color:#800000;">1</span> row <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #993333; font-weight: bold;">SET</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">01</span> sec<span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Notice the implicit conversion of c1 from text to mediumtext.  This approach can result in modified data types and silent data truncation, which makes it unacceptable for our purposes.</p>
<p>Approach #2 (outlined <a href="http://www.haidongji.com/2008/11/11/convert-character-set-to-utf8-in-mysql/" target="#">here</a>):</p>
<p>This approach avoids the issue of implicit conversions by changing each data type to it's binary counterpart before conversion.  Due to implementation limitations, however, it also converts any pre-existing binary columns to their text counterpart.  Additionally, this approach will fail because a binary column cannot be part of a FULLTEXT index.  Even if these limitations are overcome, this process is inherently unsuitable for large databases because it requires multiple alter statements to be run on each table:</p>
<p>1) Drop FULLTEXT indexes<br />
2) Convert target columns to their binary counterparts<br />
3) Convert the table to the target character set<br />
4) Convert target columns to their original data types<br />
5) Add FULLTEXT indexes back</p>
<p>For those of us routinely waiting hours, if not days, for a single alter statement to finish, this is unacceptable.</p>
<p>Approach #3:</p>
<p>Dumping the entire database and re-importing it with the appropriate server &amp; client character sets.</p>
<p>This is a three-step process, where one must first dump only the schema and then edit it by hand to have the appropriate character sets and the dump the data separately.  After which, the schema must be re-created and data imported.  If you're using replication, this usually isn't even an option because you'll have a ridiculous amount of binary logs and force a reload of data on every server in the replication chain (very time/bandwidth/disk space consuming).</p>
<p>Except for Approach #1, these approaches are much more difficult than they need to be.  Consider the following ALTER statement against the table in Approach #1:</p>
<div class="igBar"><span id="lsql-32"><a href="#" onclick="javascript:showPlainTxt('sql-32'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-32">
<div class="sql">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`t1`</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET=utf8,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">MODIFY</span> <span style="color: #993333; font-weight: bold;">COLUMN</span> <span style="color: #ff0000;">`c1`</span> text CHARACTER <span style="color: #993333; font-weight: bold;">SET</span> utf8; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This approach will both change the default character set for the table and target column, while leaving in place any FULLTEXT indexes.  It also requires only a single ALTER statement for a given table.  A perl script has been put together to parallel-ize the ALTER statements and is available at:</p>
<div class="igBar"><span id="lcode-33"><a href="#" onclick="javascript:showPlainTxt('code-33'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-33">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">%&gt; wget http:<span style="color:#FF9933; font-style:italic;">//www.pablowe.net/convert_charset </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>It will be added to <a href="https://code.launchpad.net/perconatools" target="#">Percona Tools</a> on Launchpad (or perhaps <a href="http://www.maatkit.org/" target="#">maatkit</a>, if it proves useful enough) once it is feature complete.  Outstanding issues include:</p>
<p>- Proper handling of string foreign keys (currently fails, but you probably shouldn't be using strings as foreign keys anyway ...)<br />
- Allow throttling of the number of threads created (currently creates one per table)</p>
<div class="igBar"><span id="lcode-34"><a href="#" onclick="javascript:showPlainTxt('code-34'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-34">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Usage:</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">convert_charset --database=database <span style="color:#006600; font-weight:bold;">&#91;</span>options<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Options:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">--askpass&nbsp; &nbsp; &nbsp; &nbsp; Prompt for a MySQL password</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">--charset&nbsp; &nbsp; &nbsp; &nbsp; The target character set to convert to</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">--collate&nbsp; &nbsp; &nbsp; &nbsp; The target collation to convert to</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">--database|d&nbsp; &nbsp; &nbsp;The target database</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">--help|?&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Display this help and exit</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">--host|h&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;The target host</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">--ignore-columns Columns to ignore, useful if you want to</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">keep the existing charset for a target column</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Comma-separated.&nbsp; <span style="">NO</span> SPACES.</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">table</span>.<span style="">column</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">--ignore-tables&nbsp; A comma-separated list of tables to ignore</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">--password|p&nbsp; &nbsp; &nbsp;The MySQL password to use</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">--port&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;The target port</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">--tables&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;A comma-separated list of tables to convert.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">All</span> non-named tables will be ignored</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">--test&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Print the ALTER statements that would be executed</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">without executing them.</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">--user|u&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;The MySQL user</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">--version|V&nbsp; &nbsp; &nbsp; Display version information and exit</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">defaults are:</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ATTRIBUTE&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VALUE</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">-------------------------- ------------------</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">askpass&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FALSE</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">charset&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; utf8</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">collate&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; No Default Value</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">database&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;No Default Value</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">help&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FALSE</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">host&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;localhost</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ignore-columns&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;No Default Value</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ignore-tables&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; No Default Value</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">password&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;No Default Value</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">port&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">3306</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">tables&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;No Default Value</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">test&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FALSE</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">user&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Current User</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">version&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FALSE </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>Entry posted by Ryan Lowe |
      <a href="http://www.mysqlperformanceblog.com/2009/03/17/converting-character-sets/#comments">14 comments</a></p>
    <p>Add to: <a href="http://del.icio.us/post?url=http://www.mysqlperformanceblog.com/2009/03/17/converting-character-sets/&amp;title=Converting Character Sets" title="Bookmark this post on del.icio.us"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/delicious.png" alt="delicious" /></a> | <a href="http://digg.com/submit?phase=2&amp;url=http://www.mysqlperformanceblog.com/2009/03/17/converting-character-sets/&amp;title=Converting Character Sets" title="Digg this post on Digg.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/digg.png" alt="digg" /></a> | <a href="http://reddit.com/submit?url=http://www.mysqlperformanceblog.com/2009/03/17/converting-character-sets/&amp;title=Converting Character Sets" title="Submit this post on reddit.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/reddit.png" alt="reddit" /></a> | <a href="http://www.netscape.com/submit/?U=http://www.mysqlperformanceblog.com/2009/03/17/converting-character-sets/&amp;T=Converting Character Sets" title="Vote for this article on Netscape"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/netscape.gif" alt="netscape" /></a> | <a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mysqlperformanceblog.com/2009/03/17/converting-character-sets/&amp;title=Converting Character Sets" title="Add to Google Bookmarks"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/google.png" alt="Google Bookmarks" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlperformanceblog.com/2009/03/17/converting-character-sets/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>
