<?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: INSERT INTO &#8230; SELECT  Performance with  Innodb  tables.</title>
	<atom:link href="http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/</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: mathew</title>
		<link>http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/comment-page-1/#comment-867760</link>
		<dc:creator>mathew</dc:creator>
		<pubDate>Sun, 01 Jan 2012 18:45:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/#comment-867760</guid>
		<description>@josh: No this does not applies in MySQL 5.5+. I&#039;ve already check that on a table containig 1 mln rows using insert into select from this table. No lock has been aquired and on the other thread i could simply update a row that should be blocked. But if you would like to have this exact behaviour you can use mentioned above: &quot;lock in share mode&quot; because this does the lock to be aqquired on the second table</description>
		<content:encoded><![CDATA[<p>@josh: No this does not applies in MySQL 5.5+. I&#8217;ve already check that on a table containig 1 mln rows using insert into select from this table. No lock has been aquired and on the other thread i could simply update a row that should be blocked. But if you would like to have this exact behaviour you can use mentioned above: &#8220;lock in share mode&#8221; because this does the lock to be aqquired on the second table</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: josh</title>
		<link>http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/comment-page-1/#comment-865383</link>
		<dc:creator>josh</dc:creator>
		<pubDate>Wed, 28 Dec 2011 13:15:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/#comment-865383</guid>
		<description>+1 for @adelainev.  I have the same question whether this behavior still applies in MySQL 5.5+.  This post was written in 2006, so just want to see where things stand currently.</description>
		<content:encoded><![CDATA[<p>+1 for @adelainev.  I have the same question whether this behavior still applies in MySQL 5.5+.  This post was written in 2006, so just want to see where things stand currently.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adelainev</title>
		<link>http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/comment-page-1/#comment-824661</link>
		<dc:creator>adelainev</dc:creator>
		<pubDate>Fri, 23 Sep 2011 12:00:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/#comment-824661</guid>
		<description>Does this behavior still apply to MySQL 5.5+ ?</description>
		<content:encoded><![CDATA[<p>Does this behavior still apply to MySQL 5.5+ ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vishnu rao</title>
		<link>http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/comment-page-1/#comment-823062</link>
		<dc:creator>vishnu rao</dc:creator>
		<pubDate>Sat, 17 Sep 2011 19:18:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/#comment-823062</guid>
		<description>hi peter,

facebook urges people to be cautious while using &quot;load data infile&quot; in production. they report that many a time mysql had crashed.

any thoughts on this ? many bugs have been also reported around this.

http://www.facebook.com/note.php?note_id=394073200932</description>
		<content:encoded><![CDATA[<p>hi peter,</p>
<p>facebook urges people to be cautious while using &#8220;load data infile&#8221; in production. they report that many a time mysql had crashed.</p>
<p>any thoughts on this ? many bugs have been also reported around this.</p>
<p><a href="http://www.facebook.com/note.php?note_id=394073200932" rel="nofollow">http://www.facebook.com/note.php?note_id=394073200932</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Ferk</title>
		<link>http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/comment-page-1/#comment-804630</link>
		<dc:creator>Andrew Ferk</dc:creator>
		<pubDate>Thu, 14 Apr 2011 19:46:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/#comment-804630</guid>
		<description>@Sylvain261

I tested
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET binlog_format = MIXED;
INSERT INTO â€¦.SELECT â€¦ FROM â€¦.
and it works without error and does binlog as row.  The issue with that is the potential for huge overhead.  The INSERT INTO ... SELECT I&#039;m running generates about 2.5 million records (or almost a GB in the binlog).

Thank you.</description>
		<content:encoded><![CDATA[<p>@Sylvain261</p>
<p>I tested<br />
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;<br />
SET binlog_format = MIXED;<br />
INSERT INTO â€¦.SELECT â€¦ FROM â€¦.<br />
and it works without error and does binlog as row.  The issue with that is the potential for huge overhead.  The INSERT INTO &#8230; SELECT I&#8217;m running generates about 2.5 million records (or almost a GB in the binlog).</p>
<p>Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jigen</title>
		<link>http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/comment-page-1/#comment-797919</link>
		<dc:creator>jigen</dc:creator>
		<pubDate>Sun, 13 Feb 2011 06:05:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/#comment-797919</guid>
		<description>Hi, 
I am having problem with Selects ...between... timestamp..
for example:
I have this select to select from a 200k rows...
SELECT actionid FROM  tablelogs WHERE timestampfield BETWEEN UNIX_TIMESTAMP(&#039;2010-10-01 &#039;) AND UNIX_TIMESTAMP(&#039;2011-01-01&#039;) GROUP BY actionid....

this select is taking ages to process.... now, is there a way to optimize this select or speed up? 
The tablelog is innodb with index at actionid (INT).

Also, if it will help, when I use the command select * from tablelogs vs. select actionid from tablelogs, the latter is taking ages as well while the one with * takes only 0.8 seconds. The table has 7 fields....

I am using MySQL 5+ in SQLYOG ... any ideas?

thanks</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I am having problem with Selects &#8230;between&#8230; timestamp..<br />
for example:<br />
I have this select to select from a 200k rows&#8230;<br />
SELECT actionid FROM  tablelogs WHERE timestampfield BETWEEN UNIX_TIMESTAMP(&#8217;2010-10-01 &#8216;) AND UNIX_TIMESTAMP(&#8217;2011-01-01&#8242;) GROUP BY actionid&#8230;.</p>
<p>this select is taking ages to process&#8230;. now, is there a way to optimize this select or speed up?<br />
The tablelog is innodb with index at actionid (INT).</p>
<p>Also, if it will help, when I use the command select * from tablelogs vs. select actionid from tablelogs, the latter is taking ages as well while the one with * takes only 0.8 seconds. The table has 7 fields&#8230;.</p>
<p>I am using MySQL 5+ in SQLYOG &#8230; any ideas?</p>
<p>thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sylvain261</title>
		<link>http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/comment-page-1/#comment-773610</link>
		<dc:creator>Sylvain261</dc:creator>
		<pubDate>Wed, 08 Sep 2010 13:13:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/#comment-773610</guid>
		<description>Me again.
I think that a good workaround might be to change the replication mode for the session issuing the SELECT INTO.
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET binlog_format = MIXED;
INSERT INTO ....SELECT ... FROM ....
With this two settings : 
 - There is no lock on the selected tables
 - The replication of the insert into select statement is done with row base replication witch is save in this isolation level (changing the replication mode is done only for the active session, it should not create application issues).

I&#039;ve not tested it yet.</description>
		<content:encoded><![CDATA[<p>Me again.<br />
I think that a good workaround might be to change the replication mode for the session issuing the SELECT INTO.<br />
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;<br />
SET binlog_format = MIXED;<br />
INSERT INTO &#8230;.SELECT &#8230; FROM &#8230;.<br />
With this two settings :<br />
 &#8211; There is no lock on the selected tables<br />
 &#8211; The replication of the insert into select statement is done with row base replication witch is save in this isolation level (changing the replication mode is done only for the active session, it should not create application issues).</p>
<p>I&#8217;ve not tested it yet.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sylvain261</title>
		<link>http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/comment-page-1/#comment-773604</link>
		<dc:creator>Sylvain261</dc:creator>
		<pubDate>Wed, 08 Sep 2010 11:43:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/#comment-773604</guid>
		<description>Answer to myself : 
You are wrong ! 

I&#039;ve got the exception : Transaction level &#039;READ-COMMITTED&#039; in InnoDB is not safe for binlog mode &#039;STATEMENT&#039;(INSERT INTO XXX SELECT YYY...)

It seems that, it is not permitted to issue statement that might break consistency between master and slave.
So...In statement replication mode, the OUTFILE workaround seems to be the only one that work if you don&#039;t what to set innodb_locks_unsafe_for_binlog to 1.

Sorry Peter.
Does anyone have an extra workaround ?
Thxs.</description>
		<content:encoded><![CDATA[<p>Answer to myself :<br />
You are wrong ! </p>
<p>I&#8217;ve got the exception : Transaction level &#8216;READ-COMMITTED&#8217; in InnoDB is not safe for binlog mode &#8216;STATEMENT&#8217;(INSERT INTO XXX SELECT YYY&#8230;)</p>
<p>It seems that, it is not permitted to issue statement that might break consistency between master and slave.<br />
So&#8230;In statement replication mode, the OUTFILE workaround seems to be the only one that work if you don&#8217;t what to set innodb_locks_unsafe_for_binlog to 1.</p>
<p>Sorry Peter.<br />
Does anyone have an extra workaround ?<br />
Thxs.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sylvain261</title>
		<link>http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/comment-page-1/#comment-773592</link>
		<dc:creator>Sylvain261</dc:creator>
		<pubDate>Wed, 08 Sep 2010 08:49:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/#comment-773592</guid>
		<description>Artem, 

I&#039;ve made a very simple test (mysql 5.1.45) with 2 concurrent process : 

Process 1 : 
INSERT INTO table2 SELECT * FROM table1 ;

Process 2 : 
UPDATE table1 SET myCol= &#039;X&#039; WHERE myCol= &#039;XX&#039;;


Test case 1 : REPEATABLE-READ   
=&gt; Process 2 is locked until process 1 finish.

Test case 2 : READ COMMITTED   
=&gt; Process 2 is not locked

So my understanding is that, if you don&#039;t mind that your inserted table might be not consistent in your slave with the one in your master :  using  READ COMMITTED  transaction isolation level is the way to go, it&#039;s much simpler than the INSERT ... INTO OUTFILE workaround posted by peter.
Am I wrong  ?</description>
		<content:encoded><![CDATA[<p>Artem, </p>
<p>I&#8217;ve made a very simple test (mysql 5.1.45) with 2 concurrent process : </p>
<p>Process 1 :<br />
INSERT INTO table2 SELECT * FROM table1 ;</p>
<p>Process 2 :<br />
UPDATE table1 SET myCol= &#8216;X&#8217; WHERE myCol= &#8216;XX&#8217;;</p>
<p>Test case 1 : REPEATABLE-READ<br />
=&gt; Process 2 is locked until process 1 finish.</p>
<p>Test case 2 : READ COMMITTED<br />
=&gt; Process 2 is not locked</p>
<p>So my understanding is that, if you don&#8217;t mind that your inserted table might be not consistent in your slave with the one in your master :  using  READ COMMITTED  transaction isolation level is the way to go, it&#8217;s much simpler than the INSERT &#8230; INTO OUTFILE workaround posted by peter.<br />
Am I wrong  ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Artem</title>
		<link>http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/comment-page-1/#comment-768702</link>
		<dc:creator>Artem</dc:creator>
		<pubDate>Wed, 07 Jul 2010 15:38:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/#comment-768702</guid>
		<description>Has anyone tried changing the isolation level instead of using OUTFILEs.

SET TRANSACTION ISOLATION LEVEL READ COMMITTED; 
INSERT INTO TemporaryTable SELECT ... FROM HighlyContentiousTableInInnoDb;

See my stackoverflow question/answer for more info: http://stackoverflow.com/questions/2640898/how-to-improve-insert-into-select-locking-behavior</description>
		<content:encoded><![CDATA[<p>Has anyone tried changing the isolation level instead of using OUTFILEs.</p>
<p>SET TRANSACTION ISOLATION LEVEL READ COMMITTED;<br />
INSERT INTO TemporaryTable SELECT &#8230; FROM HighlyContentiousTableInInnoDb;</p>
<p>See my stackoverflow question/answer for more info: <a href="http://stackoverflow.com/questions/2640898/how-to-improve-insert-into-select-locking-behavior" rel="nofollow">http://stackoverflow.com/questions/2640898/how-to-improve-insert-into-select-locking-behavior</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

