<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Daniel Costa &#187; Banco de Dados</title>
	<atom:link href="http://danielcosta.info/arquivo/assunto/banco-de-dados/feed" rel="self" type="application/rss+xml" />
	<link>http://danielcosta.info</link>
	<description>ponto info</description>
	<lastBuildDate>Wed, 14 Jul 2010 23:44:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Como resolver o problema do MySQL Error 1206</title>
		<link>http://danielcosta.info/arquivo/2008/06/como-resolver-o-problema-do-mysql-error-1206</link>
		<comments>http://danielcosta.info/arquivo/2008/06/como-resolver-o-problema-do-mysql-error-1206#comments</comments>
		<pubDate>Sun, 08 Jun 2008 06:06:30 +0000</pubDate>
		<dc:creator>Daniel Costa</dc:creator>
				<category><![CDATA[Banco de Dados]]></category>
		<category><![CDATA[innodb]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://danielcosta.info/arquivo/2008/06/como-resolver-o-problema-do-mysql-error-1206</guid>
		<description><![CDATA[“The total number of locks exceeds the lock table size” Este mês estou trabalhando no ClickTracker 2.0 e importando os dados do banco antigo para o novo me deparei com o erro acima em uma das minhas querys do processo de migração: # código levemente adaptado para facilitar a didática INSERT INTO clicktracker_dev.keywords (id, keyword) [...]]]></description>
			<content:encoded><![CDATA[<p><strong>“The total number of locks exceeds the lock table size”</strong></p>
<p>Este mês estou trabalhando no ClickTracker 2.0 e importando os dados do banco antigo para o novo me deparei com o erro acima em uma das minhas querys do processo de migração:</p>
<p><code># código levemente adaptado para facilitar a didática<br />
INSERT INTO clicktracker_dev.keywords (id, keyword)<br />
SELECT NULL id, DISTINCT(keyword) keyword FROM clicktracker_v1.logs;<br />
</code></p>
<p>Procurando no Google por uma solução acabei descobrindo que precisava alterar nas configurações do MySQL o valor da variável <em>innodb_buffer_pool_size</em> lá no arquivo /etc/my.cnf. O valor que estava por padrão era 2MB e eu modifiquei para 16MB &#8211; maior que isso eu imagino que vai deixar passar o que pode dar mais gargalo ainda para o servidor&#8230;</p>
<p>A parte que eu ainda queria entender era a relação do tamanho do buffer do <em>innodb</em> com essa query que insere numa tabela o resultado de uma pesquisa feita em outra.</p>
<p>Então continuando a busca para entender isso cheguei <a href="http://lists.mysql.com/mysql/193440">nessa contribuição do forum do MySQL</a>:</p>
<blockquote><p>If you have a small buffer pool, then the InnoDB lock table may indeed grow so big that it does not fit in the buffer pool. The default size of the buffer pool is just 8 MB.</p>
<p>Fix: modify my.cnf and increase innodb_buffer_pool_size. But do not make it bigger than about 70 % of your computer&#8217;s RAM.</p></blockquote>
<p>Eu de fato só aumentei para 16MB, o que é bem menos de 10% do total de RAM que tenho no meu dedicado virtual.</p>
<p>Um artigo no MySQL Performance Blog (que eu assino o feed) também <a href="http://www.mysqlperformanceblog.com/2006/07/13/how-much-memory-innodb-locks-really-take/">explica como ocorre o lock em tabelas innodb</a>:</p>
<blockquote><p>in Innodb row level locks are implemented by having special lock table, located in the buffer pool where small record allocated for each hash and for each row locked on that page bit can be set.</p></blockquote>
<p>Isto explicado e as alterações realizadas, basta reiniciar o mysqld e executar novamente a query. Com o conforto de um dedicado o processamento é prazerosamente rápido e você só se chateia com o tempo que perdeu procurando uma solução. <img src='http://danielcosta.info/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<!-- boo-widget start -->
          <script type="text/javascript">
            bb_keywords = "innodb";
            bb_bid  = "1695";
            bb_lang = "pt-BR";
            bb_name = "custom";bb_limit = "7";bb_format = "bbc";
          </script>
          <script type="text/javascript" src="http://widgets.boo-box.com/javascripts/embed.js"></script>
          <!-- boo-widget end -->]]></content:encoded>
			<wfw:commentRss>http://danielcosta.info/arquivo/2008/06/como-resolver-o-problema-do-mysql-error-1206/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
