<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: How to optimize subqueries and joins in MySQL</title>
	<atom:link href="http://www.xaprb.com/blog/2006/04/30/how-to-optimize-subqueries-and-joins-in-mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xaprb.com/blog/2006/04/30/how-to-optimize-subqueries-and-joins-in-mysql/</link>
	<description>Stay curious!</description>
	<lastBuildDate>Thu, 09 Feb 2012 09:56:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Jamie Hamel-Smith</title>
		<link>http://www.xaprb.com/blog/2006/04/30/how-to-optimize-subqueries-and-joins-in-mysql/#comment-19586</link>
		<dc:creator>Jamie Hamel-Smith</dc:creator>
		<pubDate>Sun, 21 Aug 2011 06:03:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=127#comment-19586</guid>
		<description>You sir are my new hero! I&#039;m a self taught developer at a web company and your advice just got a query I&#039;d been writing for a cron job from 235 seconds down to 2 seconds.

Nesting of the subquery is almost magical in the right situation. Life-saver!</description>
		<content:encoded><![CDATA[<p>You sir are my new hero! I&#8217;m a self taught developer at a web company and your advice just got a query I&#8217;d been writing for a cron job from 235 seconds down to 2 seconds.</p>
<p>Nesting of the subquery is almost magical in the right situation. Life-saver!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arpit</title>
		<link>http://www.xaprb.com/blog/2006/04/30/how-to-optimize-subqueries-and-joins-in-mysql/#comment-18986</link>
		<dc:creator>Arpit</dc:creator>
		<pubDate>Sat, 18 Dec 2010 02:36:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=127#comment-18986</guid>
		<description>pls help me optimize this query..its already optimized 2 some extent..bt i want 2 c if it can get further..

SELECT e.emp_no as EMP_No,DEp.dept_name AS CurrentDEpt,e.first_nAme as FirstName,e.last_nAme as SurName,t.tiTle as CurrentStatus,e.genDer as Gender,s.salary,(s.salary/10) as BOnus

FROM (dEpARTMeNts dep) JOIN (dept_emp de) ON (de.dept_no = dep.depT_NO) JOIN (employees e) ON (de.emp_no = e.emP_NO) JOIN (titles t) ON (t.emp_NO = e.emp_no AND (t.to_date = &#039;9999-01-01&#039;))
join (salaries s) on (s.emp_no = t.emp_no and s.to_date = &#039;9999-01-01&#039;) having s.salary &gt;100000
order by e.emp_no</description>
		<content:encoded><![CDATA[<p>pls help me optimize this query..its already optimized 2 some extent..bt i want 2 c if it can get further..</p>
<p>SELECT e.emp_no as EMP_No,DEp.dept_name AS CurrentDEpt,e.first_nAme as FirstName,e.last_nAme as SurName,t.tiTle as CurrentStatus,e.genDer as Gender,s.salary,(s.salary/10) as BOnus</p>
<p>FROM (dEpARTMeNts dep) JOIN (dept_emp de) ON (de.dept_no = dep.depT_NO) JOIN (employees e) ON (de.emp_no = e.emP_NO) JOIN (titles t) ON (t.emp_NO = e.emp_no AND (t.to_date = &#8217;9999-01-01&#8242;))<br />
join (salaries s) on (s.emp_no = t.emp_no and s.to_date = &#8217;9999-01-01&#8242;) having s.salary &gt;100000<br />
order by e.emp_no</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nishi</title>
		<link>http://www.xaprb.com/blog/2006/04/30/how-to-optimize-subqueries-and-joins-in-mysql/#comment-18534</link>
		<dc:creator>nishi</dc:creator>
		<pubDate>Tue, 03 Aug 2010 15:54:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=127#comment-18534</guid>
		<description>update tableA,tableB
set tableA.col2 = 1
where tableA.col1 = tableB.col1 and (tableB.col2 200);

Its taking couple of hours to execute the below query. Both tables have millions of entries and index is on col1, col2 and col3 of tableB.Also col1 in tableB is a foreign key referring to col1 of tableA
What can I do to make it run fast?
It will be of great help if you could help me with this asap</description>
		<content:encoded><![CDATA[<p>update tableA,tableB<br />
set tableA.col2 = 1<br />
where tableA.col1 = tableB.col1 and (tableB.col2 200);</p>
<p>Its taking couple of hours to execute the below query. Both tables have millions of entries and index is on col1, col2 and col3 of tableB.Also col1 in tableB is a foreign key referring to col1 of tableA<br />
What can I do to make it run fast?<br />
It will be of great help if you could help me with this asap</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.xaprb.com/blog/2006/04/30/how-to-optimize-subqueries-and-joins-in-mysql/#comment-18504</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Thu, 15 Jul 2010 15:56:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=127#comment-18504</guid>
		<description>I wanted to thank you for your help in suggesting the wrapper subquery trick. I had a query which took forever but now it runs pretty quick.</description>
		<content:encoded><![CDATA[<p>I wanted to thank you for your help in suggesting the wrapper subquery trick. I had a query which took forever but now it runs pretty quick.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Mior</title>
		<link>http://www.xaprb.com/blog/2006/04/30/how-to-optimize-subqueries-and-joins-in-mysql/#comment-18490</link>
		<dc:creator>Michael Mior</dc:creator>
		<pubDate>Fri, 09 Jul 2010 02:41:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=127#comment-18490</guid>
		<description>I know this post is ancient now. But I just wanted to thank you for your help in suggesting the wrapper subquery trick. It helped me go from a query which timed out after one hour to one which executes in around 5 seconds. Awesome!</description>
		<content:encoded><![CDATA[<p>I know this post is ancient now. But I just wanted to thank you for your help in suggesting the wrapper subquery trick. It helped me go from a query which timed out after one hour to one which executes in around 5 seconds. Awesome!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

