<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1042200" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1042200</link>
    <description></description>
    <language>en</language>
          <item>
    <title>When I passed it through</title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-question-updating-prices-huge-table#comment-1234757</link>
    <description> &lt;p&gt;When I passed it through phpMyAdmin, it had a script timeout at 300 seconds into the query run, but when I ran it at the command line, it only took 5 or 10 seconds.  I&#039;m not sure why phpMyAdmin had such a problem.&lt;/p&gt;
 </description>
     <pubDate>Sat, 01 Nov 2008 01:19:05 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1234757 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Do you remember how long</title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-question-updating-prices-huge-table#comment-1234756</link>
    <description> &lt;p&gt;Do you remember how long that query took to run? Was it in the minutes? I&#039;m just curious...&lt;/p&gt;
 </description>
     <pubDate>Fri, 31 Oct 2008 23:49:36 +0000</pubDate>
 <dc:creator>teammatt3</dc:creator>
 <guid isPermaLink="false">comment 1234756 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Yup, that worked. 
I</title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-question-updating-prices-huge-table#comment-1234708</link>
    <description> &lt;p&gt;Yup, that worked. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
&lt;p&gt;I previously ran an alternate query where I ran the internal one from the one I posted above, took the returned IDs, and placed it in the place of the subquery, so it was something like:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;UPDATE products SET products_price =3 * products_price WHERE products.products_id IN (&lt;br /&gt;*insert 40,000 IDs here*&lt;br /&gt;) &lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;phpMyAdmin couldn&#039;t run it because of the size alone.  I had to save it in a SQL file, and import it on the good &#039;ol command line. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/big.png&quot; title=&quot;Laughing out loud&quot; alt=&quot;Laughing out loud&quot; class=&quot;smiley-content&quot; /&gt;  Your query is more efficient. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Fri, 31 Oct 2008 03:29:32 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1234708 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>This is just a hunch, but I</title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-question-updating-prices-huge-table#comment-1234701</link>
    <description> &lt;p&gt;This is just a hunch, but I remember reading that MySQL treats sub queries in the WHERE clause different from those in the FROM clause. (I could totally be making that up though &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;)&lt;/p&gt;
&lt;p&gt;Can you rewrite the query to use the subquery in the FROM clause? You can use an AND to kind of emulate the WHERE.&lt;/p&gt;
&lt;p&gt;*Don&#039;t run this in a production environment*&lt;br /&gt;
[code]&lt;br /&gt;
UPDATE&lt;br /&gt;
	products&lt;br /&gt;
INNER JOIN&lt;br /&gt;
	products_to_categories ON products.products_id = products_to_categories.products_id AND products_to_categories.categories_id = 4&lt;br /&gt;
SET&lt;br /&gt;
	products_price = 3 * products_price&lt;br /&gt;
[/code]&lt;/p&gt;
&lt;p&gt;Does that work?&lt;/p&gt;
 </description>
     <pubDate>Thu, 30 Oct 2008 23:49:00 +0000</pubDate>
 <dc:creator>teammatt3</dc:creator>
 <guid isPermaLink="false">comment 1234701 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>I can answer part of your</title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-question-updating-prices-huge-table#comment-1234685</link>
    <description> &lt;p&gt;I can answer part of your question:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Why doesn&#039;t it get all the results from the sub query and then feed it all at once into the parent query?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Because MySQL&#039;s handling of subqueries are rubbish. It &lt;a href=&quot;http://bugs.mysql.com/bug.php?id=9090&quot;&gt;treats every subquery as a correlated subquery&lt;/a&gt;, meaning for every result row of the outer query the inner query is run again.&lt;/p&gt;
&lt;p&gt;Your best bet is to create a temp table, then &lt;code&gt;SELECT&lt;/code&gt; from that.&lt;/p&gt;
&lt;p&gt;Postscript: man, I&#039;ve got to fix those code boxes.&lt;/p&gt;
 </description>
     <pubDate>Thu, 30 Oct 2008 15:15:44 +0000</pubDate>
 <dc:creator>JeevesBond</dc:creator>
 <guid isPermaLink="false">comment 1234685 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
