<?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 eliminate temporary tables in MySQL</title>
	<atom:link href="http://www.xaprb.com/blog/2007/05/11/how-to-eliminate-temporary-tables-in-mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xaprb.com/blog/2007/05/11/how-to-eliminate-temporary-tables-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: The effect of temporary tables on MySQL&#8217;s replication &#171; Not Really a Blog</title>
		<link>http://www.xaprb.com/blog/2007/05/11/how-to-eliminate-temporary-tables-in-mysql/#comment-17733</link>
		<dc:creator>The effect of temporary tables on MySQL&#8217;s replication &#171; Not Really a Blog</dc:creator>
		<pubDate>Sat, 06 Feb 2010 23:06:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=98#comment-17733</guid>
		<description>[...] harsh. There are a few workarounds that can be done from an application level that you can read in http://www.xaprb.com/blog/2007/05/11/how-to-eliminate-temporary-tables-in-mysql/ which I think they could be worth thinking [...]</description>
		<content:encoded><![CDATA[<p>[...] harsh. There are a few workarounds that can be done from an application level that you can read in http://www.xaprb.com/blog/2007/05/11/how-to-eliminate-temporary-tables-in-mysql/ which I think they could be worth thinking [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2007/05/11/how-to-eliminate-temporary-tables-in-mysql/#comment-17573</link>
		<dc:creator>Xaprb</dc:creator>
		<pubDate>Sat, 09 Jan 2010 01:16:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=98#comment-17573</guid>
		<description>This article was written about a system that didn&#039;t use prepared statements.  The connection-id substitution was done client-side.</description>
		<content:encoded><![CDATA[<p>This article was written about a system that didn&#8217;t use prepared statements.  The connection-id substitution was done client-side.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: neil</title>
		<link>http://www.xaprb.com/blog/2007/05/11/how-to-eliminate-temporary-tables-in-mysql/#comment-17571</link>
		<dc:creator>neil</dc:creator>
		<pubDate>Fri, 08 Jan 2010 21:28:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=98#comment-17571</guid>
		<description>I&#039;m curious how you drop the table after you&#039;re done with it. Do you use a user variable for the table name? (i.e. CONCAT(&#039;table_&#039;, CONNECTION_ID()) - then a prepared statement to create the table?

At this point I can&#039;t figure out how to drop the table since I didn&#039;t think you could drop a table using a prepared statement?</description>
		<content:encoded><![CDATA[<p>I&#8217;m curious how you drop the table after you&#8217;re done with it. Do you use a user variable for the table name? (i.e. CONCAT(&#8216;table_&#8217;, CONNECTION_ID()) &#8211; then a prepared statement to create the table?</p>
<p>At this point I can&#8217;t figure out how to drop the table since I didn&#8217;t think you could drop a table using a prepared statement?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2007/05/11/how-to-eliminate-temporary-tables-in-mysql/#comment-16710</link>
		<dc:creator>Xaprb</dc:creator>
		<pubDate>Sun, 02 Aug 2009 23:10:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=98#comment-16710</guid>
		<description>Hi Ryan, 

I&#039;m glad my talks were helpful at the conference.  Whether or not the temporary table should be replicated depends on whether any queries depend on the data in it.  If you&#039;re inserting into the temporary table then selecting back out of it to insert into another table, or updating from a join, or any other statement that changes data depending on the data in the temporary table, the temporary table needs to be replicated to the slave, or replication will break on the slave.

I&#039;ve thought a lot about this over the years and had many interesting conversations with people who are doing different things with their data.  I have yet to find a situation where temporary tables can be used safely in replication.  Replication has many flaws, and it is not possible to make it reliable even in the best of circumstances, but I find the temporary tables are a pretty severe problem in many common scenarios.  So in my mind, they are a top 10 problem and it&#039;s well worth avoiding them entirely.</description>
		<content:encoded><![CDATA[<p>Hi Ryan, </p>
<p>I&#8217;m glad my talks were helpful at the conference.  Whether or not the temporary table should be replicated depends on whether any queries depend on the data in it.  If you&#8217;re inserting into the temporary table then selecting back out of it to insert into another table, or updating from a join, or any other statement that changes data depending on the data in the temporary table, the temporary table needs to be replicated to the slave, or replication will break on the slave.</p>
<p>I&#8217;ve thought a lot about this over the years and had many interesting conversations with people who are doing different things with their data.  I have yet to find a situation where temporary tables can be used safely in replication.  Replication has many flaws, and it is not possible to make it reliable even in the best of circumstances, but I find the temporary tables are a pretty severe problem in many common scenarios.  So in my mind, they are a top 10 problem and it&#8217;s well worth avoiding them entirely.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://www.xaprb.com/blog/2007/05/11/how-to-eliminate-temporary-tables-in-mysql/#comment-16707</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Sat, 01 Aug 2009 11:54:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=98#comment-16707</guid>
		<description>Quick aside - Baron I enjoyed your talks @ Mysql 2009!

Regarding using slave-side ignores on SBR, wouldn&#039;t it be desireable in the case of tmp data used to satisfy queries only (selects) to not have the tmp table data replicated at all (since it serves no purpose on the slave)?  I&#039;m interested to avoid the IO on the master and for the slave thread when the result will always be discarded. Particularly since I&#039;m running in the cloud, every bit of IO saved seems to count.

Currently the only &quot;safe&quot; option I see for this is SET SESSION SQL_LOG_BIN=0/1 during the tmp table operations from the app, which has the unfortunate (but also reasonable) side effect of requiring giving your app user SUPER.

Any thoughts or master-side solution that you would endorse?

That said, your solution, variants of which I have also used in the past, seems to be more useful under row-based repl where it appears the master-side ignore* params seem to behave correctly.</description>
		<content:encoded><![CDATA[<p>Quick aside &#8211; Baron I enjoyed your talks @ Mysql 2009!</p>
<p>Regarding using slave-side ignores on SBR, wouldn&#8217;t it be desireable in the case of tmp data used to satisfy queries only (selects) to not have the tmp table data replicated at all (since it serves no purpose on the slave)?  I&#8217;m interested to avoid the IO on the master and for the slave thread when the result will always be discarded. Particularly since I&#8217;m running in the cloud, every bit of IO saved seems to count.</p>
<p>Currently the only &#8220;safe&#8221; option I see for this is SET SESSION SQL_LOG_BIN=0/1 during the tmp table operations from the app, which has the unfortunate (but also reasonable) side effect of requiring giving your app user SUPER.</p>
<p>Any thoughts or master-side solution that you would endorse?</p>
<p>That said, your solution, variants of which I have also used in the past, seems to be more useful under row-based repl where it appears the master-side ignore* params seem to behave correctly.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

