<?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>Gary Pendergast &#187; MySQL</title> <atom:link href="http://pento.net/tag/mysql/feed/" rel="self" type="application/rss+xml" /><link>http://pento.net</link> <description>I&#039;m on the Internet</description> <lastBuildDate>Sat, 03 Dec 2011 09:27:46 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <cloud
domain='pento.net' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' /> <item><title>Partitioning the WordPress Comments Table</title><link>http://pento.net/2011/04/28/partitioning-the-wordpress-comments-table/</link> <comments>http://pento.net/2011/04/28/partitioning-the-wordpress-comments-table/#comments</comments> <pubDate>Thu, 28 Apr 2011 07:19:41 +0000</pubDate> <dc:creator>Gary</dc:creator> <category><![CDATA[MySQL]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[Partitioning]]></category> <guid
isPermaLink="false">http://pento.net/?p=579</guid> <description><![CDATA[WordPress sites can get big. Really big. When you&#8217;re looking at a site of Cheezburger, Engadget or Techcrunch proportions, you get hundreds of comments per post, on dozens of posts per day, which adds up to millions of comments per year. In order to keep your site running in top condition, you don&#8217;t want to [...]]]></description> <content:encoded><![CDATA[<p>WordPress sites can get big. Really big. When you&#8217;re looking at a site of Cheezburger, Engadget or Techcrunch proportions, you get hundreds of comments per post, on dozens of posts per day, which adds up to millions of comments per year.</p><p>In order to keep your site running in top condition, you don&#8217;t want to be running queries against tables with lots of rarely accessed rows, which is what happens with most comments &#8211; after the post drops off the front page, readership drops, so the comments are viewed much less frequently. So, what we want to do is remove these old comments from the primary comment table, but keep them handy, for when people read the archives.</p><p>Enter partitioning.</p><p>The idea of MySQL partitioning is that it splits tables up into multiple logical tablespaces, based on your criteria. Running a query on a single partition of a large table is much faster than running it across the entire table, even with appropriate indexes.</p><p>In the case of the WordPress comments table, splitting it up by the `comment_post_ID` seems to be the most appropriate . This should keep the partitions to a reasonable size, and ensure that there&#8217;s minimal cross-over between partitions.</p><p>First off, we need to add the `comment_post_ID` column to the Primary Key. This can be a slow process if you already have a massive `wp_comments` table, so you may need to schedule some downtime to handle this. Alternatively, there many methods for making schema changes with no downtime, such as judicious use of Replication, Facebook&#8217;s <a
href="https://www.facebook.com/notes/mysql-at-facebook/online-schema-change-for-mysql/430801045932">Online Schema Change Tool</a>, or the currently-in-development <a
href="http://code.google.com/p/maatkit/issues/detail?id=1268">mk-online-schema-change</a>, for Maatkit.</p><div
class="wp_syntax"><div
class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">ALTER</span> <span style="color: #990099; font-weight: bold;">TABLE</span> wp_comments <span style="color: #990099; font-weight: bold;">DROP</span> <span style="color: #990099; font-weight: bold;">PRIMARY KEY</span><span style="color: #000033;">,</span> <span style="color: #990099; font-weight: bold;">ADD</span> <span style="color: #990099; font-weight: bold;">PRIMARY KEY</span> <span style="color: #FF00FF;">&#40;</span>comment_ID<span style="color: #000033;">,</span> comment_post_ID<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></pre></div></div><p>Now that we&#8217;ve altered this index, we can define the partitions. For this example, we&#8217;ll say we want the comments for 1000 posts per partition. This query can take a long time to run, if you already have many comments in your system.</p><div
class="wp_syntax"><div
class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">ALTER</span> <span style="color: #990099; font-weight: bold;">TABLE</span> wp_comments PARTITION BY RANGE<span style="color: #FF00FF;">&#40;</span>comment_post_ID<span style="color: #FF00FF;">&#41;</span> <span style="color: #FF00FF;">&#40;</span>
    PARTITION p0 <span style="color: #990099; font-weight: bold;">VALUES</span> LESS THAN <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">1000</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span>
    PARTITION p1 <span style="color: #990099; font-weight: bold;">VALUES</span> LESS THAN <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">2000</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span>
    PARTITION p2 <span style="color: #990099; font-weight: bold;">VALUES</span> LESS THAN <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">3000</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span>
    PARTITION p3 <span style="color: #990099; font-weight: bold;">VALUES</span> LESS THAN <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">4000</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span>
    PARTITION p4 <span style="color: #990099; font-weight: bold;">VALUES</span> LESS THAN <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">5000</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span>
    PARTITION p5 <span style="color: #990099; font-weight: bold;">VALUES</span> LESS THAN <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">6000</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span>
    PARTITION p6 <span style="color: #990099; font-weight: bold;">VALUES</span> LESS THAN MAXVALUE
<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></pre></div></div><p>When you&#8217;re approaching the next partition divider value, adding a new partition is simple. For example, you&#8217;d run this query around post 6000.</p><div
class="wp_syntax"><div
class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">ALTER</span> <span style="color: #990099; font-weight: bold;">TABLE</span> wp_comments REORGANIZE PARTITION p6 <span style="color: #990099; font-weight: bold;">INTO</span> <span style="color: #FF00FF;">&#40;</span>
    PARTITION p6 <span style="color: #990099; font-weight: bold;">VALUES</span> LESS THAN <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">7000</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span>
    PARTITION p7 <span style="color: #990099; font-weight: bold;">VALUES</span> LESS THAN MAXVALUE
<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></pre></div></div><p>Naturally, this process is most useful for very large WordPress sites. If you&#8217;re starting a new site with big plans, however, you may just want to factor this into your architecture.</p><p><strong>UPDATE:</strong> Changed the partition definition to better reflect how WordPress uses the wp_comments table, per Giuseppe&#8217;s comments.</p> ]]></content:encoded> <wfw:commentRss>http://pento.net/2011/04/28/partitioning-the-wordpress-comments-table/feed/</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Welcome, SkySQL!</title><link>http://pento.net/2010/10/12/welcome-skysql/</link> <comments>http://pento.net/2010/10/12/welcome-skysql/#comments</comments> <pubDate>Tue, 12 Oct 2010 10:04:49 +0000</pubDate> <dc:creator>Gary</dc:creator> <category><![CDATA[MySQL]]></category> <category><![CDATA[SkySQL]]></category> <guid
isPermaLink="false">http://pento.net/?p=545</guid> <description><![CDATA[It seems the SkySQL website just went live, which I hope will breath some life back into the MySQL ecosphere &#8211; it&#8217;s been a while since there&#8217;s been some new competition, especially in the style of classic MySQL services. For those too lazy to read the SkySQL site, the services offered are similar to what [...]]]></description> <content:encoded><![CDATA[<p>It seems the <a
href="http://skysql.com/">SkySQL website</a> just went live, which I hope will breath some life back into the MySQL ecosphere &#8211; it&#8217;s been a while since there&#8217;s been some new competition, especially in the style of classic MySQL services.</p><p>For those too lazy to read the SkySQL site, the services offered are similar to what you&#8217;d be familiar with from Oracle:</p><ul><li>SkySQL&#8217;s <a
href="http://skysql.com/en/services/consulting">Consulting</a> and <a
href="http://skysql.com/en/services/training">Training</a> are pretty much the same as Oracle&#8217;s <a
href="http://www.mysql.com/consulting/">existing</a> <a
href="http://www.mysql.com/training/">offerings</a>, though a bit more limited. I expect this to grow as SkySQL grows, however.</li><li>SkySQL&#8217;s <a
href="http://skysql.com/en/products/skysql-enterprise">Support</a> has been simplified slightly, removing the equivalent of MySQL Enterprise Gold support.</li><li>They are offering monitoring and query editing, (which Oracle offers with <a
href="http://www.mysql.com/products/enterprise/monitor.html">MySQL Enterprise Monitor</a>, and <a
href="http://www.mysql.com/products/workbench/">MySQL Workbench</a>) through what I can only assume are branded versions of <a
href="http://www.webyog.com/">Webyog</a>&#8216;s MONyog and SQLyog. A smart move on their part &#8211; rather than having to develop something in house on a startup budget and timeframe, they can offer a mature product off the bat.</li></ul><p>Sadly, prices aren&#8217;t listed, so we can&#8217;t really compare that.</p><p>I do hope to see SkySQL evolve further &#8211; I count many of SkySQL&#8217;s founding employees as friends, and I know they won&#8217;t stop at just offering the same services as Oracle. I&#8217;m always a fan of a bit of friendly competition! <img
src='http://pento.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>Lycka till, SkySQL!</p> ]]></content:encoded> <wfw:commentRss>http://pento.net/2010/10/12/welcome-skysql/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Leaving MySQL (Not Really)</title><link>http://pento.net/2009/06/05/leaving-mysql-not-really/</link> <comments>http://pento.net/2009/06/05/leaving-mysql-not-really/#comments</comments> <pubDate>Fri, 05 Jun 2009 21:50:18 +0000</pubDate> <dc:creator>Gary</dc:creator> <category><![CDATA[MySQL]]></category> <category><![CDATA[Travel]]></category> <guid
isPermaLink="false">http://pento.net/?p=248</guid> <description><![CDATA[I&#8217;ve been a bit slack about writing my MySQL thoughts of late. This would be caused by the fact that, as I write this, I&#8217;m now one week into a 12 month leave of absence from MySQL. Having given it much careful consideration, I&#8217;ve decided that the wisest way to survive the current economic problems [...]]]></description> <content:encoded><![CDATA[<p>I&#8217;ve been a bit slack about writing my MySQL thoughts of late. This would be caused by the fact that, as I write this, I&#8217;m now one week into a 12 month leave of absence from MySQL.</p><p>Having given it much careful consideration, I&#8217;ve decided that the wisest way to survive the current economic problems is by blowing my savings on a year long holiday in Italy. Wait, did I say holiday? Not really. I&#8217;m still a Sun employee, and I&#8217;m still going to be active in the MySQL community. My dear support customers just won&#8217;t be seeing me around for a while. <img
src='http://pento.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>I&#8217;m looking forward to having time to write more extensively about some of the cool things we&#8217;re doing, and what&#8217;s going on in the community at large. If there&#8217;s anything you&#8217;d like to hear about (either expanding on <a
href="http://pento.net/category/mysql/">my previous posts</a>, or a completely new topic), please let me know.</p><p>Another thing I&#8217;d like to do, if there are any interested parties, is to see how companies are using MySQL in their part of the world. So, if you don&#8217;t mind showing off what you&#8217;re doing and having me write a little bit about it, feel free to drop me a line. All of my current contact details can be found on <a
href="http://pento.net/contact/">my contact page</a>. I&#8217;m going to be primarily based in Milan, but I&#8217;ll be looking to travel around the rest of Europe at some point, so I&#8217;d be more than happy to stop by and see you if the opportunity arises.</p> ]]></content:encoded> <wfw:commentRss>http://pento.net/2009/06/05/leaving-mysql-not-really/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>MySQL and Geospatial Data</title><link>http://pento.net/2009/05/18/mysql-and-geospatial-data/</link> <comments>http://pento.net/2009/05/18/mysql-and-geospatial-data/#comments</comments> <pubDate>Mon, 18 May 2009 01:08:12 +0000</pubDate> <dc:creator>Gary</dc:creator> <category><![CDATA[MySQL]]></category> <category><![CDATA[GIS]]></category> <guid
isPermaLink="false">http://pento.net/?p=242</guid> <description><![CDATA[MySQL has had basic support for Geospatial Data since 4.1, but has lacked some of the features of the OpenGIS specifications since then. The good news is, this is rapidly changing. Our own Holyfoot has been hammering away at WorkLog #1327, to provide precise functions for our GIS support. Even better, it&#8217;s fast. How fast? [...]]]></description> <content:encoded><![CDATA[<p>MySQL has had basic support for Geospatial Data since 4.1, but has lacked some of the features of the <a
href="http://www.opengeospatial.org/">OpenGIS</a> specifications since then. The good news is, this is rapidly changing. Our own Holyfoot has been hammering away at <a
href="http://forge.mysql.com/worklog/task.php?id=1326">WorkLog #1327</a>, to provide precise functions for our GIS support.</p><p>Even better, it&#8217;s fast. How fast? Well, the good people at Oki Labs, apart from having implemented <a
href="http://okilab.jp/blog/2008/07/distance_sphere_distance_spher.html">several new GIS functions</a> for MySQL, have done some benchmarking, and it&#8217;s looking good. If you&#8217;ll excuse the cliched comparison to Postgres, here are the response times (seconds) of MySQL GIS vs. PostGIS in Oki&#8217;s test:</p><table><tbody><tr><th>Connections</th><th> PostGIS</th><th> MySQL</th></tr><tr><td>1</td><td>1.817</td><td>0.220</td></tr><tr><td>100</td><td>10.517</td><td>0.557</td></tr></tbody></table><p>Source: <a
href="http://www.osgeo.jp/wordpress/wp-content/uploads/2008/11/foss4g2008_okumura.pdf">http://www.osgeo.jp/wordpress/wp-content/uploads/2008/11/foss4g2008_okumura.pdf</a></p><p>If you&#8217;re interested in checking it out, the source tree (regularly merged with MySQL 5.1) is available <a
href="https://code.launchpad.net/~mysql/mysql-server/mysql-5.1-wl1326">here</a>. Have a look at Giuseppe&#8217;s guide to <a
href="http://datacharmer.blogspot.com/2008/06/from-bazaar-to-sandbox-in-5-moves.html">running a Bazaar export</a> in <a
href="https://launchpad.net/mysql-sandbox">MySQL Sandbox</a>.</p> ]]></content:encoded> <wfw:commentRss>http://pento.net/2009/05/18/mysql-and-geospatial-data/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Open Database Alliance = Awesome</title><link>http://pento.net/2009/05/14/open-database-alliance-awesome/</link> <comments>http://pento.net/2009/05/14/open-database-alliance-awesome/#comments</comments> <pubDate>Thu, 14 May 2009 00:13:28 +0000</pubDate> <dc:creator>Gary</dc:creator> <category><![CDATA[MySQL]]></category> <category><![CDATA[ODA]]></category> <guid
isPermaLink="false">http://pento.net/?p=236</guid> <description><![CDATA[The big news coming from the MySQL Community today is that Monty Widenius and Percona have founded the Open Database Alliance, a group focused on &#8221;unifing all MySQL-related development and services, providing a solution to the fragmentation and uncertainty facing the communities, businesses and technical experts involved with MySQL&#8221;. I, for one, am 100% behind this. [...]]]></description> <content:encoded><![CDATA[<p>The big news coming from the MySQL Community today is that Monty Widenius and Percona have founded the <a
href="http://opendatabasealliance.com/">Open Database Alliance</a>, a group focused on &#8221;unifing all MySQL-related development and services, providing a solution to the fragmentation and uncertainty facing the communities, businesses and technical experts involved with MySQL&#8221;.</p><p>I, for one, am 100% behind this. I&#8217;ve always been a big fan of community foundations being a focus point for development efforts, they work well to bring everyone together, and to provide a sensible foundation to help avoid much of the uncertainty that seems to spring up around MySQL. I certainly hope that the ODA is able to do the same.</p><p>Though I do have one question, how does the ODA plan on handling competing members? If you have two companies offering the same service in the same market, which one will the ODA recommend? Monty specifically says that &#8220;all companies that are joining the Alliance should bring something to the table&#8221;, but it&#8217;s a bit difficult to bring something new when there are already several large players in the MySQL market.</p><p>I shall certainly be watching the progress of this alliance with great interest, it has the potential to turn the MySQL Community into a large driving force for development and change.</p><p>The press release is available <a
href="http://www.prweb.com/releases/2009/05/prweb2417854.htm">here</a>, Monty has written some interesting thoughts about it <a
href="http://monty-says.blogspot.com/2009/05/open-database-alliance-founded.html">here</a>.</p> ]]></content:encoded> <wfw:commentRss>http://pento.net/2009/05/14/open-database-alliance-awesome/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Don&#8217;t Forget to Alter your Federated Tables!</title><link>http://pento.net/2009/05/05/dont-forget-to-alter-your-federated-tables/</link> <comments>http://pento.net/2009/05/05/dont-forget-to-alter-your-federated-tables/#comments</comments> <pubDate>Tue, 05 May 2009 08:40:47 +0000</pubDate> <dc:creator>Gary</dc:creator> <category><![CDATA[MySQL]]></category> <category><![CDATA[federated]]></category> <guid
isPermaLink="false">http://pento.net/?p=229</guid> <description><![CDATA[If you&#8217;re using the Federated engine, here&#8217;s something important to remember (apart from the usual advice of &#8220;please don&#8217;t&#8221;). If you need to change the structure of the remote table, always remember to update the Federated table. If not, when you try to use the table, you&#8217;ll get this error: mysql&#62; SELECT * FROM foo; [...]]]></description> <content:encoded><![CDATA[<p>If you&#8217;re using the Federated engine, here&#8217;s something important to remember (apart from the usual advice of &#8220;please don&#8217;t&#8221;). If you need to change the structure of the remote table, always remember to update the Federated table. If not, when you try to use the table, you&#8217;ll get this error:</p><div
class="wp_syntax"><div
class="code"><pre class="mysql" style="font-family:monospace;">mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> foo<span style="color: #000033;">;</span>
ERROR <span style="color: #008080;">1030</span> <span style="color: #FF00FF;">&#40;</span>HY000<span style="color: #FF00FF;">&#41;</span>: Got error <span style="color: #008080;">1</span> <span style="color: #990099; font-weight: bold;">from</span> storage <span style="color: #990099; font-weight: bold;">engine</span></pre></div></div><p>This error isn&#8217;t really helpful. The problem is, the Federated engine only checks that the remote table structure is correct when it initially connects. Once it has connected, no more checks. When you restart the server, you get a much more helpful message:</p><div
class="wp_syntax"><div
class="code"><pre class="mysql" style="font-family:monospace;">mysql <span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> foo<span style="color: #000033;">;</span>
ERROR <span style="color: #008080;">1431</span> <span style="color: #FF00FF;">&#40;</span>HY000<span style="color: #FF00FF;">&#41;</span>: The foreign <span style="color: #990099; font-weight: bold;">data</span> source you are trying <span style="color: #990099; font-weight: bold;">to</span> reference does <span style="color: #CC0099; font-weight: bold;">not</span> exist. <span style="color: #990099; font-weight: bold;">Data</span> source error:  error: <span style="color: #008080;">1054</span>  <span style="color: #008000;">'Unknown column '</span>b<span style="color: #008000;">' in '</span><span style="color: #000099;">field</span> list<span style="color: #008000;">''</span></pre></div></div><p>Also, keep your eye on the <a
title="FederatedX Storage Engine project page" href="http://forge.mysql.com/projects/project.php?id=265">FederatedX</a> project. It&#8217;s still under development, but will hopefully upgrade the Federated engine to being useful again.</p> ]]></content:encoded> <wfw:commentRss>http://pento.net/2009/05/05/dont-forget-to-alter-your-federated-tables/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>MySQL is People!</title><link>http://pento.net/2009/05/03/mysql-is-people/</link> <comments>http://pento.net/2009/05/03/mysql-is-people/#comments</comments> <pubDate>Sun, 03 May 2009 11:38:01 +0000</pubDate> <dc:creator>Gary</dc:creator> <category><![CDATA[MySQL]]></category> <category><![CDATA[skydiving]]></category> <guid
isPermaLink="false">http://pento.net/?p=220</guid> <description><![CDATA[I went skydiving yesterday. Here&#8217;s a short video of me voluntarily leaving an airborne and perfectly sound aeroplane: What does this have to do with MySQL? Well, over the past few weeks there have been a bunch of conspiracy theories bouncing around. There are various topics, but the two favourite at the moment happen to [...]]]></description> <content:encoded><![CDATA[<p>I went skydiving yesterday. Here&#8217;s a short video of me voluntarily leaving an airborne and perfectly sound aeroplane:</p><p
style="text-align: center;"><object
type="application/x-shockwave-flash" style="width:480px; height:385px;" data="http://www.youtube.com/v/Qern2XzU3sg"><param
name="movie" value="http://www.youtube.com/v/Qern2XzU3sg" /></object></p><p>What does this have to do with MySQL? Well, over the past few weeks there have been a bunch of conspiracy theories bouncing around. There are various topics, but the two favourite at the moment happen to be Oracle&#8217;s plans for MySQL, and the licensing of the MySQL documentation. There has been a long history of conspiracies surrounding MySQL, from Oracle&#8217;s original purchase of InnoDB, to our decision to create the Enterprise edition of the server, through to our long and bumpy release cycle.</p><p>Now, don&#8217;t get me wrong. I&#8217;m not making any calls to stifle discussion, I&#8217;m a big fan of community input. I was a member of the community before I joined MySQL, and I like to think that I still am. But I would like it if we could at least think about conspiracy theories before posting about them. We&#8217;re all people here at MySQL, we have evenings and weekends and lives just like you. Some of us are crazy enough to do silly things like jumping out of aeroplanes. We&#8217;re not out to get you, and we&#8217;re certainly not planning on turning into some sort of faceless corporate stereotype. We&#8217;re here to do what we love, creating and supporting a really good product.</p><p>Oh, and how do you know this isn&#8217;t some corporate play to make us seem human? Well, it&#8217;s 9:30pm on a Sunday night here, I&#8217;m yet to find a company who could pay me well enough to be shilling for them. But MySQL happens to be a group of people I like enough to defend them on my own time.</p> ]]></content:encoded> <wfw:commentRss>http://pento.net/2009/05/03/mysql-is-people/feed/</wfw:commentRss> <slash:comments>11</slash:comments> </item> <item><title>MySQL Workbench: My Impressions</title><link>http://pento.net/2009/04/17/mysql-workbench-my-impressions/</link> <comments>http://pento.net/2009/04/17/mysql-workbench-my-impressions/#comments</comments> <pubDate>Fri, 17 Apr 2009 10:23:37 +0000</pubDate> <dc:creator>Gary</dc:creator> <category><![CDATA[MySQL]]></category> <category><![CDATA[MySQL Workbench]]></category> <guid
isPermaLink="false">http://pento.net/?p=217</guid> <description><![CDATA[I&#8217;ve been using the MySQL Workbench 5.1 beta for the past few days now, and I&#8217;m wondering how I designed databases without it. Okay, so that&#8217;s a pretty strong statement, but I&#8217;m genuinely happy with it. 5.1 has fixed my main problem with 5.0, in that the EER diagram mode was horribly slow to render, [...]]]></description> <content:encoded><![CDATA[<p>I&#8217;ve been using the MySQL Workbench 5.1 beta for the past few days now, and I&#8217;m wondering how I designed databases without it.</p><p>Okay, so that&#8217;s a pretty strong statement, but I&#8217;m genuinely happy with it. 5.1 has fixed my main problem with 5.0, in that the EER diagram mode was horribly slow to render, now it&#8217;s all nice and smooth. The ability to easily visualise tables and their relationships makes design very simple.</p><p>In fact, I really only have one (minor) complaint, the ability to export without foreign keys would be nice. Sometimes you just don&#8217;t want to deal with the performance hit.</p><p>That&#8217;s about it. Go and download the <a
title="MySQL Workbench OSS 5.1 Beta download" href="http://dev.mysql.com/downloads/workbench/5.1.html#Workbench_5.1_Beta_-_Binaries_and_Source">OSS edition for free now</a>, have a play around. Make it your Friday afternoon experiment. I promise you&#8217;ll like it.</p> ]]></content:encoded> <wfw:commentRss>http://pento.net/2009/04/17/mysql-workbench-my-impressions/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Backing up permissions for individual databases</title><link>http://pento.net/2009/03/12/backing-up-permissions-for-individual-databases/</link> <comments>http://pento.net/2009/03/12/backing-up-permissions-for-individual-databases/#comments</comments> <pubDate>Thu, 12 Mar 2009 01:00:38 +0000</pubDate> <dc:creator>Gary</dc:creator> <category><![CDATA[MySQL]]></category> <category><![CDATA[backup]]></category> <category><![CDATA[mysqldump]]></category> <category><![CDATA[permissions]]></category> <category><![CDATA[users]]></category> <guid
isPermaLink="false">http://pento.net/?p=120</guid> <description><![CDATA[Sometimes, you want to backup individual databases in MySQL to move to a different server. This part is easy using mysqldump: shell> mysqldump -u root -p --databases db1 db2 ... > backup.sql The problem is, what happens when you want to backup the permissions associated with these databases? Well, here are a few queries to [...]]]></description> <content:encoded><![CDATA[<p>Sometimes, you want to backup individual databases in MySQL to move to a different server. This part is easy using mysqldump:</p><pre>
shell> mysqldump -u root -p --databases db1 db2 ... > backup.sql
</pre><p>The problem is, what happens when you want to backup the permissions associated with these databases? Well, here are a few queries to help you out.</p><div
class="wp_syntax"><div
class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">-- Grab the users with global permissions, </span>
<span style="color: #808080; font-style: italic;">-- with permissions to the databases you want, </span>
<span style="color: #808080; font-style: italic;">-- and tables/stored procedures in it.</span>
mysql<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">SELECT</span> u<span style="color: #66cc66;">.*</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #993333; font-weight: bold;">OUTFILE</span> <span style="color: #ff0000;">'/tmp/user.txt'</span>
	<span style="color: #993333; font-weight: bold;">FIELDS</span> <span style="color: #993333; font-weight: bold;">TERMINATED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">','</span> <span style="color: #993333; font-weight: bold;">OPTIONALLY</span> <span style="color: #993333; font-weight: bold;">ENCLOSED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'&quot;'</span> <span style="color: #993333; font-weight: bold;">ESCAPED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\\</span>'</span>
	<span style="color: #993333; font-weight: bold;">LINES</span> <span style="color: #993333; font-weight: bold;">TERMINATED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span>
	<span style="color: #993333; font-weight: bold;">FROM</span>
		mysql<span style="color: #66cc66;">.</span><span style="color: #993333; font-weight: bold;">USER</span> u
	<span style="color: #993333; font-weight: bold;">WHERE</span>
		u<span style="color: #66cc66;">.</span>Select_priv<span style="color: #66cc66;">=</span><span style="color: #ff0000;">'Y'</span>
	<span style="color: #993333; font-weight: bold;">UNION</span>
	<span style="color: #993333; font-weight: bold;">SELECT</span> u<span style="color: #66cc66;">.*</span>
	<span style="color: #993333; font-weight: bold;">FROM</span>
		mysql<span style="color: #66cc66;">.</span><span style="color: #993333; font-weight: bold;">USER</span> u<span style="color: #66cc66;">,</span>
		mysql<span style="color: #66cc66;">.</span>db d
	<span style="color: #993333; font-weight: bold;">WHERE</span>
		d<span style="color: #66cc66;">.</span>Db <span style="color: #993333; font-weight: bold;">IN</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'db1'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'db2'</span><span style="color: #66cc66;">,</span> <span style="color: #66cc66;">...</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AND</span>
		d<span style="color: #66cc66;">.</span><span style="color: #993333; font-weight: bold;">USER</span> <span style="color: #66cc66;">=</span> u<span style="color: #66cc66;">.</span><span style="color: #993333; font-weight: bold;">USER</span>
	<span style="color: #993333; font-weight: bold;">UNION</span>
	<span style="color: #993333; font-weight: bold;">SELECT</span> u<span style="color: #66cc66;">.*</span>
	<span style="color: #993333; font-weight: bold;">FROM</span>
		mysql<span style="color: #66cc66;">.</span><span style="color: #993333; font-weight: bold;">USER</span> u<span style="color: #66cc66;">,</span>
		mysql<span style="color: #66cc66;">.</span>tables_priv t
	<span style="color: #993333; font-weight: bold;">WHERE</span>
		t<span style="color: #66cc66;">.</span>Db <span style="color: #993333; font-weight: bold;">IN</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'db1'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'db2'</span><span style="color: #66cc66;">,</span> <span style="color: #66cc66;">...</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AND</span>
		t<span style="color: #66cc66;">.</span><span style="color: #993333; font-weight: bold;">USER</span> <span style="color: #66cc66;">=</span> u<span style="color: #66cc66;">.</span><span style="color: #993333; font-weight: bold;">USER</span>
	<span style="color: #993333; font-weight: bold;">UNION</span>
	<span style="color: #993333; font-weight: bold;">SELECT</span> u<span style="color: #66cc66;">.*</span>
	<span style="color: #993333; font-weight: bold;">FROM</span>
		mysql<span style="color: #66cc66;">.</span><span style="color: #993333; font-weight: bold;">USER</span> u<span style="color: #66cc66;">,</span>
		mysql<span style="color: #66cc66;">.</span>procs_priv p
	<span style="color: #993333; font-weight: bold;">WHERE</span>
		p<span style="color: #66cc66;">.</span>Db <span style="color: #993333; font-weight: bold;">IN</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'db1'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'db2'</span><span style="color: #66cc66;">,</span> <span style="color: #66cc66;">...</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AND</span>
		p<span style="color: #66cc66;">.</span><span style="color: #993333; font-weight: bold;">USER</span> <span style="color: #66cc66;">=</span> u<span style="color: #66cc66;">.</span><span style="color: #993333; font-weight: bold;">USER</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">-- Now, grab the database permissions, and those of objects in the database.</span>
mysql<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #993333; font-weight: bold;">OUTFILE</span> <span style="color: #ff0000;">'/tmp/db.txt'</span>
	<span style="color: #993333; font-weight: bold;">FIELDS</span> <span style="color: #993333; font-weight: bold;">TERMINATED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">','</span> <span style="color: #993333; font-weight: bold;">OPTIONALLY</span> <span style="color: #993333; font-weight: bold;">ENCLOSED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'&quot;'</span> <span style="color: #993333; font-weight: bold;">ESCAPED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\\</span>'</span>
	<span style="color: #993333; font-weight: bold;">LINES</span> <span style="color: #993333; font-weight: bold;">TERMINATED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span>
	<span style="color: #993333; font-weight: bold;">FROM</span>
		mysql<span style="color: #66cc66;">.</span>db
	<span style="color: #993333; font-weight: bold;">WHERE</span>
		Db <span style="color: #993333; font-weight: bold;">IN</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'db1'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'db2'</span><span style="color: #66cc66;">,</span> <span style="color: #66cc66;">...</span><span style="color: #66cc66;">&#41;</span>;
mysql<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #993333; font-weight: bold;">OUTFILE</span> <span style="color: #ff0000;">'/tmp/tables_priv.txt'</span>
	<span style="color: #993333; font-weight: bold;">FIELDS</span> <span style="color: #993333; font-weight: bold;">TERMINATED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">','</span> <span style="color: #993333; font-weight: bold;">OPTIONALLY</span> <span style="color: #993333; font-weight: bold;">ENCLOSED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'&quot;'</span> <span style="color: #993333; font-weight: bold;">ESCAPED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\\</span>'</span>
	<span style="color: #993333; font-weight: bold;">LINES</span> <span style="color: #993333; font-weight: bold;">TERMINATED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span>
	<span style="color: #993333; font-weight: bold;">FROM</span>
		mysql<span style="color: #66cc66;">.</span>tables_priv
	<span style="color: #993333; font-weight: bold;">WHERE</span>
		Db <span style="color: #993333; font-weight: bold;">IN</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'db1'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'db2'</span><span style="color: #66cc66;">,</span> <span style="color: #66cc66;">...</span><span style="color: #66cc66;">&#41;</span>;
mysql<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #993333; font-weight: bold;">OUTFILE</span> <span style="color: #ff0000;">'/tmp/procs_priv.txt'</span>
	<span style="color: #993333; font-weight: bold;">FIELDS</span> <span style="color: #993333; font-weight: bold;">TERMINATED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">','</span> <span style="color: #993333; font-weight: bold;">OPTIONALLY</span> <span style="color: #993333; font-weight: bold;">ENCLOSED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'&quot;'</span> <span style="color: #993333; font-weight: bold;">ESCAPED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\\</span>'</span>
	<span style="color: #993333; font-weight: bold;">LINES</span> <span style="color: #993333; font-weight: bold;">TERMINATED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span>
	<span style="color: #993333; font-weight: bold;">FROM</span>
		mysql<span style="color: #66cc66;">.</span>procs_priv
	<span style="color: #993333; font-weight: bold;">WHERE</span>
		Db <span style="color: #993333; font-weight: bold;">IN</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'db1'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'db2'</span><span style="color: #66cc66;">,</span> <span style="color: #66cc66;">...</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div><p>Then, re-loading the permissions onto the new server is simple:</p><div
class="wp_syntax"><div
class="code"><pre class="sql" style="font-family:monospace;">mysql<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">LOAD</span> <span style="color: #993333; font-weight: bold;">DATA</span> <span style="color: #993333; font-weight: bold;">INFILE</span> <span style="color: #ff0000;">'/tmp/user.txt'</span>
	<span style="color: #993333; font-weight: bold;">FIELDS</span> <span style="color: #993333; font-weight: bold;">TERMINATED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">','</span> <span style="color: #993333; font-weight: bold;">OPTIONALLY</span> <span style="color: #993333; font-weight: bold;">ENCLOSED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'&quot;'</span> <span style="color: #993333; font-weight: bold;">ESCAPED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\\</span>'</span>
	<span style="color: #993333; font-weight: bold;">LINES</span> <span style="color: #993333; font-weight: bold;">TERMINATED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span>
	<span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #993333; font-weight: bold;">TABLE</span> mysql<span style="color: #66cc66;">.</span><span style="color: #993333; font-weight: bold;">USER</span>;
mysql<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">LOAD</span> <span style="color: #993333; font-weight: bold;">DATA</span> <span style="color: #993333; font-weight: bold;">INFILE</span> <span style="color: #ff0000;">'/tmp/db.txt'</span>
	<span style="color: #993333; font-weight: bold;">FIELDS</span> <span style="color: #993333; font-weight: bold;">TERMINATED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">','</span> <span style="color: #993333; font-weight: bold;">OPTIONALLY</span> <span style="color: #993333; font-weight: bold;">ENCLOSED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'&quot;'</span> <span style="color: #993333; font-weight: bold;">ESCAPED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\\</span>'</span>
	<span style="color: #993333; font-weight: bold;">LINES</span> <span style="color: #993333; font-weight: bold;">TERMINATED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span>
	<span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #993333; font-weight: bold;">TABLE</span> mysql<span style="color: #66cc66;">.</span>db;
mysql<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">LOAD</span> <span style="color: #993333; font-weight: bold;">DATA</span> <span style="color: #993333; font-weight: bold;">INFILE</span> <span style="color: #ff0000;">'/tmp/tables_priv.txt'</span>
	<span style="color: #993333; font-weight: bold;">FIELDS</span> <span style="color: #993333; font-weight: bold;">TERMINATED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">','</span> <span style="color: #993333; font-weight: bold;">OPTIONALLY</span> <span style="color: #993333; font-weight: bold;">ENCLOSED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'&quot;'</span> <span style="color: #993333; font-weight: bold;">ESCAPED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\\</span>'</span>
	<span style="color: #993333; font-weight: bold;">LINES</span> <span style="color: #993333; font-weight: bold;">TERMINATED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span>
	<span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #993333; font-weight: bold;">TABLE</span> mysql<span style="color: #66cc66;">.</span>tables_priv;
mysql<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">LOAD</span> <span style="color: #993333; font-weight: bold;">DATA</span> <span style="color: #993333; font-weight: bold;">INFILE</span> <span style="color: #ff0000;">'/tmp/procs_priv.txt'</span>
	<span style="color: #993333; font-weight: bold;">FIELDS</span> <span style="color: #993333; font-weight: bold;">TERMINATED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">','</span> <span style="color: #993333; font-weight: bold;">OPTIONALLY</span> <span style="color: #993333; font-weight: bold;">ENCLOSED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'&quot;'</span> <span style="color: #993333; font-weight: bold;">ESCAPED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\\</span>'</span>
	<span style="color: #993333; font-weight: bold;">LINES</span> <span style="color: #993333; font-weight: bold;">TERMINATED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span>
	<span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #993333; font-weight: bold;">TABLE</span> mysql<span style="color: #66cc66;">.</span>procs_priv;</pre></div></div><p>All up, a few queries to account for everything, but pretty easy to include in your backup/restore process. For further development, you could put the database list in a variable, so that you only need to change it on one line, rather than 6.</p> ]]></content:encoded> <wfw:commentRss>http://pento.net/2009/03/12/backing-up-permissions-for-individual-databases/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>A Brief Introduction to MySQL Performance Tuning</title><link>http://pento.net/2009/03/05/a-brief-introduction-to-mysql-performance-tuning/</link> <comments>http://pento.net/2009/03/05/a-brief-introduction-to-mysql-performance-tuning/#comments</comments> <pubDate>Thu, 05 Mar 2009 02:04:01 +0000</pubDate> <dc:creator>Gary</dc:creator> <category><![CDATA[MySQL]]></category> <category><![CDATA[InnoDB]]></category> <category><![CDATA[performance]]></category> <guid
isPermaLink="false">http://pento.net/?p=116</guid> <description><![CDATA[Here are some common performance tuning concepts that I frequently run into. Please note that this really is only a basic introduction to performance tuning. For more in-depth tuning, it strongly depends on your systems, data and usage. Server Variables For tuning InnoDB performance, your primary variable is innodb_buffer_pool_size. This is the chunk of memory [...]]]></description> <content:encoded><![CDATA[<p>Here are some common performance tuning concepts that I frequently run into. Please note that this really is only a basic introduction to performance tuning. For more in-depth tuning, it strongly depends on your systems, data and usage.</p><h2>Server Variables</h2><p>For tuning InnoDB performance, your primary variable is <code>innodb_buffer_pool_size</code>. This is the chunk of memory that InnoDB uses for caching data, indexes and various pieces of information about your database. The bigger, the better. If you can cache all of your data in memory, you&#8217;ll see significant performance improvements.</p><p>For MyISAM, there is a similar buffer defined by <code>key_buffer_size</code>, though this is only used for indexes, not data. Again, the bigger, the better.</p><p>Other variables that are worth investigating for performance tuning are:</p><p><code>query_cache_size</code> &#8211; This can be very useful if you have a small number of read queries that are repeated frequently, with no write queries in between. There have been problems with too large a query cache locking up the server, so you will need to experiment to find a value that&#8217;s right for you.</p><p><code>innodb_log_file_size</code> &#8211; Don&#8217;t fall into the trap of setting this to be too large. A large InnoDB log file group is necessary if you have lots of large, concurrent transactions, but comes at the expense of slowing down InnoDB recover, in event of a crash.</p><p><code>sort_buffer_size</code> &#8211; Another one that shouldn&#8217;t be set too large. Peter Zaitsev did <a
href="http://www.mysqlperformanceblog.com/2007/09/17/mysql-what-read_buffer_size-value-is-optimal/">some testing</a> a while back showing that increasing sort_buffer_size can in fact reduce the speed of the query.</p><h2>Server Hardware</h2><p>There are a few solid recommendations for improving the performance of MySQL by upgrading your hardware:</p><ul><li>Use a 64-bit processor, operating system and MySQL binary. This will allow you to address lots of RAM. At this point in time, InnoDB does have issues scaling past 8 cores, so you don&#8217;t need to go out of your way to have lots of processors.</li><li>Speaking of RAM, buy lots of it. Enough to fit all of your data and indexes, if you can.</li><li>If you can&#8217;t fit all of your data into RAM, you&#8217;ll need fast disks, RAID if you can. Have multiple disks, so you can seperate your data files, OS files and log files onto different physical disks.</li></ul><h2>Query Tuning</h2><p>Finally, though probably the most important, we look at tuning queries. In particular, we make sure that they&#8217;re using indexes, and they&#8217;re running quickly. To do so, turn on the Slow Query Log for a day, with <code>log_queries_not_using_indexes</code> enabled as well. Run the resulting log through <a
href="http://dev.mysql.com/doc/refman/5.1/en/mysqldumpslow.html">mysqldumpslow</a>, which will produce a summary of the log. This will help you prioritize which queries to tackle first. Then, you can use EXPLAIN to find out what they&#8217;re doing, and adjust your indexes accordingly.</p><p>Have fun!</p> ]]></content:encoded> <wfw:commentRss>http://pento.net/2009/03/05/a-brief-introduction-to-mysql-performance-tuning/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
