<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="http://www.saigonist.com/taxonomy/term/5/all" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>mysql</title>
    <link>http://www.saigonist.com/taxonomy/term/5/all</link>
    <description></description>
    <language>en</language>
          <item>
    <title>AutoMySQLBackup</title>
    <link>http://www.saigonist.com/b/automysqlbackup</link>
    <description>&lt;p&gt;I&#039;m using AutoMySQLBackup v2.5 and haven&#039;t upgraded to v3.0 because the new version splits out config from code (nice) but also expects you to put everything in /etc (not nice).  It&#039;s a fairly simple script made complicated by this new version which even includes an installer script now, which is more reason to keep with the old version.&lt;/p&gt;
&lt;p&gt;Some changes I made:&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;OPT&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot; --quote-names --opt --skip-lock-tables&amp;quot;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I&#039;m running this script out of cron and I don&#039;t want to lock tables which the web server is serving, even if it means some rows will be out of sync.&lt;/p&gt;
&lt;p&gt;Then I change all &quot;rm -fv&quot; to &quot;rm -f&quot; because OpenBSD rm doesn&#039;t have a &quot;-v&quot; option, which if my assumption is correct means &quot;verbose&quot; and it&#039;s not useful in this script.&lt;/p&gt;
&lt;p&gt;Since my databases aren&#039;t so small anymore, I&#039;ve had to set MAXATTSIZE=&quot;20000&quot;.  I also want to filter certain tables (big ones that never change, cache and log tables) and AutoMySQLBackup 3.0 has a new setting CONFIG_table_exclude for this.&lt;/p&gt;
&lt;p&gt;The section of new code that does this is:&lt;br /&gt;
&lt;div class=&quot;geshifilter&quot;&gt;&lt;pre class=&quot;javascript geshifilter-javascript&quot; style=&quot;font-family:monospace;&quot;&gt;    &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;#CONFIG_table_exclude&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;@&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; then
      &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;for&lt;/span&gt; i &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;in&lt;/span&gt; &lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;${CONFIG_table_exclude[@]}&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;do&lt;/span&gt;
	opt&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;${opt[@]}&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;--ignore-table=$i&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;
      done
    fi&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;In 2.5 we can add these tables manually to the OPT variable after the &quot;&lt;br /&gt;
OPT&quot; line, e.g.&lt;br /&gt;
&lt;div class=&quot;geshifilter&quot;&gt;&lt;pre class=&quot;javascript geshifilter-javascript&quot; style=&quot;font-family:monospace;&quot;&gt;$OPT&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;$OPT --ignore-table=foo.bar --ignore-table=foo.baz&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;This saves a lot of disk space and space in my Gmail account used for storing backups.&lt;/p&gt;
</description>
     <comments>http://www.saigonist.com/b/automysqlbackup#comments</comments>
 <category domain="http://www.saigonist.com/category/type/tech">Tech</category>
 <category domain="http://www.saigonist.com/category/tags/backup">backup</category>
 <category domain="http://www.saigonist.com/category/tags/bash">bash</category>
 <category domain="http://www.saigonist.com/category/tags/mysql">mysql</category>
 <category domain="http://www.saigonist.com/category/tags/script">script</category>
 <pubDate>Sat, 08 Oct 2011 18:09:20 +0000</pubDate>
 <dc:creator>tomo</dc:creator>
 <guid isPermaLink="false">260 at http://www.saigonist.com</guid>
  </item>
  <item>
    <title>Sorting broken after upgrading Pligg</title>
    <link>http://www.saigonist.com/content/sorting-broken-after-upgrading-pligg</link>
    <description>&lt;p&gt;If, after upgrading from an old version of Pligg to 1.1.2, you notice that the front page is sorted completely backwards and you can&#039;t change the sorting even by fiddling with the sort-query code in index.php, it may be because of the new Groups feature.  A new groups table has been added and all queries join this table but the Pligg upgrader only creates the table and sets the new link_group_id to 0 for all rows in links.  The solution is to populate the groups table.  An easy way is to head to groups/submit/ and create a generic catchall group.  Then in your database, change the group_id for the newly created row in groups to 0 (if it&#039;s 1).  &lt;/p&gt;
&lt;p&gt;If the Pligg group submitter is broken (as Pligg is prone to be buggy) then just:&lt;br /&gt;
&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;INSERT INTO groups &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;group_id&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; VALUES &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Now those queries like:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;geshifilter&quot;&gt;&lt;pre class=&quot;javascript geshifilter-javascript&quot; style=&quot;font-family:monospace;&quot;&gt;SELECT link_id FROM links LEFT JOIN groups ON links.&lt;span style=&quot;color: #660066;&quot;&gt;link_group_id&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; groups.&lt;span style=&quot;color: #660066;&quot;&gt;group_id&lt;/span&gt; WHERE link_status&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&#039;published&#039;&lt;/span&gt; AND &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;groups.&lt;span style=&quot;color: #660066;&quot;&gt;group_privacy&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&#039;private&#039;&lt;/span&gt; OR ISNULL&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;groups.&lt;span style=&quot;color: #660066;&quot;&gt;group_privacy&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; OR groups.&lt;span style=&quot;color: #660066;&quot;&gt;group_id&lt;/span&gt; IN&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; GROUP BY link_id ORDER BY link_published_date DESC&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; link_date DESC LIMIT &lt;span style=&quot;color: #CC0000;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;10&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;will work again!&lt;/p&gt;
</description>
     <comments>http://www.saigonist.com/content/sorting-broken-after-upgrading-pligg#comments</comments>
 <category domain="http://www.saigonist.com/category/type/tech">Tech</category>
 <category domain="http://www.saigonist.com/category/tags/mysql">mysql</category>
 <category domain="http://www.saigonist.com/category/tags/pligg">pligg</category>
 <pubDate>Thu, 06 Jan 2011 00:36:07 +0000</pubDate>
 <dc:creator>tomo</dc:creator>
 <guid isPermaLink="false">27 at http://www.saigonist.com</guid>
  </item>
  <item>
    <title>Pligg long running queries</title>
    <link>http://www.saigonist.com/content/pligg-long-running-queries</link>
    <description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div&gt;For awhile I&amp;#39;ve been plagued with these long running queries on my Pligg site that were running up CPU:&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;SELECT DISTIN&lt;/code&gt;&lt;/span&gt;CT pv_user_id, pv_type, pv_page_id FROM mypligg_pageviews GROUP BY pv_type, pv_page_id, pv&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;And so I was running the mkill Perl script to kill any queries taking longer than a minute to complete.&lt;/div&gt;
&lt;div&gt;But recently even that stopped working, leaving queries in the Killed state but still running up CPU. &amp;nbsp;They were all stuck in &amp;quot;converting&amp;nbsp;HEAP&amp;nbsp;to&amp;nbsp;MyISAM&amp;quot;. &amp;nbsp;Did some diagnostics:&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;mysql&lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;gt&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; SHOW GLOBAL STATUS LIKE &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;#&lt;span style=&quot;color: #CC0000;&quot;&gt;39&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;Created_tmp_tables&lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;#&lt;span style=&quot;color: #CC0000;&quot;&gt;39&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+--------------------+-------+&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;&lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt; Variable_name &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;nbsp&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;nbsp&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;nbsp&lt;span style=&quot;color: #339933;&quot;&gt;;|&lt;/span&gt; Value &lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+--------------------+-------+&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;&lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt; Created_tmp_tables &lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;196&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;nbsp&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+--------------------+-------+&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;1&lt;/span&gt; row &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;in&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;set&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;0.01&lt;/span&gt; sec&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;mysql&lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;gt&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; SHOW GLOBAL STATUS LIKE &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;#&lt;span style=&quot;color: #CC0000;&quot;&gt;39&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;Created_tmp_disk_tables&lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;#&lt;span style=&quot;color: #CC0000;&quot;&gt;39&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+-------------------------+-------+&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;&lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt; Variable_name &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;nbsp&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;nbsp&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;nbsp&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;nbsp&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;nbsp&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt; Value &lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+-------------------------+-------+&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;&lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt; Created_tmp_disk_tables &lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;159&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;nbsp&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+-------------------------+-------+&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;1&lt;/span&gt; row &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;in&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;set&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;0.01&lt;/span&gt; sec&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;mysql&lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;gt&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; show variables like &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;#&lt;span style=&quot;color: #CC0000;&quot;&gt;39&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;tmp_table_size&lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;#&lt;span style=&quot;color: #CC0000;&quot;&gt;39&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+----------------+----------+&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;&lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt; Variable_name &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;nbsp&lt;span style=&quot;color: #339933;&quot;&gt;;|&lt;/span&gt; Value &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;nbsp&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;nbsp&lt;span style=&quot;color: #339933;&quot;&gt;;|&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+----------------+----------+&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;&lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt; tmp_table_size &lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;33554432&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+----------------+----------+&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;1&lt;/span&gt; row &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;in&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;set&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;0.01&lt;/span&gt; sec&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;So it seemed there wasn&amp;#39;t enough memory to perform the conversion without going to disk which is not what we want. &amp;nbsp;So I set&amp;nbsp;tmp_table_size&amp;nbsp;and&amp;nbsp;max_heap_table_size to larger values,&amp;nbsp;max_heap_table_size too because MySQL uses the lesser of the two.&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;mysql&lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;gt&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;set&lt;/span&gt; tmp_table_size&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;100000000&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;Query OK&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;0&lt;/span&gt; rows affected &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;0.00&lt;/span&gt; sec&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;mysql&lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;gt&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;set&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;nbsp&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;max_heap_table_size&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;100000000&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;javascript geshifilter-javascript&quot;&gt;Query OK&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;0&lt;/span&gt; rows affected &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;0.01&lt;/span&gt; sec&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;p&gt;And now we&amp;#39;re golden, CPU back down to normal levels and queries finishing.&lt;/p&gt;
</description>
     <comments>http://www.saigonist.com/content/pligg-long-running-queries#comments</comments>
 <category domain="http://www.saigonist.com/category/type/tech">Tech</category>
 <category domain="http://www.saigonist.com/category/tags/mysql">mysql</category>
 <category domain="http://www.saigonist.com/category/tags/pligg">pligg</category>
 <category domain="http://www.saigonist.com/category/tags/yalla">yalla</category>
 <pubDate>Mon, 06 Sep 2010 19:20:55 +0000</pubDate>
 <dc:creator>tomo</dc:creator>
 <guid isPermaLink="false">4 at http://www.saigonist.com</guid>
  </item>
  </channel>
</rss>