<?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 is join_buffer_size allocated?</title>
	<atom:link href="http://www.mysqlperformanceblog.com/2010/07/05/how-is-join_buffer_size-allocated/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com/2010/07/05/how-is-join_buffer_size-allocated/</link>
	<description>Percona&#039;s MySQL &#38; InnoDB performance and scalability blog</description>
	<lastBuildDate>Sat, 11 Feb 2012 16:45:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Normalex</title>
		<link>http://www.mysqlperformanceblog.com/2010/07/05/how-is-join_buffer_size-allocated/comment-page-1/#comment-828529</link>
		<dc:creator>Normalex</dc:creator>
		<pubDate>Mon, 03 Oct 2011 23:13:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=3252#comment-828529</guid>
		<description>size=max(thd-&gt;variables.join_buff_size, cache-&gt;length);

and the main question is how does the cache-&gt;length is being determined?
If it just waists the memory  what is the point to use join_buff_size then? 

There is obviously a lack of documentation about it.</description>
		<content:encoded><![CDATA[<p>size=max(thd-&gt;variables.join_buff_size, cache-&gt;length);</p>
<p>and the main question is how does the cache-&gt;length is being determined?<br />
If it just waists the memory  what is the point to use join_buff_size then? </p>
<p>There is obviously a lack of documentation about it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Baron Schwartz</title>
		<link>http://www.mysqlperformanceblog.com/2010/07/05/how-is-join_buffer_size-allocated/comment-page-1/#comment-775426</link>
		<dc:creator>Baron Schwartz</dc:creator>
		<pubDate>Thu, 23 Sep 2010 14:02:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=3252#comment-775426</guid>
		<description>Shahryar, you are right.  The manual (http://dev.mysql.com/doc/refman/5.0/en/nested-loop-joins.html) has the following quote: &quot;Join buffering can be used when the join is of type ALL or index (in other words, when no possible keys can be used, and a full scan is done, of either the data or index rows, respectively), or range.&quot;

Thanks for correcting me!</description>
		<content:encoded><![CDATA[<p>Shahryar, you are right.  The manual (<a href="http://dev.mysql.com/doc/refman/5.0/en/nested-loop-joins.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.0/en/nested-loop-joins.html</a>) has the following quote: &#8220;Join buffering can be used when the join is of type ALL or index (in other words, when no possible keys can be used, and a full scan is done, of either the data or index rows, respectively), or range.&#8221;</p>
<p>Thanks for correcting me!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shahryar Ghazi</title>
		<link>http://www.mysqlperformanceblog.com/2010/07/05/how-is-join_buffer_size-allocated/comment-page-1/#comment-775302</link>
		<dc:creator>Shahryar Ghazi</dc:creator>
		<pubDate>Wed, 22 Sep 2010 14:46:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=3252#comment-775302</guid>
		<description>I disagree with &quot;A join buffer is allocated to cache rows from each table in a join when the join canâ€™t use an index.&quot; because even if MySQL decides to scan all index rows and/or uses range for SELECTion it prefers to use the join buffer. Also, there is another variable that determines the max size of join buffer and that is max_join_size (no. of rows to be joined not the buffer size).</description>
		<content:encoded><![CDATA[<p>I disagree with &#8220;A join buffer is allocated to cache rows from each table in a join when the join canâ€™t use an index.&#8221; because even if MySQL decides to scan all index rows and/or uses range for SELECTion it prefers to use the join buffer. Also, there is another variable that determines the max size of join buffer and that is max_join_size (no. of rows to be joined not the buffer size).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Baron Schwartz</title>
		<link>http://www.mysqlperformanceblog.com/2010/07/05/how-is-join_buffer_size-allocated/comment-page-1/#comment-769158</link>
		<dc:creator>Baron Schwartz</dc:creator>
		<pubDate>Mon, 12 Jul 2010 20:41:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=3252#comment-769158</guid>
		<description>Shlomi, buffers are usually deallocated at the end in &quot;cleaning up&quot; state.  I haven&#039;t checked where this one is.

Geoff, I am not sure; I did not look that closely at that code to figure out its purpose.</description>
		<content:encoded><![CDATA[<p>Shlomi, buffers are usually deallocated at the end in &#8220;cleaning up&#8221; state.  I haven&#8217;t checked where this one is.</p>
<p>Geoff, I am not sure; I did not look that closely at that code to figure out its purpose.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Baron Schwartz</title>
		<link>http://www.mysqlperformanceblog.com/2010/07/05/how-is-join_buffer_size-allocated/comment-page-1/#comment-768799</link>
		<dc:creator>Baron Schwartz</dc:creator>
		<pubDate>Thu, 08 Jul 2010 16:02:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=3252#comment-768799</guid>
		<description>It&#039;s not accurate to say it can ONLY be used for that.  I explained in the blog post what the server uses it for.</description>
		<content:encoded><![CDATA[<p>It&#8217;s not accurate to say it can ONLY be used for that.  I explained in the blog post what the server uses it for.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shlomi Noach</title>
		<link>http://www.mysqlperformanceblog.com/2010/07/05/how-is-join_buffer_size-allocated/comment-page-1/#comment-768781</link>
		<dc:creator>Shlomi Noach</dc:creator>
		<pubDate>Thu, 08 Jul 2010 12:11:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=3252#comment-768781</guid>
		<description>Baron,

Very interesting! A buffer-per-join-per query is news to me. What about deallocation, then? Do all these per-join buffers live for the duration of the connection?

Thanks</description>
		<content:encoded><![CDATA[<p>Baron,</p>
<p>Very interesting! A buffer-per-join-per query is news to me. What about deallocation, then? Do all these per-join buffers live for the duration of the connection?</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Geoff</title>
		<link>http://www.mysqlperformanceblog.com/2010/07/05/how-is-join_buffer_size-allocated/comment-page-1/#comment-768762</link>
		<dc:creator>Geoff</dc:creator>
		<pubDate>Thu, 08 Jul 2010 07:59:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=3252#comment-768762</guid>
		<description>Is it correct that the allocated cache size is then the maximum of *one* row of the join data and the size specified in the configuration?  As I understand, that would allow it to degrade from a Block-Nested Loop Join to a Nested Loop Join should only one row fit in cache.</description>
		<content:encoded><![CDATA[<p>Is it correct that the allocated cache size is then the maximum of *one* row of the join data and the size specified in the configuration?  As I understand, that would allow it to degrade from a Block-Nested Loop Join to a Nested Loop Join should only one row fit in cache.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dalin</title>
		<link>http://www.mysqlperformanceblog.com/2010/07/05/how-is-join_buffer_size-allocated/comment-page-1/#comment-768736</link>
		<dc:creator>dalin</dc:creator>
		<pubDate>Thu, 08 Jul 2010 00:28:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=3252#comment-768736</guid>
		<description>Then what is the purpose of a setting that can only be used to waste memory?</description>
		<content:encoded><![CDATA[<p>Then what is the purpose of a setting that can only be used to waste memory?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2010/07/05/how-is-join_buffer_size-allocated/comment-page-1/#comment-768548</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Mon, 05 Jul 2010 18:35:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=3252#comment-768548</guid>
		<description>Baron,

First about allocation - it is checked but it is NOT reported if it failed which can cause someone to set large buffer and get lower performance because it is not used.
I think MySQL should warn about such failures - print stuff in the error log file or at least have a global variable counter for allocation failures (which should stay 0 for any well configured system)

A note on crashing the server - you would do a lot better by allocating very large number of smaller buffers, for example 128K  or so.   If Server failed to allocate 1GB it still can likely allocate few MB needed to run most of concurrent queries successfully.  If however you can&#039;t allocate even 128K any more nothing else probably will work.

Also do not forget about over commit behavior for a lot of systems - they can  let you to allocate a lot of memory but may fail when you can actually use it (access it)</description>
		<content:encoded><![CDATA[<p>Baron,</p>
<p>First about allocation &#8211; it is checked but it is NOT reported if it failed which can cause someone to set large buffer and get lower performance because it is not used.<br />
I think MySQL should warn about such failures &#8211; print stuff in the error log file or at least have a global variable counter for allocation failures (which should stay 0 for any well configured system)</p>
<p>A note on crashing the server &#8211; you would do a lot better by allocating very large number of smaller buffers, for example 128K  or so.   If Server failed to allocate 1GB it still can likely allocate few MB needed to run most of concurrent queries successfully.  If however you can&#8217;t allocate even 128K any more nothing else probably will work.</p>
<p>Also do not forget about over commit behavior for a lot of systems &#8211; they can  let you to allocate a lot of memory but may fail when you can actually use it (access it)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

