<?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>PlanetMysql.ru - информация о СУБД MySQL &#187; advanced</title>
	<atom:link href="http://planetmysql.ru/category/advanced/feed/" rel="self" type="application/rss+xml" />
	<link>http://planetmysql.ru</link>
	<description>Блог о самой популярной СУБД MySQL</description>
	<lastBuildDate>Thu, 29 Jul 2010 23:40:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Three editions of MySQL are available</title>
		<link>http://www.pythian.com/news/14823/three-editions-of-mysql-are-available/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=three-editions-of-mysql-are-available</link>
		<comments>http://www.pythian.com/news/14823/three-editions-of-mysql-are-available/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 23:19:27 +0000</pubDate>
		<dc:creator>Sheeri K. Cabral</dc:creator>
				<category><![CDATA[Non-Tech Articles]]></category>
		<category><![CDATA[Technical Blog]]></category>
		<category><![CDATA[advanced]]></category>
		<category><![CDATA[enterprise]]></category>
		<category><![CDATA[license]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[pricing]]></category>
		<category><![CDATA[pro]]></category>

		<guid isPermaLink="false">http://www.pythian.com/news/?p=14823</guid>
		<description><![CDATA[Yes, you read the title correctly &#8212; there are three editions of MySQL available, according to http://www.mysql.com/products/enterprise/server.html.  Well, that page names two, and then of course there is the community edition&#8230;.
From the manual page:
MySQL Enterprise Server is available in the following editions:
    * MySQL Enterprise Server &#8211; Pro is the world&#8217;s most popular open source database that enables you to rapidly deliver high performance and scalable Online Transaction Processing (OLTP) applications.
    * MySQL Enterprise Server &#8211; Advanced is the most comprehensive edition of MySQL. It provides all the benefits of MySQL Enterprise Server Pro and adds horizontal table and index partitioning for improving the performance and management of VLDBs (Very Large Databases).
How is &#8220;horizontal table and index partitioning&#8221; different from the regular partitioning available in MySQL 5.1?

Those of us that have been around for the past 3 or so years know that there was a point in time where there were two different editions of MySQL available, back when MySQL Enterprise and MySQL Community were actually different.  But that experiment was a complete failure, and the code is now the same.  MySQL Enterprise does package the software in a way that is not available to the community, specifically the quarterly service pack (QSP) releases.  But the actual code&#8230;.the same.
The pricing page at http://globalspecials.sun.com/store/mysql/ContentTheme/pbPage.categoryEnterprise shows that the Advanced server can be acquired for $3k (Gold) or $5k (Platinum) per year.  The fee is worth it for the support MySQL will give you, but why is MySQL muddying the waters by having more &#8220;editions&#8221;, which very likely are not even different code?
(Special thanks to Aaron Macks for pointing out the existence of mysql-advanced, which was the impetus for this blog post.)]]></description>
			<content:encoded><![CDATA[<p>Yes, you read the title correctly &#8212; there are <strong>three</strong> editions of MySQL available, according to <a href="http://www.mysql.com/products/enterprise/server.html">http://www.mysql.com/products/enterprise/server.html</a>.  Well, that page names two, and then of course there is the community edition&#8230;.</p>
<p>From the manual page:</p>
<blockquote><p>MySQL Enterprise Server is available in the following editions:</p>
<p>    * MySQL Enterprise Server &#8211; Pro is the world&#8217;s most popular open source database that enables you to rapidly deliver high performance and scalable Online Transaction Processing (OLTP) applications.<br />
    * MySQL Enterprise Server &#8211; Advanced is the most comprehensive edition of MySQL. It provides all the benefits of MySQL Enterprise Server Pro and adds horizontal table and index partitioning for improving the performance and management of VLDBs (Very Large Databases).</p></blockquote>
<p>How is &#8220;horizontal table and index partitioning&#8221; different from the regular partitioning available in MySQL 5.1?<br />
<span></span></p>
<p>Those of us that have been around for the past 3 or so years know that there was a point in time where there were two different editions of MySQL available, back when MySQL Enterprise and MySQL Community were actually different.  But that experiment was a complete failure, and the code is now the same.  MySQL Enterprise does package the software in a way that is not available to the community, specifically the quarterly service pack (QSP) releases.  But the actual code&#8230;.the same.</p>
<p>The pricing page at <a href="http://globalspecials.sun.com/store/mysql/ContentTheme/pbPage.categoryEnterprise">http://globalspecials.sun.com/store/mysql/ContentTheme/pbPage.categoryEnterprise</a> shows that the Advanced server can be acquired for $3k (Gold) or $5k (Platinum) per year.  The fee is worth it for the <strong>support</strong> MySQL will give you, but why is MySQL muddying the waters by having more &#8220;editions&#8221;, which very likely are not even different code?</p>
<p>(Special thanks to <a href="http://mt.wiglaf.org/aaronm/">Aaron Macks</a> for pointing out the existence of mysql-advanced, which was the impetus for this blog post.)</p><br/>PlanetMySQL Voting:
	 <a href="http://planet.mysql.com/entry/vote/?entry_id=25346&vote=1&apivote=1">Vote UP</a> /
	 <a href="http://planet.mysql.com/entry/vote/?entry_id=25346&vote=-1&apivote=1">Vote DOWN</a>]]></content:encoded>
			<wfw:commentRss>http://www.pythian.com/news/14823/three-editions-of-mysql-are-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Datetime &amp; Timestamp manipulation / migration explained</title>
		<link>http://mysqlpreacher.com/wordpress/2010/06/datetime-timestamp-manipulation-migration-explained/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=datetime-timestamp-manipulation-migration-explained</link>
		<comments>http://mysqlpreacher.com/wordpress/2010/06/datetime-timestamp-manipulation-migration-explained/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 16:47:16 +0000</pubDate>
		<dc:creator>Darren Cassar</dc:creator>
				<category><![CDATA[Intermediate]]></category>
		<category><![CDATA[advanced]]></category>
		<category><![CDATA[date_format]]></category>
		<category><![CDATA[datetime]]></category>
		<category><![CDATA[microsecond]]></category>
		<category><![CDATA[migrating to mysql]]></category>
		<category><![CDATA[migration]]></category>
		<category><![CDATA[millisecond]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql millisecond]]></category>
		<category><![CDATA[str_to_date]]></category>
		<category><![CDATA[timstamp]]></category>

		<guid isPermaLink="false">http://mysqlpreacher.com/wordpress/?p=351</guid>
		<description><![CDATA[Are you doing some datetime manipulation or maybe you are migrating from some database technology to MySQL or possibly using milliseconds?
Here is an example on how to go about it:
Say you have the following date: MAR 16 2008 09:12:51:893AM
SELECT DATE_FORMAT(STR_TO_DATE('MAR 16 2008 09:12:51:893AM','%M %d %Y %h:%i:%s:%f%p'),'%Y%m%d%k%i%s.%f'); --&#62; 2008031691251.893000

What if its PM rather than AM
SELECT DATE_FORMAT(STR_TO_DATE('MAR 16 2008 09:12:51:893PM','%M %d %Y %h:%i:%s:%f%p'),'%Y%m%d%k%i%s.%f'); --&#62; 20080316211251.893000

Ok so this is just simple string manipulation where:
%M is the month name
%d is day number
%Y is the year
%h is the hour
%i is the minute
%s is the second
%f is the microsecond
%p is the period: ante or post meridiem
In the DATE_FORMAT part we se a %k which is in 24hr format in order to loose the period.
A more detailed list is found here
Here is a demo:
mysql Tue Jun 15 12:32:37 2010 &#62; CREATE TABLE test.abc(a DECIMAL(17,3)) ENGINE=MYISAM;
Query OK, 0 rows affected (0.03 sec)
mysql Tue Jun 15 12:32:45 2010 &#62; INSERT INTO abc VALUES ( DATE_FORMAT(STR_TO_DATE('MAR 16 2008 09:12:51:893PM','%M %d %Y %h:%i:%s:%f%p'),'%Y%m%d%k%i%s.%f') );
Query OK, 1 row affected (0.01 sec)
mysql Tue Jun 15 12:32:51 2010 &#62; SELECT * FROM abc;
+--------------------+
&#124; a                  &#124;
+--------------------+
&#124; 20080316211251.893 &#124;
+--------------------+
1 row in set (0.00 sec)

mysql Tue Jun 15 12:32:56 2010 &#62; SELECT TIMESTAMP(a) FROM abc;
+----------------------------+
&#124; TIMESTAMP(a)               &#124;
+----------------------------+
&#124; 2008-03-16 21:12:51.893000 &#124;
+----------------------------+
1 row in set (0.00 sec)]]></description>
			<content:encoded><![CDATA[<p>Are you doing some datetime manipulation or maybe you are migrating from some database technology to MySQL or possibly using milliseconds?<br />
Here is an example on how to go about it:</p>
<p>Say you have the following date: MAR 16 2008 09:12:51:893AM<br />
<code>SELECT DATE_FORMAT(STR_TO_DATE('MAR 16 2008 09:12:51:893AM','%M %d %Y %h:%i:%s:%f%p'),'%Y%m%d%k%i%s.%f'); --&gt; 2008031691251.893000<br />
</code></p>
<p>What if its PM rather than AM<br />
<code>SELECT DATE_FORMAT(STR_TO_DATE('MAR 16 2008 09:12:51:893PM','%M %d %Y %h:%i:%s:%f%p'),'%Y%m%d%k%i%s.%f'); --&gt; 20080316211251.893000<br />
</code></p>
<p>Ok so this is just simple string manipulation where:<br />
<code>%M is the month name<br />
%d is day number<br />
%Y is the year<br />
%h is the hour<br />
%i is the minute<br />
%s is the second<br />
%f is the microsecond<br />
%p is the period: ante or post meridiem</code><br />
In the DATE_FORMAT part we se a %k which is in 24hr format in order to loose the period.</p>
<p>A more detailed list is found <a href="http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format" >here</a></p>
<p>Here is a demo:</p>
<p><code>mysql Tue Jun 15 12:32:37 2010 &gt; CREATE TABLE test.abc(a DECIMAL(17,3)) ENGINE=MYISAM;<br />
Query OK, 0 rows affected (0.03 sec)</code></p>
<p><code>mysql Tue Jun 15 12:32:45 2010 &gt; INSERT INTO abc VALUES ( DATE_FORMAT(STR_TO_DATE('MAR 16 2008 09:12:51:893PM','%M %d %Y %h:%i:%s:%f%p'),'%Y%m%d%k%i%s.%f') );<br />
Query OK, 1 row affected (0.01 sec)</code></p>
<p><code>mysql Tue Jun 15 12:32:51 2010 &gt; SELECT * FROM abc;<br />
+--------------------+<br />
| a                  |<br />
+--------------------+<br />
| 20080316211251.893 |<br />
+--------------------+<br />
1 row in set (0.00 sec)</p>
<p></code></p>
<p><code>mysql Tue Jun 15 12:32:56 2010 &gt; SELECT TIMESTAMP(a) FROM abc;<br />
+----------------------------+<br />
| TIMESTAMP(a)               |<br />
+----------------------------+<br />
| 2008-03-16 21:12:51.893000 |<br />
+----------------------------+<br />
1 row in set (0.00 sec)</code></p><br/>PlanetMySQL Voting:
	 <a href="http://planet.mysql.com/entry/vote/?entry_id=25032&vote=1&apivote=1">Vote UP</a> /
	 <a href="http://planet.mysql.com/entry/vote/?entry_id=25032&vote=-1&apivote=1">Vote DOWN</a>]]></content:encoded>
			<wfw:commentRss>http://mysqlpreacher.com/wordpress/2010/06/datetime-timestamp-manipulation-migration-explained/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Further Thoughts on MySQL Upgrades</title>
		<link>http://blog.wl0.org/2010/01/further-thoughts-on-mysql-upgrades/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=further-thoughts-on-mysql-upgrades</link>
		<comments>http://blog.wl0.org/2010/01/further-thoughts-on-mysql-upgrades/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 23:25:48 +0000</pubDate>
		<dc:creator>Simon Mudd</dc:creator>
				<category><![CDATA[5.0]]></category>
		<category><![CDATA[5.1]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[advanced]]></category>
		<category><![CDATA[enterprise]]></category>
		<category><![CDATA[hints]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[rpm]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://blog.wl0.org/2010/01/further-thoughts-on-mysql-upgrades/</guid>
		<description><![CDATA[I have been upgrading more MySQL database instances recently and have found a few more potential gotchas, which if you are not careful, can potentially be rather nasty. These are not documented explicitly by MySQL, so it may be handy for you to know if you have not come across this type of thing before.
Most of the issues are those related to upgrading MySQL instances which are replicated, either the master servers or the slaves. Some seem specific to the rpm packages I am using (MySQL enterprise or MySQL advanced rpms), though others are not.
Take care upgrading a 5.0 master when you have 5.1 slaves
It is not a good idea to run a mixed major version of mysql in a replicated environment so why would I be doing this? If you work in a replicated environment and have several slaves then it is recommended that you upgrade the slaves first. I work with quite a few slaves so the process of upgrading them all takes longer than you would think. Quite a long time in fact, while different systems are tested and upgraded. Along came a newer version of 5.0 and I thought of upgrading the master which had been giving a few issues, and one of them was resolved in the lastest 5.0.89. At least when using rpm packages, the package upgrade uses /usr/bin/mysql_install_db &#8211;rpm &#8211;user=mysql as part of the package upgrade procedure. This ensures that the mysql db is up to date but also writes to the binlog if one is configured. running on a master normally this would be the case. Of course these are 5.0 install commands and they are not really understood by the slaves which try to interpret them too. End result. Broken replication and you need to skip several transactions. If you have several slaves this can be rather painful.
Note: this is the cause of replicating the mysql database which I do as it is a good, quick and clean way to distribute GRANT information on to all slaves. As far as I know MySQL does not discourage this though perhaps many sites do not replicate their MySQL database.
If you upgrade a master server from 5.o to 5.1 by running mysql_upgrade after upgrading the binaries you may have a similar issue as the mysql_upgrade script determines that some new columns or tables are needed on the master and so adds them.  Again this gets written to the binlog which is good for point in time recovery on the server itself, but again bad from a replication point of view if the slave does not run the same version of MySQL.
In fact the binlog has these 2 uses: (a) writing changes for point in time recovery, and (b) writing the changes for replication to slaves.  Once could argue that for (a) the changes should not be written to the binlog but I think that is wrong if you have to recover just after an upgrade. So I would suggest that the upgrade changes should probably flagged specially in the binlog, allowing the slave to probably ignore them in the normal situation but also be able to recognise them, allowing you to stop the slave and perform the same binary upgrade, and then continue the upgrade with the new binaries exactly in the way this had been executed on the master. This behaviour should be controlled by a runtime flag which can be dynamically configured.
RPM Installs/Upgrades always start the server
rpm(8) is good but some of the design decisions in the MySQL rpms are questionable. One of these is that the current MySQL rpms are designed to always start when either doing a fresh install or doing an upgrade. Currently it&#8217;s not good practice to do rpm -Uvh MySQL-server-advanced-gpl&#8230;rpm (5.1 rpm) if you are running a MySQL-server-enterprise-gpl&#8230;rpm (5.0 rpm) so normally I stop MySQL, remove the enterprise rpm and install the advanced rpm. That starts the server and the slave on a box which is not completely &#8220;stable&#8221;. Solution is to add slave-skip-start to /etc/my.cnf but that should not be necessary as immediately after running mysql_upgrade you need to remove the value again.
Also during the upgrade process it is a good thing to avoid external client access so sometimes I also set the bind-address to 127.0.0.1 during the period of the upgrade.  That may not keep clients away if they are running on the local server but helps in many cases.
Conclusions
All this leads me to a simple conclusion: if you can, upgrade one box the slow way and then clone the other slaves from that. Cloning is simple and requires no thought so is a good idea.
The other conclusion based on the first one is that if you can: build a new master. That is clone a slave to make a new master. This will be the new master. Configure it to write it&#8217;s own binlogs and then you can move the existing slaves underneath the new one. Once all slaves are underneath the new master (left as the only slave of the original master) then you can simply point clients to the new master instead of the old one. That keeps down time to a minimum and avoids many problems.
As far as I know none of the comments I have made above are in the current 5.1 upgrade documentation. I have opened quite a few tickets requesting the documentation be improved and I guess that will happen slowly. For many people the points I have mentioned may seem irrelevant for their situation but for me they have caused a few problems. If you do not need to worry, then you can skip the documentation, otherwise if this were documented then you would be saved a few tears when least expecting problems.]]></description>
			<content:encoded><![CDATA[<p>I have been upgrading more MySQL database instances recently and have found a few more potential <em>gotchas,</em> which if you are not careful, can potentially be rather nasty. These are not documented explicitly by MySQL, so it may be handy for you to know if you have not come across this type of thing before.</p>
<p>Most of the issues are those related to upgrading MySQL instances which are replicated, either the master servers or the slaves. Some seem specific to the rpm packages I am using (MySQL enterprise or MySQL advanced rpms), though others are not.</p>
<h2>Take care upgrading a 5.0 master when you have 5.1 slaves</h2>
<p>It is not a good idea to run a mixed major version of mysql in a replicated environment so why would I be doing this? If you work in a replicated environment and have several slaves then it is recommended that you upgrade the slaves first. I work with quite a few slaves so the process of upgrading them all takes longer than you would think. Quite a long time in fact, while different systems are tested and upgraded. Along came a newer version of 5.0 and I thought of upgrading the master which had been giving a few issues, and one of them was resolved in the lastest 5.0.89. At least <span>when using rpm packages</span>, the package upgrade uses /usr/bin/mysql_install_db &#8211;rpm &#8211;user=mysql as part of the package upgrade procedure. This ensures that the mysql db is up to date but also writes to the binlog if one is configured. running on a master normally this would be the case. Of course these are 5.0 install commands and they are not really understood by the slaves which try to interpret them too. End result. Broken replication and you need to skip several transactions. If you have several slaves this can be rather painful.</p>
<p>Note: this is the cause of replicating the <span>mysql</span> database which I do as it is a good, quick and clean way to distribute GRANT information on to all slaves. As far as I know MySQL does not discourage this though perhaps many sites do not replicate their MySQL database.</p>
<p>If you upgrade a master server from 5.o to 5.1 by running <em>mysql_upgrade</em> after upgrading the binaries you may have a similar issue as the <em>mysql_upgrade</em> script determines that some new columns or tables are needed on the master and so adds them.  Again this gets written to the binlog which is good for point in time recovery on the server itself, but again bad from a replication point of view if the slave does not run the same version of MySQL.</p>
<p>In fact the binlog has these 2 uses: (a) writing changes for point in time recovery, and (b) writing the changes for replication to slaves.  Once could argue that for (a) the changes should not be written to the binlog but I think that is wrong if you have to recover just after an upgrade. So I would suggest that the <em>upgrade changes</em> should probably flagged specially in the binlog, allowing the slave to probably ignore them in the normal situation but also be able to recognise them, allowing you to stop the slave and perform the same binary upgrade, and then continue the upgrade with the new binaries exactly in the way this had been executed on the master. This behaviour should be controlled by a runtime flag which can be dynamically configured.</p>
<h2>RPM Installs/Upgrades always start the server</h2>
<p>rpm(8) is good but some of the design decisions in the MySQL rpms are questionable. One of these is that the current MySQL rpms are designed to always start when either doing a fresh install or doing an upgrade. Currently it&#8217;s not good practice to do rpm -Uvh MySQL-server-advanced-gpl&#8230;rpm (5.1 rpm) if you are running a MySQL-server-enterprise-gpl&#8230;rpm (5.0 rpm) so normally I stop MySQL, remove the enterprise rpm and install the advanced rpm. That starts the server and the slave on a box which is not completely &#8220;stable&#8221;. Solution is to add slave-skip-start to /etc/my.cnf but that should not be necessary as immediately after running mysql_upgrade you need to remove the value again.</p>
<p>Also during the upgrade process it is a good thing to avoid external client access so sometimes I also set the bind-address to 127.0.0.1 during the period of the upgrade.  That may not keep clients away if they are running on the local server but helps in many cases.</p>
<h2>Conclusions</h2>
<p>All this leads me to a simple conclusion: if you can, upgrade one box the slow way and then clone the other slaves from that. Cloning is simple and requires no thought so is a good idea.</p>
<p>The other conclusion based on the first one is that if you can: <strong>build a new master</strong>. That is clone a slave to make a new master. This will be the new master. Configure it to write it&#8217;s own binlogs and then you can move the existing slaves underneath the new one. Once all slaves are underneath the new master (left as the only slave of the original master) then you can simply point clients to the new master instead of the old one. That keeps down time to a minimum and avoids many problems.</p>
<p>As far as I know none of the comments I have made above are in the current 5.1 upgrade documentation. I have opened quite a few tickets requesting the documentation be improved and I guess that will happen slowly. For many people the points I have mentioned may seem irrelevant for their situation but for me they have caused a few problems. If you do not need to worry, then you can skip the documentation, otherwise if this were documented then you would be saved a few tears when least expecting problems.</p><br/>PlanetMySQL Voting:
	 <a href="http://planet.mysql.com/entry/vote/?entry_id=23236&vote=1&apivote=1">Vote UP</a> /
	 <a href="http://planet.mysql.com/entry/vote/?entry_id=23236&vote=-1&apivote=1">Vote DOWN</a>]]></content:encoded>
			<wfw:commentRss>http://blog.wl0.org/2010/01/further-thoughts-on-mysql-upgrades/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
