<?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: IN vs INNER JOIN</title>
	<atom:link href="http://sqlinthewild.co.za/index.php/2010/01/12/in-vs-inner-join/feed/" rel="self" type="application/rss+xml" />
	<link>http://sqlinthewild.co.za/index.php/2010/01/12/in-vs-inner-join/</link>
	<description>A discussion on SQL Server</description>
	<lastBuildDate>Mon, 14 May 2012 23:51:41 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: IN vs INNER JOIN en Mysql. ¿Cuál es más rápida? &#124; Grab This Code!</title>
		<link>http://sqlinthewild.co.za/index.php/2010/01/12/in-vs-inner-join/comment-page-1/#comment-1987</link>
		<dc:creator>IN vs INNER JOIN en Mysql. ¿Cuál es más rápida? &#124; Grab This Code!</dc:creator>
		<pubDate>Sun, 04 Mar 2012 21:07:49 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=394#comment-1987</guid>
		<description>[...] operadores en ese sistema gestor de base de datos. Sobre Sql Server existe una buena comparativa en esta página, la cual da como ganador a in versus inner join. Pero&#8230;y sobre Mysql? No he podido encontrar [...]</description>
		<content:encoded><![CDATA[<p>[...] operadores en ese sistema gestor de base de datos. Sobre Sql Server existe una buena comparativa en esta página, la cual da como ganador a in versus inner join. Pero&#8230;y sobre Mysql? No he podido encontrar [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gail</title>
		<link>http://sqlinthewild.co.za/index.php/2010/01/12/in-vs-inner-join/comment-page-1/#comment-1786</link>
		<dc:creator>Gail</dc:creator>
		<pubDate>Mon, 22 Aug 2011 12:21:52 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=394#comment-1786</guid>
		<description>I&#039;ve added the missing definition for BigTable.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve added the missing definition for BigTable.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom Thomson</title>
		<link>http://sqlinthewild.co.za/index.php/2010/01/12/in-vs-inner-join/comment-page-1/#comment-1785</link>
		<dc:creator>Tom Thomson</dc:creator>
		<pubDate>Mon, 22 Aug 2011 11:40:16 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=394#comment-1785</guid>
		<description>I think that this statement is wreong:
----quote
DECLARE @SomeTable (IntCol int)
 Insert into @SomeTable (IntCol) Values (1)
 Insert into @SomeTable (IntCol) Values (2)
 Insert into @SomeTable (IntCol) Values (2)
 Insert into @SomeTable (IntCol) Values (3)
Insert into @SomeTable (IntCol) Values (4)
Insert into @SomeTable (IntCol) Values (5)
 Insert into @SomeTable (IntCol) Values (5)

SELECT *
 FROM BigTable
 WHERE SomeColumn IN (Select IntCol FROM @SomeTable)

This returns 5 rows and only columns from BigTable.
----end quote
There&#039;s no telling how many rows will be returned from BigTable - BigTable might have a 1000 rows where SomeColumn is 1, in which case the query will return at least 1000 rows; or it might have no rows with SomColumn less than 25, in which case it will return 0 rows.  SOme people might be think you qactually meant what you wrote there, and be misled.</description>
		<content:encoded><![CDATA[<p>I think that this statement is wreong:<br />
&#8212;-quote<br />
DECLARE @SomeTable (IntCol int)<br />
 Insert into @SomeTable (IntCol) Values (1)<br />
 Insert into @SomeTable (IntCol) Values (2)<br />
 Insert into @SomeTable (IntCol) Values (2)<br />
 Insert into @SomeTable (IntCol) Values (3)<br />
Insert into @SomeTable (IntCol) Values (4)<br />
Insert into @SomeTable (IntCol) Values (5)<br />
 Insert into @SomeTable (IntCol) Values (5)</p>
<p>SELECT *<br />
 FROM BigTable<br />
 WHERE SomeColumn IN (Select IntCol FROM @SomeTable)</p>
<p>This returns 5 rows and only columns from BigTable.<br />
&#8212;-end quote<br />
There&#8217;s no telling how many rows will be returned from BigTable &#8211; BigTable might have a 1000 rows where SomeColumn is 1, in which case the query will return at least 1000 rows; or it might have no rows with SomColumn less than 25, in which case it will return 0 rows.  SOme people might be think you qactually meant what you wrote there, and be misled.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nilesh Sane</title>
		<link>http://sqlinthewild.co.za/index.php/2010/01/12/in-vs-inner-join/comment-page-1/#comment-1636</link>
		<dc:creator>Nilesh Sane</dc:creator>
		<pubDate>Fri, 06 May 2011 08:29:50 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=394#comment-1636</guid>
		<description>I agree, with the fact that if you populate the vaules in a table the subquery with IN will be slightly faster then an inner join. I was speaking from my experience where &#039;a&#039; programmer, constructed the values which would form the part of the IN query by stringing together a comma seperated values (this method in itself is very inefficient). In such cases, if the programmer takes an approach of inserting such values in a table and doing an IN query, the performance will increase, as shown by you in this article.</description>
		<content:encoded><![CDATA[<p>I agree, with the fact that if you populate the vaules in a table the subquery with IN will be slightly faster then an inner join. I was speaking from my experience where &#8216;a&#8217; programmer, constructed the values which would form the part of the IN query by stringing together a comma seperated values (this method in itself is very inefficient). In such cases, if the programmer takes an approach of inserting such values in a table and doing an IN query, the performance will increase, as shown by you in this article.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gail</title>
		<link>http://sqlinthewild.co.za/index.php/2010/01/12/in-vs-inner-join/comment-page-1/#comment-1635</link>
		<dc:creator>Gail</dc:creator>
		<pubDate>Fri, 06 May 2011 08:09:57 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=394#comment-1635</guid>
		<description>In with value list is not really equivalent to an inner join, unless you take the time to populate the values into a table. If you do that, then the IN with subquery will likely still be faster (a little) than the inner join.</description>
		<content:encoded><![CDATA[<p>In with value list is not really equivalent to an inner join, unless you take the time to populate the values into a table. If you do that, then the IN with subquery will likely still be faster (a little) than the inner join.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nilesh Sane</title>
		<link>http://sqlinthewild.co.za/index.php/2010/01/12/in-vs-inner-join/comment-page-1/#comment-1634</link>
		<dc:creator>Nilesh Sane</dc:creator>
		<pubDate>Fri, 06 May 2011 06:40:09 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=394#comment-1634</guid>
		<description>Thanks for sharing the info.
Theres another form of in query, where the in clause actually has the values which are comma separated. In such cases I have found that as the number of records in the in-clause increase the innner join query proves to be exponentially better than the in query. The difference becomes obvious when the number of records cross 100.</description>
		<content:encoded><![CDATA[<p>Thanks for sharing the info.<br />
Theres another form of in query, where the in clause actually has the values which are comma separated. In such cases I have found that as the number of records in the in-clause increase the innner join query proves to be exponentially better than the in query. The difference becomes obvious when the number of records cross 100.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gail</title>
		<link>http://sqlinthewild.co.za/index.php/2010/01/12/in-vs-inner-join/comment-page-1/#comment-1633</link>
		<dc:creator>Gail</dc:creator>
		<pubDate>Wed, 04 May 2011 20:46:35 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=394#comment-1633</guid>
		<description>You mean a large number of matches, so each row in the one table has lots and lots of rows in the second?

In that case, you&#039;d need to inner join and distinct to get rid of the duplicates that appear because of the full join. Adding a sort or hash to the execution plan is unlikely to make it faster.</description>
		<content:encoded><![CDATA[<p>You mean a large number of matches, so each row in the one table has lots and lots of rows in the second?</p>
<p>In that case, you&#8217;d need to inner join and distinct to get rid of the duplicates that appear because of the full join. Adding a sort or hash to the execution plan is unlikely to make it faster.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://sqlinthewild.co.za/index.php/2010/01/12/in-vs-inner-join/comment-page-1/#comment-1632</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Wed, 04 May 2011 18:45:41 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=394#comment-1632</guid>
		<description>Hello,

I simple explanation about your tests. IN was better than INNER JOIN ONLY because the result set you had used in your example had few registers. If you work with a large number of registers, and your table have unique indexs, INNER JOIN is probably better.
Try this out ;)</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>I simple explanation about your tests. IN was better than INNER JOIN ONLY because the result set you had used in your example had few registers. If you work with a large number of registers, and your table have unique indexs, INNER JOIN is probably better.<br />
Try this out <img src='http://sqlinthewild.co.za/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neha</title>
		<link>http://sqlinthewild.co.za/index.php/2010/01/12/in-vs-inner-join/comment-page-1/#comment-715</link>
		<dc:creator>Neha</dc:creator>
		<pubDate>Tue, 28 Sep 2010 06:48:15 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=394#comment-715</guid>
		<description>Thanks ! Wonderful explanation. This helped resolve an issue!</description>
		<content:encoded><![CDATA[<p>Thanks ! Wonderful explanation. This helped resolve an issue!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dinesh</title>
		<link>http://sqlinthewild.co.za/index.php/2010/01/12/in-vs-inner-join/comment-page-1/#comment-606</link>
		<dc:creator>dinesh</dc:creator>
		<pubDate>Sun, 23 May 2010 15:57:17 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=394#comment-606</guid>
		<description>Nice Article</description>
		<content:encoded><![CDATA[<p>Nice Article</p>
]]></content:encoded>
	</item>
</channel>
</rss>

