<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.12-alpha" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Use of join buffer is now visible in EXPLAIN</title>
	<link>http://s.petrunia.net/blog/?p=18</link>
	<description>Random observations made while working on MySQL / MariaDB query optimizer</description>
	<pubDate>Thu, 09 Sep 2010 04:21:29 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.12-alpha</generator>

	<item>
		<title>by: ever027</title>
		<link>http://s.petrunia.net/blog/?p=18#comment-68994</link>
		<pubDate>Fri, 18 Jun 2010 01:07:11 +0000</pubDate>
		<guid>http://s.petrunia.net/blog/?p=18#comment-68994</guid>
					<description>you said "tbl_x is not inner w.r.t. some outer join",
what is the meaning of "w.r.t."?</description>
		<content:encoded><![CDATA[<p>you said &#8220;tbl_x is not inner w.r.t. some outer join&#8221;,<br />
what is the meaning of &#8220;w.r.t.&#8221;?
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: sergey</title>
		<link>http://s.petrunia.net/blog/?p=18#comment-36984</link>
		<pubDate>Wed, 26 Nov 2008 22:42:05 +0000</pubDate>
		<guid>http://s.petrunia.net/blog/?p=18#comment-36984</guid>
					<description>&gt; Are there any hints for properly sizing the @@join_buffer_size variable relative to the table being buffered?

There are many factors in play:
- join buffer stores only columns used by the query;
- join buffer isn't actually used to buffer tables. As the picture above shows, join buffer stores (tbl1.*, tbl2*) pairs, or more precisely, (used_columns(tbl1), used_columns(tbl2)) pairs that satisfy the part of the WHERE clause that refers to tbl1 and tbl2.

So it doesn't directly depend on the table size. If you have very big tables but highly selective conditions in the WHERE clause, you are in the same situation as those with small tables and conditions with poor selectivity.

To get a rough estimate, I'd calculate how many record combinations the join is going to enumerate (product of "rows" columns in EXPLAIN output), and divide that by the number of tables in the join to account for records being filtered out.  This roughly gives the maximum useful size.

The speedup obtained from using bigger join buffer tends to diminish as buffer size increases, so you only need to set it to a reasonably big value.</description>
		<content:encoded><![CDATA[<p>> Are there any hints for properly sizing the @@join_buffer_size variable relative to the table being buffered?</p>
<p>There are many factors in play:<br />
- join buffer stores only columns used by the query;<br />
- join buffer isn&#8217;t actually used to buffer tables. As the picture above shows, join buffer stores (tbl1.*, tbl2*) pairs, or more precisely, (used_columns(tbl1), used_columns(tbl2)) pairs that satisfy the part of the WHERE clause that refers to tbl1 and tbl2.</p>
<p>So it doesn&#8217;t directly depend on the table size. If you have very big tables but highly selective conditions in the WHERE clause, you are in the same situation as those with small tables and conditions with poor selectivity.</p>
<p>To get a rough estimate, I&#8217;d calculate how many record combinations the join is going to enumerate (product of &#8220;rows&#8221; columns in EXPLAIN output), and divide that by the number of tables in the join to account for records being filtered out.  This roughly gives the maximum useful size.</p>
<p>The speedup obtained from using bigger join buffer tends to diminish as buffer size increases, so you only need to set it to a reasonably big value.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Robert</title>
		<link>http://s.petrunia.net/blog/?p=18#comment-36796</link>
		<pubDate>Sat, 22 Nov 2008 08:01:34 +0000</pubDate>
		<guid>http://s.petrunia.net/blog/?p=18#comment-36796</guid>
					<description>Are there any hints for properly sizing the @@join_buffer_size variable relative to the table being buffered?</description>
		<content:encoded><![CDATA[<p>Are there any hints for properly sizing the @@join_buffer_size variable relative to the table being buffered?
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Introducing MySQL Visual Explain at Xaprb</title>
		<link>http://s.petrunia.net/blog/?p=18#comment-6058</link>
		<pubDate>Sun, 29 Jul 2007 18:14:31 +0000</pubDate>
		<guid>http://s.petrunia.net/blog/?p=18#comment-6058</guid>
					<description>[...] MySQL themselves, and many community members, have sometimes discussed the need for a tree view of EXPLAIN. I sincerely hope they implement that feature and make this little tool obsolete in future versions of MySQL. I also understand MySQL is trying to add more information to EXPLAIN. Currently it&#8217;s not possible to get a complete query execution plan from EXPLAIN, because it doesn&#8217;t show you everything the server does while executing the query. If MySQL adds information, I&#8217;ll update this tool. I have a feature request pending to show when a GROUP BY happens, for example. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] MySQL themselves, and many community members, have sometimes discussed the need for a tree view of EXPLAIN. I sincerely hope they implement that feature and make this little tool obsolete in future versions of MySQL. I also understand MySQL is trying to add more information to EXPLAIN. Currently it&#8217;s not possible to get a complete query execution plan from EXPLAIN, because it doesn&#8217;t show you everything the server does while executing the query. If MySQL adds information, I&#8217;ll update this tool. I have a feature request pending to show when a GROUP BY happens, for example. [&#8230;]
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Sergey Petrunia&#8217;s blog &#187; EXPLAIN: &#34;Using join cache&#34; renamed to &#34;Using join buffer&#34;</title>
		<link>http://s.petrunia.net/blog/?p=18#comment-4791</link>
		<pubDate>Sun, 10 Jun 2007 01:13:11 +0000</pubDate>
		<guid>http://s.petrunia.net/blog/?p=18#comment-4791</guid>
					<description>[...] As soon as I've finished writing this post about "Using join cache", it was apparent that "Using join cache" is poor wording. First, the corresponding server variable is called @@join_buffer_size, not join cache size, and second, there is really no cache involved. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] As soon as I&#8217;ve finished writing this post about &#8220;Using join cache&#8221;, it was apparent that &#8220;Using join cache&#8221; is poor wording. First, the corresponding server variable is called @@join_buffer_size, not join cache size, and second, there is really no cache involved. [&#8230;]
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
