<?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>ststyle.net &#187; tuning</title>
	<atom:link href="http://www.ststyle.net/weblog/archives/tag/tuning/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ststyle.net/weblog</link>
	<description>Just another ststyle techlog</description>
	<lastBuildDate>Mon, 19 Jul 2010 13:53:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PostgreSQl チューニング</title>
		<link>http://www.ststyle.net/weblog/archives/449</link>
		<comments>http://www.ststyle.net/weblog/archives/449#comments</comments>
		<pubDate>Fri, 23 Oct 2009 07:25:21 +0000</pubDate>
		<dc:creator>ststyle</dc:creator>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[tuning]]></category>

		<guid isPermaLink="false">http://www.ststyle.net/weblog/?p=449</guid>
		<description><![CDATA[チューニング(多少の..)
チューニング(多少の&#8230;) （実メモリ1G）
postgreSQlの再起動
PostgreSQLの再起動時に
This error usually means that Postgr [...]]]></description>
			<content:encoded><![CDATA[<p>チューニング(多少の..)</p>
<pre class="brush: bash; auto-links: false;">

ipcs -lm

------ シェアードメモリの制限 --------
max number of segments = 4096
max seg size (kbytes) = 4194303
max total shared memory (kbytes) = 1073741824
min seg size (bytes) = 1

echo $((4194303 / 1024))=4095
echo $((1073741824 / 1024 / 1024)) = 1024:1G
</pre>
<p>チューニング(多少の&#8230;) （実メモリ1G）</p>
<pre class="brush: bash; auto-links: false;">

su postgres
vi /var/pgsql/data/postgresql.conf

同時接続数
max_connections = 50

共有バッファを増やす（物理メモリの 1/4～1/2)
#shared_buffers = 32MB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # min 128kB or max_connections*16kB
&darr;
shared_buffers = 512MB&nbsp;&nbsp;&nbsp; (物理メモリの1/4～1/2(DBが主な仕事の場合))

#参考値
#1000ページ(8MB)
#2000ページ(16MB)
#4000ページ(32MB)
#8000ページ(64MB)
#16000ページ(128MB)
#32000ページ(256MB)
#64000ページ(512MB)
#128000ページ(1024MB)(1G)
#256000ページ(2048MB)(2G)
#512000ページ(4096MB)(4G)
#1024000ページ(8012MB)(8G)

●テンプバッファの調整
#temp_buffers = 8MB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # min 800kB
&darr;
temp_buffers = 16MB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # min 800kB

●ソートメモリ
#work_mem = 1MB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # min 64kB
&darr;
work_mem = 8MB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # min 64kB

●トランザクションログバッファの調整
wal_buffers = 64kB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # min 32kB
&darr;
wal_buffers = 256kB
</pre>
<p>postgreSQlの再起動</p>
<pre class="brush: bash; auto-links: false;">

pg_ctl restart
</pre>
<p>PostgreSQLの再起動時に<br />
<span style="color: #ff0000;">This error usually means that PostgreSQL&#8217;s request for<br />
a shared memory segment exceeded your kernel&#8217;s SHMMAX<br />
parameter.云々<br />
</span>といわれる時は<br />
/proc/sys/kernel/shmmax の値を増やします</p>
<pre class="brush: bash; auto-links: false;">

#echo 130023424 &amp;gt; /proc/sys/kernel/shmmax&nbsp; 等
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ststyle.net/weblog/archives/449/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
