<?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>Jtanium's Notebook &#187; utosc</title>
	<atom:link href="http://www.jtanium.com/category/utosc/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jtanium.com</link>
	<description>I jot things down, in hopes of finding them later...</description>
	<lastBuildDate>Wed, 21 Dec 2011 23:21:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>MySQL, Keys and Functions</title>
		<link>http://www.jtanium.com/2007/09/07/mysql-keys-and-functions/</link>
		<comments>http://www.jtanium.com/2007/09/07/mysql-keys-and-functions/#comments</comments>
		<pubDate>Fri, 07 Sep 2007 18:03:12 +0000</pubDate>
		<dc:creator>jtanium</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[utosc]]></category>

		<guid isPermaLink="false">http://www.jtanium.com/blog/?p=45</guid>
		<description><![CDATA[I&#8217;m at the UTOSC, and I just learned something I want to remember: The MySQL optimizer will not use keys if they are in a function. For example: ... where col_w_key + 1 = 3 would result in a full table scan. It should be rewritten, like so: ... where col_w_key = (3 - 1) [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m at the <a href="http://utosc.org">UTOSC</a>, and I just learned something I want to remember:</p>
<p>The MySQL optimizer will not use keys if they are in a function.  For example:</p>
<pre>... where col_w_key + 1 = 3</pre>
<p>would result in a full table scan.  It should be rewritten, like so:</p>
<pre>... where col_w_key = (3 - 1)</pre>
<p>The basic idea is to rewrite:</p>
<pre>... where func(key1) = val1</pre>
<p>to be:</p>
<pre>... where key1 = rev_func(val1)</pre>
<p>I think I knew this implicitly all along, I never liked performing functions on performing functions on columns, but it&#8217;s good to know this explicitly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jtanium.com/2007/09/07/mysql-keys-and-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

