<?xml version="1.0" encoding="ISO-8859-1"?>
<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>il corra &#187; MySQLen</title>
	<atom:link href="http://blog.pandiani.com/category/mysqlen/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.pandiani.com</link>
	<description>pensieri in libertà</description>
	<lastBuildDate>Tue, 12 May 2009 08:24:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>MySQL 5.1? It works for me.</title>
		<link>http://blog.pandiani.com/2008/12/03/mysql-51-it-works-for-me/</link>
		<comments>http://blog.pandiani.com/2008/12/03/mysql-51-it-works-for-me/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 14:36:50 +0000</pubDate>
		<dc:creator>corra</dc:creator>
				<category><![CDATA[MySQLen]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://blog.pandiani.com/?p=1068</guid>
		<description><![CDATA[On what was said by Monty. I think that in any dispute there are never two separate positions; there&#8217;s no a &#8220;black position&#8221;, there&#8217;s no a &#8220;white position&#8221;. I think about a &#8220;gray gradient&#8221; where there exists several different positions and opinions. Maybe the truth in this case is &#8220;gray&#8221; colored! As a good Italian [...]]]></description>
			<content:encoded><![CDATA[<p>On what was said by Monty.</p>
<p>I think that in any dispute there are never two separate positions; there&#8217;s no a &#8220;black position&#8221;, there&#8217;s no a &#8220;white position&#8221;. I think about a &#8220;gray gradient&#8221; where there exists several different positions and opinions. Maybe the truth in this case is &#8220;gray&#8221; colored!<br />
As a good Italian I stay in the middle thinking that there are some truths in the criticism of Monty, but at the same time I think there&#8217;s also exaggeration.<br />
But mine is not a relevant opinion! I don&#8217;t have a deep knowledge of MySQL AB organization and I don&#8217;t know all the facts and the people involved. My contribution to the discussion is very simple and humble, just to say that I&#8217;m using 5.1 version since August 2008 in a more than 2 million queries per day  production environment and I never experienced a server crash (ok, sometimes it crashed &#8230; but that was my own fault!).<br />
For the goals of my applications I found partitioning useful and powerful. In my experience MySQL 5.1 works!</p>
<p>Well, it is certainly true that there are bugs, but there has never been a software product without them, even when declared stable.  </p>
<p>In an optimistic way, I feel Monty wanted to encourage MySQL AB and all the developers to do their best in the future to develop a better product. If there were errors somewhere in the development of 5.1 I think it&#8217;s time to correct them. Errors are a significant part of human nature, we couldn&#8217;t do anything without them. There is no progress without errors.</p>
<p>I&#8217;m one of the winners of the <a href="http://blogs.mysql.com/kaj/2008/11/28/mysql-51-use-case-competition-position-3/" target="_blank">MySQL 5.1 Use Case Competition</a> and as an award I won a dinner with Monty. I would dine with him ardently (note for the cook: I like fish <img src='http://blog.pandiani.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ) and I hope this could be still possible.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pandiani.com/2008/12/03/mysql-51-it-works-for-me/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>I won the bronze medal</title>
		<link>http://blog.pandiani.com/2008/11/28/i-won-the-bronze-medal/</link>
		<comments>http://blog.pandiani.com/2008/11/28/i-won-the-bronze-medal/#comments</comments>
		<pubDate>Fri, 28 Nov 2008 16:32:13 +0000</pubDate>
		<dc:creator>corra</dc:creator>
				<category><![CDATA[MySQLen]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://blog.pandiani.com/?p=1067</guid>
		<description><![CDATA[Follow the link: MySQL 5.1 Use Case Competion &#8230; California dreamin&#8217;]]></description>
			<content:encoded><![CDATA[<p>Follow the link: <a href="http://blogs.mysql.com/kaj/2008/11/28/mysql-51-use-case-competition-position-3/" target="_blank">MySQL 5.1 Use Case Competion</a></p>
<p>&#8230; California dreamin&#8217; </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pandiani.com/2008/11/28/i-won-the-bronze-medal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>capitalize function</title>
		<link>http://blog.pandiani.com/2008/10/07/capitalize-function/</link>
		<comments>http://blog.pandiani.com/2008/10/07/capitalize-function/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 15:07:14 +0000</pubDate>
		<dc:creator>corra</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[MySQLen]]></category>

		<guid isPermaLink="false">http://blog.pandiani.com/?p=1059</guid>
		<description><![CDATA[Here is just a simple stored function to capitalize the first letter of each word in a string. Sometimes it&#8217;is useful to convert name of cities and persons using the correct capitalization. DROP FUNCTION IF EXISTS `capitalize`; DELIMITER $$ CREATE FUNCTION `capitalize`(stringa TEXT) RETURNS text DETERMINISTIC BEGIN DECLARE i INT DEFAULT 2; DECLARE sout TEXT; [...]]]></description>
			<content:encoded><![CDATA[<p>Here is just a simple stored function to capitalize the first letter of each word in a string.</p>
<p>Sometimes it&#8217;is useful to convert name of cities and persons using the correct capitalization.</p>
<pre>
DROP FUNCTION IF EXISTS `capitalize`;
DELIMITER $$
CREATE FUNCTION `capitalize`(stringa TEXT) RETURNS text
    DETERMINISTIC
BEGIN

        DECLARE i INT DEFAULT 2;
        DECLARE sout TEXT;
        DECLARE ucn INT DEFAULT 0;

        SET stringa=LCASE(TRIM(BOTH ' ' FROM stringa));
        SET sout=UCASE(LEFT(stringa,1));

        WHILE i <= LENGTH(stringa) DO

                SET sout = CONCAT(sout,IF(ucn=1,UCASE(SUBSTRING(stringa,i,
1)),SUBSTRING(stringa,i,1)));

                SET ucn = IF(SUBSTRING(stringa,i,1)=' ',1,0);

                SET i = i + 1;

        END WHILE;

        RETURN sout;

END
$$
</pre>
<p>Example:</p>
<pre>
mysql> SELECT capitalize(' new york ');
+--------------------------+
| capitalize(' new york ') |
+--------------------------+
| New York                 |
+--------------------------+
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.pandiani.com/2008/10/07/capitalize-function/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>my use case of 5.1 on mysql.com</title>
		<link>http://blog.pandiani.com/2008/09/10/my-use-case-of-51-on-mysqlcom/</link>
		<comments>http://blog.pandiani.com/2008/09/10/my-use-case-of-51-on-mysqlcom/#comments</comments>
		<pubDate>Wed, 10 Sep 2008 20:11:31 +0000</pubDate>
		<dc:creator>corra</dc:creator>
				<category><![CDATA[MySQLen]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://blog.pandiani.com/?p=1050</guid>
		<description><![CDATA[I started to use MySQL 5.1 in a production environment at the beginning of August 2008. My purpose was to log all my web visits (more than 1 million pages per day) and to calculate real-time and on-demand statistics. New features such as partitioning and event scheduler gave to me the opportunity to solve some [...]]]></description>
			<content:encoded><![CDATA[<p>I started to use MySQL 5.1 in a production environment at the beginning of August 2008. My purpose was to log all my web visits (more than 1 million pages per day) and to calculate real-time and on-demand statistics.<br />
New features such as partitioning and event scheduler gave to me the opportunity to solve some problem.</p>
<p>I sent my &#8220;use case&#8221; to the <a href="http://dev.mysql.com/tech-resources/articles/mysql-5.1-use-case-competition.html" target="_blank">competition</a> proposed by mysql.com and now there&#8217;s an article on the developer section of the site where you can read what I did.<br />
If you like, please <a href="http://dev.mysql.com/tech-resources/articles/pandiani-use-case.html" target="_blank">read it</a>.</p>
<p>(If you are here following the link on the article on mysql.com &#8230; don&#8217;t mind &#8230; and thanks)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pandiani.com/2008/09/10/my-use-case-of-51-on-mysqlcom/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MySQL 5.1 Cluster guide error on InnoDB</title>
		<link>http://blog.pandiani.com/2008/03/13/mysql-51-cluster-guide-error-on-innodb/</link>
		<comments>http://blog.pandiani.com/2008/03/13/mysql-51-cluster-guide-error-on-innodb/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 12:24:24 +0000</pubDate>
		<dc:creator>corra</dc:creator>
				<category><![CDATA[MySQLen]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://blog.pandiani.com/2008/03/13/mysql-51-cluster-guide-error-on-innodb/</guid>
		<description><![CDATA[In MySQL 5.1 Cluster Certification Study Guide at page 151 there&#8217;s the following sentence: &#8220;InnoDB operates with the REPEATABLE READ isolation level, which still allows phantom reads but suppresses non-repeatable reads&#8221;. The sentence is wrong: the REPEATABLE READ isolation level for InnoDB engine doesn&#8217;t allow phantom reads. In some database systems, REPEATABLE READ isolation level [...]]]></description>
			<content:encoded><![CDATA[<p>In MySQL 5.1 Cluster Certification Study Guide at page 151 there&#8217;s the following sentence: &#8220;InnoDB operates with the REPEATABLE READ isolation level, which still allows phantom reads but suppresses non-repeatable reads&#8221;.</p>
<p>The sentence is wrong: the REPEATABLE READ isolation level for InnoDB engine doesn&#8217;t allow phantom reads.</p>
<p>In some database systems, REPEATABLE READ isolation level allows phantoms, such that if another transaction inserts new rows in the interval between the SELECT statements, the second SELECT will see them. This is not true for InnoDB; phantoms do not occur for the REPEATABLE READ level. SERIALIZABLE isolation level is similar to REPEATABLE READ with the additional restriction that rows selected by one transaction cannot be changed by another until the first transaction finishes. (as stated by MySQL 5 Certification Guide)</p>
<p>Here is an example to demonstrate such a behaviour.</p>
<p>To distinguish two different sessions I use two different prompts: s1> and s2>  setting the mysql&#8217;s PROMPT statement.</p>
<p>Create a table on s1 and disable autocommit mode to begin a new transaction:</p>
<pre>
mysql> prompt s1>
PROMPT set to 's1> '
s1> 

s1> create table t_idb( id int) engine=innodb;
Query OK, 0 rows affected (0.10 sec)

s1> set autocommit=OFF;
Query OK, 0 rows affected (0.00 sec)
</pre>
<p>Disable autocommit mode on s2 too to begin a new transaction</p>
<pre>
mysql> prompt s2>
PROMPT set to 's2> '

s2> set autocommit=OFF;
Query OK, 0 rows affected (0.00 sec)
</pre>
<p>Insert some values on s1</p>
<pre>
s1> insert into t_idb values(1);
Query OK, 1 row affected (0.00 sec)

s1> insert into t_idb values(2);
Query OK, 1 row affected (0.00 sec)
</pre>
<p>Now, on s2 we won&#8217;t be able to see these values because s1 is still in the middle of the transaction (not yet committed). For example, this wouldn&#8217;t be true in the case of READ UNCOMMITTED mode.</p>
<pre>
s2> select * from t_idb;
Empty set (0.00 sec)
</pre>
<p>Now, we commit the transaction on s1.</p>
<pre>
s1> commit;
Query OK, 0 rows affected (0.01 sec)
</pre>
<p>Read again the table on s2.</p>
<pre>
s2> select * from t_idb;
Empty set (0.00 sec)
</pre>
<p>s2 is still in the middle of his transaction and thus it doesn&#8217;t see committed inserts by the another one. This is in contrast with the sentence on the Cluster guide.</p>
<p>s2 will be able to see the values inserted by s1 only after his transaction will be finished (committed or rollbacked)</p>
<pre>
s2> commit;
Query OK, 0 rows affected (0.00 sec)

s2> select * from t_idb;
+------+
| id   |
+------+
|    1 |
|    2 |
+------+
2 rows in set (0.00 sec)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.pandiani.com/2008/03/13/mysql-51-cluster-guide-error-on-innodb/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>some fun: sql injection</title>
		<link>http://blog.pandiani.com/2008/03/12/some-fun-sql-injection/</link>
		<comments>http://blog.pandiani.com/2008/03/12/some-fun-sql-injection/#comments</comments>
		<pubDate>Wed, 12 Mar 2008 12:38:58 +0000</pubDate>
		<dc:creator>corra</dc:creator>
				<category><![CDATA[MySQLen]]></category>

		<guid isPermaLink="false">http://blog.pandiani.com/2008/03/12/some-fun-sql-injection/</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><img src='http://blog.pandiani.com/wp-content/uploads/2008/03/exploits_of_a_mom.png' alt='exploits of a mom' width='620' /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pandiani.com/2008/03/12/some-fun-sql-injection/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Reading the guide</title>
		<link>http://blog.pandiani.com/2008/02/16/reading-the-guide/</link>
		<comments>http://blog.pandiani.com/2008/02/16/reading-the-guide/#comments</comments>
		<pubDate>Sat, 16 Feb 2008 08:51:17 +0000</pubDate>
		<dc:creator>corra</dc:creator>
				<category><![CDATA[MySQLen]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://blog.pandiani.com/2008/02/16/reading-the-guide/</guid>
		<description><![CDATA[I&#8217;m reading the guide, but I&#8217;m still too busy with my work to read it proficiently. In order to pass the exam I have to read it again focusing all the details. But, after reading the first 6 chapters (more then 50% of the entire book) I found the guide useful and simply understandable &#8230; [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.pandiani.com/wp-content/uploads/2007/12/cluter_cert.jpeg"><br />
I&#8217;m reading the guide, but I&#8217;m still too busy with my work to read it proficiently. In order to pass the exam I have to read it again focusing all the details.</p>
<p>But, after reading the first  6 chapters (more then 50% of the entire book) I found the guide useful and simply understandable &#8230; and, thanks to lulu.com, it seems to me to be cheapest.<br />
Well done authors!!!  </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pandiani.com/2008/02/16/reading-the-guide/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The sunny dolphin</title>
		<link>http://blog.pandiani.com/2008/01/20/the-sunny-dolphin/</link>
		<comments>http://blog.pandiani.com/2008/01/20/the-sunny-dolphin/#comments</comments>
		<pubDate>Sun, 20 Jan 2008 09:47:41 +0000</pubDate>
		<dc:creator>corra</dc:creator>
				<category><![CDATA[MySQLen]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://blog.pandiani.com/2008/01/20/the-sunny-dolphin/</guid>
		<description><![CDATA[I&#8217;m excited and a little bit worried about the aquisition of MySQL AB. Sun has lots of billions, has lots of big customers and a great interest in competing with Oracle. These issues could be the ones to think about a more brilliant future for mysql. I see in future a new SAMP paradigm (Solaris-Apache-MySQL-PHP/Perl/Python). [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m excited and a little bit worried about the aquisition of MySQL AB.</p>
<p>Sun has lots of billions, has lots of big customers and a great interest in competing with Oracle. These issues could be the ones to think about a more brilliant future for mysql. </p>
<p>I see in future a new SAMP paradigm (Solaris-Apache-MySQL-PHP/Perl/Python).</p>
<p>But I&#8217;m also a little bit worried. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pandiani.com/2008/01/20/the-sunny-dolphin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Buying the guide</title>
		<link>http://blog.pandiani.com/2007/12/02/buying-the-guide/</link>
		<comments>http://blog.pandiani.com/2007/12/02/buying-the-guide/#comments</comments>
		<pubDate>Sun, 02 Dec 2007 10:21:41 +0000</pubDate>
		<dc:creator>corra</dc:creator>
				<category><![CDATA[MySQLen]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://blog.pandiani.com/2007/12/02/buying-the-guide/</guid>
		<description><![CDATA[Just to say I&#8217;ve bought the book as soon as it was available on lulu.com. I was waiting for it from april.]]></description>
			<content:encoded><![CDATA[<p><img src='http://blog.pandiani.com/wp-content/uploads/2007/12/cluter_cert.jpeg' alt='cluster certification guide' /></p>
<p>Just to say I&#8217;ve bought the book as soon as it was available on <a href="http://www.lulu.com/content/1297960" target="_blank">lulu.com</a>.</p>
<p>I was waiting for it from april.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pandiani.com/2007/12/02/buying-the-guide/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Controlling optimizer performance</title>
		<link>http://blog.pandiani.com/2007/11/27/controlling-optimizer-performance/</link>
		<comments>http://blog.pandiani.com/2007/11/27/controlling-optimizer-performance/#comments</comments>
		<pubDate>Tue, 27 Nov 2007 13:09:28 +0000</pubDate>
		<dc:creator>corra</dc:creator>
				<category><![CDATA[MySQLen]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://blog.pandiani.com/2007/11/27/controlling-optimizer-performance/</guid>
		<description><![CDATA[The optimizer is the part of the mysql server whose responsibility is to discover the optimal plan (the execution oath) to solve an SQL query. When dealing with joins there exist various execution paths depending on the number of tables involved. The number of possible plans to investigates grows exponentially with the number of tables. [...]]]></description>
			<content:encoded><![CDATA[<p>The optimizer is the part of the mysql server whose responsibility is to discover the optimal plan (the execution oath) to solve an SQL query.<br />
When dealing with joins there exist various execution paths depending on the number of tables involved. The number of possible plans to investigates grows exponentially with the number of tables. This is not a problem for queries with few tables (less than 10) but could be a serious problem when the number of tables climbs.<br />
When dealing with dozens of tables the time spent to evaluate all possible plans to solve the query is longer than the execution of the query itself. Not good.<br />
Starting from version 5.0.1 MySQL introduces a flexible method to avoid the possible bottleneck when you have lot of tables joined in a query. </p>
<p>Using the system variable <b>optimizer_prune_level</b> (possible values are 0 or 1) you can tell the optimizer to skip certain plans from being inspected based on the evaluated number of rows involved for every table. The algorithm is heuristic. The default value is <b>1</b> (enabled) and this means that a limited number of execution plans are evaluated instead of all possibile combination. This leads to a significant increase of performance when dealing with multi-table join queries.<br />
Setting <b>optimizer_prune_level=0</b> leads to a much longer query compilation. This is not a problem with few tables but don&#8217;t use it if not. </p>
<p>Another useful system variable is <b>optimizer_search_depth</b>. It tells the optimizer how far in the future to expand an incomplete plan. Also in this case the optimizer is able to compile the query faster. As the value of this variable is close to the number of tables involved in a join, the compile time is much longer.<br />
Setting this variable to zero means that the server will determine tha optimal value for every query.<br />
As in the previous case, this variable has negligible effect with few table joins and usually the value set to zero is the best solution.</p>
<p>Surely, using these system variables leads to better performance, but could be possibile that the optimizer fails to find to optimal solution. If you think that the optimizer is failing you can help it forcing or avoiding the use of certain index (FORCE INDEX, IGNORE INDEX) or maybe forcing an order to read the tables (STRAIGHT_JOIN). This are issues left to you and the knowledge of your tables and indexes. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pandiani.com/2007/11/27/controlling-optimizer-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

