<?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/"
	>

<channel>
	<title>Pythian Group Blog &#187; Keith Murphy</title>
	<atom:link href="http://www.pythian.com/news/author/murphy/feed" rel="self" type="application/rss+xml" />
	<link>http://www.pythian.com/news</link>
	<description>News and views from Pythian DBAs</description>
	<pubDate>Fri, 03 Jul 2009 19:20:05 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>MySQL Query Analyzer review</title>
		<link>http://www.pythian.com/news/1457/mysql-query-analyzer-review</link>
		<comments>http://www.pythian.com/news/1457/mysql-query-analyzer-review#comments</comments>
		<pubDate>Tue, 03 Feb 2009 13:57:26 +0000</pubDate>
		<dc:creator>Keith Murphy</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[query analyzer]]></category>

		<guid isPermaLink="false">http://www.pythian.com/blogs/1457/mysql-query-analyzer-review</guid>
		<description><![CDATA[I had the chance to review the new Query Analyzer program from Sun over the last few days. I am very interested in how it performs as I have previously not had a chance to see the program in action (or the Enterprise Monitor program either for that matter). So, before getting into what the [...]]]></description>
			<content:encoded><![CDATA[<p>I had the chance to review the new Query Analyzer program from Sun over the last few days. I am very interested in how it performs as I have previously not had a chance to see the program in action (or the Enterprise Monitor program either for that matter). So, before getting into what the Query Analyzer can (and cannot) do let&#8217;s look at what Sun says it does.</p>
<p>From the November 19th, 2008 press release:</p>
<p>The MySQL Query Analyzer saves time and effort in finding and fixing problem queries by providing:</p>
<ul>
<li>Aggregated view into query execution counts, run time, result sets across all MySQL servers with no dependence on MySQL logs or <code>SHOW PROCESSLIST</code></li>
<li>Sortable views by all monitored statistics</li>
<li>Searchable and sortable queries by query type, content, server, database, date/time, interval range, and &#8220;when first seen&#8221;</li>
<li>Historical and real-time analysis of all queries across all servers</li>
<li>Drill downs into sampled query execution statistics, fully qualified with variable substitutions, and <code>EXPLAIN</code> results</li>
</ul>
<p>Can you do all this with other tools or by hand?</p>
<p>Absolutely. Some of the those very tools I have discussed before. Most I have used at least once or twice. The question is really can Query Analyzer do this better? <span id="more-1457"></span>Find out the answer at the end!!<br />
<!--more--></p>
<h3>Installation</h3>
<p>The Query Analyzer program is part of the Enterprise Monitor program. For those who are not familiar, Enterprise monitor is used for monitoring MySQL servers. Big surprise right? It works by having an &#8220;agent&#8221; installed on the server to be monitored which then passes information back to the central server which displays gathered information in an web-based interface.</p>
<p>I will confess. The installation of the service manager was performed by <a href="http://www.pythian.com/blogs/author/sheeri">Sheeri</a>. However, going through the notes she left it appears to have been rather straightforward. I picked it up where the configuration begins.</p>
<p>I will note one problem with configuration. Once the package is installed you have to do some setup before actually using the program. This is where it got a bit tricky. The test setup is on a system without direct Internet access (prevented by a firewall, for security reasons). The package has your key, your enterprise account name (email) and password.  It connects to the Sun servers to verify your credentials and activate the program. Well, not if your server doesn&#8217;t have a direct connection to the Internet! </p>
<p>In that case you use a product key. Well, being new to this I had no idea where to get that from. I searched around a bit on the enterprise website and did not find it.Â  On the enterprise website I opened a ticket with Sun with a level of S3 (meaning this is non-production impacting..testing setup). I had a <strong>correct</strong> reply in <strong>FOUR</strong> minutes.</p>
<p>Sun support response time is very good!  On the downside, this information probably should have been in the knowledge base.</p>
<p>This actually finished up the configuration of the Service Manager (the core functionality). Now to install the Service Agent which goes on the server(s) you are going to monitor. In this case the Agent was also being installed on the test system. As with the Service Manager the actual install was straightforward.</p>
<p>The program started up correctly the first time I tried. The proxy by default starts on port 4040 and I kept this as the setting.</p>
<h3>Running the Program</h3>
<p>Once this little quirk was resolved I began running some queries and seeing them show up in the Query Analyzer.</p>
<p>First impressions are that Query Analyzer does exactly what Sun says that it does. As you queries pass through the proxy and on to the database they are also sent to the Service Manager program. It slices,dices and display the data gathered in close to real time on the Query Analyzer tab of the dashboard.</p>
<p>Here are the various ways you can sort your queries:</p>
<ul>
<li>By Query</li>
<li>By Database</li>
<li>By total execution count</li>
<li>By Execution time
<ul>
<li>total query execution time</li>
<li>maximum query execution time</li>
<li>average query execution time</li>
</ul>
</li>
<li>By Rows
<ul>
<li>total rows</li>
<li>maximum</li>
</ul>
</li>
<li>By Bytes
<ul>
<li>total bytes</li>
<li>maximum bytes</li>
<li>average bytes</li>
</ul>
</li>
<li>by date/time query was first seen</li>
</ul>
<p>One click is all it takes to change the sorting method.</p>
<p>The Query Analyzer table can let you see at a glance what is going on with your system. Here is a a screen shot of the Query Analyzer (click to enlarge):</p>
<p><a href='http://www.pythian.com/blogs/wp-content/uploads/query_analyzer_1.png' title='Query Analyzer Screenshot #1'><img src='http://www.pythian.com/blogs/wp-content/uploads/query_analyzer_1.png' alt='Query Analyzer Screenshot #1' /></a></p>
<p>By default the Query Analyzer displays data for up to 24 hours. This can be altered by pulling down the &#8220;Time Display&#8221; option in the filter bar and choosing the &#8220;From / To&#8221; option instead of &#8220;Interval&#8221;. This will change the filter bar to have date based pick lists so you can specify a longer date range. Be warned - with a significant amount of data this can impact performance.</p>
<p>Any query can be drilled down into and examined, even showing the <code>EXPLAIN </code>of the queryÂ  if it took longer than 500 ms. Utilizing this you can begin your resolution of the problem in the typical MySQL manner.</p>
<h3>The Final Analysis</h3>
<p>I am not aware of anything else available either commercially or freely available that does this type of analysis for MySQL. The only similar functionality done by other products is through reading of the slow query log. While this can provide some of the information, the Query Analyzer does a better job at real-time analysis of the collected data with your sorting options.</p>
<p>While I am not familiar with other vendor&#8217;s database servers, I <a href="http://www.pythian.com">work</a> with people who are. So I asked them. From what I understand there is somewhat similar functionality to the various programs that work with the slow query log, but nothing that is quite like the real-time analysis that Query Analyzer proves. If I am wrong, kindly suggest similar tools!</p>
<p>While the use of the proxy program provides added complexity, it also brings flexibility to the program.</p>
<p>Does the Query Analyzer do what it says it does? Yes! The only significant downside to this program is the cost. However, if you have Enterprise support it&#8217;s already included. So that&#8217;s not bad. I would not recommend that you buy Enterprise support JUST to get Query Analyzer &#8212; maybe Sun should package the Query Analyzer as a separate product? Reasonably priced (say, $200 or less) I would be the first person to tell you to buy it for any company with production systems.</p>
<p>As I said at the start, there other programs out there that can do grunt work that Query Analyzer does and help you resolve issues with slow queries. They don&#8217;t do this in <em>real time</em> and in addition the ease of use <em>after configuration</em> is what sets this apart. The simple graphical interface makes it dead simpleÂ  for everyone to see what is causing traffic to snarl. It would be nice if it resolved the problems for you&#8230;but I don&#8217;t know of any software that does that!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pythian.com/news/1457/mysql-query-analyzer-review/feed</wfw:commentRss>
		</item>
		<item>
		<title>Log Buffer #133: A Carnival of the Vanities for DBAs</title>
		<link>http://www.pythian.com/news/1465/log-buffer-133-a-carnival-of-the-vanities-for-dbas</link>
		<comments>http://www.pythian.com/news/1465/log-buffer-133-a-carnival-of-the-vanities-for-dbas#comments</comments>
		<pubDate>Fri, 30 Jan 2009 17:07:47 +0000</pubDate>
		<dc:creator>Keith Murphy</dc:creator>
		
		<category><![CDATA[Log Buffer]]></category>

		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[Non-Tech Articles]]></category>

		<category><![CDATA[Oracle]]></category>

		<category><![CDATA[PostgreSQL]]></category>

		<category><![CDATA[Pythian]]></category>

		<category><![CDATA[SQL Server]]></category>

		<category><![CDATA[MySQL Magazine]]></category>

		<guid isPermaLink="false">http://www.pythian.com/blogs/1465/log-buffer-133-a-carnival-of-the-vanities-for-dbas</guid>
		<description><![CDATA[Hello and welcome to my Log Buffer, the weekly review of database blogs. My name is Keith Murphy and I am the editor of MySQL Magazine, a free digital magazine with information for MySQL administrators and developers, released quarterly.Â  I am also a MySQL database administrator at Pythian.
I am losing count of how many of [...]]]></description>
			<content:encoded><![CDATA[<p>Hello and welcome to my <a href="http://www.pythian.com/blogs/about-log-buffer"><em>Log Buffer</em></a>, the weekly review of database blogs. My name is Keith Murphy and I am the editor of <a href="http://www.mysqlzine.net" rel="nofollow">MySQL Magazine</a>, a free digital magazine with information for MySQL administrators and developers, released quarterly.Â  I am also a MySQL database administrator at <a href="http://www.pythian.com">Pythian</a>.</p>
<p>I am losing count of how many of these <em>Log Buffers</em> I have done. If I recall correctly, this is number three. But then again, it could be number four. You know what they say though&#8212;the more the merrier!</p>
<p>This week&#8217;s <em>Buffer</em> features a great allegory about a database, some tips, feature requests, and breaking news.  It seems that this week, people shared information that was relevant across database servers, so I recommend that no matter the database server you work on, you should read through each section today.</p>
<h3>MySQL</h3>
<p>Since the writer of the <em>Buffer</em> gets to choose the order of the stories, I will begin with my favorite db&#8212;MySQL. This week the MySQL world sawÂ  some <a href="http://www.mysqlperformanceblog.com/2009/01/23/another-scalability-fix-in-xtradb/">benchmarking</a> of testing of recent improvements to the XtraDB storage engine. the discussion generated around what was done to improve the performance on a 16-core box was really interesting. I&#8217;m looking forward to working with the XtraDB engine.</p>
<p><span id="more-1465"></span></p>
<p>And while only somewhat MySQL-specific, for those who have an interest in database warehousing, comes this interesting post from <a href="http://tomictech.com"><strong>Alex Tomic</strong></a> on <a href="http://tomictech.com/2009/01/27/on-the-need-for-an-agile-approach-to-data-warehousing/">agile development with data warehousing</a>. Bet you never though you would hear those two phrases together!</p>
<p><a href="http://blog.onefreevoice.com"><strong>Gregory Haas</strong></a> talks about his <a href="http://blog.onefreevoice.com/2009/01/27/source-control-heirarchy/">methods for source control</a> for his database servers. It&#8217;s something that many DBAs don&#8217;t consider. I won&#8217;t embarrass everyoneÂ  by asking for a show of hands of who has their schema and tools under source control.</p>
<p>Now that MySQL server 5.1 has been GA for a while, it is starting to roll out into production at some sites. <a href="http://karlssonondatabases.blogspot.com"><strong>Karlsson</strong></a> writes about <a href="http://karlssonondatabases.blogspot.com/2009/01/putting-5x-features-to-good-use-of.html">his use of events</a>.Â  I will leave it to the gentle reader to determine the very important benefit he points out about events. Thanks for the tip Karlsson!</p>
<p>For those still using 5.0 (&nbsp;.&nbsp;.&nbsp;.&nbsp;um&nbsp;.&nbsp;.&nbsp;.&nbsp;the approximate 99.9% of you), <a href="http://www.bigdbahead.com"><ins datetime="2009-02-04T16:02:50+00:00">Yves Trudeau</ins> <strong><del datetime="2009-02-04T16:02:50+00:00">Matt Yonkovit</del></strong></a> shows how with a little manual hackery <a href="http://www.bigdbahead.com/?p=99">you can gather the queries</a> that are hitting your server&#8221;at will&#8221;. While not as elegant as 5.1&#8217;s dynamic logging, it certainly does the job. Thanks Matt!</p>
<p><a href="http://www.xaprb.com/blog"><strong>Baron</strong></a> has a good idea: <a href="http://www.xaprb.com/blog/2009/01/26/idea-a-reverse-changelog-for-mysql/">a reverse changelog</a>.Â  If you have ever worked your way through a changelog in preparation for an upgrade, this will make sense to you. </p>
<p>My colleague <strong>Sheeri</strong> wrote a great blog post on <a href="http://www.pythian.com/blogs/1463/apparent-vs-actual-data-integrity">MySQL&#8217;s default silent truncation behavior</a> and how this can affect your database server&#8217;s data integrity.</p>
<p><a href="http://mysqlha.blogspot.com"><strong>Mark Callaghan</strong></a>, Google wizard of the dolphin, writes about <a href="http://mysqlha.blogspot.com/2009/01/no-new-global-mutexes-and-how-to-make.html">global mutexes and how they are limiting the SMP performanceÂ  of MySQL server</a>. There has been much discussion about this over the last year and it seems some progress is being made. <a href="http://krow.livejournal.com"><strong>Brian Aker</strong></a> writes down <a href="http://krow.livejournal.com/631051.html">his thoughts on the matter as well</a>.</p>
<p>Finally, for those going to the MySQL User&#8217;s Conference, <a href="http://blogs.sun.com/datacharmer"><strong>Giuseppe Maxia</strong></a> <a href="http://blogs.sun.com/datacharmer/entry/mysql_users_conference_with_embedded">officially announced the MySQL Camp</a>, which will run in conjunction with the User&#8217;s Conference.</p>
<h3>Microsoft SQL Server</h3>
<p>You know there are people who think DBAs are boring and stuffy. I think these people should all meet <a href="http://sqlblogcasts.com/blogs/simons"><strong>Simon Sabin</strong></a>. This chap from the UK has a twisted sense of humor, and he manages to <a href="http://sqlblogcasts.com/blogs/simons/archive/2009/01/23/Why-is-my-chip-shop-like-SQL-Server.aspx">relate a fish and chip shop to a database server</a>. Take time to read through. It is absolutely hysterical!</p>
<p>On a more serious note. What does it take to build the 60GB index for a billion-and-a-half rows? Well the <a href="http://sqlfool.com">SQL Fool</a> knows. And she <a href="http://sqlfool.com/2009/01/creating-a-60-gb-index/">shows you how to execute a well-crafted plan</a> to do this without bring the database to its knees (and keeping your users from being howling mad).</p>
<p><a href="http://blogs.msdn.com/buckwoody"><strong>Buck Woody</strong></a> points to a site with <a href="http://blogs.msdn.com/buckwoody/archive/2009/01/19/free-t-sql-beautifier.aspx">an SQL formatter available online</a>. Not only does it format SQL for Microsoft SQL server, it also does Oracle, MySQL, and DB2. Not only that, but it will translate the output to a multitude of programming languages including C#, Java, and PHP to name a few. It looks a really cool tool. </p>
<p>Speaking of tools, <a href="http://sqlblog.com/blogs/kalen_delaney"><strong>Kalen Delaney</strong></a> provides <a href="http://sqlblog.com/blogs/kalen_delaney/archive/2009/01/23/troubleshooting-tools-update.aspx">a nice list of free troubleshooting tools</a> available for SQL Server.</p>
<p>Need a random number? <a href="http://blogs.lessthandot.com"><strong>George Mastros</strong></a> give some great tips on <a href="http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/sql-server-set-based-random-numbers">generating numbers for creating tables for testing</a>.</p>
<p>Are you someone who has to hire a senior DBA? <a href="http://www.brentozar.com"><strong>Brent Ozar</strong></a> has a <a href="http://www.brentozar.com/archive/2009/01/top-10-interview-questions-to-ask-senior-dbas/">list of 10 questions you can ask in the interview process</a>. Good questions, Brent!</p>
<h3>Oracle</h3>
<p>I&#8217;ll kick this off with some basic material excellently presented. <a href="http://awads.net/wp"><strong>Eddie Awad</strong></a> points to a 9.5 minute <a href="http://awads.net/wp/2009/01/23/sql-indexing-video/">video on indexing by <strong>Stephane Faroult</strong></a>. Stephane is the the author of <a href="http://oreilly.com/catalog/9780596008949/"><em>The Art of SQL</em></a> (a book I highly recommend). <a href="http://arup.blogspot.com"><strong>Arup Nanda</strong></a> has a very good post about how to <a href="http://arup.blogspot.com/2009/01/ultra-fast-mv-alteration-using-prebuilt.html">alter a materialized view of any size in seconds</a>.</p>
<p><a href="http://it.toolbox.com/blogs/oracle-guide"><strong>Lewis Cunningham&#8217;s</strong></a> blog is always a good read. It seems he just got involved with agile development. He <a href="http://it.toolbox.com/blogs/oracle-guide/does-scrum-mean-no-more-documentation-29532">gives his perspective on the process</a>.</p>
<p><a href="http://blog.tanelpoder.com"><strong>Tanel Poder</strong></a> gets in-depth with cursors in Oracle. He calls it <a href="http://blog.tanelpoder.com/2009/01/23/multipart-cursor-subexecution-and-precompute_subquery-hint/">Multipart cursor subexection and PRECOMPUTE_SUBQUERY hint</a>.</p>
<p>Want to learn about the <code>ALL_TABS_COLUMN</code> table? Don&#8217;t know what it is? Join <a href="http://thinkoracle.blogspot.com"><strong>Robert Vollman</strong></a>&#8212;AKA the Oracle guru&#8212;as he schools a pupil in the how you can <a href="http://thinkoracle.blogspot.com/2009/01/cleaning-up-with-alltabcols.html">use the <code>ALL_TABS _COLUMN</code> to find out information about your tables columns</a>.</p>
<p><a href="http://dbatrain.wordpress.com"><strong>Joel Goodman</strong></a> talks about <a href="http://dbatrain.wordpress.com/2009/01/22/asm-storage-possibilities/">different ways an ASM external storage solution can be integrated</a> with your Oracle RAC or single-instance server. </p>
<p><a href="http://prodlife.wordpress.com"><strong>Chen Shapira</strong></a>, the Simple DBA, offered some <a href="http://prodlife.wordpress.com/2009/01/27/random-thoughts-about-queues/">good theory and practical application on queues.</a></p>
<h3>PostgreSQL</h3>
<p>In the world of PostgreSQL,Â  <a href="http://gmrpgsql.tumblr.com"><strong>Gavin</strong></a> brings us some <a href="http://gmrpgsql.tumblr.com/post/73798984/initial-ext3-vs-ext4-results">benchmarking results comparing two GNU/Linux filesystems, ext4 and ext3</a>. If GNU/Linux is running on your servers, you need to take a look at this post.</p>
<p>That is all for this edition. I hope you had as much fun reading it as I had writing it.  If I missed you favorite DB blog from this week, please leave a comment with a link.  Also, I encourage you to give it a shot as well&#8212;<a href="mailto:logbuffercoordinator@pythian.com?Subject=Log%20Buffer">drop Dave a line</a> and get <em>Log Buffer</em> going on your own blog.</p>
<p>See you all soon!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pythian.com/news/1465/log-buffer-133-a-carnival-of-the-vanities-for-dbas/feed</wfw:commentRss>
		</item>
		<item>
		<title>MySQL Memory Consumption</title>
		<link>http://www.pythian.com/news/1455/mysql-memory-consumption</link>
		<comments>http://www.pythian.com/news/1455/mysql-memory-consumption#comments</comments>
		<pubDate>Fri, 23 Jan 2009 22:37:14 +0000</pubDate>
		<dc:creator>Keith Murphy</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[cacti]]></category>

		<category><![CDATA[Ganglia]]></category>

		<category><![CDATA[InnoDB]]></category>

		<category><![CDATA[innodb_buffer_pool_size]]></category>

		<category><![CDATA[key_buffer_size]]></category>

		<category><![CDATA[memory]]></category>

		<guid isPermaLink="false">http://www.pythian.com/blogs/1455/mysql-memory-consumption</guid>
		<description><![CDATA[Had an interesting situation come up today with a client. We had a situation where a server crashed because it ran out of memory. The calculation we used to monitor memory usage did not take into account all factors. When looking at this, I noticed a couple of things:

There are numerous calculations available online.
It seems [...]]]></description>
			<content:encoded><![CDATA[<p>Had an interesting situation come up today with a client. We had a situation where a server crashed because it ran out of memory. The calculation we used to monitor memory usage did not take into account all factors. When looking at this, I noticed a couple of things:</p>
<ol>
<li>There are <em>numerous</em> calculations available online.</li>
<li>It seems that none of them take everything in account.</li>
</ol>
<p>Wouldn&#8217;t it be nice if there was a total possible memory consumption status value? It can be a valuable piece of information. (And while I am requesting things, what about peak memory usage by the mysqld server since it has been online?) Realistically, there is almost no case where you would actually use the maximum amount of memory. But knowing how much memory that MySQL server could possibly use would be a very useful bit of information to know.</p>
<p>Second, why isn&#8217;t there an &#8220;official&#8221; formula that actually shows everything? It&#8217;s easy to forget things. Just as the simple case, what about the query cache? Did you remember it?</p>
<p><span id="more-1455"></span></p>
<p>Sure, there are some big things.  <code>innodb_buffer_pool_size</code> and <code>key_buffer_size</code> spring to mind. But all the little things add up too. On a busy system did you consider <code>thread_stack</code>? It defaults to 128k per connection. With 500 connections that&#8217;s 64 MB. You may dismiss that and and say its not much. But in the end it doesn&#8217;t take 64 MB to cause a crash of your serve.</p>
<p>Do you know how much the core of MySQL server actually uses outside of all the buffers and data structures it builds? The only figure I have seen is 32 MB.</p>
<p>What about the operating system?Â  And I don&#8217;t even want to consider if other programs are running on the same server.</p>
<pre>
max_memory_needed = core_mysql + global_values + (thread_buffers * max_connections)

max_memory_needed = core_mysql
    + key_buffer_size
    + innodb_buffer_pool_size
    + innnodb_additional_memory_pool_size
    + innodb_log_buffer_size
    + max_tmp_tables * min(tmp_table_size,max_heap_table_size)
    + query_cache_size
    + 3 * myisam_sort_buffer_size
    + max_connections * ( read_buffer_size + join_buffer_size + read_rnd_buffer_size + thread_stack + (2 * max_packet_size) ))
</pre>
<p><code>core_mysql</code> is the amount actually used by the core server itself without all the buffers and data structures that are given above.Â  The only figure I have seen for this is 32 MB which is probably pretty close.</p>
<p>The <code>myisam_sort_buffer_size</code> is the size of the buffer allocated when sorting MyISAM indexes during a <code>REPAIR TABLE</code>, or when creating  indexes with <code>CREATE TABLE</code> or <code>CREATE INDEX</code>. I am estimating there will never be more than three of these operations going on at the same time. Of course there is no guarantee of this.</p>
<p>I believe the above formula will give a pretty accurate representation of the total amount of memory that could possibly be used by a MySQL server and operating system.</p>
<p>Where it becomes far more unclear is a more realistic &#8220;normal operating conditions&#8221; formula. The problem here is that this is going to vary from application to application. One application might never hit more than 75% of the memory calculated by this formula.Â  Another might be 50%, and another 87%.</p>
<p>How do you resolve this?Â  Well, probably the best way is through long-term monitoring. <a href="http://www.cacti.net/">Cacti</a> or <a href="http://ganglia.info/">Ganglia</a> spring to mind for this. If you configure a server conservatively and know that it is using 80% of RAM at any time over a significant period of time (including periods of time with spikes in server activity), then you know you can increase the amount of memory allocated somewhere.</p>
<p>What I typically do (if I have a choice), is configure a server for the expected number of connections, and then, after establishing a baseline of a set amount of connections and a minimum amount of buffering, I monitor the server while it is in use. Then I add any additional memory the server can spare to the InnoDB buffer pool (this is presuming that InnoDB is the main storage engine in use). Always leave some free memory and don&#8217;t allocate everything down to the last byte. Once MySQL starts hitting your swap partition, very bad things can happen with servers slowing down and users complaining.</p>
<p>How do you determine your buffer allocations and memory usage? Is it just hit-or-miss? And did I miss something in the above formula? I want to hear from you!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pythian.com/news/1455/mysql-memory-consumption/feed</wfw:commentRss>
		</item>
		<item>
		<title>Call for Articles for Winter Issue of MySQL Magazine</title>
		<link>http://www.pythian.com/news/1416/call-for-articles-for-winter-issue-of-mysql-magazine</link>
		<comments>http://www.pythian.com/news/1416/call-for-articles-for-winter-issue-of-mysql-magazine#comments</comments>
		<pubDate>Tue, 09 Dec 2008 20:35:41 +0000</pubDate>
		<dc:creator>Keith Murphy</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[Non-Tech Articles]]></category>

		<category><![CDATA[MySQL Magazine]]></category>

		<guid isPermaLink="false">http://www.pythian.com/blogs/1416/call-for-articles-for-winter-issue-of-mysql-magazine</guid>
		<description><![CDATA[It&#8217;s that time again. Time for fame and fortune! Sorry, as usual there is no fortune, but the good news is that our readership continues to grow, so author fame is imminent. We are planning the winter issue of MySQL Magazine. With the new GA release of MySQL server 5.1 last month, there is certainly [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s that time again. Time for fame <strike>and fortune</strike>! Sorry, as usual there is no fortune, but the good news is that our readership continues to grow, so author fame is imminent. We are planning the winter issue of <a href="http://www.mysqlzine.net">MySQL Magazine</a>. With the new GA release of MySQL server 5.1 last month, there is certainly plenty to talk about!</p>
<p>You can reach  me with your ideas at <a href="mailto:b&#109;&#117;&#114;&#112;hy&#64;&#112;&#97;ra&#103;&#111;&#110;&#45;&#99;&#115;.&#99;om&#32;?Subject=Proposal:%20MySQL%20Mag%20Winter">&#98;&#109;&#117;&#114;&#112;&#104;y&#64;&#112;&#97;&#114;&#97;&#103;&#111;&#110;&#45;&#99;&#115;.&#99;&#111;&#109;&#32;</a>. I need to see all article proposals by the 15<sup>th</sup> of this month.  Draft articles must be in by the 10<sup>th</sup> of January, so if I accept your proposal, you have a month to get things ready.   I should also mention that in the past we have used blog postings (with author permission and full credit of course). If you have blogged something recently that you feel is worthy of publishing in the magazine, send me the link and I will take a look.</p>
<p>Never heard of <strong>MySQL Magazine</strong>? It is a digital magazine designed for both database administrators and developers of the MySQL database server. All six back-issues are available for free download from the website.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pythian.com/news/1416/call-for-articles-for-winter-issue-of-mysql-magazine/feed</wfw:commentRss>
		</item>
		<item>
		<title>Overview of Transaction Logging in MySQL</title>
		<link>http://www.pythian.com/news/1337/overview-of-transaction-logging-in-mysql</link>
		<comments>http://www.pythian.com/news/1337/overview-of-transaction-logging-in-mysql#comments</comments>
		<pubDate>Thu, 06 Nov 2008 20:22:02 +0000</pubDate>
		<dc:creator>Keith Murphy</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[ACID]]></category>

		<category><![CDATA[Falcon]]></category>

		<category><![CDATA[InnoDB]]></category>

		<category><![CDATA[recovery]]></category>

		<category><![CDATA[redo log]]></category>

		<category><![CDATA[transaction logging]]></category>

		<category><![CDATA[transactional logs]]></category>

		<category><![CDATA[undo log]]></category>

		<guid isPermaLink="false">http://www.pythian.com/blogs/1337/overview-of-transaction-logging-in-mysql</guid>
		<description><![CDATA[I was doing some research over the weekend on how transactions work &#8220;under the hood&#8221; in MySQL. I thought it might be enlightening if I wrote about what I found.
The database system must resolve the situation where, for whatever reason, the database server stops working in the middle of a transaction.Â  Perhaps the power goes [...]]]></description>
			<content:encoded><![CDATA[<p>I was doing some research over the weekend on how transactions work &#8220;under the hood&#8221; in MySQL. I thought it might be enlightening if I wrote about what I found.</p>
<p>The database system must resolve the situation where, for whatever reason, the database server stops working in the middle of a transaction.Â  Perhaps the power goes out, the hard drive crashes, or the CPU disappears in a cloud of smoke. Maybe the MySQL Server itself crashes for some reason. What does the MySQL Server do when operation resumes? </p>
<p>Potentially, there are transactions in an inconsistent state. How are inconsistent transactions resolved? They are resolved through a recovery process involving log files that are called transactional logs. There are two kinds of transactional logs: redo logs and undo logs.</p>
<p><span id="more-1337"></span></p>
<p>Redo logs are used to apply changes that were made in memory but not flushed to the permanent table records (for example, InnoDB&#8217;s  permanent table records are the ibdata files.) This situation would typically happen after a MySQL Server crash.Â  Logging is done this way because it allows faster database operation.</p>
<p>This might be seem counter-intuitive at first look. Instead of writing to one file (the permanent table records file) you are writing to two different files (the redo log file and the permanent table records file). The difference is that the writes to the database table file(s) are random in nature while the writes to the redo log file will be sequential,  which is usually going to be much faster. You perform the much-faster writes to the redo log as needed and then perform the slower writes to the table files periodically when there is time. Thus, the system actually operates faster writing to both files rather than only one file. This applying of the redo logs occurs automatically on startup of the MySQL server after a crash. Very similar processes are used by other database platforms.</p>
<p>In addition to the redo log there must also be undo logs. When a database user starts a transaction and executes some commands, the database does not know if the user will end the transaction with a <code>COMMIT</code> or a <code>ROLLBACK</code> command. Ending withÂ  a <code>COMMIT</code> means all the changes made in the course of the transaction have to be preserved (fulfilling the Durable aspect of ACID). If the transaction gets interrupted for some reason, such as the MySQL daemon crashing, the client disconnecting before sending a <code>COMMIT</code>, or the user issuing a <code>ROLLBACK</code> command, then all changes made by the transaction need to be undone.</p>
<p>If the server crashed, the redo log files are applied first, on start up. This puts the database in a consistent state. Now the database server will need to roll back the transactions which were not committed but hadÂ  already made changes to the database. Undo logs are used for this.Â  As an example, if you are running a transaction that adds a million rows and the server crashes after eight hundred thousand inserts are performed, the server will first use the redo log to get the database server into a consistent stand than then will perform a rollback of the eight hundred thousand inserts using the undo logs. For InnoDB, this undo information is stored in the ibdata file(s). For Falcon the undo log information is stored in the serial log file.</p>
<p>Transactional logs have some common characteristics. The log records each contain <em>Log Sequence Numbers</em> (LSN) which are unique IDs for each record. There is a also a <em>Previous Log Sequence Number</em> (Prev LSN), which is a link to the last log record. A <em>Transaction ID</em> number is used to reference the database transaction generating the log record.Â  Finally, <em>checkpoints</em> are entries in the transactional logs that are used to speed up the processing of those logs when they are needed. Checkpoints contain a list of transactions that are open when the checkpoint was created. This is used by the server to determine how far back into the log it must go to begin processing.</p>
<p>(A small side note. Some people get confused thinking the binary log files are used in this process. That is not true. The binary logs are used only for replication purposes and for manual data recover situations, such as when a backup is restored and you need to &#8220;catch the server up&#8221; using the binary logs. The server does not use these files in the transactional recovery process.)</p>
<p>That completes this general overview of the transactional logs in MySQL (or any modern RDBMS really). I hope you find it useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pythian.com/news/1337/overview-of-transaction-logging-in-mysql/feed</wfw:commentRss>
		</item>
		<item>
		<title>Thoughts on the Cloud</title>
		<link>http://www.pythian.com/news/1322/thoughts-on-the-cloud</link>
		<comments>http://www.pythian.com/news/1322/thoughts-on-the-cloud#comments</comments>
		<pubDate>Tue, 04 Nov 2008 19:25:05 +0000</pubDate>
		<dc:creator>Keith Murphy</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[Non-Tech Articles]]></category>

		<category><![CDATA[Oracle]]></category>

		<category><![CDATA[PostgreSQL]]></category>

		<category><![CDATA[SQL Server]]></category>

		<category><![CDATA[Amazon]]></category>

		<category><![CDATA[AWS]]></category>

		<category><![CDATA[cloud computing]]></category>

		<category><![CDATA[EBS]]></category>

		<category><![CDATA[Elastic Block Storage]]></category>

		<category><![CDATA[S3]]></category>

		<category><![CDATA[Simple Queuing System]]></category>

		<category><![CDATA[SQS]]></category>

		<guid isPermaLink="false">http://www.pythian.com/blogs/1322/thoughts-on-the-cloud</guid>
		<description><![CDATA[For those of you who have been under a rock for the last several years, there is a buzz-phrase floating around&#8212;cloud computing. If you haven&#8217;t been paying attention, it is time to wake up.
While I could spend an entire blog post&#8212;if not several&#8212;on a definition of cloud computing, I will be talking only about cloud [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who have been under a rock for the last several years, there is a buzz-phrase floating around&#8212;<em>cloud computing</em>. If you haven&#8217;t been paying attention, it is time to wake up.</p>
<p>While I could spend an entire blog post&#8212;if not several&#8212;on a definition of cloud computing, I will be talking only about cloud computing in the sense of companies moving servers from their building or network operations center to running virtual servers in this computing cloud.</p>
<p>While there are a number of companies providing virtual servers, the most visible is Amazon, with their Amazon Web Services (AWS). I will be talking about AWS in this post as it is the service with which I am most familiar. It seems like every month, AWS  rolls out new options and services. Just recentlyÂ Amazon announced that you can now run on AWS the Windows operating system along with SQL Server.</p>
<p>Amazon also announced a service level agreement (SLA) of 99.5%. The SLA is important. It is a guarantee of service uptime. If Amazon don&#8217;t meet the SLA, then you get money back. As any of you will know, you have to be able to count on your data center. 99.5% is a pretty good level of coverage. </p>
<p>Beyond that, one of the new features Amazon will be implementing during the next year is the use of regions and availability zones. Regions are distinctly different areas of a country (or completely separate countries); availability zones are designed to be insulated from failures in other availability zones and provide inexpensive, low-latency network connectivity to other availability zones in the same region. What does this mean?  It will soon be very easy to deploy a set of servers in different areas and/or regions so that your data and servers are spread out and not vulnerable to a single point of failure.</p>
<p>I am not going to go into any detail about how virtual servers work. That&#8217;s not the point of this post. I am going to concentrate on what you can <em>do</em> with virtual servers.</p>
<p><span id="more-1322"></span></p>
<p>Once you are properly set up, you can bring new servers online in just a few minutes. Got a spike in your app usage due to Digg coverage or a big sale? Bring X number of servers online to handle the load, and then after it passes, shut down the now-unneeded servers. Simple, cheap and fast.</p>
<p>In a traditional setting where the company maintains its own servers, they either have to order servers far in advance and having them sitting idle in the racks at the data center. Or risk not having enough compute power in place. If this taken into account, the savings offered a company by a cloud-based approach can really begin to add up.</p>
<p>A simple way to begin using the cloud would be to use the S3 storage service to store your backups from your current databases. In one simple step you have off-site storage of unlimited capacity, available anytime you need it. Use the Amazon Simple Queuing System (SQS) to build a network of servers that can operate on a queue of tasks in parallel. While you could develop this setup internally, it would take a lot of time, energy, and money. With SQS, you can bypass all that and be running in days, if not hours.</p>
<p>These are just the obvious things that spring to mind. I am sure over the next few years we will see many innovative applications and uses that I can&#8217;t imagine right now.</p>
<p>Are there limitations? Of course. Currently, RAM is limited to 15 gigs with four cores of CPU power. Amazon offers a SAN-based permanent storage called Elastic Block Storage (EBS). I have seen no data regarding the actual throughput of EBS, so I don&#8217;t know how suitable it would be for a very high-end system. For many systems, however, this would be perfectly adequate.</p>
<p>Overall, I think the flexibility that a system such as AWS provides will allow a new generation of companies who are quicker to market, more agile to make changes and have lower overhead. All good things in this economy!</p>
<p>I am certain that at the MySQL Users Conference next year, there will be many talks on how to leverage cloud computing with MySQL.  I look forward to that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pythian.com/news/1322/thoughts-on-the-cloud/feed</wfw:commentRss>
		</item>
		<item>
		<title>Poll: MySQL on Debian or Ubuntu?</title>
		<link>http://www.pythian.com/news/1331/poll-mysql-on-debian-or-ubuntu</link>
		<comments>http://www.pythian.com/news/1331/poll-mysql-on-debian-or-ubuntu#comments</comments>
		<pubDate>Mon, 03 Nov 2008 19:46:57 +0000</pubDate>
		<dc:creator>Keith Murphy</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[Non-Tech Articles]]></category>

		<category><![CDATA[debian]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Poll]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.pythian.com/blogs/1331/poll-mysql-on-debian-or-ubuntu</guid>
		<description><![CDATA[I have put up a poll on my personal blog, Diamond Notes asking whether you prefer Ubuntu or Debian as an operating system for MySQL server. I am curious because I have seen a shift in the last year of Debian users to the Ubuntu distribution, and I would like to put some actual numbers [...]]]></description>
			<content:encoded><![CDATA[<p>I have put up a poll on my personal blog, <a href=" http://blog.paragon-cs.com">Diamond Notes</a> asking whether you prefer Ubuntu or Debian as an operating system for MySQL server. I am curious because I have seen a shift in the last year of Debian users to the Ubuntu distribution, and I would like to put some actual numbers to what I am seeing. (Please don&#8217;t vote if you use another OS or another Linux distribution, as I am strictly interested in the usage patterns of these two operating systems.)</p>
<p>Thanks,<br />
Keith.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pythian.com/news/1331/poll-mysql-on-debian-or-ubuntu/feed</wfw:commentRss>
		</item>
		<item>
		<title>Log Buffer #121: a Carnival of the Vanities for DBAs</title>
		<link>http://www.pythian.com/news/1323/log-buffer-121-a-carnival-of-the-vanities-for-dbas</link>
		<comments>http://www.pythian.com/news/1323/log-buffer-121-a-carnival-of-the-vanities-for-dbas#comments</comments>
		<pubDate>Fri, 31 Oct 2008 16:01:34 +0000</pubDate>
		<dc:creator>Keith Murphy</dc:creator>
		
		<category><![CDATA[Log Buffer]]></category>

		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[Non-Tech Articles]]></category>

		<category><![CDATA[Oracle]]></category>

		<category><![CDATA[PostgreSQL]]></category>

		<category><![CDATA[SQL Server]]></category>

		<category><![CDATA[DB2]]></category>

		<guid isPermaLink="false">http://www.pythian.com/blogs/1323/log-buffer-121-a-carnival-of-the-vanities-for-dbas</guid>
		<description><![CDATA[This week gives me a chance to get back into something I love to do&#8212;write. For those who don&#8217;t know, my name is Keith Murphy and I am a MySQL DBA at the Pythian Group. In addition, I have the privilege of being the editor of the MySQL Magazine, a quarterlyÂ  magazine for those who [...]]]></description>
			<content:encoded><![CDATA[<p>This week gives me a chance to get back into something I love to do&#8212;write. For those who don&#8217;t know, my name is <a href="http://www.pythian.com/blogs/author/murphy">Keith Murphy</a> and I am a MySQL DBA at the Pythian Group. In addition, I have the privilege of being the editor of the <a href="http://www.mysqlzine.net/" rel="nofollow">MySQL Magazine</a>, a quarterlyÂ  magazine for those who use MySQL on a daily basis, either as a DBA or a developer. The sixth issue was just released last week and is <a href="http://www.paragon-cs.com/mag/issue6.pdf" rel="nofollow">available for download now</a>. But enough about me! Let&#8217;s see what you all had to say this week.</p>
<p>Beginning with the world of <strong>MySQL</strong>.</p>
<p><a href="http://mysql-ha.com/">Monty Taylor</a> kicks things off, bringing us news of the <a href="http://mysql-ha.com/2008/10/28/drizzle-now-with-the-innodb-plugin/">ability to use the innodb plugin with Drizzle</a>. I just think its great how the Drizzle development is moving along so rapidly. My thanks to everyone involved.Â  Monty also <a href="http://mysql-ha.com/2008/10/27/help-pay-for-drizzleorg/">puts out a call</a> to help defray the cost of the purchase of the drizzle.org domain name.</p>
<p>There have been several posts this week on virtualization of MySQL Server. I point you to a colleague at Pythian, <a href="http://www.pythian.com/blogs/author/sheeri">Sheeri Cabral</a>, who wrote about some of the benefits our customers have already <a href="http://www.pythian.com/blogs/1321/virtualizing-mysql">experienced while using virtualized servers.</a> While virtualized servers are not a panacea, they definitely have a place in the DBA&#8217;s environment. If you don&#8217;t work with any currently, you will be doing so down the road.</p>
<p>The <a href="http://opensqlcamp.org">OpenSQL</a> &#8220;unconference&#8221; is coming! The date is Nov 14 -16 in Charlottesville, Virginia, USA. <a href="http://www.pythian.com/blogs/1320/important-registration-for-opensql-camp">Details and registration information are available here</a>. Speaking of conferences, the <a href="http://www.mysqlconf.com">MySQL Users Conference</a>, which is in April in Santa Clara, CA, USA has <a href="http://www.theopenforce.com/2008/10/mysql-uc-cfp-as.html">extended its deadline for topic proposals</a>.</p>
<p><a href="http://www.xaprb.com/">Baron</a> has a great post on <a href="http://www.xaprb.com/blog/2008/10/26/the-power-of-a-good-sql-naming-convention/">naming conventions for your schema</a>.</p>
<p>In the how-to department, Falko Timme has a good tutorial on how to set up <a href="http://www.greensql.net/">GreenSQL </a>to <a href="http://www.howtoforge.com/preventing-mysql-injection-attacks-with-greensql-on-debian-etch">protect your databases from SQL Injection attacks</a>. Finally, <a href="http://johanandersson.blogspot.com/">Johan Andersson</a> has a good introductory blog post on <a href="http://johanandersson.blogspot.com/2008/10/optimizing-queries-on-cluster.html">optimizing queries for a NDB cluster</a>, and a post on how you can <a href="http://johanandersson.blogspot.com/2008/10/mysql-cluster-sandbox.html">get the Cluster Sandbox tool</a> for testing the MySQL Cluster.</p>
<p>The <strong>Oracle</strong> world had sad news this week. <a href="http://carlback.blogspot.com/">Carl Backstrom</a>, who was an Oracle employee and APEX developer, was killed early Sunday morning in a car accident in Nevada. <span id="more-1323"></span> Many people have written their thoughts about this, and I give you the links in no particular order:</p>
<p><a href="http://joelkallman.blogspot.com/2008/10/carl-backstrom.html">http://joelkallman.blogspot.com/2008/10/carl-backstrom.html</a><br />
<a href="http://tonguc.wordpress.com/2008/10/28/we-lost-carl/">http://tonguc.wordpress.com/2008/10/28/we-lost-carl/</a><br />
<a href="http://www.liberidu.com/blog/?p=576">http://www.liberidu.com/blog/?p=576</a><br />
<a href="http://fuadarshad.blogspot.com/2008/10/rip-carlback.html">http://fuadarshad.blogspot.com/2008/10/rip-carlback.html</a><br />
<a href="http://www.oraclenerd.com/2008/10/carl-backstrom.html">http://www.oraclenerd.com/2008/10/carl-backstrom.html</a><br />
<a href="http://spendolini.blogspot.com/2008/10/carl-backstrom-tragic-loss.html">http://spendolini.blogspot.com/2008/10/carl-backstrom-tragic-loss.html</a></p>
<p>This week brings us the <a href="http://antognini.ch/2008/10/introduce-tvdxtat/">introduction of a new beta version</a> (4.0 beta 7) of TVD$XTAT, <a href="http://antognini.ch/blog/">Christian Antognini&#8217;s</a> freewareÂ  tool for working with raw SQL trace files.</p>
<p>Even though the Exadata server was introduced some time ago it is still generating comment in the Oracle users community. <a href="http://structureddata.org/">Greg Rahn</a> from the Oracle Real-World Performance Group at Oracle had some thoughts about some <a href="http://structureddata.org/2008/10/24/oracle-exadata-in-response-to-chuck-hollis/">recent comparisons between the Exadata servers and EMSÂ  arrays</a>.</p>
<p>An interesting observation comes from <a href="http://scale-out-blog.blogspot.com/">Robert Hodges</a> about <a href="http://scale-out-blog.blogspot.com/2008/10/simple-is-beautiful.html">building highly reliable database systems</a> (not just for Oracle!).</p>
<p><a href="http://www.pythian.com/blogs/author/billette">Marc Billette</a> brings some interesting information about <a href="http://www.pythian.com/blogs/1309/standby-log-apply-elapsed-time">how you can monitor the amount of time it takes Oracle to apply logs</a>. <a href="http://jarneil.wordpress.com/">Jason Arneil</a> has some very noteworthy  work showing how <a href="http://jarneil.wordpress.com/2008/10/27/asm-rebalance-io-saturation/">performing an online rebalance of ASM can affect your system with I/O saturation</a>. <a href="http://richardfoote.wordpress.com/">Richard Foote</a> has some very in-depth details for those who want to know what is going on with indexes and how <a href="http://richardfoote.wordpress.com/2008/10/28/fragmented-indexes-due-to-large-number-of-duplicate-entries-more/">indexes can become fragmented even when deletions of the index are not occurring</a>.</p>
<p>Looking to automate your Oracle installations more? Take a look at <a href="http://www.ardentperf.com/">Jeremy&#8217;s</a> idea for a project to <a href="http://www.ardentperf.com/2008/10/22/oracle-fully-automated-install-and-patch/">automate the install patch process</a>.</p>
<p>The world of <strong>SQL Server</strong> brings us a lot of news this week.</p>
<p><a href="http://sqlblogcasts.com/blogs/tonyrogerson/">Tony Rogerson</a> shows a simple method of <a href="http://sqlblogcasts.com/blogs/tonyrogerson/archive/2008/10/24/format-query-output-into-an-html-table-the-easy-way.aspx">creating an HTML table with table data from query results</a>. All done in SQL! Another nifty coding idea to add to your arsenal is given by the <a href="http://blogs.conchango.com/jamiethomson/">SSIS Junkie</a> where he talks about <a href="http://blogs.conchango.com/jamiethomson/archive/2008/10/24/ssis-nesting-variables-to-calculate-values.aspx">nesting variables to calculate values</a>.</p>
<p><a href="http://sqlserverpedia.com/blog">SQLServerpedia</a> reports that Windows Server 2008 will <a href="http://sqlserverpedia.com/blog/virtualization/windows-2008-r2-will-be-64-bit-only/">only be offered in aÂ  64-bit version</a>. This should simplify the life of some SQL Server DBAs! New functionality for SQL Server 2008 was written about by <a href="http://www.sqlskills.com/BLOGS/PAUL/">Paul Randal</a> with the re(addition) of <a href="http://www.sqlskills.com/BLOGS/PAUL/post/New-minimally-logged-insert-functionality-in-SQL-Server-2008.aspx">minimally-logged inserts for bulk data loads</a>. And finally, and maybe most important, Paul also blogs about something near and dear to my heart: <a href="http://www.sqlskills.com/BLOGS/PAUL/post/Planning-a-backup-strategy.aspx">backups and the recovery process</a>.</p>
<p>Anyone who quotes <a href="http://www.catb.org/~esr/">Eric Raymond</a> immediately gets high marks in my book. Ken Downs, <a href="http://database-programmer.blogspot.com/">The Database Programmer</a>, does just that in his great post about the assertion that people make (erroneously, I believe) that <a href="http://database-programmer.blogspot.com/2008/10/data-and-code-at-application-level.html">code is data</a>. Ken, your post made my week!</p>
<p>Continuing the coding examples, the <a href="http://weblogs.sqlteam.com/peterl/">Patron Saint of Lost Yaks</a> writes about using <a href="http://weblogs.sqlteam.com/peterl/archive/2008/10/27/Bayesian-Estimate-and-Root-Mean-Square.aspx">bayesian estimates for averages</a>.</p>
<p><strong>PostgreSQL</strong></p>
<p>The <a href="http://www.postgresonline.com/">Postgres online journal</a> was busy this week. They have a good post on <a href="http://www.postgresonline.com/journal/index.php?/archives/78-Why-is-my-index-not-being-used.html">why sometimes indexes aren&#8217;t used</a>. Also, the journal has a good second part of an article on <a href="http://www.postgresonline.com/journal/index.php?/archives/76-Quick-Guide-to-writing-PLPGSQL-Functions-Part-2-.html">how to write Postgres functions</a>.</p>
<p><a href="http://www.chesnok.com/daily/">Selena</a> writes a nice summary of <a href="http://www.chesnok.com/daily/2008/10/27/mentor-summit-report-for-postgresql/">happenings at the Google Summer of Code</a>  Mentor Summit. And a trick or treat from <a href="http://www.depesz.com">Depesz</a> who bring us a trick on <a href="http:/http://www.depesz.com/index.php/2008/10/30/tips-n%E2%80%99-tricks-setting-field-based-on-order">how to set a field based on the sort order</a>.</p>
<p><strong>Informix</strong></p>
<p>For those working with Informix, <a href="http://www.ibm.com/developerworks/blogs/page/gbowerman">Guy Bowerman</a> has written a <a href="http://www.ibm.com/developerworks/blogs/page/gbowerman?entry=book_review_administering_informix_dynamic">good book review of <em>Administering Informix Dynamic Server</em></a>.</p>
<p><strong>DB2</strong></p>
<p>The DB2 DBAs had a conference this week&#8212;the IOD (Information on Demand) conference. Several people have blogged about it.  <a href="http://it.toolbox.com/blogs/db2zos/">Willie Favero</a> shared his <a href="http://it.toolbox.com/blogs/db2zos/iod-tuesday-is-now-one-for-the-books-27972">thoughts on IOD here</a>.</p>
<p>Here&#8217;s what <a href="http://datageekgal.blogspot.com/">Beth Breidenbach</a> had to say about <a href="http://datageekgal.blogspot.com/2008/10/iod-day-1-optimizing-information.html">Monday at IOD</a>, and <a href="http://www.adamgartenberg.com/gartenberg/agartenberg.nsf">Adam Gartenberg</a> wrote about <a href="http://www.adamgartenberg.com/gartenberg/agartenberg.nsf/dx/iod-tuesday-wrap-up">Tuesday at the conference</a>.</p>
<p>That&#8217;s all.  Thanks for your attention, and I&#8217;ll see you again soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pythian.com/news/1323/log-buffer-121-a-carnival-of-the-vanities-for-dbas/feed</wfw:commentRss>
		</item>
		<item>
		<title>MySQL Schema Synchronization and GUI Tools</title>
		<link>http://www.pythian.com/news/1301/mysql-schema-synchronization-and-gui-tools</link>
		<comments>http://www.pythian.com/news/1301/mysql-schema-synchronization-and-gui-tools#comments</comments>
		<pubDate>Tue, 21 Oct 2008 20:22:10 +0000</pubDate>
		<dc:creator>Keith Murphy</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[foreign keys]]></category>

		<category><![CDATA[GUI tools]]></category>

		<category><![CDATA[InnoDB]]></category>

		<category><![CDATA[myisam]]></category>

		<category><![CDATA[MySQL Workbench]]></category>

		<category><![CDATA[SQLyog]]></category>

		<guid isPermaLink="false">http://www.pythian.com/blogs/1301/mysql-schema-synchronization-and-gui-tools</guid>
		<description><![CDATA[Or, There is a Use for GUI Tools!
Recently I was working on a problem for a customer. They are converting a server with two InnoDB data files to innodb_file_per_table:

$ ls -l ibdata*
-rwxr-xr-xÂ Â  1 mysqlÂ Â Â  mysqlÂ Â Â Â Â Â  2.0G Oct 14 13:10 ibdata1
-rwxr-xr-xÂ Â  1 mysqlÂ Â Â  mysqlÂ Â Â Â Â Â  350G Oct 14 13:10 ibdata2

I honestly don&#8217;t recall ever seeing (or hearing [...]]]></description>
			<content:encoded><![CDATA[<h3>Or, There is a Use for GUI Tools!</h3>
<p>Recently I was working on a problem for a customer. They are converting a server with two InnoDB data files to <code>innodb_file_per_table</code>:</p>
<pre>
$ ls -l ibdata*
-rwxr-xr-xÂ Â  1 mysqlÂ Â Â  mysqlÂ Â Â Â Â Â  2.0G Oct 14 13:10 ibdata1
-rwxr-xr-xÂ Â  1 mysqlÂ Â Â  mysqlÂ Â Â Â Â Â  350G Oct 14 13:10 ibdata2
</pre>
<p>I honestly don&#8217;t recall ever seeing (or hearing about) so large a data file.</p>
<p>The method chosen for conversion boils down to this:</p>
<ol>
<li>stop and start the server to enable <code>innodb_file_per_table</code></li>
<li>alter all tables to myisam</li>
<li>stop server and delete ibdata file</li>
<li>restart server</li>
<li>convert tables back to InnoDB</li>
<li>add foreign keys</li>
</ol>
<p>This post isn&#8217;t about how we did it, or about whether or not it was the best way, or anything like that. This post is really about the the last two steps.</p>
<p>There were over 500 InnoDB tables and something like 375 foreign keys. So I needed to somehow create the <code>ALTER TABLE</code> statements for these 500 servers. To drop the Foreign Keys, I used the following <code>SELECT</code> statement:</p>
<pre>SELECT CONCAT( "mysql -u root -pPASS ", table_schema," -e 'ALTER TABLE ",table_name, ' DROP FOREIGN KEY ', constraint_name,';'' &amp;') AS list_of_fks FROM information_schema.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_NAME is not null ORDER BY TABLE_NAME, COLUMN_NAME;</pre>
<p>This created a list of statements that I could then put in a batch file, edit a little, and have them run in parallel.</p>
<p>I used the following <code>SELECT</code> statement to find all InnoDB tables and prepare a command to convert them to MyISAM:</p>
<pre>
SELECT CONCAT("mysql -u root -pPASS ", TABLE_SCHEMA, " -e 'ALTER TABLE ", TABLE_NAME, " ENGINE=MYISAM;' &amp; ") FROM INFORMATION_SCHEMA.TABLES WHERE ENGINE='INNODB';
</pre>
<p>Again, the output can be put in a batch file, modified a little, and run in parallel.</p>
<p>Once everything was converted to MyISAM, I shut down the database and removed the InnoDB log and data files and modified the <code>my.cnf</code> to so I had <code>file_per_table</code> and a much smaller InnoDB data file. That was the fairly straightforward part. Now the fun began. <span id="more-1301"></span> I needed to convert all the tables back to InnoDB and add the FKs back.</p>
<p>Now ordinarily, I&#8217;m a command-line kind of of guy. However, having used <code>diff</code> before for comparisons, I decided to go another route.  Based on some previous experience, I chose <a href="http://www.webyog.com">SQLyog</a> for the job. Before I began any conversion of the tables I dumped the schema of the database and loaded it into a MySQL server running on my laptop.</p>
<p>Once all the conversions were done I used a tool inÂ SQLyog called a &#8220;Schema Synchronization Tool&#8221;.Â  Essentially, you point the tool a &#8220;source&#8221; database and a &#8220;target&#8221; database. (It is very important to keep track of which is which.) During the choice of the source and target you also choose the database that you want to compare. Once this is done you simply click compare and it checks both database and then returns a nice list of SQL statements.</p>
<p>Since we had 500 tables to convert I didn&#8217;t just copy the SQL into a file and import it. I created more files that contained lines similar to:</p>
<pre>mysql -u root -pXXX "ALTER TABLE .... " &amp;</pre>
<p>This way, they ran in the background. At one point I had over 200 alter statements running at the same time.</p>
<p>My one complaint about SQLyog is that the SQL it generated was sometimes inefficient. It would give me a SQL statement to <code>ALTER TABLE engine=Innodb</code> and then three separate statements for three different FKs. Each time it would have to copy the table so this would take four times as long as combining all these statement into one.Â  It is perfectly feasible to do this:</p>
<pre>ALTER TABLE X ADD FK X1, ADD FK X2, ADD FKX3, engine=innodb;</pre>
<p>Big time savings!</p>
<p>Unfortunately, I did run across what amounts to a bug. Not in SQLyog, but in MySQL. You can run this:</p>
<pre>ALTER TABLE X ADD FK X1, ADD FK X2, ADD FKX3;</pre>
<p>and MySQL will happily take the statement and run. Hours later when it gets done, you find out that the table is still MyISAM and the FKs were just turned into indexes. Stupid!</p>
<p><a href="http://www.pythian.com/blogs/author/sheeri/">Sheeri</a> pointed out that the MySQL Workbench program does something very similar. I haven&#8217;t had a chance to look into it yet. Having worked with <a href="http://dev.mysql.com/workbench/">MySQL Workbench</a> before, I am sure it does a schema sync very well. Either way, trust me on this&#8212;if you have a significant schema synchronization project, you need to look into one of these tools.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pythian.com/news/1301/mysql-schema-synchronization-and-gui-tools/feed</wfw:commentRss>
		</item>
		<item>
		<title>It&#8217;s a Good Time to be Involved with MySQL</title>
		<link>http://www.pythian.com/news/1294/its-a-good-time-to-be-involved-with-mysql</link>
		<comments>http://www.pythian.com/news/1294/its-a-good-time-to-be-involved-with-mysql#comments</comments>
		<pubDate>Thu, 09 Oct 2008 23:28:14 +0000</pubDate>
		<dc:creator>Keith Murphy</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[Non-Tech Articles]]></category>

		<category><![CDATA[employment]]></category>

		<category><![CDATA[market penetration]]></category>

		<category><![CDATA[recession]]></category>

		<guid isPermaLink="false">http://www.pythian.com/blogs/1294/its-a-good-time-to-be-involved-with-mysql</guid>
		<description><![CDATA[In many parts of the world times are uncertain. I live in the United States and we are in the middle of a financial meltdown that many fear may be as bad as the Great Depression. Because the world&#8217;s economies are so linked it is causing severe distress in many other countries as well. I [...]]]></description>
			<content:encoded><![CDATA[<p>In many parts of the world times are uncertain. I live in the United States and we are in the middle of a financial meltdown that many fear may be as bad as the Great Depression. Because the world&#8217;s economies are so linked it is causing severe distress in many other countries as well. I just read that two trillion dollars have been lost from nest eggs in the last 15 months here in the States.</p>
<p>I am not going to turn this into a rant about who is right, who is wrong, orÂ  what should be done about it to resolve the problem. This isn&#8217;t the place. I probably don&#8217;t even have the right answer. I have a different angle.</p>
<p>If you are involved with MySQL as a database administrator, or if you work directly with MySQL in some other aspect, you can probably breathe a little easier. Why is this? MySQL Server has grown in market penetration for a long time. It is now a significant section of the RDBMS pie.Â  I predict that this market penetration will only continue to grow. As this economic downturn/recession/whatever continues, companies will look harder for ways to save money. What better way to do so than replace your proprietary RDBMS that can cost you significant amounts of money, with MySQL Server? For all intents, the same functionality is there, the speed and flexibility is certainly there, and there is a giant company behind MySQL now, providing &#8220;enterprise-ready&#8221; support.</p>
<p>The market is crying right now for MySQL database administrators. We don&#8217;t cost any more than Oracle or Microsoft DBAs, you know. Just a couple of years ago, very few companies hired MySQL DBAs. They hired developers who also did database administration, or a system administrators who also managed the MySQL server. Now, as the number of database servers increases and the amount of data grows they want real, honest-to-goodness database administrators. If you have production experience with MySQL server in any significant amount you will not have any problems finding a job. I don&#8217;t think this is going to change anytime soon. So, even if your company succumbs to the times, there are others out there who need your experience. Don&#8217;t be dismayed! <span id="more-1294"></span></p>
<p>And companies who might be reading this&#8212;be smart. I know it costs time and dollars to move your infrastructure, but this is time and money well spent. Larry and Bill both have plenty of money and they really don&#8217;t need you or your company to continue to line their pockets with upgrades and maintenance and whatever. There is very little that either of their servers can do that MySQL can&#8217;t do right now. Why are you waiting?</p>
<p>MySQL too small for you? Well, Sun owns MySQL now. Ever heard of them? If you are so enterprise-uptight that you want one vendor to provide support for everything, congratulations. You should be in heaven. Sun does servers, Solaris for the OS, and  of course, MySQL. Need middle-ware? Ever heard of Java? Might not be what <em>I</em> would recommend, but if it floats your boat, Sun can certainly provide all this and support too.</p>
<p>One thing I have found is that MySQL DBAs love to work remotely. In the job of a DBA it is often perfectly reasonable to work off-site. It requires a little &#8220;out-of-the-box&#8221; thinking, but the rewards are worth it. If you want the best for your company, you might want to consider this as an option.</p>
<p>If you are a working MySQL DBA andÂ  are worried about the economy, you can worry a little less. While your house might be losing value, and your 401k has fallen on it&#8217;s face, you have a job. And there is a good chance it (or another one) will be there even when Wall Street is singing the blues.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pythian.com/news/1294/its-a-good-time-to-be-involved-with-mysql/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
