<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>I gotta have my orange juice. &#187; MySQL</title>
	<atom:link href="http://scottmoonen.com/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://scottmoonen.com</link>
	<description>Jesu, Juva</description>
	<lastBuildDate>Thu, 31 May 2012 16:33:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='scottmoonen.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/71456a1f4695cc8129f159ece0f7b3a1?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>I gotta have my orange juice. &#187; MySQL</title>
		<link>http://scottmoonen.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://scottmoonen.com/osd.xml" title="I gotta have my orange juice." />
	<atom:link rel='hub' href='http://scottmoonen.com/?pushpress=hub'/>
		<item>
		<title>PostgreSQL foreign keys and indexes</title>
		<link>http://scottmoonen.com/2008/12/19/postgresql-foreign-keys-and-indexes/</link>
		<comments>http://scottmoonen.com/2008/12/19/postgresql-foreign-keys-and-indexes/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 16:15:30 +0000</pubDate>
		<dc:creator>Scott Moonen</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[constraint]]></category>
		<category><![CDATA[foreign key]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://blog.fullvalence.com/?p=42</guid>
		<description><![CDATA[If you&#8217;re a frequent user of MySQL, you may be familiar with the fact that all MySQL table constraints automatically create indexes for you.  This is true of the InnoDB foreign key constraints, for which &#8220;an index is created on the referencing table automatically if it does not exist.&#8221; If you&#8217;re switching or considering a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=scottmoonen.com&#038;blog=9709237&#038;post=114&#038;subd=smoonen&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.postgresql.org/"><img style="border:0 none;float:right;margin:.5em;" src="http://smoonen.files.wordpress.com/2008/12/postgres.gif?w=95&h=51" alt="[PostgreSQL]" width="95" height="51" /></a>If you&#8217;re a frequent user of MySQL, you may be familiar with the fact that all MySQL table constraints automatically create indexes for you.  This is true of the <a href="http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html">InnoDB foreign key constraints</a>, for which &#8220;an index is created on the referencing table automatically if it does not exist.&#8221;</p>
<p>If you&#8217;re switching or considering a switch to PostgreSQL, you should be aware that not all PostgreSQL table constraints will automatically create indexes for for you.  In PostgreSQL, a UNIQUE or PRIMARY KEY constraint on one or more fields <em>will</em> implicitly create an index for you.  However, in PostgreSQL a FOREIGN KEY constraint will <em>not</em> automatically create an index for you.</p>
<p>For each of your foreign key constraints, you should evaluate whether you want to create an index.  You may want to do this for optimizing your own queries, but be aware that it can also help to speed up DELETE queries on the referenced table and UPDATE queries on the referenced field.  This is because any foreign key reference must be located to enforce whatever ON DELETE and ON UPDATE behavior is in effect for the constraint.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/smoonen.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/smoonen.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/smoonen.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/smoonen.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/smoonen.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/smoonen.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/smoonen.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/smoonen.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/smoonen.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/smoonen.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/smoonen.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/smoonen.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/smoonen.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/smoonen.wordpress.com/114/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=scottmoonen.com&#038;blog=9709237&#038;post=114&#038;subd=smoonen&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://scottmoonen.com/2008/12/19/postgresql-foreign-keys-and-indexes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c801efd19dadd22c4f35d3f1f6ea1869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">smoonen</media:title>
		</media:content>

		<media:content url="http://smoonen.files.wordpress.com/2008/12/postgres.gif" medium="image">
			<media:title type="html">[PostgreSQL]</media:title>
		</media:content>
	</item>
		<item>
		<title>A performance comparison of AF_UNIX with loopback on Linux</title>
		<link>http://scottmoonen.com/2008/04/05/a-performance-comparison-of-af_unix-with-loopback-on-linux/</link>
		<comments>http://scottmoonen.com/2008/04/05/a-performance-comparison-of-af_unix-with-loopback-on-linux/#comments</comments>
		<pubDate>Sat, 05 Apr 2008 23:03:25 +0000</pubDate>
		<dc:creator>Scott Moonen</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[AF_INET]]></category>
		<category><![CDATA[AF_UNIX]]></category>
		<category><![CDATA[connection]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[latency]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[local]]></category>
		<category><![CDATA[loopback]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Postgres]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[socket]]></category>
		<category><![CDATA[throughput]]></category>

		<guid isPermaLink="false">http://blog.fullvalence.com/2008/04/05/a-performance-comparison-of-af_unix-with-loopback-on-linux/</guid>
		<description><![CDATA[On various Linux hosts I use either MySQL or PostgreSQL for my back-end database.  Typically the database is running on the local host, and this raises the question of how to connect to the database.  For both MySQL and PostgreSQL it is possible to connect using a local AF_UNIX connection, or using an AF_INET connection [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=scottmoonen.com&#038;blog=9709237&#038;post=104&#038;subd=smoonen&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.postgresql.org/"><img src="http://smoonen.files.wordpress.com/2008/12/postgres.gif?w=95&h=51" style="border:0 none;float:right;margin:.5em;" alt="[PostgreSQL]" width="95" height="51" /></a>On various Linux hosts I use either MySQL or PostgreSQL for my back-end database.  Typically the database is running on the local host, and this raises the question of how to connect to the database.  For both MySQL and PostgreSQL it is possible to connect using a local AF_UNIX connection, or using an AF_INET connection over the loopback socket (address 127.0.0.1).</p>
<p>I had thought that it might actually be more efficient to connect over loopback; for my day job I work on the TCP/IP stack for the z/OS operating system, and I know firsthand that our TCP/IP implementation is heavily optimized, including specific optimizations for local traffic.</p>
<p>I decided to test this hypothesis by comparing both the throughput and latency of AF_UNIX and AF_INET connections.  I was running on a Celeron Dual-core system running Debian 4.0 with kernel version 2.6.18-4-686.  The results disproved my hypothesis, at least for Linux:</p>
<ul>
<li>AF_UNIX:
<ul>
<li>100GB transferred in 80.575200 s</li>
<li>100 million 8-byte messages:
<ul>
<li>Average latency 14.463910 μs</li>
<li>Standard deviation 0.003376 μs</li>
</ul>
</li>
</ul>
</li>
<li>AF_INET, loopback address
<ul>
<li>100GB transferred in 226.717520 s</li>
<li>100 million 8-byte messages:
<ul>
<li>Average latency 1133.444424 μs</li>
<li>Standard deviation 0.067419 μs</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>So, for both throughput and latency, on the Linux platform AF_UNIX is a superior choice to AF_INET.  For local MySQL and PostgreSQL connections you should use a local socket rather than the loopback socket.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/smoonen.wordpress.com/104/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/smoonen.wordpress.com/104/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/smoonen.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/smoonen.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/smoonen.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/smoonen.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/smoonen.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/smoonen.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/smoonen.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/smoonen.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/smoonen.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/smoonen.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/smoonen.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/smoonen.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/smoonen.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/smoonen.wordpress.com/104/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=scottmoonen.com&#038;blog=9709237&#038;post=104&#038;subd=smoonen&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://scottmoonen.com/2008/04/05/a-performance-comparison-of-af_unix-with-loopback-on-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c801efd19dadd22c4f35d3f1f6ea1869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">smoonen</media:title>
		</media:content>

		<media:content url="http://smoonen.files.wordpress.com/2008/12/postgres.gif" medium="image">
			<media:title type="html">[PostgreSQL]</media:title>
		</media:content>
	</item>
	</channel>
</rss>
