<?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/category/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>Extracting a Database From a mysqldump File</title><link>http://pento.net/2009/04/16/extracting-a-database-from-a-mysqldump-file/</link> <comments>http://pento.net/2009/04/16/extracting-a-database-from-a-mysqldump-file/#comments</comments> <pubDate>Thu, 16 Apr 2009 03:31:55 +0000</pubDate> <dc:creator>Gary</dc:creator> <category><![CDATA[MySQL]]></category> <category><![CDATA[mysqldump]]></category> <category><![CDATA[sed]]></category> <guid
isPermaLink="false">http://pento.net/?p=208</guid> <description><![CDATA[Restoring a single database from a full dump is pretty easy, using the mysql command line client&#8217;s --one-database option: mysql&#62; mysql -u root -p --one-database db_to_restore &#60; fulldump.sql But what if you don&#8217;t want to restore the database, you just want to extract it out of the dump file? Well, that happens to be easy [...]]]></description> <content:encoded><![CDATA[<p>Restoring a single database from a full dump is pretty easy, using the <kbd>mysql</kbd> command line client&#8217;s <kbd>--one-database</kbd> option:</p><pre>mysql&gt; mysql -u root -p --one-database db_to_restore &lt; fulldump.sql</pre><p>But what if you don&#8217;t want to restore the database, you just want to extract it out of the dump file? Well, that happens to be easy as well, thanks to the magic of <kbd>sed</kbd>:</p><pre>shell&gt; sed -n '/^-- Current Database: `test`/,/^-- Current Database: `/p' fulldump.sql &gt; test.sql</pre><p>You just need to change &#8220;test&#8221; to be the name of the database you want extracted.</p> ]]></content:encoded> <wfw:commentRss>http://pento.net/2009/04/16/extracting-a-database-from-a-mysqldump-file/feed/</wfw:commentRss> <slash:comments>8</slash:comments> </item> <item><title>Don&#8217;t put a NULL in the IN clause in 5.1</title><link>http://pento.net/2009/04/08/dont-put-a-null-in-the-in-clause-in-51/</link> <comments>http://pento.net/2009/04/08/dont-put-a-null-in-the-in-clause-in-51/#comments</comments> <pubDate>Wed, 08 Apr 2009 07:36:08 +0000</pubDate> <dc:creator>Gary</dc:creator> <category><![CDATA[MySQL]]></category> <category><![CDATA[MySQL 5.1]]></category> <category><![CDATA[optimizer]]></category> <category><![CDATA[regression]]></category> <guid
isPermaLink="false">http://pento.net/?p=173</guid> <description><![CDATA[There seems to be an optimizer problem in 5.1, if you put a NULL in the IN clause of a SELECT. For example, given the following table: CREATE TABLE foo &#40; a INT NOT NULL AUTO_INCREMENT, PRIMARY KEY &#40;a&#41; &#41;; Compare these two EXPLAINs: mysql&#62; EXPLAIN * FROM foo WHERE a IN &#40;160000, 160001, 160002&#41;\G [...]]]></description> <content:encoded><![CDATA[<p>There seems to be an optimizer problem in 5.1, if you put a NULL in the IN clause of a SELECT. For example, given the following table:</p><div
class="wp_syntax"><div
class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">TABLE</span> foo <span style="color: #FF00FF;">&#40;</span>
    a <span style="color: #999900; font-weight: bold;">INT</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #FF9900; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #000033;">,</span>
    <span style="color: #990099; font-weight: bold;">PRIMARY KEY</span> <span style="color: #FF00FF;">&#40;</span>a<span style="color: #FF00FF;">&#41;</span>
<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></pre></div></div><p>Compare these two EXPLAINs:</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;">EXPLAIN</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> foo <span style="color: #990099; font-weight: bold;">WHERE</span> a <span style="color: #990099; font-weight: bold;">IN</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">160000</span><span style="color: #000033;">,</span> <span style="color: #008080;">160001</span><span style="color: #000033;">,</span> <span style="color: #008080;">160002</span><span style="color: #FF00FF;">&#41;</span>\G
<span style="color: #CC0099;">***************************</span> <span style="color: #008080;">1</span>. row <span style="color: #CC0099;">***************************</span>
           id: <span style="color: #008080;">1</span>
  select_type: <span style="color: #990099; font-weight: bold;">SIMPLE</span>
        <span style="color: #990099; font-weight: bold;">table</span>: foo
         <span style="color: #990099; font-weight: bold;">type</span>: range
possible_keys: PRIMARY
          <span style="color: #990099; font-weight: bold;">key</span>: PRIMARY
      key_len: <span style="color: #008080;">4</span>
          ref: <span style="color: #9900FF; font-weight: bold;">NULL</span>
         rows: <span style="color: #008080;">3</span>
        Extra: <span style="color: #990099; font-weight: bold;">Using</span> <span style="color: #990099; font-weight: bold;">where</span>
<span style="color: #008080;">1</span> row <span style="color: #990099; font-weight: bold;">in</span> <span style="color: #990099; font-weight: bold;">set</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">0.06</span> sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">EXPLAIN</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: #990099; font-weight: bold;">WHERE</span> a <span style="color: #990099; font-weight: bold;">IN</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span> <span style="color: #008080;">160000</span><span style="color: #000033;">,</span> <span style="color: #008080;">160001</span><span style="color: #000033;">,</span> <span style="color: #008080;">160002</span><span style="color: #FF00FF;">&#41;</span>\G
<span style="color: #CC0099;">***************************</span> <span style="color: #008080;">1</span>. row <span style="color: #CC0099;">***************************</span>
           id: <span style="color: #008080;">1</span>
  select_type: <span style="color: #990099; font-weight: bold;">SIMPLE</span>
        <span style="color: #990099; font-weight: bold;">table</span>: foo
         <span style="color: #990099; font-weight: bold;">type</span>: <span style="color: #990099; font-weight: bold;">ALL</span>
possible_keys: PRIMARY
          <span style="color: #990099; font-weight: bold;">key</span>: <span style="color: #9900FF; font-weight: bold;">NULL</span>
      key_len: <span style="color: #9900FF; font-weight: bold;">NULL</span>
          ref: <span style="color: #9900FF; font-weight: bold;">NULL</span>
         rows: <span style="color: #008080;">327680</span>
        Extra: <span style="color: #990099; font-weight: bold;">Using</span> <span style="color: #990099; font-weight: bold;">where</span>
<span style="color: #008080;">1</span> row <span style="color: #990099; font-weight: bold;">in</span> <span style="color: #990099; font-weight: bold;">set</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">0.00</span> sec<span style="color: #FF00FF;">&#41;</span></pre></div></div><p>In the query with the NULL, it does a full table scan. So, if you&#8217;ve run into this problem under MySQL 5.1, the workaround is to remove the NULL. This doesn&#8217;t affect MySQL 4.x or 5.0.</p><p>You can also follow along with <a
href="http://bugs.mysql.com/44139">Bug #33139</a>.</p> ]]></content:encoded> <wfw:commentRss>http://pento.net/2009/04/08/dont-put-a-null-in-the-in-clause-in-51/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
