<?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>code.openark.org &#187; MySQL</title>
	<atom:link href="http://code.openark.org/blog/category/mysql/feed" rel="self" type="application/rss+xml" />
	<link>http://code.openark.org/blog</link>
	<description>Blog by Shlomi Noach</description>
	<lastBuildDate>Fri, 12 Mar 2010 13:27:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>But I DO want MySQL to say &#8220;ERROR&#8221;!</title>
		<link>http://code.openark.org/blog/mysql/but-i-do-want-mysql-to-say-error</link>
		<comments>http://code.openark.org/blog/mysql/but-i-do-want-mysql-to-say-error#comments</comments>
		<pubDate>Fri, 12 Mar 2010 04:53:28 +0000</pubDate>
		<dc:creator>shlomi</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Data Types]]></category>
		<category><![CDATA[sql_mode]]></category>
		<category><![CDATA[Syntax]]></category>

		<guid isPermaLink="false">http://code.openark.org/blog/?p=2005</guid>
		<description><![CDATA[MySQL is known for its willingness to accept invalid queries, data values. It can silently commit your transaction, truncate your data.

Using GROUP_CONCAT with a small group_concat_max_len setting? Your result will be silently truncated (make sure to check the warnings though).
Calling CREATE TEMPORARY TABLE? You get silent commit.
Issuing a ROLLBACK on non-transactional involved engines? Have a [...]]]></description>
			<content:encoded><![CDATA[<p>MySQL is known for its willingness to accept invalid queries, data values. It can silently commit your transaction, truncate your data.</p>
<ul>
<li>Using <strong>GROUP_CONCAT</strong> with a small <strong>group_concat_max_len</strong> setting? Your result will be silently truncated (make sure to check the warnings though).</li>
<li>Calling <strong>CREATE <span style="text-decoration: line-through;">TEMPORARY</span> TABLE</strong>? You get <a href="http://www.joinfu.com/2010/03/a-follow-up-on-the-sql-puzzle/">silent commit</a>.</li>
<li>Issuing a <strong>ROLLBACK</strong> on non-transactional involved engines? Have a warning; no error.</li>
<li>Using <strong>LOCK IN SHARE MODE</strong> on non transactional tables? Not a problem. Nothing reported.</li>
<li>Adding a <strong>FOREIGN KEY</strong> on a MyISAM table? Good for you; no action actually taken.</li>
<li>Inserting <strong>300</strong> to a <strong>TINYINT</strong> column in a relaxed <strong>sql_mode</strong>? Give me <strong>255</strong>, I&#8217;ll silently drop the remaining <strong>45</strong>. I owe you.</li>
</ul>
<h4>Warnings and errors</h4>
<p>It would be nice to:<span id="more-2005"></span></p>
<ul>
<li>Have an <strong>auto_propagate_warning_to_error</strong> server variable (global/session/both) which, well, does what it says.</li>
<li>Have an <strong>i_am_really_not_a_dummy</strong> server variable which implies stricter checks for all the above and prevents you from doing with <em>anything</em> that may be problematic (or rolls back your transactions on your invalid actions).</li>
</ul>
<p>Connectors may be nice enough to propagate warnings to errors &#8211; that&#8217;s good. But not enough: since data is already committed in MySQL.</p>
<p>If I understand correctly, and maybe it&#8217;s just a myth, it all relates to the times where MySQL had interest in a widespread adoption across the internet, in such way that it does not interfere too much with the users (hence leading to the common myth that &#8220;MySQL just works out of the box and does not require me to configure or understand anything&#8221;).</p>
<p>MySQL is a database system, and is now widespread, and is used by serious companies and products. It is time to stop play nice to everyone and provide with strict integrity &#8212; or, be nice to everyone, just allow me to specify what &#8220;nice&#8221; means for me.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.openark.org/blog/mysql/but-i-do-want-mysql-to-say-error/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Proper SQL table alias use conventions</title>
		<link>http://code.openark.org/blog/mysql/proper-sql-table-alias-use-conventions</link>
		<comments>http://code.openark.org/blog/mysql/proper-sql-table-alias-use-conventions#comments</comments>
		<pubDate>Thu, 11 Mar 2010 07:10:09 +0000</pubDate>
		<dc:creator>shlomi</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Opinions]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Syntax]]></category>

		<guid isPermaLink="false">http://code.openark.org/blog/?p=2156</guid>
		<description><![CDATA[After seeing quite some SQL statements over the years, something is bugging me: there is no consistent convention as for how to write an SQL query.
I&#8217;m going to leave formatting, upper/lower-case issues aside, and discuss a small part of the SQL syntax: table aliases. Looking at three different queries, I will describe what I find [...]]]></description>
			<content:encoded><![CDATA[<p>After seeing quite some SQL statements over the years, something is bugging me: there is no consistent convention as for how to write an SQL query.</p>
<p>I&#8217;m going to leave formatting, upper/lower-case issues aside, and discuss a small part of the SQL syntax: table aliases. Looking at three different queries, I will describe what I find to be problematic table alias use.</p>
<p>Using the <a href="http://dev.mysql.com/doc/sakila/en/sakila.html">sakila</a> database, take a look at the following queries:<span id="more-2156"></span></p>
<h4>Query #1</h4>
<blockquote>
<pre><strong>SELECT</strong>
 R.rental_date, C.customer_id, C.first_name, C.last_name
<strong>FROM</strong>
 rental R
 <strong>JOIN</strong> customer C <strong>USING</strong> (customer_id)
<strong>WHERE</strong>
 R.rental_date &gt;= DATE('2005-10-01')
 <strong>AND</strong> C.store_id=1;
</pre>
</blockquote>
<p>The above looks for film rentals done in a specific store (store #<strong>1</strong>), as of Oct. 1st, 2005.</p>
<h4>Query #2</h4>
<blockquote>
<pre><strong>SELECT</strong>
 F.title, C.name
<strong>FROM</strong>
 film <strong>AS</strong> F
 <strong>JOIN</strong> film_category <strong>AS</strong> S <strong>ON</strong> (F.film_id = S.film_id)
 <strong>JOIN</strong> category <strong>AS</strong> C <strong>ON</strong> (S.category_id = C.category_id)
<strong>WHERE</strong> F.length &gt; 180;</pre>
</blockquote>
<p>The above lists the title and category for all films longer than three hours.</p>
<h4>Query #3</h4>
<blockquote>
<pre><strong>SELECT</strong> c.customer_id, c.last_name
<strong>FROM</strong>
  customer c
  <strong>INNER JOIN</strong> address a ON (c.address_id = a.address_id)
  <strong>INNER JOIN</strong> (
    <strong>SELECT</strong>
      c.city_id
    <strong>FROM</strong>
      city AS c
      <strong>JOIN</strong> country s <strong>ON</strong> (c.country_id = s.country_id)
    <strong>WHERE</strong>
      s.country <strong>LIKE</strong> 'F%'
  ) s1 <strong>USING</strong> (city_id)
<strong>WHERE</strong>
  create_date &gt;= DATE('2005-10-01');
</pre>
</blockquote>
<p>The above lists customers created as of Oct. 1st, 2005, and who live in countries starting with an &#8216;F&#8217;. The query could be solved without a subquery, but there&#8217;s a good reason why I made it so.</p>
<h4>The problems</h4>
<p>I used very different conventions on any one of the queries, and sometimes within each query. And it&#8217;s common that I see the same on a customer&#8217;s site, what with having many programmers do the SQL coding. Again, I will only discuss the table aliases conventions. I&#8217;ll leaver the rest to the reader.</p>
<p>Here&#8217;s where I see problems:</p>
<ul>
<li>Query <strong>#1</strong>: In itself, it looks fine. <strong>Rental</strong> turns to <strong>R</strong>, <strong>Customer</strong> turns to <strong>C</strong>. I will comment on this slightly later on when I provide my full opinion.</li>
<li>Query <strong>#2</strong>: So <strong>film</strong> turns to <strong>F</strong>, <strong>category</strong> turns to <strong>C</strong>. What should <strong>film_category</strong> turn into? <em>Out of letters?</em> Let&#8217;s just go for <strong>S</strong>, shall we? But <strong>S</strong> has nothing do with <strong>film_category</strong>. Yet it&#8217;s so commonly seen.</li>
<li>Query <strong>#2</strong>: We&#8217;re using the <strong>AS</strong> keyword now. We didn&#8217;t use it before.</li>
<li>Queries <strong>#1</strong>, <strong>#2</strong>: Hold on. Wasn&#8217;t <strong>C</strong> taken for <strong>customer</strong> in Query <strong>#1</strong>? Now, in Query <strong>#2</strong> it stands for <strong>category</strong>? I&#8217;m beginning to get confused.</li>
<li>Query <strong>#3</strong>: Now aliases are lower case; I was just getting used to them being upper case.</li>
<li>Query <strong>#3</strong>: But, hey, <strong>c</strong> is back to <strong>customer</strong>!</li>
<li>Query <strong>#3</strong>: Or, is it? Take a look at the subquery. Theres another <strong>c</strong> in there! This time it&#8217;s <strong>city</strong>! And it&#8217;s perfectly valid syntax. We actually have two identical aliases in the same query.</li>
<li>Query <strong>#3</strong>: If I could, I would name country with <strong>c</strong> as well. But I can&#8217;t. So why not throw in <strong>s</strong> again?</li>
<li>Query <strong>#3</strong>: and now I don&#8217;t even bother using the alias when accessing the <strong>create_date</strong>. Well, there&#8217;s no such column in any of the other tables!</li>
</ul>
<h4>Proper conventions</h4>
<p>What I find so disturbing is that whenever I read a complex query, I need to go back and forth, back and forth between table aliases (found everywhere in the query) and their declaration point. Such irregularities make the queries difficult to read.</p>
<p>Any of the above issues could be justified. But I wish to make some suggestions:</p>
<ul>
<li>Decide whether you&#8217;re going for upper or lower case.</li>
<li>Do not use the same alias twice in your query, even if it&#8217;s valid.</li>
<li>Aliases do not have to be single character. <strong>film_category</strong> may just as well be <strong>FC</strong>.</li>
<li>Do not alias something that is hard to interpret. <strong>s</strong> does not stand for <strong>country</strong>.</li>
<li>Think ahead: use same aliases throughout all your queries, as far as you can. If uniqueness is a problem, make for longer aliases. Use <strong>cust</strong> instead of <strong>c</strong>.</li>
</ul>
<p>The above should make for more organized and readable SQL code. Remember: what one programmer finds as a very intuitive alias, is unintuitive to another!</p>
<h4>My own convention</h4>
<p>Simple: I <em>only use aliases</em> when using self joins. I am aware that queries are much longer what with long table names. I go farther than that: I prefer fully qualifying questionable columns throughout the query. Yes, it makes the query even longer.</p>
<p>I know this does not appeal to many. But there&#8217;s no confusion. And it&#8217;s easily searchable. And it&#8217;s consistent. And if properly formatted, as in the above queries, is well readable.</p>
<p>Now please join me in asking Oracle if they can add multi-line Strings for java, as there are for python.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.openark.org/blog/mysql/proper-sql-table-alias-use-conventions/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>mk-schema-change? Check out ideas from oak-online-alter-table</title>
		<link>http://code.openark.org/blog/mysql/mk-schema-change-check-out-ideas-from-oak-online-alter-table</link>
		<comments>http://code.openark.org/blog/mysql/mk-schema-change-check-out-ideas-from-oak-online-alter-table#comments</comments>
		<pubDate>Wed, 10 Mar 2010 18:28:29 +0000</pubDate>
		<dc:creator>shlomi</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[openark kit]]></category>
		<category><![CDATA[Schema]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://code.openark.org/blog/?p=2144</guid>
		<description><![CDATA[In response to Mark Callaghan&#8217;s post mk-schema-change.
I apologize for not commenting on the post itself, I do not hold a Facebook account. Anyway this is a long write, so it may as well deserve a post of its own.
Some of the work Mark is describing already exists under openark kit&#8217;s oak-online-alter-table. Allow me to explain [...]]]></description>
			<content:encoded><![CDATA[<p>In response to Mark Callaghan&#8217;s post <a href="http://www.facebook.com/note.php?note_id=356997370932">mk-schema-change</a>.</p>
<p>I apologize for not commenting on the post itself, I do not hold a Facebook account. Anyway this is a long write, so it may as well deserve a post of its own.</p>
<p>Some of the work Mark is describing already exists under <a href="http://code.openark.org/forge/openark-kit">openark kit</a>&#8217;s <a href="http://code.openark.org/forge/openark-kit/oak-online-alter-table">oak-online-alter-table</a>. Allow me to explain what I have gained there, and how the issue can be further pursued. There is relevance to Mark&#8217;s suggestion.</p>
<p><em>oak-online-alter-table</em> uses a combination of locks, chunks and triggers to achieve an almost non-blocking <strong>ALTER TABLE</strong> effect. I had a very short opportunity to speak with Mark on last year&#8217;s conference, in between bites. Mark stated that anything involving triggers was irrelevant in his case.</p>
<p>The triggers are a pain, but I believe a few other insights from <em>oak-online-alter-table</em> can be of interest.<span id="more-2144"></span></p>
<h4>The first attempt</h4>
<p>My first attempt with the script assumed:</p>
<ul>
<li>Table has an <strong>AUTO_INCREMENT PRIMARY KEY</strong> column</li>
<li>New rows always gain ascending <strong>PRIMARY KEY</strong> values</li>
<li><strong>PRIMARY KEY</strong> never changes for an existing row</li>
<li><strong>PRIMARY KEY</strong> values are never reused</li>
<li>Rows may be deleted at will</li>
<li>No triggers exist on the table</li>
<li>No <strong>FOREIGN KEY</strong>s exist on the table.</li>
</ul>
<p>So the idea was: when one wants to do an <strong>ALTER TABLE</strong>:</p>
<ol>
<li>Create a <em>ghost</em> table with the new structure.</li>
<li>Read the minimum and maximum PK values.</li>
<li>Create <strong>AFTER INSERT</strong>, <strong>AFTER UPDATE</strong>, <strong>AFTER DELETE</strong> triggers on the original table. These triggers will propagate the changes onto the <em>ghost</em> table.</li>
<li>Working out slowly, and in small chunks, copy rows within recorded min-max values range into the <em>ghost</em> table. The interesting part is where the script makes sure there&#8217;s no contradiction between these actions and those of the triggers, (whichever came first!). This is largely solved using <strong>INSERT IGNORE</strong> and <strong>REPLACE INTO</strong> in the proper context.</li>
<li>Working out slowly and in chunks again, we <em>remove</em> rows from the <em>ghost</em> table, which are no longer existent in the original table.</li>
<li>Once all chunking is complete, <strong>RENAME</strong> original table to *_old, and <em>ghost</em> table in place of the original table.</li>
</ol>
<p>Steps <strong>4</strong> &amp; <strong>5</strong> are similar in concept to transactional recovery through <em>redo logs</em> and <em>undo logs</em>.</p>
<h4>The next attempt</h4>
<p>Next phase removed the <strong>AUTO_INCREMENT</strong> requirement, as well as the &#8220;no reuse of PK&#8221;. In fact, the only remaining constraints were:</p>
<ul>
<li>There is some <strong>UNIQUE KEY</strong> on the table which is unaffected by the <strong>ALTER</strong> operation</li>
<li>No triggers exist on the table</li>
<li>No <strong>FOREIGN KEY</strong>s exist on the table.</li>
</ul>
<p>The steps are in general very similar to those listed previously, only now a more elaborate chunking method is used with possible non-integer, possible multi-column chunking algorithm. Also, the triggers take care of changes in <strong>UNIQUE KEY</strong> values themselves.</p>
<h4>mk-schema-change?</h4>
<p>Have a look at the <a href="http://code.google.com/p/openarkkit/w/list">wiki pages</a> for OnlineAlterTable*. There is some discussion on concurrency issues; on transactional behavior, which explains why <em>oak-online-alter-table</em> performs correctly. Some of these are very relvant, I believe, to Mark&#8217;s suggestion. In particular, making the chunks copy; retaining transactional integrity, etc.</p>
<p>To remove any doubt, <em>oak-online-alter-table</em> is<em> </em> <strong>not production ready</strong> or anywhere near. Use at your own risk. I&#8217;ve seen it work, and I&#8217;ve seen it crash. I got little feedback and thus little chance to fix things. I also didn&#8217;t touch the code for quite a few months now, so I&#8217;m a little rusty myself.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.openark.org/blog/mysql/mk-schema-change-check-out-ideas-from-oak-online-alter-table/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Things to monitor on MySQL, the user&#8217;s perspective</title>
		<link>http://code.openark.org/blog/mysql/things-to-monitor-on-mysql-the-users-perspective</link>
		<comments>http://code.openark.org/blog/mysql/things-to-monitor-on-mysql-the-users-perspective#comments</comments>
		<pubDate>Wed, 10 Mar 2010 09:12:24 +0000</pubDate>
		<dc:creator>shlomi</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Execution plan]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[mycheckpoint]]></category>

		<guid isPermaLink="false">http://code.openark.org/blog/?p=2008</guid>
		<description><![CDATA[Working on mycheckpoint, I have the intention of adding custom monitoring. That is, letting the user define things to monitor. I have my own thoughts, I would be grateful to get more input!
What would the user want to monitor?
Monitoring for the number of SELECT statements per second, InnoDB locks, slave replication lag etc. is very [...]]]></description>
			<content:encoded><![CDATA[<p>Working on <em>mycheckpoint</em>, I have the intention of adding custom monitoring. That is, letting the user define things to monitor. I have my own thoughts, I would be grateful to get more input!</p>
<h4>What would the user want to monitor?</h4>
<p>Monitoring for the number of SELECT statements per second, InnoDB locks, slave replication lag etc. is very important, and monitoring utilities provide with this information. But what does that tell the end user? Not much.</p>
<p>The experienced DBA may gain a lot. The user would be more interested in completely other kind of information. In between, some information is relevant to both.</p>
<p>Say we were managing an on-line store. We want to monitor the health of the database. But the health of the database is inseparable from the health of the application. I mean, having little to no disk usage is fine, unless&#8230; something is wrong with the application, which leads to no new purchases.</p>
<p>And so a user would be interested in monitoring the number of purchases per hour, or the time passed since last successful purchase. This kind of data can only be generated by a user&#8217;s specific query. Looking at the charts, the user would then feel safer and confident in the wellness of his store app.</p>
<p><span id="more-2008"></span>But let&#8217;s dig further. We want the store&#8217;s website to provide with good response. In particular, the query which returns the items in a customer&#8217;s cart must react quickly. Our user would not only want to see that purchases get along, but also that page load times (as in our example) are quick for those critical parts. And so a user should be able to monitor the <em>time</em> it took to execute a given query.</p>
<p>It can be of further interest to know how many times per second a given query is executed. This part is not easily done on the server side, and requires the user&#8217;s cooperation (or else we must analyze the general log, sniff, or set up a proxy). If the user is willing, she can log to some table each time she executes a certain query. Then we&#8217;re back to monitoring a regular table, as with the first example.</p>
<p>It is also possible to monitor for a query&#8217;s execution plan. Is it full scan? How many rows are expected? But given that we can monitor the time it took to execute a query, I&#8217;m not sure this is useful. If everything runs fast enough &#8212; who cares about <em>how</em> it executes?</p>
<p>Some of the above can be monitored on an altogether higher level: if  we&#8217;re talking about some web application, then we can use our Apache logs to determine load time for pages, or number of requests to our &#8220;cart items&#8221; page. But not always do we work with web servers, and we may be interested in checking the specific queries behind the scenes.</p>
<h4>Summary</h4>
<p>Custom monitoring can include:</p>
<ul>
<li>User defined queries (number of concurrent visitors; count of successful operations per second; number of rows per given table or condition; &#8230;)</li>
<li>Execution time for user defined queries (time it takes to return cart items; find rows matching condition; sort a table; &#8230;)</li>
<li>Number of executions for a given query, per second.</li>
</ul>
<p>I intend to incorporate the above into <em>mycheckpoint</em> as part of its standard monitoring scheme.</p>
<p>Please share your thought below.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.openark.org/blog/mysql/things-to-monitor-on-mysql-the-users-perspective/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tip: faster than TRUNCATE</title>
		<link>http://code.openark.org/blog/mysql/tip-faster-than-truncate</link>
		<comments>http://code.openark.org/blog/mysql/tip-faster-than-truncate#comments</comments>
		<pubDate>Tue, 09 Mar 2010 11:37:01 +0000</pubDate>
		<dc:creator>shlomi</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[InnoDB]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://code.openark.org/blog/?p=1896</guid>
		<description><![CDATA[TRUNCATE is usually a fast operation (much faster than DELETE FROM). But sometimes it just hangs; I&#8217;ve has several such uncheerful events with InnoDB (Plugin) tables which were extensively written to. The TRUNCATE hanged; nothing else would work; minutes pass.
TRUNCATE on tables with no FOREIGN KEYs should act fast: it translate to dropping the table [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://dev.mysql.com/doc/refman/5.0/en/truncate-table.html"><strong>TRUNCATE</strong></a> is usually a fast operation (much faster than <strong>DELETE FROM</strong>). But sometimes it just hangs; I&#8217;ve has several such uncheerful events with InnoDB (Plugin) tables which were extensively written to. The <strong>TRUNCATE</strong> hanged; nothing else would work; minutes pass.</p>
<p><strong>TRUNCATE</strong> on tables with no <strong>FOREIGN KEY</strong>s <em>should</em> act fast: it translate to dropping the table and creating a new one (and it all depends on the MySQL version, see the manual).</p>
<p>What&#8217;s faster than <strong>TRUNCATE</strong>, then? If you don&#8217;t have triggers nor <strong>FOREIGN KEY</strong>s, a <a href="http://dev.mysql.com/doc/refman/5.0/en/rename-table.html"><strong>RENAME TABLE</strong></a> can come to the rescue. Instead of:</p>
<blockquote>
<pre>TRUNCATE log_table</pre>
</blockquote>
<p>Do:</p>
<blockquote>
<pre>CREATE TABLE log_table_new LIKE log_table;
<strong>RENAME TABLE</strong> log_table TO log_table_old, log_table_new TO log_table;
DROP TABLE log_table_old;</pre>
</blockquote>
<p>I found this to work well for me. Do note that <strong>AUTO_INCREMENT</strong> values can be tricky here: the &#8220;new&#8221; table is created with an <strong>AUTO_INCREMENT</strong> value which is immediately taken in the &#8220;working&#8221; table. If you care about not using same <strong>AUTO_INCREMENT</strong> values, you can:<span id="more-1896"></span></p>
<blockquote>
<pre>ALTER TABLE log_table_new AUTO_INCREMENT=<em>some high enough value;</em></pre>
</blockquote>
<p>Just before renaming.</p>
<p>I do not have a good explanation as for why the <strong>RENAME TABLE</strong> succeeds to respond faster than <strong>TRUNCATE</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.openark.org/blog/mysql/tip-faster-than-truncate/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Quick reminder: avoid using binlog-do-db</title>
		<link>http://code.openark.org/blog/mysql/quick-reminder-avoid-using-binlog-do-db</link>
		<comments>http://code.openark.org/blog/mysql/quick-reminder-avoid-using-binlog-do-db#comments</comments>
		<pubDate>Tue, 02 Mar 2010 19:03:50 +0000</pubDate>
		<dc:creator>shlomi</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Replication]]></category>

		<guid isPermaLink="false">http://code.openark.org/blog/?p=2077</guid>
		<description><![CDATA[Nothing new about this warning; but it&#8217;s worth repeating:
Using binlog-do-db is dangerous to your replication. It means the master will not write to binary logs any statement not in the given database.
Ahem. Not exactly. It will not write to binary logs any statement which did not originate from the given database.
Which is why a customer, [...]]]></description>
			<content:encoded><![CDATA[<p>Nothing new about this warning; but it&#8217;s worth repeating:</p>
<p>Using <a href="http://dev.mysql.com/doc/refman/5.1/en/replication-options-binary-log.html#option_mysqld_binlog-do-db"><strong>binlog-do-db</strong></a> is dangerous to your replication. It means the master will not write to binary logs any statement not in the given database.</p>
<p>Ahem. Not exactly. It will not write to binary logs any statement which did not originate from the given database.</p>
<p>Which is why a customer, who was using <strong>Toad for MySQL</strong> as client interface to MySQL, and by default connected to the <strong>mysql</strong> schema, did not see his queries being replicated. In fact, he later on got replication errors. If you do:</p>
<blockquote>
<pre>USE test;
INSERT INTO world.City VALUES (...)</pre>
</blockquote>
<p>Then the statement is assumed to be in the <strong>test</strong> database, not in the <strong>world</strong> database.</p>
<p>Slightly better is using <strong>replicate-do-db</strong> on the slave machines. At least we allow the master to write everything. But still, for the same reasons, slaves may fail to repeat a perfectly valid query, just because it has been issued in the context of the wrong database. <strong>replicate-ignore-db</strong> is somewhat safer yet, but the trap is still there.</p>
<p>My advice is that replication should replicate <em>everything</em>. Make sure you and everyone else you work with understand the implications of <strong>binlog-do-db</strong> and <strong>replicate-do-db</strong> before implementing it.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.openark.org/blog/mysql/quick-reminder-avoid-using-binlog-do-db/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Static charts vs. interactive charts</title>
		<link>http://code.openark.org/blog/mysql/static-charts-vs-interactive-charts</link>
		<comments>http://code.openark.org/blog/mysql/static-charts-vs-interactive-charts#comments</comments>
		<pubDate>Tue, 02 Mar 2010 13:28:08 +0000</pubDate>
		<dc:creator>shlomi</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Analysis]]></category>
		<category><![CDATA[Graphs]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[mycheckpoint]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://code.openark.org/blog/?p=2027</guid>
		<description><![CDATA[I&#8217;m having my usual fun with charts. Working on mycheckpoint, I&#8217;ve generated monitoring charts using the Google Chars API. But I&#8217;ve also had chance to experiment and deploy interactive charts, JavaScript based. In particular, I used and tweaked dygraphs.
I&#8217;d like to note some differences in using charts of both kinds. And I think it makes [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m having my usual fun with charts. Working on <a href="http://code.openark.org/forge/mycheckpoint">mycheckpoint</a>, I&#8217;ve generated monitoring charts using the <a href="http://code.google.com/apis/chart/image_charts.html">Google Chars API</a>. But I&#8217;ve also had chance to experiment and deploy interactive charts, JavaScript based. In particular, I used and tweaked <a href="http://www.danvk.org/dygraphs/">dygraphs</a>.</p>
<p>I&#8217;d like to note some differences in using charts of both kinds. And I think it makes a very big difference.</p>
<h4>Static charts</h4>
<p>I&#8217;ll call any image-based chart by &#8220;static chart&#8221;. It&#8217;s just a static image. Example of such charts are those generated by Google Image Charts (they now also have new, interactive charts), or <a href="http://oss.oetiker.ch/rrdtool/index.en.html">RRDtool</a>. Show below is an example of a static chart; in this example, generated by Google:<span id="more-2027"></span></p>
<blockquote>
<pre><img class="alignnone" src="http://chart.apis.google.com/chart?cht=lc&amp;chs=400x200&amp;chts=808080,12&amp;chtt=Dec+4,+15:00++-++Dec+5,+15:00&amp;chf=c,s,ffffff&amp;chdl=com_select_psec|com_insert_psec|com_delete_psec|com_update_psec|com_replace_psec&amp;chdlp=b&amp;chco=ff8c00,4682b4,9acd32,dc143c,9932cc&amp;chd=s:zpvxszxsxur11p1xt10wyxzuyv6xw4yx3x041x2zz6zvz7y91x23z4niqkkmojllkhknhlgnmimohilkkqgkkmnmhlljinjmnhmo________________imlnpmkukopmnpjsojnrrlrqnpprs,iZagVcgWXaZdjVbgSbhYdXZXZcbcXZbcadabccabbZaaZeabdYbbZXceWUXaXYXSXVXaSSZUUXWYUUXbTYUUVabWWVZZVYaWZZYa________________ZYbVcXWdYWZcXaYaYWXYfZcdaVZaZ,MNNNNNONLKOMPNNMNNOPMNNLMQNOMMMNMNNNNRONNOPMNQMPONPOLMTNKJKMKKJILKILJJJLIIKUMHJJIIHHHKJIIHIIIHJHIIJM________________NOMLMMLOPOPKLKKNPKMMNMOPQNNOL,NIIMHKOIHKIKOHKMGKNJKIJIKMKLJJMKIKJKLLJLLJLLKMLJLJKKKIIVIIJLJKJHJIKLIHMIIKIKIIKLHKIIJLKIJJKKIJKIKKJK________________IIKILJJLKIKKHJJJJIJJMIKLKGJKK,AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA________________AAAAAAAAAAAAAAAAAAAAAAAAAAAAA&amp;chxt=x,y&amp;chxr=1,0,136.620000&amp;chxl=0:||16:00||+||20:00||+||00:00||+||04:00||+||08:00||+||12:00||+||&amp;chxs=0,505050,10,0,lt&amp;chg=4.17,25,1,2,0.00,0&amp;chxp=0,0.00,4.17,8.34,12.51,16.68,20.85,25.02,29.19,33.36,37.53,41.70,45.87,50.04,54.21,58.38,62.55,66.72,70.89,75.06,79.23,83.40,87.57,91.74,95.91,100.08" alt="" width="400" height="200" /></pre>
</blockquote>
<h4>Pros and cons of static charts</h4>
<p>Pros</p>
<ul>
<li>Images can be viewed on any graphical platform. Browsers, email clients, cell phones, whatever.</li>
<li>Self contained: chart image, legend, scales: all in one image.</li>
<li>As such, easy to move around.</li>
<li>Are safe to use.</li>
</ul>
<p>Cons</p>
<ul>
<li>Images are fuzzy. Is the <strong>com_replace_psec</strong> really 0? Maybe it&#8217;s 0.1? A larger value can make lower values hard to tell.</li>
<li>Images are inaccurate: the colors can lie. The red and green lines showing are hard to tell apart. The red is painted above the green. Data gets &#8220;lost&#8221;.</li>
<li>They do not zoom (one needs to regenerate larger image)</li>
<li>Unless encoded with base64, HTML pages which include images need to link outside.</li>
<li>In the particular case of Google Charts, one is limited to 2K length URL. Trust me, it&#8217;s a big limitation! (PS, Google now support POST method to allow for up to 16K. But&#8230; it&#8217;s a POST method&#8230;)</li>
<li>In the particular case of Google Charts, one must have an internet connection.</li>
<li>In the particular case of Google Charts, one must submit data to Google.</li>
</ul>
<h4>Interactive charts</h4>
<p>Interactive charts are those which react to your commands. These are either JavaScript or Flash based, mostly. They allow for really nice features. Take the following chart as an example: try and <strong>move over with your mouse</strong>; or <strong>select sections to zoom in</strong>.</p>
<p><script src="http://code.openark.org/blog/wp-content/uploads/2010/03/dygraph-combined.js" type="text/javascript"></script><br />
<!--[if IE]><script src="http://code.openark.org/blog/wp-content/uploads/2010/03/excanvas-min.js"></script>< ![endif]--></p>
<blockquote>
<pre>
<h4>DML</h4>
<div id="graphDiv_DML" class="graphdiv" style="width: 400px; height: 160px;">[graphDiv]</div>
<div id="labelsDiv_DML" class="legend">[labelsDiv]</div>
</pre>
</blockquote>
<p><script type="text/javascript">// < ![CDATA[
// < ![CDATA[
 g_DML = new Dygraph( document.getElementById("graphDiv_DML"),                         "Date,com_select_psec,com_insert_psec,com_delete_psec,com_update_psec,com_replace_psec\n2009-12-04 15:00:00,113.28,76.54,26.14,29.54,0.00\n2009-12-04 15:10:00,91.51,55.74,30.07,18.13,0.00\n2009-12-04 15:20:00,104.98,57.75,28.26,18.24,0.00\n2009-12-04 15:30:00,110.64,72.17,30.17,27.58,0.00\n2009-12-04 15:40:00,97.79,46.27,29.27,15.91,0.00\n2009-12-04 15:50:00,114.35,61.85,29.55,22.45,0.00\n2009-12-04 16:00:00,110.82,72.38,30.67,30.70,0.00\n2009-12-04 16:10:00,99.05,49.70,29.35,18.56,0.00\n2009-12-04 16:20:00,109.68,50.87,25.74,16.55,0.00\n2009-12-04 16:30:00,103.92,58.70,22.09,22.58,0.00\n2009-12-04 16:40:00,97.24,56.29,31.71,18.78,0.00\n2009-12-04 16:50:00,119.25,65.72,27.80,22.56,0.00\n2009-12-04 17:00:00,118.31,78.34,34.18,30.43,0.00\n2009-12-04 17:10:00,91.06,47.59,29.66,16.60,0.00\n2009-12-04 17:20:00,117.81,59.82,28.94,21.40,0.00\n2009-12-04 17:30:00,109.79,71.37,27.62,27.64,0.00\n2009-12-04 17:40:00,101.07,40.51,29.57,14.18,0.00\n2009-12-04 17:50:00,117.66,61.18,28.31,22.44,0.00\n2009-12-04 18:00:00,115.48,72.82,32.12,28.74,0.00\n2009-12-04 18:10:00,106.51,54.34,32.96,20.37,0.00\n2009-12-04 18:20:00,111.34,65.11,27.60,22.60,0.00\n2009-12-04 18:30:00,109.66,52.25,29.47,18.47,0.00\n2009-12-04 18:40:00,113.63,55.16,28.67,19.98,0.00\n2009-12-04 18:50:00,103.72,51.86,24.67,18.08,0.00\n2009-12-04 19:00:00,111.27,55.78,26.66,22.62,0.00\n2009-12-04 19:10:00,105.73,63.16,35.37,25.88,0.00\n2009-12-04 19:20:00,130.50,60.07,29.82,22.99,0.00\n2009-12-04 19:30:00,110.41,62.64,30.35,24.46,0.00\n2009-12-04 19:40:00,107.05,52.04,27.15,19.22,0.00\n2009-12-04 19:50:00,126.11,57.06,27.12,19.34,0.00\n2009-12-04 20:00:00,111.36,61.40,26.13,25.96,0.00\n2009-12-04 20:10:00,108.82,61.97,29.52,23.49,0.00\n2009-12-04 20:20:00,122.57,59.28,26.03,18.48,0.00\n2009-12-04 20:30:00,109.35,65.42,29.21,23.13,0.00\n2009-12-04 20:40:00,117.19,57.69,28.01,19.24,0.00\n2009-12-04 20:50:00,125.03,61.15,28.95,21.74,0.00\n2009-12-04 21:00:00,118.31,63.11,29.66,23.99,0.00\n2009-12-04 21:10:00,109.98,62.24,38.77,24.02,0.00\n2009-12-04 21:20:00,121.28,57.78,30.48,20.26,0.00\n2009-12-04 21:30:00,113.89,59.62,29.77,23.72,0.00\n2009-12-04 21:40:00,113.93,60.42,29.35,24.71,0.00\n2009-12-04 21:50:00,130.36,55.68,31.94,21.16,0.00\n2009-12-04 22:00:00,114.11,58.93,32.62,24.41,0.00\n2009-12-04 22:10:00,105.52,58.58,26.04,24.47,0.00\n2009-12-04 22:20:00,113.52,57.04,29.26,22.28,0.00\n2009-12-04 22:30:00,132.64,66.22,34.87,26.82,0.00\n2009-12-04 22:40:00,112.08,59.19,27.16,23.73,0.00\n2009-12-04 22:50:00,136.62,59.74,33.41,20.04,0.00\n2009-12-04 23:00:00,119.58,65.67,31.40,24.40,0.00\n2009-12-04 23:10:00,109.12,53.74,28.38,19.60,0.00\n2009-12-04 23:20:00,121.52,60.03,33.16,22.38,0.00\n2009-12-04 23:30:00,123.33,59.59,31.09,22.51,0.00\n2009-12-04 23:40:00,114.75,56.82,25.53,23.43,0.00\n2009-12-04 23:50:00,124.92,51.26,27.86,19.03,0.00\n2009-12-05 00:00:00,88.23,63.21,41.50,18.59,0.00\n2009-12-05 00:10:00,75.10,66.62,29.94,48.01,0.00\n2009-12-05 00:20:00,94.85,49.27,22.05,18.66,0.00\n2009-12-05 00:30:00,80.27,45.21,20.56,17.55,0.00\n2009-12-05 00:40:00,80.96,52.03,21.66,21.14,0.00\n2009-12-05 00:50:00,85.21,57.68,26.57,23.58,0.00\n2009-12-05 01:00:00,88.66,52.56,21.75,20.94,0.00\n2009-12-05 01:10:00,78.66,53.26,22.89,22.36,0.00\n2009-12-05 01:20:00,83.80,50.74,20.65,19.49,0.00\n2009-12-05 01:30:00,82.70,39.99,17.23,15.86,0.00\n2009-12-05 01:40:00,79.66,52.35,23.55,20.94,0.00\n2009-12-05 01:50:00,74.56,47.64,23.05,18.97,0.00\n2009-12-05 02:00:00,81.25,51.35,17.94,21.61,0.00\n2009-12-05 02:10:00,86.83,58.48,25.03,24.95,0.00\n2009-12-05 02:20:00,73.31,41.39,21.09,17.56,0.00\n2009-12-05 02:30:00,82.31,39.70,19.84,16.74,0.00\n2009-12-05 02:40:00,71.19,55.84,19.05,25.97,0.00\n2009-12-05 02:50:00,88.00,44.13,25.32,17.74,0.00\n2009-12-05 03:00:00,84.54,44.78,18.42,18.78,0.00\n2009-12-05 03:10:00,76.92,50.57,17.91,21.81,0.00\n2009-12-05 03:20:00,84.45,49.12,21.54,18.58,0.00\n2009-12-05 03:30:00,89.52,54.20,45.41,22.39,0.00\n2009-12-05 03:40:00,74.15,44.67,26.54,18.04,0.00\n2009-12-05 03:50:00,76.32,44.36,15.02,18.39,0.00\n2009-12-05 04:00:00,83.90,52.30,19.50,22.39,0.00\n2009-12-05 04:10:00,80.26,61.12,20.66,25.68,0.00\n2009-12-05 04:20:00,80.95,42.11,16.95,14.84,0.00\n2009-12-05 04:30:00,93.01,53.36,17.91,21.94,0.00\n2009-12-05 04:40:00,72.70,45.22,16.63,18.16,0.00\n2009-12-05 04:50:00,81.22,44.73,15.41,18.54,0.00\n2009-12-05 05:00:00,80.02,46.60,16.07,21.04,0.00\n2009-12-05 05:10:00,84.33,57.86,21.77,24.71,0.00\n2009-12-05 05:20:00,87.48,60.54,19.66,22.95,0.00\n2009-12-05 05:30:00,86.19,48.62,18.47,17.51,0.00\n2009-12-05 05:40:00,72.92,50.10,18.46,21.00,0.00\n2009-12-05 05:50:00,81.79,48.14,15.75,19.36,0.00\n2009-12-05 06:00:00,83.11,55.70,17.15,23.02,0.00\n2009-12-05 06:10:00,77.98,55.89,18.36,23.16,0.00\n2009-12-05 06:20:00,77.05,45.96,18.06,17.27,0.00\n2009-12-05 06:30:00,87.58,53.76,15.56,20.79,0.00\n2009-12-05 06:40:00,79.33,58.86,21.02,22.84,0.00\n2009-12-05 06:50:00,85.33,49.99,16.23,18.82,0.00\n2009-12-05 07:00:00,87.54,56.70,17.96,23.31,0.00\n2009-12-05 07:10:00,73.33,56.51,17.57,21.74,0.00\n2009-12-05 07:20:00,84.02,52.77,21.21,20.80,0.00\n2009-12-05 07:30:00,88.86,58.34,27.45,23.10,0.00\n2009-12-05 07:40:00,,,,,\n2009-12-05 07:50:00,,,,,\n2009-12-05 08:00:00,,,,,\n2009-12-05 08:10:00,,,,,\n2009-12-05 08:20:00,,,,,\n2009-12-05 08:30:00,,,,,\n2009-12-05 08:40:00,,,,,\n2009-12-05 08:50:00,,,,,\n2009-12-05 09:00:00,,,,,\n2009-12-05 09:10:00,,,,,\n2009-12-05 09:20:00,,,,,\n2009-12-05 09:30:00,,,,,\n2009-12-05 09:40:00,,,,,\n2009-12-05 09:50:00,,,,,\n2009-12-05 10:00:00,,,,,\n2009-12-05 10:10:00,,,,,\n2009-12-05 10:20:00,77.11,55.87,29.31,18.09,0.00\n2009-12-05 10:30:00,85.31,53.70,31.03,18.46,0.00\n2009-12-05 10:40:00,82.72,61.32,26.30,22.98,0.00\n2009-12-05 10:50:00,87.28,46.53,25.04,18.04,0.00\n2009-12-05 11:00:00,92.07,62.62,27.09,25.14,0.00\n2009-12-05 11:10:00,84.59,50.42,25.97,19.96,0.00\n2009-12-05 11:20:00,80.34,49.64,25.75,20.31,0.00\n2009-12-05 11:30:00,103.61,64.36,31.79,24.71,0.00\n2009-12-05 11:40:00,80.03,54.33,33.83,22.37,0.00\n2009-12-05 11:50:00,90.42,48.24,31.26,18.43,0.00\n2009-12-05 12:00:00,92.51,56.34,33.53,22.45,0.00\n2009-12-05 12:10:00,84.34,62.26,22.66,23.31,0.00\n2009-12-05 12:20:00,86.24,51.96,25.69,16.02,0.00\n2009-12-05 12:30:00,92.08,58.61,23.16,19.34,0.00\n2009-12-05 12:40:00,78.48,53.33,22.72,19.51,0.00\n2009-12-05 12:50:00,97.85,57.71,29.80,20.19,0.00\n2009-12-05 13:00:00,89.23,54.84,34.62,20.93,0.00\n2009-12-05 13:10:00,78.92,50.02,22.47,18.19,0.00\n2009-12-05 13:20:00,87.24,50.92,26.37,19.38,0.00\n2009-12-05 13:30:00,96.29,54.78,27.13,20.04,0.00\n2009-12-05 13:40:00,96.39,69.48,30.21,27.19,0.00\n2009-12-05 13:50:00,83.21,55.13,26.48,18.00,0.00\n2009-12-05 14:00:00,97.00,63.61,30.89,22.23,0.00\n2009-12-05 14:10:00,94.65,65.33,33.51,25.04,0.00\n2009-12-05 14:20:00,86.94,58.14,36.10,22.07,0.00\n2009-12-05 14:30:00,91.91,47.25,28.41,14.45,0.00\n2009-12-05 14:40:00,92.55,55.73,29.59,20.69,0.00\n2009-12-05 14:50:00,97.35,58.90,31.63,22.22,0.00\n2009-12-05 15:00:00,97.91,56.09,23.80,21.68,0.00\n",                         { chartDiv:  document.getElementById("chartDiv_DML"), labelsDiv: document.getElementById("labelsDiv_DML") } ); g_DML.resize(400,160);
// ]]&gt;</script></p>
<p>The above chart is generated with <em>dygraphs</em>. Since it is embedded within my Wordpress page, the layout is affected by that of my theme. Take a look at this <a href="http://code.openark.org/blog/wp-content/uploads/2010/03/mycheckpoint_interactive_demo.html"><strong>example page</strong></a> to see similar charts outside this blog site (Internet Explorer users: Maxmimize/minimize button will not work well for now. And, may I suggest <a href="http://www.mozilla.com/en-US/firefox">Mozilla Firefox</a>?)<a href="http://code.openark.org/blog/wp-content/uploads/2010/03/mycheckpoint_interactive_demo.html"></a></p>
<h4>Pros and cons of interactive charts</h4>
<p>Pros</p>
<ul>
<li>Can present you with exact values. No more doubt about the <strong>com_replace_psec</strong> values.</li>
<li>Can allow for zoom in, zoom out.</li>
</ul>
<p>Cons</p>
<ul>
<li>Need supporting platform. The above cannot be viewed by non-JavaScript browsers (cell phones, etc.)</li>
<li>Browser support is also an issue with JavaScript.</li>
<li>Emailing such report will result in mail blocking in many companies: mail filters will not allow for JavaScript code to pass.</li>
<li>Charts are not necessarily self-contained, in terms of the chart entity With Flash charts (e.g. Fusion Charts) this works. But in the above, the legend and scales are outside the image. As such, they cannot be just moved around.</li>
<li>HTML pages which include such charts <em>can be</em> self contained. The HTML page can include all the JavaScript dependencies, in addition to the chart generating code. Flash based charts cannot be self contained.</li>
</ul>
<h4>Summary</h4>
<p>Interactive charts are cool!</p>
<p>I&#8217;m now integrating <a href="http://www.danvk.org/dygraphs/">dygraphs</a> into <em>mycheckpoint</em> (How nice it is to work with BSD &amp; MIT licenses!). Though I may later switch to <a href="http://code.google.com/p/flot/">flot</a>, interactive charts will be the next standard charting way in <em>mycheckpoint</em>. I will continue supporting static Google Charts, as follows from the above pros and cons list.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.openark.org/blog/mysql/static-charts-vs-interactive-charts/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>What I look forward to hear on &#8220;State of the Dolphin&#8221;, 2010</title>
		<link>http://code.openark.org/blog/mysql/what-i-look-forward-to-hear-on-state-of-the-dolphin-2010</link>
		<comments>http://code.openark.org/blog/mysql/what-i-look-forward-to-hear-on-state-of-the-dolphin-2010#comments</comments>
		<pubDate>Mon, 01 Mar 2010 10:42:52 +0000</pubDate>
		<dc:creator>shlomi</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[mysqlconf]]></category>
		<category><![CDATA[Opinions]]></category>

		<guid isPermaLink="false">http://code.openark.org/blog/?p=1999</guid>
		<description><![CDATA[Though most probably I won&#8217;t be there in person, here&#8217;s what I expect to hear from Edward Screven, Oracle, on the State of the Dolphin keynote, coming MySQL Conference &#38; Expo.
I&#8217;m under the assumption that no shocking news are delivered. That is, that for the near future, it&#8217;s business as usual for MySQL.
Last year&#8217;s great [...]]]></description>
			<content:encoded><![CDATA[<p>Though most probably I won&#8217;t be there in person, here&#8217;s what I expect to hear from <a href="http://en.oreilly.com/mysql2010/public/schedule/speaker/78864">Edward Screven</a>, Oracle, on the <a href="http://en.oreilly.com/mysql2010/public/schedule/detail/12440">State of the Dolphin</a> keynote, coming MySQL Conference &amp; Expo.</p>
<p>I&#8217;m under the assumption that no shocking news are delivered. That is, that for the near future, it&#8217;s business as usual for MySQL.</p>
<p>Last year&#8217;s great message, delivered by Karen Padir, was <em>&#8220;more community&#8221;</em>. More community participation, more community patches. Looking back, I&#8217;m not sure I saw that coming true. The 5.4 version was announced at that same conference, and was criticized for being community-oriented yet community-hidden. The latest 5.5 milestones announcement took everyone by surprise again. Ideas from Google patches were incorporated into 5.5M2. but, to the best of my understanding, no community patch was delievered.</p>
<p>I have both <a href="http://code.openark.org/blog/mysql/in-favour-of-a-milestone-based-release-model">congratulated and expressed my desire</a> that community took greater part in this.</p>
<h4>So what am I looking forward to hear?</h4>
<ol>
<li>Like everyone else, the general plans Oracle holds for MySQL. Again, I&#8217;m not expecting shocking news here.</li>
<li>The expected roadmap for MySQL, technically speaking. I don&#8217;t actually know if there is a roadmap right now.</li>
<li>The intended role for the MySQL community. Frankly, it would be just fine with me if Oracle were to say: &#8220;we will not accept community patches&#8221;, and that would be the end of it. That&#8217;s fine, because it&#8217;s their right, and it would be an honest announcement. Naturally, I&#8217;ll be much happier to hear &#8220;we will incorporate the best 20 community patches withing the next three days&#8221;. Somewhere in between, I&#8217;ll be really satisfied with a clear explanation of how Oracle sees the community, and how it would like to cooperate with it. Will it share the development plan with the community? Will it allow the community to have a say about what goes in or not?</li>
</ol>
<p><span id="more-1999"></span>I realize this must all be very pressing, what with the acquisition; big new company; new rules; new bosses; new things to learn. But I do believe it&#8217;s in Oracle&#8217;s best interest (and obligation) to speak up their mind on MySQL in relation to the community.</p>
<p>The situation where the users (not the community) don&#8217;t know what&#8217;s planned for MySQL on the technical level, what&#8217;s the next milestone, when the 5.4/5.5 versions are scheduled to be released, what will happen with all those features which were supposed to be incorporated into 5.2/6.0 &#8212; had better be done with quickly.</p>
<p>My congratulations to the MySQL team on the finalization of the acquisition, and best wishes to a smooth and successful merge into Oracle.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.openark.org/blog/mysql/what-i-look-forward-to-hear-on-state-of-the-dolphin-2010/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Defined your MySQL backup &amp; recovery plan recently?</title>
		<link>http://code.openark.org/blog/mysql/defined-your-mysql-backup-recovery-plan-recently</link>
		<comments>http://code.openark.org/blog/mysql/defined-your-mysql-backup-recovery-plan-recently#comments</comments>
		<pubDate>Wed, 17 Feb 2010 09:52:00 +0000</pubDate>
		<dc:creator>shlomi</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Replication]]></category>

		<guid isPermaLink="false">http://code.openark.org/blog/?p=1976</guid>
		<description><![CDATA[Following up on Ronald Bradford&#8217;s Checked your MySQL recovery process recently? post, I wish to add a prequel.
To see whether you have a clear definition of your backup requirements, ask yourself these questions:

Is there a backup/restore plan?
Is there a written backup/restore plan?
How fast do you need to recover a backup? What&#8217;s the longest downtime you [...]]]></description>
			<content:encoded><![CDATA[<p>Following up on <a href="http://ronaldbradford.com/">Ronald Bradford</a>&#8217;s <a href="http://ronaldbradford.com/blog/checked-your-mysql-recovery-process-recently-2010-02-15/">Checked your MySQL recovery process recently?</a> post, I wish to add a <em>prequel</em>.</p>
<p>To see whether you have a clear definition of your backup requirements, ask yourself these questions:</p>
<ul>
<li>Is there a backup/restore plan?</li>
<li>Is there a written backup/restore plan?</li>
<li>How fast do you need to recover a backup? What&#8217;s the longest downtime you will allow from the point of failure to the point of restored, functional database?</li>
<li>How much data are you willing to lose in case of crash? A second&#8217;s worth of data? An hour&#8217;s worth? A day&#8217;s worth? None?</li>
<li>Are you willing to allow that the database becomes read-only when taking the backup? Or completely down?</li>
<li>Are you willing to take the risk that the backup will not be 100% compatible with the data? (Backing up your slave holds this risk)</li>
<li>Is your manager willing to all that you are willing?</li>
<li>Is the backup plan known to the management team, or do they just know that &#8220;<em>the database has backups</em>&#8220;?</li>
</ul>
<p>The above checklist is by no means complete.</p>
<p>I have a vivid memory of a very good sys admin who failed on the last two points. He had some very sour days when recovering a lost file from tape took much longer than was affordable to some contract.</p>
<p>I found that technical people rarely share the same views as marketing/management. Make sure to consult with the management team; they will have a clearer view on what the company can afford and what it cannot afford.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.openark.org/blog/mysql/defined-your-mysql-backup-recovery-plan-recently/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>To not yum or to not apt-get?</title>
		<link>http://code.openark.org/blog/mysql/to-not-yum-or-to-not-apt-get</link>
		<comments>http://code.openark.org/blog/mysql/to-not-yum-or-to-not-apt-get#comments</comments>
		<pubDate>Tue, 16 Feb 2010 11:44:25 +0000</pubDate>
		<dc:creator>shlomi</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Installation]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://code.openark.org/blog/?p=1776</guid>
		<description><![CDATA[I&#8217;ve written shortly on this before. I like yum; I love apt-get; I prefer not to use them for MySQL installations. I consider a binary tarball to be the best MySQL installation format (source installations being a different case altogether).
Why?
I use yum and apt-get whenever I can and for almost all needs (sometimes preferring CPAN [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve <a href="http://code.openark.org/blog/mysql/manually-installing-multiple-mysql-instances-on-linux-howto">written</a> shortly on this before. I like <strong>yum</strong>; I love <strong>apt-get</strong>; I prefer <em>not</em> to use them for MySQL installations. I consider a binary tarball to be the best MySQL installation format (source installations being a different case altogether).</p>
<h4>Why?</h4>
<p>I use <strong>yum</strong> and <strong>apt-get</strong> whenever I can and for almost all needs (sometimes preferring CPAN for Perl installations). But on a MySQL machine, I avoid doing so. The reason is either dependency hell or dependency mismatch.</p>
<p>Package managers are supposed to solve the dependency hell issue. But package managers will rarely have an up to date MySQL version.</p>
<p>I&#8217;ve had several experiences where a simple <strong>yum</strong> installation re-installed the MySQL version. I&#8217;ve had customers calling me up when, having installed something with <strong>yum</strong>, MySQL would not work anymore.<span id="more-1776"></span></p>
<p><strong>yum install package-which-depends-on-mysql-server</strong> will install MySQL server on your system if it hasn&#8217;t been installed with <strong>yum</strong>. Are you on CentOS <strong>5.0</strong>? You&#8217;ll get MySQL <strong>5.0.22</strong>. Oh, did you already have a <strong>RPM</strong> installation for MySQL <strong>5.0.81</strong>? Sorry &#8211; it&#8217;s just been <em>downgraded</em>, plus <em>it won&#8217;t work</em> anymore since the error messages file has been changed since then.</p>
<p>Don&#8217;t press &#8216;<strong>Y</strong>&#8216; too soon!</p>
<p>Things are slightly better with <strong>apt-get</strong>. I&#8217;ve encountered less situations where <strong>mysql-server</strong> was on the dependency list. Many times it&#8217;s just the <strong>libmysqlclient</strong> package or the <strong>mysql-common</strong> one.</p>
<p>But wait! Did you install <strong>mysql-common</strong>? Bonus! You get the elusive <strong>/etc/mysql/my.cnf</strong> file created, and there goes your server configuration. Future spawns of the MySQL server / clients will read from the wrong configuration file, and will probably fail to load.</p>
<p>Not to mention neither will help you out with multiple instances installation.</p>
<h4>My argument</h4>
<p>A sys admin recently argued with me that it was wrong of me to have the entire machine set up with <strong>yum</strong>, but have MySQL installed with binary tarball. He argued that it broke the entire setup. I expressed my opinion: <em>on a MySQL dedicated server, MySQL gets to be prioritized. It&#8217;s special</em>. It is the reason for the existence of the machine. I would imagine that same would hold for Apache on an Apache dedicated machine, for Sendmail on a Sendmail dedicated machine, etc. As a DBA, I want to have best control of the MySQL installation; I want to be able to upgrade minor versions quickly: I often find newer versions to solve bugs I was concerned with; I want to be able to install multiple instances; I want to be able to downgrade without having to remove and uninstall the previous version.</p>
<p>I want to have control. World domination aside, that is.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.openark.org/blog/mysql/to-not-yum-or-to-not-apt-get/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
	</channel>
</rss>
