<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[iRedMail — Help!!! Mysql use 99.9% of CPU!!!]]></title>
	<link rel="self" href="http://www.iredmail.org/forum/feed-atom-topic3218.xml" />
	<updated>2012-12-23T08:51:46Z</updated>
	<generator>PunBB</generator>
	<id>http://www.iredmail.org/forum/topic3218-help-mysql-use-999-of-cpu.html</id>
		<entry>
			<title type="html"><![CDATA[Re: Help!!! Mysql use 99.9% of CPU!!!]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post19635.html#p19635" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>melaleuca5 wrote:</cite><blockquote><p>When running the script I get <br /> Lock wait timeout exceeded; in the logs, any idea how to fix this</p></blockquote></div><p>Looked like i have about 1.4 gig of logs so I truncate the tables manually seems like it works now.</p>]]></content>
			<author>
				<name><![CDATA[melaleuca5]]></name>
				<uri>http://www.iredmail.org/forum/user24484.html</uri>
			</author>
			<updated>2012-12-23T08:51:46Z</updated>
			<id>http://www.iredmail.org/forum/post19635.html#p19635</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help!!! Mysql use 99.9% of CPU!!!]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post19634.html#p19634" />
			<content type="html"><![CDATA[<p>When running the script I get <br /> Lock wait timeout exceeded; in the logs, any idea how to fix this</p>]]></content>
			<author>
				<name><![CDATA[melaleuca5]]></name>
				<uri>http://www.iredmail.org/forum/user24484.html</uri>
			</author>
			<updated>2012-12-23T06:54:28Z</updated>
			<id>http://www.iredmail.org/forum/post19634.html#p19634</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help!!! Mysql use 99.9% of CPU!!!]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post19627.html#p19627" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>posa68 wrote:</cite><blockquote><p>Can I use statement &quot;truncate tablename&quot; ?</p></blockquote></div><p>Yes you can.</p>]]></content>
			<author>
				<name><![CDATA[ZhangHuangbin]]></name>
				<uri>http://www.iredmail.org/forum/user2.html</uri>
			</author>
			<updated>2012-12-21T01:10:57Z</updated>
			<id>http://www.iredmail.org/forum/post19627.html#p19627</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help!!! Mysql use 99.9% of CPU!!!]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post19625.html#p19625" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>ZhangHuangbin wrote:</cite><blockquote><p>There are two time related columns in `amavisd.msgs`: time_num, time_iso, you can delete old records based on them.</p><p>Note: `msgrcpt.mail_id` = `msgs.mail_id`.</p></blockquote></div><p>And if I wish to remove ALL this records?<br />Can I use statement &quot;truncate tablename&quot; ?</p><p>Thanks.</p>]]></content>
			<author>
				<name><![CDATA[posa68]]></name>
				<uri>http://www.iredmail.org/forum/user18067.html</uri>
			</author>
			<updated>2012-12-20T16:15:27Z</updated>
			<id>http://www.iredmail.org/forum/post19625.html#p19625</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help!!! Mysql use 99.9% of CPU!!!]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post19623.html#p19623" />
			<content type="html"><![CDATA[<p>There are two time related columns in `amavisd.msgs`: time_num, time_iso, you can delete old records based on them.</p><p>Note: `msgrcpt.mail_id` = `msgs.mail_id`.</p>]]></content>
			<author>
				<name><![CDATA[ZhangHuangbin]]></name>
				<uri>http://www.iredmail.org/forum/user2.html</uri>
			</author>
			<updated>2012-12-20T12:42:15Z</updated>
			<id>http://www.iredmail.org/forum/post19623.html#p19623</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help!!! Mysql use 99.9% of CPU!!!]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post19616.html#p19616" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>ZhangHuangbin wrote:</cite><blockquote><div class="quotebox"><cite>posa68 wrote:</cite><blockquote><p>I&#039;m not sure I understand what you mean and how to do it...</p></blockquote></div><p>For example, if you set &#039;AMAVISD_REMOVE_MAILLOG_IN_DAYS = 7&#039; to keep old records for 7 days, is there any records older than 7 days after you execute the script to clean up database records?</p></blockquote></div><p>I think the script does&#039;n clear the db, I have too many records inside amavisd:</p><p>maddr -&gt; 79340 rows -&gt; 14.1 MB<br />msgcrpt -&gt; 90567 rows -&gt; 20 MB<br />msgs -&gt; 268087 rows -&gt; 128.3 MB</p><p>How can I safely delete all unnecessary records?</p><p>Thanks...</p>]]></content>
			<author>
				<name><![CDATA[posa68]]></name>
				<uri>http://www.iredmail.org/forum/user18067.html</uri>
			</author>
			<updated>2012-12-19T08:29:57Z</updated>
			<id>http://www.iredmail.org/forum/post19616.html#p19616</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help!!! Mysql use 99.9% of CPU!!!]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post19600.html#p19600" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>posa68 wrote:</cite><blockquote><p>I&#039;m not sure I understand what you mean and how to do it...</p></blockquote></div><p>For example, if you set &#039;AMAVISD_REMOVE_MAILLOG_IN_DAYS = 7&#039; to keep old records for 7 days, is there any records older than 7 days after you execute the script to clean up database records?</p>]]></content>
			<author>
				<name><![CDATA[ZhangHuangbin]]></name>
				<uri>http://www.iredmail.org/forum/user2.html</uri>
			</author>
			<updated>2012-12-18T09:59:19Z</updated>
			<id>http://www.iredmail.org/forum/post19600.html#p19600</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help!!! Mysql use 99.9% of CPU!!!]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post19598.html#p19598" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>ZhangHuangbin wrote:</cite><blockquote><p>Did you find any record in database &quot;amavisd&quot; older than days set in AMAVISD_REMOVE_MAILLOG_IN_DAYS?</p></blockquote></div><p>I&#039;m sorry for the lag but I see your reply just now...</p><p>I&#039;m not sure I understand what you mean and how to do it...</p>]]></content>
			<author>
				<name><![CDATA[posa68]]></name>
				<uri>http://www.iredmail.org/forum/user18067.html</uri>
			</author>
			<updated>2012-12-18T09:24:36Z</updated>
			<id>http://www.iredmail.org/forum/post19598.html#p19598</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help!!! Mysql use 99.9% of CPU!!!]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post19390.html#p19390" />
			<content type="html"><![CDATA[<p>Did you find any record in database &quot;amavisd&quot; older than days set in AMAVISD_REMOVE_MAILLOG_IN_DAYS?</p>]]></content>
			<author>
				<name><![CDATA[ZhangHuangbin]]></name>
				<uri>http://www.iredmail.org/forum/user2.html</uri>
			</author>
			<updated>2012-12-06T14:02:44Z</updated>
			<id>http://www.iredmail.org/forum/post19390.html#p19390</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help!!! Mysql use 99.9% of CPU!!!]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post19372.html#p19372" />
			<content type="html"><![CDATA[<p>Thank you very much, this helps.<br />The problem is not completely gone: when i enter in admin interface the page hang out for about 40/50 seconds, but is better than before...</p><p>Thanks again.</p>]]></content>
			<author>
				<name><![CDATA[posa68]]></name>
				<uri>http://www.iredmail.org/forum/user18067.html</uri>
			</author>
			<updated>2012-12-05T13:41:06Z</updated>
			<id>http://www.iredmail.org/forum/post19372.html#p19372</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help!!! Mysql use 99.9% of CPU!!!]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post19347.html#p19347" />
			<content type="html"><![CDATA[<p>iRedAdmin-Pro ships a python script which works with cron job: tools/cleanup_amavisd_db.py.</p><div class="codebox"><pre><code># USAGE:
#
#   1: Make sure you have correct database settings in iRedAdmin config file,
#      settings.ini, under section [amavisd].
#
#   2: Set proper values of below two parameters in libs/settings_local.py
#      (recommended) or libs/settings.py. For example:
#
#       AMAVISD_REMOVE_MAILLOG_IN_DAYS = 30
#       AMAVISD_REMOVE_QUARANTINED_IN_DAYS = 7
#
#   3: Test this script in command line directly, make sure no errors in output
#      message.
#
#       # python /path/to/cleanup_amavisd_db.py
#
#   4: Setup a cron job to execute this script daily. For example: execute
#      this script at 1:30AM.
#
#       30  1   *   *   *   python /path/to/cleanup_amavisd_db.py &gt;/dev/null
#
# That&#039;s all.</code></pre></div>]]></content>
			<author>
				<name><![CDATA[ZhangHuangbin]]></name>
				<uri>http://www.iredmail.org/forum/user2.html</uri>
			</author>
			<updated>2012-12-03T13:47:33Z</updated>
			<id>http://www.iredmail.org/forum/post19347.html#p19347</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help!!! Mysql use 99.9% of CPU!!!]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post19342.html#p19342" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>ZhangHuangbin wrote:</cite><blockquote><p>Yes.</p><p>In next release of iRedAdmin-Pro, it won&#039;t try to remove old records anymore, so it should be quicker.</p></blockquote></div><p>Hi,</p><p>Sorry if I resume this old post, but the problem on quarantine messages it&#039;s happening again.</p><p>I don&#039;t see the old post on how to make a cron job to delete old messages from mysql, can you describe how to do that or maybe you have an example?</p><p>Plus: I have iRedAdminPro 1.5.0 this release don&#039;t remove old records?</p><p>I try to remove manually in Mysql with this 2 commands:</p><p>DELETE FROM msgs WHERE content IN (&#039;S&#039;, &#039;s&#039;, &#039;V&#039;, &#039;Y&#039;) AND quar_type = &#039;Q&#039; AND time_num &lt; UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 7 DAY))<br />--<br />DELETE msgrcpt.* FROM msgrcpt INNER JOIN msgs ON msgrcpt.mail_id=msgs.mail_id WHERE msgs.content IN (&#039;U&#039;, &#039;M&#039;, &#039;H&#039;, &#039;O&#039;, &#039;C&#039;) AND msgs.time_num &lt; UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 7 DAY))</p><p>Only this second command delete some records, but not so much...</p><p>Thanks in advance...</p><p>Bye.</p>]]></content>
			<author>
				<name><![CDATA[posa68]]></name>
				<uri>http://www.iredmail.org/forum/user18067.html</uri>
			</author>
			<updated>2012-12-03T11:16:34Z</updated>
			<id>http://www.iredmail.org/forum/post19342.html#p19342</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help!!! Mysql use 99.9% of CPU!!!]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post15606.html#p15606" />
			<content type="html"><![CDATA[<p>Yes.</p><p>In next release of iRedAdmin-Pro, it won&#039;t try to remove old records anymore, so it should be quicker.</p>]]></content>
			<author>
				<name><![CDATA[ZhangHuangbin]]></name>
				<uri>http://www.iredmail.org/forum/user2.html</uri>
			</author>
			<updated>2012-05-06T12:05:53Z</updated>
			<id>http://www.iredmail.org/forum/post15606.html#p15606</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help!!! Mysql use 99.9% of CPU!!!]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post15601.html#p15601" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>ZhangHuangbin wrote:</cite><blockquote><div class="quotebox"><cite>posa68 wrote:</cite><blockquote><p>Meantime, which table/records can I reset?</p></blockquote></div><p>Major tables are: msgs, msgrcpt, quarantine.</p></blockquote></div><p>Thanks, now the dashboard is loaded more quickcly.</p><p>I see that statistics is started again, it&#039;s normal, right?</p>]]></content>
			<author>
				<name><![CDATA[posa68]]></name>
				<uri>http://www.iredmail.org/forum/user18067.html</uri>
			</author>
			<updated>2012-05-06T07:58:08Z</updated>
			<id>http://www.iredmail.org/forum/post15601.html#p15601</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help!!! Mysql use 99.9% of CPU!!!]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post15572.html#p15572" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>posa68 wrote:</cite><blockquote><p>Meantime, which table/records can I reset?</p></blockquote></div><p>Major tables are: msgs, msgrcpt, quarantine.</p>]]></content>
			<author>
				<name><![CDATA[ZhangHuangbin]]></name>
				<uri>http://www.iredmail.org/forum/user2.html</uri>
			</author>
			<updated>2012-05-05T08:14:31Z</updated>
			<id>http://www.iredmail.org/forum/post15572.html#p15572</id>
		</entry>
</feed>
