<?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>Internet Strategy Guide &#187; mysql</title>
	<atom:link href="http://phpprotip.com/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://phpprotip.com</link>
	<description>Together we can defeat the internet</description>
	<lastBuildDate>Fri, 20 Aug 2010 18:15:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>tekx &#8211; lig&#8217;s talk on scalability and mysql</title>
		<link>http://phpprotip.com/2010/05/tekx-ligs-talk-on-scalability-and-mysql/</link>
		<comments>http://phpprotip.com/2010/05/tekx-ligs-talk-on-scalability-and-mysql/#comments</comments>
		<pubDate>Thu, 20 May 2010 21:56:30 +0000</pubDate>
		<dc:creator>chance</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phptek]]></category>
		<category><![CDATA[tekx]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Exception handling]]></category>
		<category><![CDATA[innodb]]></category>
		<category><![CDATA[Replication]]></category>
		<category><![CDATA[scalability]]></category>

		<guid isPermaLink="false">http://phpprotip.com/?p=285</guid>
		<description><![CDATA[@lig will be talking about mysql 5.5 and scalability this session She is Senior Technical Support Engineer for MySQL. We will be covering semi-synchronous replication performance schema SIGNAL/RESIGNAL more partitioning options InnoDB - LOTS of InnoDB (performance and scalability improvements) In 5.5 InnoDB will be the default!!! WOOT. Default replication is asynchronous. Meaning master writes [...]]]></description>
			<content:encoded><![CDATA[<p>@lig will be talking about mysql 5.5 and <a class=\"zem_slink freebase/en/scalability\" title=\"Scalability\" rel=\"wikipedia\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9TY2FsYWJpbGl0eQ==">scalability</a> this session She is Senior Technical Support Engineer for <a class=\"zem_slink freebase/en/mysql\" title=\"MySQL\" rel=\"homepage\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5teXNxbC5jb20=">MySQL</a>.</p>
<p>We will be covering</p>
<ul>
<li>semi-synchronous replication</li>
<li>performance schema</li>
<li>SIGNAL/RESIGNAL</li>
<li>more partitioning options</li>
<li><a class=\"zem_slink freebase/en/innodb\" title=\"InnoDB\" rel=\"homepage\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5pbm5vZGIuY29tLw==">InnoDB</a> - LOTS of InnoDB (performance and scalability improvements)</li>
</ul>
<p>In 5.5 InnoDB will be the default!!! WOOT.</p>
<p>Default replication is asynchronous. Meaning master writes to binary log and the slave connects and "pulls" contents of the binary log. Bad thing is if the master crashes, there's no guarantee that a slave has all committed transanction.</p>
<p>Simi-Synchronous Replication is an alternative to <a class=\"zem_slink freebase/en/replication\" title=\"Replication (computer science)\" rel=\"wikipedia\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9SZXBsaWNhdGlvbl8lMjhjb21wdXRlcl9zY2llbmNlJTI5">asynchronous replication</a>. Midway point between asynchronous and fully syncronous. Master only waits for a slave to receive an event. Don't have to wait for slaves to actually commit.</p>
<p>Performance schema tracks at an extremely low level. Just like <a class=\"zem_slink freebase/en/information_schema\" title=\"Information schema\" rel=\"wikipedia\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9JbmZvcm1hdGlvbl9zY2hlbWE=">Information schema</a>, tables are views or temporary tables. Activation doesn't cause any change in server behavior. This is designed for advanced users.</p>
<p>Think of SIGNAL as an exception, a way to "return" an error. You get exception-handling logic for <a class=\"zem_slink freebase/en/stored_procedure\" title=\"Stored procedure\" rel=\"wikipedia\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9TdG9yZWRfcHJvY2VkdXJl">stored procedures</a>, stored functions, triggers,events and db apps.</p>
<p>RESIGNAL lets you pass error information up. Think of it as a catch. Requres an active handler to execute. Lets you program on your PHP side to catch that very specific handling.</p>
<p><span id="more-285"></span></p>
<p>Column partitioning is variants on RANGE and LIST partitioning. Allows the use of multiple columns in partitioning keys. All columns are taken into account for placing rows in partitions and for partitioning pruning. Supports the use of non-integer columns (DATE/DATETIME/strings...).</p>
<p>Major differences from just RANGE is you don't accept expressions, only names in columns. Looking at an example. You're looking at full tuples, not the individual parts. Both parts of the <a class=\"zem_slink freebase/en/tuple\" title=\"Tuple\" rel=\"wikipedia\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9UdXBsZQ==">tuple</a> have to pass.</p>
<p>List column allows for multiple column values. Do not need to convert values to integers to work with. Much easier to read. Example slide is very hot.</p>
<p><a class=\"zem_slink freebase/en/mutual_exclusion\" title=\"Mutual exclusion\" rel=\"wikipedia\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9NdXR1YWxfZXhjbHVzaW9u">Mutex</a>: Mutually Exclusive lock. Apparently horrible for concurrency.</p>
<p>Read Ahead is when InnoDB tries to be smart for you. Prefetch multiple pages in the buffer cache asynchronously. You can now control when InnoDB performs a read-aahead operation by setting innodb_read_ahead_threshold. Default is 56.</p>
<p>Edit/Note: There was a lot more discussed by @lig but it was over my head a bit. I'll try to look at her slides and see if I can understand them. Trying the slideshare embed below so that others can see. Feel free to explain the rest of the slides to me because, like i said, they're beyond my current skill level.</p>
<div id="__ss_4184212" style="width: 425px;"><strong style="display: block; margin: 12px 0 4px;"><a title=\"MySQL 5.5\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5zbGlkZXNoYXJlLm5ldC9saWdheWEvbXlzcWwtNTU=">MySQL 5.5</a></strong><object id="__sse4184212" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=5-5talk-100520185426-phpapp02&amp;stripped_title=mysql-55" /><param name="name" value="__sse4184212" /><param name="allowfullscreen" value="true" /><embed id="__sse4184212" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=5-5talk-100520185426-phpapp02&amp;stripped_title=mysql-55" name="__sse4184212" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<div style="padding: 5px 0 12px;">View more <a href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5zbGlkZXNoYXJlLm5ldC8=">presentations</a> from <a href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5zbGlkZXNoYXJlLm5ldC9saWdheWE=">Ligaya Turmelle</a>.</div>
</div>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles by Zemanta</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5teXNxbHBlcmZvcm1hbmNlYmxvZy5jb20vMjAxMC8wMi8yOC9teXNxbC01LTUtbTItc2NhbGFiaWxpdHkv">MySQL 5.5-m2 scalability</a> (mysqlperformanceblog.com)</li>
<li class="zemanta-article-ul-li"><a href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5teXNxbHBlcmZvcm1hbmNlYmxvZy5jb20vMjAxMC8wNS8yNS9mbGFzaGNhY2hlLXRwY2Mtd29ya2xvYWQv">FlashCache: tpcc workload</a> (mysqlperformanceblog.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class=\"zemanta-pixie-a\" title=\"Reblog this post [with Zemanta]\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3JlYmxvZy56ZW1hbnRhLmNvbS96ZW1pZmllZC82MGFlZmUwNC0xNGNmLTQxZjgtOTFiZC1kMmQ2NGM2M2IxMWIv"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/reblog_a.png?x-id=60aefe04-14cf-41f8-91bd-d2d64c63b11b" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related more-info pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
 <img src="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=285" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://phpprotip.com/2010/05/tekx-ligs-talk-on-scalability-and-mysql/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>mysql alter table add foreign key</title>
		<link>http://phpprotip.com/2009/07/mysql-alter-table-add-foreign-key/</link>
		<comments>http://phpprotip.com/2009/07/mysql-alter-table-add-foreign-key/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 17:20:09 +0000</pubDate>
		<dc:creator>chance</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[alter table add constraint]]></category>
		<category><![CDATA[alter table add foreign key]]></category>
		<category><![CDATA[errno 150]]></category>
		<category><![CDATA[foreign key]]></category>
		<category><![CDATA[innodb]]></category>

		<guid isPermaLink="false">http://phpprotip.com/?p=159</guid>
		<description><![CDATA[I recently ran into a situation where I needed to add a foreign key to a table. This seems easy at first but was actually a 3 step process compared to the couple of lines it takes in a create table sytax. Short version: when creating your FK column, it helps to have the column [...]]]></description>
			<content:encoded><![CDATA[<p>I recently ran into a situation where I needed to add a foreign key to a table. This seems easy at first but was actually a 3 step process compared to the couple of lines it takes in a create table sytax.</p>
<p>Short version: when creating your FK column, it helps to have the column definition of the FK match the column definition. In retrospec, this seems like a no-brainer but was the heart of my problem.</p>
<p>So, you want create a FK to an existing table. Lets start by creating our table.</p>
<pre>
CREATE TABLE IF NOT EXISTS Role(
Id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
Name VARCHAR(255) NOT NULL UNIQUE,
Description TEXT DEFAULT NULL,
PRIMARY KEY(Id)
);
</pre>
<p>Pretend we pooped data into it and now it's a big pain in the ass to do a drop/create with how we want things.</p>
<p>First we add our column that will be the Foreign Key.</p>
<pre>
ALTER TABLE Role ADD COLUMN Parent int(11) UNSIGNED DEFAULT NULL;
</pre>
<p>Next we add an index. Why? <a href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Rldi5teXNxbC5jb20vZG9jL3JlZm1hbi81LjEvZW4vaW5ub2RiLWZvcmVpZ24ta2V5LWNvbnN0cmFpbnRzLmh0bWw=">because mysql says so</a> and FKs rely on indexes</p>
<pre>
ALTER TABLE Role ADD INDEX Parent (Parent);
</pre>
<p>Now we add our constraint.</p>
<pre>
ALTER TABLE `Role` ADD CONSTRAINT `Parent` FOREIGN KEY(`Parent`) REFERENCES `Role`(`Id`) ON DELETE SET NULL ON UPDATE SET NULL;
</pre>
<p>For fun, do</p>
<pre>
ALTER TABLE Role ADD COLUMN Parent int(11) DEFAULT NULL;
</pre>
<p>for the first step. Everything will look awesome until you get to the the last step. You'll get a wonderful "Errno 150" error and spend a bunch of time googling various key words trying to figure out what went wrong. Well, at least I did.</p>
 <img src="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=159" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://phpprotip.com/2009/07/mysql-alter-table-add-foreign-key/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pwning your MySQL</title>
		<link>http://phpprotip.com/2008/03/pwning-your-mysql/</link>
		<comments>http://phpprotip.com/2008/03/pwning-your-mysql/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 18:13:04 +0000</pubDate>
		<dc:creator>chance</dc:creator>
				<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://magic.garciawebapps.com/?p=4</guid>
		<description><![CDATA[How to find out if a specific column exists: SHOW COLUMNS FROM TableName WHERE Field LIKE ('ColName')]]></description>
			<content:encoded><![CDATA[<p>How to find out if a specific column exists:<br />
<code><br />
SHOW COLUMNS FROM TableName WHERE Field LIKE ('ColName')<br />
</code></p>
 <img src="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=4" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://phpprotip.com/2008/03/pwning-your-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
