<?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>Gary Pendergast &#187; bugs</title> <atom:link href="http://pento.net/tag/bugs/feed/" rel="self" type="application/rss+xml" /><link>http://pento.net</link> <description>I&#039;m on the Internet</description> <lastBuildDate>Thu, 17 May 2012 04:24:17 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <cloud
domain='pento.net' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' /> <item><title>Don&#8217;t Quote Your Numbers</title><link>http://pento.net/2009/03/03/dont-quote-your-numbers/</link> <comments>http://pento.net/2009/03/03/dont-quote-your-numbers/#comments</comments> <pubDate>Tue, 03 Mar 2009 02:30:42 +0000</pubDate> <dc:creator>Gary</dc:creator> <category><![CDATA[MySQL]]></category> <category><![CDATA[bugs]]></category> <category><![CDATA[performance]]></category> <guid
isPermaLink="false">http://pento.net/?p=111</guid> <description><![CDATA[It&#8217;s a fairly simple rule, and something that should be obeyed for your health and sanity. There are a couple of bugs which you could run into, when quoting large numbers. First of all, Bug #34384. This is concerning quoting large INTs in the WHERE condition of an UPDATE or DELETE. It seems that this [...]]]></description> <content:encoded><![CDATA[<p>It&#8217;s a fairly simple rule, and something that should be obeyed for your health and sanity.</p><p>There are a couple of bugs which you could run into, when quoting large numbers. First of all, <a
title="MySQL Bug #34384: Big quoted int in WHERE of UPDATE or DELETE causes drop in performance" href="http://bugs.mysql.com/34384">Bug #34384</a>. This is concerning quoting large INTs in the WHERE condition of an UPDATE or DELETE. It seems that this will cause a table scan, which is going to be slooooow on big tables.</p><p>Similarly, there is the more recently discovered <a
title="MySQL Bug #43319: Table/index scan when quoting large numbers in an 'IN' of a SELECT ... WHERE" href="http://bugs.mysql.com/43319">Bug #43319</a>. You can run into this if you quote large INTs in the IN clause of a SELECT &#8230; WHERE. For example:</p><div
class="wp_syntax"><div
class="code"><pre class="sql" style="font-family:monospace;">mysql<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">EXPLAIN</span> <span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">FROM</span> a <span style="color: #993333; font-weight: bold;">WHERE</span> a <span style="color: #993333; font-weight: bold;">IN</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'9999999999999999999999'</span><span style="color: #66cc66;">&#41;</span>\G
<span style="color: #66cc66;">***************************</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">.</span> <span style="color: #993333; font-weight: bold;">ROW</span> <span style="color: #66cc66;">***************************</span>
           id: <span style="color: #cc66cc;">1</span>
  select_type: SIMPLE
        <span style="color: #993333; font-weight: bold;">TABLE</span>: <span style="color: #993333; font-weight: bold;">NULL</span>
         <span style="color: #993333; font-weight: bold;">TYPE</span>: <span style="color: #993333; font-weight: bold;">NULL</span>
possible_keys: <span style="color: #993333; font-weight: bold;">NULL</span>
          <span style="color: #993333; font-weight: bold;">KEY</span>: <span style="color: #993333; font-weight: bold;">NULL</span>
      key_len: <span style="color: #993333; font-weight: bold;">NULL</span>
          <span style="color: #993333; font-weight: bold;">REF</span>: <span style="color: #993333; font-weight: bold;">NULL</span>
         <span style="color: #993333; font-weight: bold;">ROWS</span>: <span style="color: #993333; font-weight: bold;">NULL</span>
        Extra: Impossible <span style="color: #993333; font-weight: bold;">WHERE</span> noticed after reading const <span style="color: #993333; font-weight: bold;">TABLES</span>
<span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">ROW</span> <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #993333; font-weight: bold;">SET</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0.00</span> sec<span style="color: #66cc66;">&#41;</span>
&nbsp;
mysql<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">EXPLAIN</span> <span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">FROM</span> a <span style="color: #993333; font-weight: bold;">WHERE</span> a <span style="color: #993333; font-weight: bold;">IN</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'9999999999999999999999'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'9999999999999999999999'</span><span style="color: #66cc66;">&#41;</span>\G
<span style="color: #66cc66;">***************************</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">.</span> <span style="color: #993333; font-weight: bold;">ROW</span> <span style="color: #66cc66;">***************************</span>
           id: <span style="color: #cc66cc;">1</span>
  select_type: SIMPLE
        <span style="color: #993333; font-weight: bold;">TABLE</span>: a
         <span style="color: #993333; font-weight: bold;">TYPE</span>: <span style="color: #993333; font-weight: bold;">ALL</span>
possible_keys: <span style="color: #993333; font-weight: bold;">PRIMARY</span>
          <span style="color: #993333; font-weight: bold;">KEY</span>: <span style="color: #993333; font-weight: bold;">NULL</span>
      key_len: <span style="color: #993333; font-weight: bold;">NULL</span>
          <span style="color: #993333; font-weight: bold;">REF</span>: <span style="color: #993333; font-weight: bold;">NULL</span>
         <span style="color: #993333; font-weight: bold;">ROWS</span>: <span style="color: #cc66cc;">655360</span>
        Extra: <span style="color: #993333; font-weight: bold;">USING</span> <span style="color: #993333; font-weight: bold;">WHERE</span>
<span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">ROW</span> <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #993333; font-weight: bold;">SET</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0.00</span> sec<span style="color: #66cc66;">&#41;</span></pre></div></div><p>Note that you only run into it when you quote multiple large numbers.</p><p>Anyway, the long and the short of this post is: if at all possible, don&#8217;t quote numbers. MySQL will love you for it.</p> ]]></content:encoded> <wfw:commentRss>http://pento.net/2009/03/03/dont-quote-your-numbers/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> </channel> </rss>
