<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:old.nabble.com,2006:forum-774</id>
	<title>Nabble - PostgreSQL - performance</title>
	<updated>2009-12-16T05:01:24Z</updated>
	<link rel="self" type="application/atom+xml" href="http://old.nabble.com/PostgreSQL---performance-f774.xml" />
	<link rel="alternate" type="text/html" href="http://old.nabble.com/PostgreSQL---performance-f774.html" />
	<subtitle type="html"></subtitle>
	
<entry>
	<id>tag:old.nabble.com,2006:post-26810721</id>
	<title>Slow select</title>
	<published>2009-12-16T05:01:24Z</published>
	<updated>2009-12-16T05:01:24Z</updated>
	<author>
		<name>yuliada</name>
	</author>
	<content type="html">I have a table with column of character varying(100). There are about 150.000.000 rows in a table. Index was created as
&lt;br&gt;&lt;br&gt;CREATE INDEX idx_stringv
&lt;br&gt;&amp;nbsp; ON bn_stringvalue
&lt;br&gt;&amp;nbsp; USING btree
&lt;br&gt;&amp;nbsp; (lower(value::text));
&lt;br&gt;&lt;br&gt;I'm trying to execute queries like 'select * from stringvalue where value=lower(?)'. Making 1000 selects takes about 4-5 min. I did vacuum and analyze on this table and checked that query plan uses index. What can I do to make it faster?
&lt;br&gt;&lt;br&gt;Thanks in advance, Yulia</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Slow-select-tp26810721p26810721.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26807901</id>
	<title>Re: Parallel Function calls using multiple processes</title>
	<published>2009-12-16T00:38:22Z</published>
	<updated>2009-12-16T00:38:22Z</updated>
	<author>
		<name>Pavel Stehule</name>
	</author>
	<content type="html">2009/12/16 Vishal Gupta &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26807901&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;vishal.g@...&lt;/a&gt;&amp;gt;:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Dear Pavel,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks for quick response.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Yes I am using explicit locks but only at row-level, not at table level,
&lt;br&gt;&amp;gt; will this cause sequential execution?
&lt;br&gt;&amp;gt; select ...on primary key..... for update;
&lt;br&gt;&amp;gt; My objective is to execute this function in parallel for different PK
&lt;br&gt;&amp;gt; entities, for same primary key value, sequential is fine.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Also I have noted that though the function execution after the code calls is
&lt;br&gt;&amp;gt; taking more than 2-3 minutes but ,
&lt;br&gt;&amp;gt; when I have put in notice statements for start/end of function it has only
&lt;br&gt;&amp;gt; taken a second in pg_log.
&lt;br&gt;&amp;gt; Code is definitely not the problem here, as earlier function logic was
&lt;br&gt;&amp;gt; getting executed as multiple queries
&lt;br&gt;&amp;gt; from the code and were working fine for even higher load before I moved to
&lt;br&gt;&amp;gt; function for the same. This problem started after moving to function only.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I doubt that query is the reason for slowness, and it seems to be more
&lt;br&gt;&amp;gt; related to database load at times, because it happens 3-4 times out of every
&lt;br&gt;&amp;gt; 4000 transactions.
&lt;br&gt;&amp;gt; pg_stat doesn't show any locks at the moment, but might not reflect the
&lt;br&gt;&amp;gt; actual scenario as currently the transactions are working fine.
&lt;/div&gt;&lt;br&gt;it should be a different problem - in bgwriter configuration. There
&lt;br&gt;could help migration on 8.3, maybe.
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/Checkpoint-tuning-on-8.2.4-td17685494.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://old.nabble.com/Checkpoint-tuning-on-8.2.4-td17685494.html&lt;/a&gt;&lt;br&gt;&lt;br&gt;Regards
&lt;br&gt;Pavel Stehule
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Regards,
&lt;br&gt;&amp;gt; Vishal Gupta - 9910991635
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ----- Original Message -----
&lt;br&gt;&amp;gt; From: &amp;quot;Pavel Stehule&amp;quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26807901&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pavel.stehule@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt; To: &amp;quot;Vishal Gupta&amp;quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26807901&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;vishal.g@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt; Cc: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26807901&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;
&lt;br&gt;&amp;gt; Sent: Wednesday, December 16, 2009 1:04:48 PM GMT +05:30 Chennai, Kolkata,
&lt;br&gt;&amp;gt; Mumbai, New Delhi
&lt;br&gt;&amp;gt; Subject: Re: [PERFORM] Parallel Function calls using multiple processes
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; 2009/12/16 Vishal Gupta &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26807901&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;vishal.g@...&lt;/a&gt;&amp;gt;:
&lt;br&gt;&amp;gt;&amp;gt; Problem: Function call typically takes 2-3 millisecond but at times
&lt;br&gt;&amp;gt;&amp;gt; exceeding 2-3 Minutes.
&lt;br&gt;&amp;gt;&amp;gt; =====================================================
&lt;br&gt;&amp;gt;&amp;gt; From the DB logs it seems when multiple processes are trying to execute
&lt;br&gt;&amp;gt;&amp;gt; the
&lt;br&gt;&amp;gt;&amp;gt; function,
&lt;br&gt;&amp;gt;&amp;gt; execution takes sequentially rather than parallel, which means Nth thread
&lt;br&gt;&amp;gt;&amp;gt; will have to wait for (N-1)*ExecutionTime before getting its turn
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; it's depend - if there are some locks then yes.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; but reason could be a slow query inside procedure too - look on
&lt;br&gt;&amp;gt; pg_stat_activity table, if there are processes waiting for lock.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; see
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/Query-is-slow-when-executing-in-procedure-td26490782.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://old.nabble.com/Query-is-slow-when-executing-in-procedure-td26490782.html&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Regards
&lt;br&gt;&amp;gt; Pavel Stehule
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Is my observation correct? If yes then what is the solution for this? If
&lt;br&gt;&amp;gt;&amp;gt; not
&lt;br&gt;&amp;gt;&amp;gt; where/how to find the exact cause of the above problem?
&lt;br&gt;&amp;gt;&amp;gt; =====================================================
&lt;br&gt;&amp;gt;&amp;gt; DB Version: 8.2
&lt;br&gt;&amp;gt;&amp;gt; Function Details:
&lt;br&gt;&amp;gt;&amp;gt; --returns numeric, takes 10 parameters
&lt;br&gt;&amp;gt;&amp;gt; --select query to validate data
&lt;br&gt;&amp;gt;&amp;gt; --row level lock for select and validate
&lt;br&gt;&amp;gt;&amp;gt; --bare minimum business logic
&lt;br&gt;&amp;gt;&amp;gt; --update data
&lt;br&gt;&amp;gt;&amp;gt; --couple of inserts for transaction logs/account management
&lt;br&gt;&amp;gt;&amp;gt; --also note that few of the tables have audit triggers causing the row to
&lt;br&gt;&amp;gt;&amp;gt; be
&lt;br&gt;&amp;gt;&amp;gt; inserted in audit table with the action (only Update/Insert/Delete)
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26807901&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Parallel-Function-calls-using-multiple-processes-tp26806954p26807901.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26807696</id>
	<title>Re: Parallel Function calls using multiple processes</title>
	<published>2009-12-16T00:17:01Z</published>
	<updated>2009-12-16T00:17:01Z</updated>
	<author>
		<name>vhgupta</name>
	</author>
	<content type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;div style='font-family: Times New Roman; font-size: 12pt; color: #000000'&gt;Dear Pavel,&lt;br&gt;&lt;br&gt;Thanks for quick response.&lt;br&gt;&lt;br&gt;Yes I am using explicit locks but only at row-level, not at table level, will this cause sequential execution?&lt;br&gt;select ...on primary key..... for update;&lt;br&gt;My objective is to execute this function in parallel for different PK entities, for same primary key value, sequential is fine.&lt;br&gt;&lt;br&gt;Also I have noted that though the function execution after the code calls is taking more than 2-3 minutes but , &lt;br&gt;when I have put in notice statements for start/end of function it has only taken a second in pg_log. &lt;br&gt;Code is definitely not the problem here, as earlier function logic was getting executed as multiple queries&lt;br&gt;from the code and were working fine for even higher load before I moved to function for the same. This problem started after moving to function only.&lt;br&gt;&lt;br&gt;I doubt that query is the reason for slowness, and it seems to be more related to database load at times, because it happens 3-4 times out of every 4000 transactions.&lt;br&gt;pg_stat doesn't show any locks at the moment, but might not reflect the actual scenario as currently the transactions are working fine.&lt;br&gt;&lt;br&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;Regards,&lt;br&gt;Vishal Gupta - 9910991635&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br&gt;&lt;br&gt;----- Original Message -----&lt;br&gt;From: &quot;Pavel Stehule&quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26807696&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pavel.stehule@...&lt;/a&gt;&amp;gt;&lt;br&gt;To: &quot;Vishal Gupta&quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26807696&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;vishal.g@...&lt;/a&gt;&amp;gt;&lt;br&gt;Cc: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26807696&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;&lt;br&gt;Sent: Wednesday, December 16, 2009 1:04:48 PM GMT +05:30 Chennai, Kolkata, Mumbai, New Delhi&lt;br&gt;Subject: Re: [PERFORM] Parallel Function calls using multiple processes&lt;br&gt;&lt;br&gt;2009/12/16 Vishal Gupta &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26807696&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;vishal.g@...&lt;/a&gt;&amp;gt;:&lt;br&gt;&amp;gt; Problem: Function call typically takes 2-3 millisecond but at times&lt;br&gt;&amp;gt; exceeding 2-3 Minutes.&lt;br&gt;&amp;gt; =====================================================&lt;br&gt;&amp;gt; From the DB logs it seems when multiple processes are trying to execute the&lt;br&gt;&amp;gt; function,&lt;br&gt;&amp;gt; execution takes sequentially rather than parallel, which means Nth thread&lt;br&gt;&amp;gt; will have to wait for (N-1)*ExecutionTime before getting its turn&lt;br&gt;&lt;br&gt;it's depend - if there are some locks then yes.&lt;br&gt;&lt;br&gt;but reason could be a slow query inside procedure too - look on&lt;br&gt;pg_stat_activity table, if there are processes waiting for lock.&lt;br&gt;&lt;br&gt;see http://old.nabble.com/Query-is-slow-when-executing-in-procedure-td26490782.html&lt;br&gt;&lt;br&gt;Regards&lt;br&gt;Pavel Stehule&lt;br&gt;&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;&lt;br&gt;&amp;gt; Is my observation correct? If yes then what is the solution for this? If not&lt;br&gt;&amp;gt; where/how to find the exact cause of the above problem?&lt;br&gt;&amp;gt; =====================================================&lt;br&gt;&amp;gt; DB Version: 8.2&lt;br&gt;&amp;gt; Function Details:&lt;br&gt;&amp;gt; --returns numeric, takes 10 parameters&lt;br&gt;&amp;gt; --select query to validate data&lt;br&gt;&amp;gt; --row level lock for select and validate&lt;br&gt;&amp;gt; --bare minimum business logic&lt;br&gt;&amp;gt; --update data&lt;br&gt;&amp;gt; --couple of inserts for transaction logs/account management&lt;br&gt;&amp;gt; --also note that few of the tables have audit triggers causing the row to be&lt;br&gt;&amp;gt; inserted in audit table with the action (only Update/Insert/Delete)&lt;br&gt;&amp;gt;&lt;br&gt;&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Parallel-Function-calls-using-multiple-processes-tp26806954p26807696.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26807298</id>
	<title>Re: Parallel Function calls using multiple processes</title>
	<published>2009-12-15T23:34:48Z</published>
	<updated>2009-12-15T23:34:48Z</updated>
	<author>
		<name>Pavel Stehule</name>
	</author>
	<content type="html">2009/12/16 Vishal Gupta &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26807298&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;vishal.g@...&lt;/a&gt;&amp;gt;:
&lt;br&gt;&amp;gt; Problem: Function call typically takes 2-3 millisecond but at times
&lt;br&gt;&amp;gt; exceeding 2-3 Minutes.
&lt;br&gt;&amp;gt; =====================================================
&lt;br&gt;&amp;gt; From the DB logs it seems when multiple processes are trying to execute the
&lt;br&gt;&amp;gt; function,
&lt;br&gt;&amp;gt; execution takes sequentially rather than parallel, which means Nth thread
&lt;br&gt;&amp;gt; will have to wait for (N-1)*ExecutionTime before getting its turn
&lt;br&gt;&lt;br&gt;it's depend - if there are some locks then yes.
&lt;br&gt;&lt;br&gt;but reason could be a slow query inside procedure too - look on
&lt;br&gt;pg_stat_activity table, if there are processes waiting for lock.
&lt;br&gt;&lt;br&gt;see &lt;a href=&quot;http://old.nabble.com/Query-is-slow-when-executing-in-procedure-td26490782.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://old.nabble.com/Query-is-slow-when-executing-in-procedure-td26490782.html&lt;/a&gt;&lt;br&gt;&lt;br&gt;Regards
&lt;br&gt;Pavel Stehule
&lt;br&gt;&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Is my observation correct? If yes then what is the solution for this? If not
&lt;br&gt;&amp;gt; where/how to find the exact cause of the above problem?
&lt;br&gt;&amp;gt; =====================================================
&lt;br&gt;&amp;gt; DB Version: 8.2
&lt;br&gt;&amp;gt; Function Details:
&lt;br&gt;&amp;gt; --returns numeric, takes 10 parameters
&lt;br&gt;&amp;gt; --select query to validate data
&lt;br&gt;&amp;gt; --row level lock for select and validate
&lt;br&gt;&amp;gt; --bare minimum business logic
&lt;br&gt;&amp;gt; --update data
&lt;br&gt;&amp;gt; --couple of inserts for transaction logs/account management
&lt;br&gt;&amp;gt; --also note that few of the tables have audit triggers causing the row to be
&lt;br&gt;&amp;gt; inserted in audit table with the action (only Update/Insert/Delete)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26807298&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Parallel-Function-calls-using-multiple-processes-tp26806954p26807298.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26806954</id>
	<title>Parallel Function calls using multiple processes</title>
	<published>2009-12-15T22:46:36Z</published>
	<updated>2009-12-15T22:46:36Z</updated>
	<author>
		<name>vhgupta</name>
	</author>
	<content type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;div style='font-family: Times New Roman; font-size: 12pt; color: #000000'&gt;Problem: Function call typically takes 2-3 millisecond but at times exceeding 2-3 Minutes. &lt;br&gt;=====================================================&lt;br&gt;From the DB logs it seems when multiple processes are trying to execute the function,&lt;br&gt;execution takes sequentially rather than parallel, which means Nth thread will have to wait for (N-1)*ExecutionTime before getting its turn&lt;br&gt;&lt;br&gt;Is my observation correct? If yes then what is the solution for this? If not where/how to find the exact cause of the above problem?&lt;br&gt;=====================================================&lt;br&gt;DB Version: 8.2&lt;br&gt;Function Details:&lt;br&gt;--returns numeric, takes 10 parameters&lt;br&gt;--select query to validate data&lt;br&gt;--row level lock for select and validate&lt;br&gt;--bare minimum business logic&lt;br&gt;--update data&lt;br&gt;--couple of inserts for transaction logs/account management&lt;br&gt;--also note that few of the tables have audit triggers causing the row to be inserted in audit table with the action (only Update/Insert/Delete)&lt;br&gt;&lt;br&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Parallel-Function-calls-using-multiple-processes-tp26806954p26806954.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26804925</id>
	<title>Re: big select is resulting in a large amount of  disk writing by kjournald</title>
	<published>2009-12-15T17:28:21Z</published>
	<updated>2009-12-15T17:28:21Z</updated>
	<author>
		<name>Scott Carey</name>
	</author>
	<content type="html">&lt;br&gt;On 12/10/09 8:41 AM, &amp;quot;Kevin Grittner&amp;quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26804925&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Kevin.Grittner@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; There has been some talk about possibly writing tuples in a frozen
&lt;br&gt;&amp;gt; state with the hint bits already set if they are loaded in the same
&lt;br&gt;&amp;gt; database transaction which creates the table, but I'm not aware of
&lt;br&gt;&amp;gt; anyone currently working on this.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;nbsp; &amp;nbsp;
&lt;br&gt;Wow, that would be nice. &amp;nbsp;That would cut in half the time it takes to
&lt;br&gt;restore a several TB db (3 days to 1.5 here).
&lt;br&gt;&lt;br&gt;I assume this would help a lot of &amp;quot;CREATE TABLE AS SELECT ...&amp;quot; use cases
&lt;br&gt;too. &amp;nbsp;That is often the fastest way to do a large update on a table, but it
&lt;br&gt;can still be annoyingly write intensive.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;gt; -Kevin
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26804925&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;&amp;gt; To make changes to your subscription:
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26804925&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/big-select-is-resulting-in-a-large-amount-of-disk-writing-by-kjournald-tp26715264p26804925.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26763469</id>
	<title>Re: 8.4.1 ubuntu karmic slow createdb</title>
	<published>2009-12-12T19:56:42Z</published>
	<updated>2009-12-12T19:56:42Z</updated>
	<author>
		<name>Robert Haas</name>
	</author>
	<content type="html">On Fri, Dec 11, 2009 at 5:12 PM, Scott Marlowe &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26763469&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;scott.marlowe@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Fri, Dec 11, 2009 at 2:59 PM, Scott Mead
&lt;br&gt;&amp;gt; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26763469&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;scott.lists@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; On Fri, Dec 11, 2009 at 4:39 PM, Nikolas Everett &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26763469&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;nik9000@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Fair enough.  I'm of the opinion that developers need to have their unit
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; tests run fast.  If they aren't fast then your just not going to test as
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; much as you should.  If your unit tests *have* to createdb then you have to
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; do whatever you have to do to get it fast.  It'd probably be better if unit
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; tests don't create databases or alter tables at all though.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Regardless of what is going on on your dev box you really should leave
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; fsync on on your continuous integration, integration test, and QA machines.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; They're what your really modeling your production on anyway.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;   The other common issue is that developers running with something like
&lt;br&gt;&amp;gt;&amp;gt; 'fsync=off' means that they have completely unrealistic expectations of the
&lt;br&gt;&amp;gt;&amp;gt; performance surrounding something.  If your developers see that when fsync
&lt;br&gt;&amp;gt;&amp;gt; is on, createdb takes x seconds vs. when it's off, then they'll know that
&lt;br&gt;&amp;gt;&amp;gt; basing their entire process on that probably isn't a good idea.  When
&lt;br&gt;&amp;gt;&amp;gt; developers think something is lightning, they tend to base lots of stuff on
&lt;br&gt;&amp;gt;&amp;gt; it, whether it's production ready or not.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Yeah, it's a huge mistake to give development super fast servers to
&lt;br&gt;&amp;gt; test on.  Keep in mind production may need to handle 10k requests a
&lt;br&gt;&amp;gt; minute / second whatever.  Developers cannot generate that kind of
&lt;br&gt;&amp;gt; load by just pointing and clicking.  Our main production is on a
&lt;br&gt;&amp;gt; cluster of 8 and 12 core machines with scads of memory and RAID-10
&lt;br&gt;&amp;gt; arrays all over the place.  Development gets a 4 core machine with 8G
&lt;br&gt;&amp;gt; ram and an 8 drive RAID-6.  It ain't slow, but it ain't really that
&lt;br&gt;&amp;gt; fast either.
&lt;/div&gt;&lt;br&gt;My development box at work is an 1.8 Ghz Celeron with 256K of CPU
&lt;br&gt;cache, 1 GB of memory, and a single IDE drive... &amp;nbsp;I don't have too
&lt;br&gt;many slow queries in there.
&lt;br&gt;&lt;br&gt;...Robert
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26763469&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/8.4.1-ubuntu-karmic-slow-createdb-tp26734177p26763469.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26760967</id>
	<title>Re: 8.4.1 ubuntu karmic slow createdb</title>
	<published>2009-12-12T12:38:41Z</published>
	<updated>2009-12-12T12:38:41Z</updated>
	<author>
		<name>Andres Freund</name>
	</author>
	<content type="html">On Saturday 12 December 2009 21:36:27 Michael Clemmons wrote:
&lt;br&gt;&amp;gt; If ppl think its worth it I'll create a ticket
&lt;br&gt;Thanks, no need. I will post a patch tomorrow or so.
&lt;br&gt;&lt;br&gt;Andres
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26760967&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/8.4.1-ubuntu-karmic-slow-createdb-tp26734177p26760967.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26760948</id>
	<title>Re: 8.4.1 ubuntu karmic slow createdb</title>
	<published>2009-12-12T12:36:27Z</published>
	<updated>2009-12-12T12:36:27Z</updated>
	<author>
		<name>Michael Clemmons</name>
	</author>
	<content type="html">If ppl think its worth it I&amp;#39;ll create a ticket&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Sat, Dec 12, 2009 at 6:09 AM, Hannu Krosing &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26760948&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;hannu@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;&lt;div class=&quot;im&quot;&gt;On Sat, 2009-12-12 at 01:19 +0100, Andres Freund wrote:&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; On Saturday 12 December 2009 00:59:13 Scott Marlowe wrote:&lt;br&gt;
&amp;gt; &amp;gt; On Fri, Dec 11, 2009 at 3:52 PM, Michael Clemmons&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;  Createdb takes&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; 12secs on my system(9.10 pg8.4 and ext4)  which is impossibly slow for&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; running 200unittests.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;  Fsync got it to .2secs or so which is blazing but&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; also the speed I expected being used to 8.3 and xfs.  This dev box is my&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; laptop and the data is litterally unimportant and doesn&amp;#39;t exist longer&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; than 20sec but Im all about good practices.  Will definately try&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; synchronous commit tonight once Im done working for the day.  I&amp;#39;ve got&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; some massive copying todo later though so this will probably help in the&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; future as well.&lt;br&gt;
&amp;gt; &amp;gt; Yeah, I&amp;#39;d probably resort to fsync off in that circumstance too&lt;br&gt;
&amp;gt; &amp;gt; especially if syn commit off didn&amp;#39;t help that much.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; How should syn commit help with creating databases?&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;It does not help here. Tested ;)&lt;br&gt;
&lt;div class=&quot;im&quot;&gt;&lt;br&gt;
&amp;gt; The problem with 8.4 and creating databases is that the number of files&lt;br&gt;
&amp;gt; increased hugely because of the introduction of relation forks.&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;Plus the fact that fsync on ext4 is really slow. some info here:&lt;br&gt;
&lt;a href=&quot;http://ldn.linuxfoundation.org/article/filesystems-data-preservation-fsync-and-benchmarks-pt-3&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://ldn.linuxfoundation.org/article/filesystems-data-preservation-fsync-and-benchmarks-pt-3&lt;/a&gt;&lt;br&gt;

&lt;div class=&quot;im&quot;&gt;&lt;br&gt;
&amp;gt; It probably wouldnt be that hard to copy all files first, then reopen and fsync&lt;br&gt;
&amp;gt; them. Actually that should be a patch doable in an hour or two.&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;Probably something worth doing, as it will speed this up on all&lt;br&gt;
filesystems, and doubly so on ext4 and xfs.&lt;br&gt;
&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class=&quot;h5&quot;&gt;&lt;br&gt;
--&lt;br&gt;
Hannu Krosing   &lt;a href=&quot;http://www.2ndQuadrant.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.2ndQuadrant.com&lt;/a&gt;&lt;br&gt;
PostgreSQL Scalability and Availability&lt;br&gt;
   Services, Consulting and Training&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/8.4.1-ubuntu-karmic-slow-createdb-tp26734177p26760948.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26753568</id>
	<title>Re: 8.4.1 ubuntu karmic slow createdb</title>
	<published>2009-12-11T16:19:38Z</published>
	<updated>2009-12-11T16:19:38Z</updated>
	<author>
		<name>Andres Freund</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&lt;br&gt;On Saturday 12 December 2009 00:59:13 Scott Marlowe wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Fri, Dec 11, 2009 at 3:52 PM, Michael Clemmons
&lt;br&gt;&amp;gt; &amp;gt; &amp;nbsp;Createdb takes
&lt;br&gt;&amp;gt; &amp;gt; 12secs on my system(9.10 pg8.4 and ext4) &amp;nbsp;which is impossibly slow for
&lt;br&gt;&amp;gt; &amp;gt; running 200unittests.
&lt;br&gt;&amp;gt; &amp;gt; &amp;nbsp;Fsync got it to .2secs or so which is blazing but
&lt;br&gt;&amp;gt; &amp;gt; also the speed I expected being used to 8.3 and xfs. &amp;nbsp;This dev box is my
&lt;br&gt;&amp;gt; &amp;gt; laptop and the data is litterally unimportant and doesn't exist longer
&lt;br&gt;&amp;gt; &amp;gt; than 20sec but Im all about good practices. &amp;nbsp;Will definately try
&lt;br&gt;&amp;gt; &amp;gt; synchronous commit tonight once Im done working for the day. &amp;nbsp;I've got
&lt;br&gt;&amp;gt; &amp;gt; some massive copying todo later though so this will probably help in the
&lt;br&gt;&amp;gt; &amp;gt; future as well.
&lt;br&gt;&amp;gt; Yeah, I'd probably resort to fsync off in that circumstance too
&lt;br&gt;&amp;gt; especially if syn commit off didn't help that much.
&lt;/div&gt;How should syn commit help with creating databases?
&lt;br&gt;&lt;br&gt;The problem with 8.4 and creating databases is that the number of files 
&lt;br&gt;increased hugely because of the introduction of relation forks.
&lt;br&gt;It probably wouldnt be that hard to copy all files first, then reopen and fsync 
&lt;br&gt;them. Actually that should be a patch doable in an hour or two.
&lt;br&gt;&lt;br&gt;Andres
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26753568&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/8.4.1-ubuntu-karmic-slow-createdb-tp26734177p26753568.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26753399</id>
	<title>Re: 8.4.1 ubuntu karmic slow createdb</title>
	<published>2009-12-11T15:59:13Z</published>
	<updated>2009-12-11T15:59:13Z</updated>
	<author>
		<name>Scott Marlowe-2</name>
	</author>
	<content type="html">On Fri, Dec 11, 2009 at 3:52 PM, Michael Clemmons
&lt;br&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26753399&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;glassresistor@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; Thanks all this has been a good help.
&lt;br&gt;&amp;gt; I don't have control(or easy control) over unit tests creating/deleting
&lt;br&gt;&amp;gt; databases since Im using the django framework for this job.
&lt;br&gt;&lt;br&gt;Reminds of the issues we had with Ruby on Rails and it's (at the time)
&lt;br&gt;very mysql-centric tools that made us take a fork to large portions of
&lt;br&gt;its brain to get things like this working. &amp;nbsp;Worked with a developer
&lt;br&gt;for a day or two fixing most of the worst mysqlisms in RoR at the time
&lt;br&gt;to just get this kind of stuff working.
&lt;br&gt;&lt;br&gt;&amp;gt;  Createdb takes
&lt;br&gt;&amp;gt; 12secs on my system(9.10 pg8.4 and ext4)  which is impossibly slow for
&lt;br&gt;&amp;gt; running 200unittests.
&lt;br&gt;&lt;br&gt;Wait, so each unit test createdbs by itself? &amp;nbsp;Wow...
&lt;br&gt;&lt;br&gt;&amp;gt;  Fsync got it to .2secs or so which is blazing but
&lt;br&gt;&amp;gt; also the speed I expected being used to 8.3 and xfs.  This dev box is my
&lt;br&gt;&amp;gt; laptop and the data is litterally unimportant and doesn't exist longer than
&lt;br&gt;&amp;gt; 20sec but Im all about good practices.  Will definately try synchronous
&lt;br&gt;&amp;gt; commit tonight once Im done working for the day.  I've got some massive
&lt;br&gt;&amp;gt; copying todo later though so this will probably help in the future as well.
&lt;br&gt;&lt;br&gt;Yeah, I'd probably resort to fsync off in that circumstance too
&lt;br&gt;especially if syn commit off didn't help that much.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26753399&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/8.4.1-ubuntu-karmic-slow-createdb-tp26734177p26753399.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26752643</id>
	<title>Re: 8.4.1 ubuntu karmic slow createdb</title>
	<published>2009-12-11T14:52:01Z</published>
	<updated>2009-12-11T14:52:01Z</updated>
	<author>
		<name>Michael Clemmons</name>
	</author>
	<content type="html">Thanks all this has been a good help.&lt;br&gt;I don&amp;#39;t have control(or easy control) over unit tests creating/deleting databases since Im using the django framework for this job.  Createdb takes 12secs on my system(9.10 pg8.4 and ext4)  which is impossibly slow for running 200unittests.  Fsync got it to .2secs or so which is blazing but also the speed I expected being used to 8.3 and xfs.  This dev box is my laptop and the data is litterally unimportant and doesn&amp;#39;t exist longer than 20sec but Im all about good practices.  Will definately try synchronous commit tonight once Im done working for the day.  I&amp;#39;ve got some massive copying todo later though so this will probably help in the future as well. &lt;br&gt;
&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Fri, Dec 11, 2009 at 5:39 PM, Greg Smith &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26752643&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;greg@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
&lt;div class=&quot;im&quot;&gt;Scott Mead wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
The other common issue is that developers running with something like &amp;#39;fsync=off&amp;#39; means that they have completely unrealistic expectations of the performance surrounding something.&lt;br&gt;
&lt;/blockquote&gt;&lt;/div&gt;
Right, but the flip side here is that often the production server will have hardware such as a caching RAID card that vastly improves performance in this area.  There&amp;#39;s some room to cheat in order to accelerate the dev systems lack of such things, while still not giving a completely unrealistic view of performance.&lt;br&gt;

&lt;br&gt;
As far as I&amp;#39;m concerned, using &amp;quot;fsync=off&amp;quot; is almost never excusable if you&amp;#39;re running 8.3 or later where &amp;quot;synchronous_commit=off&amp;quot; is a possibility.  If you use that, it will usually improve the worst part of commit issues substantially.  And it happens in a way that&amp;#39;s actually quite similar to how a caching write production server will run:  small writes happen instantly, but eventually bigger ones will end up bottlenecked at the disks anyway.&lt;br&gt;

&lt;br&gt;
It would improve the average safety of our community members if anytime someone suggests &amp;quot;fsync=off&amp;quot;, we strongly suggest &amp;quot;synchronous_commit=off&amp;quot; and potentially tuning its interval instead as a middle ground, while still helping people who need to speed their systems up.  Saying &amp;quot;never turn fsync off&amp;quot; without suggesting this alternative is counter-productive.  If you&amp;#39;re in the sort of position where fsync is killing your performance you&amp;#39;ll do anything to speed things up (I&amp;#39;ve seen a 100:1 speed improvement) no matter how risky.  I&amp;#39;ve ran a production system of 8.2 with fsync off, a TB of data, and no safety net if a crash introduced corruption beyond a ZFS snapshot.  It wasn&amp;#39;t fun, but it was the only possibility to get bulk loading (there was an ETL step in the middle after COPY) to happen fast enough.  Using async commit instead is a much better approach now that it&amp;#39;s available.&lt;br&gt;
&lt;font color=&quot;#888888&quot;&gt;
&lt;br&gt;
-- &lt;br&gt;
Greg Smith    2ndQuadrant   Baltimore, MD&lt;br&gt;
PostgreSQL Training, Services and Support&lt;br&gt;
&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26752643&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;greg@...&lt;/a&gt;  &lt;a href=&quot;http://www.2ndQuadrant.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;www.2ndQuadrant.com&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/8.4.1-ubuntu-karmic-slow-createdb-tp26734177p26752643.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26752497</id>
	<title>Re: 8.4.1 ubuntu karmic slow createdb</title>
	<published>2009-12-11T14:39:54Z</published>
	<updated>2009-12-11T14:39:54Z</updated>
	<author>
		<name>Greg Smith-21</name>
	</author>
	<content type="html">Scott Mead wrote:
&lt;br&gt;&amp;gt; The other common issue is that developers running with something like 
&lt;br&gt;&amp;gt; 'fsync=off' means that they have completely unrealistic expectations 
&lt;br&gt;&amp;gt; of the performance surrounding something.
&lt;br&gt;Right, but the flip side here is that often the production server will 
&lt;br&gt;have hardware such as a caching RAID card that vastly improves 
&lt;br&gt;performance in this area. &amp;nbsp;There's some room to cheat in order to 
&lt;br&gt;accelerate the dev systems lack of such things, while still not giving a 
&lt;br&gt;completely unrealistic view of performance.
&lt;br&gt;&lt;br&gt;As far as I'm concerned, using &amp;quot;fsync=off&amp;quot; is almost never excusable if 
&lt;br&gt;you're running 8.3 or later where &amp;quot;synchronous_commit=off&amp;quot; is a 
&lt;br&gt;possibility. &amp;nbsp;If you use that, it will usually improve the worst part of 
&lt;br&gt;commit issues substantially. &amp;nbsp;And it happens in a way that's actually 
&lt;br&gt;quite similar to how a caching write production server will run: &amp;nbsp;small 
&lt;br&gt;writes happen instantly, but eventually bigger ones will end up 
&lt;br&gt;bottlenecked at the disks anyway.
&lt;br&gt;&lt;br&gt;It would improve the average safety of our community members if anytime 
&lt;br&gt;someone suggests &amp;quot;fsync=off&amp;quot;, we strongly suggest 
&lt;br&gt;&amp;quot;synchronous_commit=off&amp;quot; and potentially tuning its interval instead as 
&lt;br&gt;a middle ground, while still helping people who need to speed their 
&lt;br&gt;systems up. &amp;nbsp;Saying &amp;quot;never turn fsync off&amp;quot; without suggesting this 
&lt;br&gt;alternative is counter-productive. &amp;nbsp;If you're in the sort of position 
&lt;br&gt;where fsync is killing your performance you'll do anything to speed 
&lt;br&gt;things up (I've seen a 100:1 speed improvement) no matter how risky. &amp;nbsp;
&lt;br&gt;I've ran a production system of 8.2 with fsync off, a TB of data, and no 
&lt;br&gt;safety net if a crash introduced corruption beyond a ZFS snapshot. &amp;nbsp;It 
&lt;br&gt;wasn't fun, but it was the only possibility to get bulk loading (there 
&lt;br&gt;was an ETL step in the middle after COPY) to happen fast enough. &amp;nbsp;Using 
&lt;br&gt;async commit instead is a much better approach now that it's available.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Greg Smith &amp;nbsp; &amp;nbsp;2ndQuadrant &amp;nbsp; Baltimore, MD
&lt;br&gt;PostgreSQL Training, Services and Support
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26752497&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;greg@...&lt;/a&gt; &amp;nbsp;www.2ndQuadrant.com
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26752497&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/8.4.1-ubuntu-karmic-slow-createdb-tp26734177p26752497.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26752279</id>
	<title>Re: 8.4.1 ubuntu karmic slow createdb</title>
	<published>2009-12-11T14:19:05Z</published>
	<updated>2009-12-11T14:19:05Z</updated>
	<author>
		<name>Scott Marlowe-2</name>
	</author>
	<content type="html">On Fri, Dec 11, 2009 at 3:12 PM, Scott Carey &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26752279&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;scott@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; On 12/11/09 1:57 PM, &amp;quot;Scott Marlowe&amp;quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26752279&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;scott.marlowe@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; This is my big issue.  dropping / creating databases for unit tests is
&lt;br&gt;&amp;gt;&amp;gt; overkill.  Running any DDL at all for a unit test seems wrong to me
&lt;br&gt;&amp;gt;&amp;gt; too.  Insert a row if you need it, MAYBE.  Unit tests should work with
&lt;br&gt;&amp;gt;&amp;gt; a test database that HAS the structure and database already in place.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; What happens if your unit tests get lose in production and drop a
&lt;br&gt;&amp;gt;&amp;gt; database, or a table.  Not good.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Production should not have a db with the same username/pw combination as dev
&lt;br&gt;&amp;gt; boxes and unit tests . . .
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Unfortunately, unit-like (often more than a 'unit') tests can't always rely
&lt;br&gt;&amp;gt; on a test db being already set up.  If one leaves any cruft around, it might
&lt;br&gt;&amp;gt; break later tests later on non-deterministically.  Automated tests that
&lt;br&gt;&amp;gt; insert data are absolutely required somewhere if the application inserts
&lt;br&gt;&amp;gt; data.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The best way to do this in postgres is to create a template database from
&lt;br&gt;&amp;gt; scratch with whatever DDL is needed at the start of the run, and then create
&lt;br&gt;&amp;gt; and drop db's as copies of that template per test or test suite.
&lt;/div&gt;&lt;br&gt;Debateable. &amp;nbsp;Last job we had 44k or so unit tests, and we gave each
&lt;br&gt;dev their own db made from the main qa / unit testing db that they
&lt;br&gt;could refresh at any time, and run the unit tests locally before
&lt;br&gt;committing code. &amp;nbsp;Actual failures like the one you mention were very
&lt;br&gt;rare because of this approach. &amp;nbsp;A simple ant refresh-db and they were
&lt;br&gt;ready to test their code before committing it to the continuous
&lt;br&gt;testing farm.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26752279&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/8.4.1-ubuntu-karmic-slow-createdb-tp26734177p26752279.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26752209</id>
	<title>Re: 8.4.1 ubuntu karmic slow createdb</title>
	<published>2009-12-11T14:12:47Z</published>
	<updated>2009-12-11T14:12:47Z</updated>
	<author>
		<name>Scott Marlowe-2</name>
	</author>
	<content type="html">On Fri, Dec 11, 2009 at 2:59 PM, Scott Mead
&lt;br&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26752209&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;scott.lists@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Fri, Dec 11, 2009 at 4:39 PM, Nikolas Everett &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26752209&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;nik9000@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Fair enough.  I'm of the opinion that developers need to have their unit
&lt;br&gt;&amp;gt;&amp;gt; tests run fast.  If they aren't fast then your just not going to test as
&lt;br&gt;&amp;gt;&amp;gt; much as you should.  If your unit tests *have* to createdb then you have to
&lt;br&gt;&amp;gt;&amp;gt; do whatever you have to do to get it fast.  It'd probably be better if unit
&lt;br&gt;&amp;gt;&amp;gt; tests don't create databases or alter tables at all though.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Regardless of what is going on on your dev box you really should leave
&lt;br&gt;&amp;gt;&amp;gt; fsync on on your continuous integration, integration test, and QA machines.
&lt;br&gt;&amp;gt;&amp;gt; They're what your really modeling your production on anyway.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;   The other common issue is that developers running with something like
&lt;br&gt;&amp;gt; 'fsync=off' means that they have completely unrealistic expectations of the
&lt;br&gt;&amp;gt; performance surrounding something.  If your developers see that when fsync
&lt;br&gt;&amp;gt; is on, createdb takes x seconds vs. when it's off, then they'll know that
&lt;br&gt;&amp;gt; basing their entire process on that probably isn't a good idea.  When
&lt;br&gt;&amp;gt; developers think something is lightning, they tend to base lots of stuff on
&lt;br&gt;&amp;gt; it, whether it's production ready or not.
&lt;/div&gt;&lt;br&gt;Yeah, it's a huge mistake to give development super fast servers to
&lt;br&gt;test on. &amp;nbsp;Keep in mind production may need to handle 10k requests a
&lt;br&gt;minute / second whatever. &amp;nbsp;Developers cannot generate that kind of
&lt;br&gt;load by just pointing and clicking. &amp;nbsp;Our main production is on a
&lt;br&gt;cluster of 8 and 12 core machines with scads of memory and RAID-10
&lt;br&gt;arrays all over the place. &amp;nbsp;Development gets a 4 core machine with 8G
&lt;br&gt;ram and an 8 drive RAID-6. &amp;nbsp;It ain't slow, but it ain't really that
&lt;br&gt;fast either.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26752209&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/8.4.1-ubuntu-karmic-slow-createdb-tp26734177p26752209.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26752215</id>
	<title>Re: 8.4.1 ubuntu karmic slow createdb</title>
	<published>2009-12-11T14:12:45Z</published>
	<updated>2009-12-11T14:12:45Z</updated>
	<author>
		<name>Scott Carey</name>
	</author>
	<content type="html">&lt;br&gt;On 12/11/09 1:57 PM, &amp;quot;Scott Marlowe&amp;quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26752215&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;scott.marlowe@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; This is my big issue. &amp;nbsp;dropping / creating databases for unit tests is
&lt;br&gt;&amp;gt; overkill. &amp;nbsp;Running any DDL at all for a unit test seems wrong to me
&lt;br&gt;&amp;gt; too. &amp;nbsp;Insert a row if you need it, MAYBE. &amp;nbsp;Unit tests should work with
&lt;br&gt;&amp;gt; a test database that HAS the structure and database already in place.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; What happens if your unit tests get lose in production and drop a
&lt;br&gt;&amp;gt; database, or a table. &amp;nbsp;Not good.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&lt;br&gt;Production should not have a db with the same username/pw combination as dev
&lt;br&gt;boxes and unit tests . . .
&lt;br&gt;&lt;br&gt;Unfortunately, unit-like (often more than a 'unit') tests can't always rely
&lt;br&gt;on a test db being already set up. &amp;nbsp;If one leaves any cruft around, it might
&lt;br&gt;break later tests later on non-deterministically. &amp;nbsp;Automated tests that
&lt;br&gt;insert data are absolutely required somewhere if the application inserts
&lt;br&gt;data.
&lt;br&gt;&lt;br&gt;The best way to do this in postgres is to create a template database from
&lt;br&gt;scratch with whatever DDL is needed at the start of the run, and then create
&lt;br&gt;and drop db's as copies of that template per test or test suite.
&lt;br&gt;&lt;br&gt;So no, its not overkill at all IMO. &amp;nbsp;I do wish to avoid it, and ideally all
&lt;br&gt;tests clean up after themselves, but in practice this does not happen and
&lt;br&gt;results in hard to track down issues where test X fails because of something
&lt;br&gt;that any one of tests A to W did (all of which pass), often wasting time of
&lt;br&gt;the most valuable developers -- those who know the majority of the system
&lt;br&gt;well enough to track down such issues across the whole system.
&lt;br&gt;&lt;br&gt;One thing to consider, is putting this temp database in a RAMFS, or ramdisk
&lt;br&gt;since postgres does a lot of file creates and fsyncs when cloning a db from
&lt;br&gt;a template. &amp;nbsp;For almost all such test db's the actual data is small, but the
&lt;br&gt;# of tables is large.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26752215&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;&amp;gt; To make changes to your subscription:
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26752215&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/8.4.1-ubuntu-karmic-slow-createdb-tp26734177p26752215.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26752114</id>
	<title>Re: 8.4.1 ubuntu karmic slow createdb</title>
	<published>2009-12-11T13:59:43Z</published>
	<updated>2009-12-11T13:59:43Z</updated>
	<author>
		<name>Scott Mead-3</name>
	</author>
	<content type="html">&lt;div class=&quot;gmail_quote&quot;&gt;On Fri, Dec 11, 2009 at 4:39 PM, Nikolas Everett &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26752114&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;nik9000@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;&lt;div&gt;&lt;br&gt;Fair enough.  I&amp;#39;m of the opinion that developers need to have their unit tests run fast.  If they aren&amp;#39;t fast then your just not going to test as much as you should.  If your unit tests *have* to createdb then you have to do whatever you have to do to get it fast.  It&amp;#39;d probably be better if unit tests don&amp;#39;t create databases or alter tables at all though.&lt;br&gt;


&lt;br&gt;Regardless of what is going on on your dev box you really should leave fsync on on your continuous integration, integration test, and QA machines.  They&amp;#39;re what your really modeling your production on anyway.&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;&lt;br&gt;  The other common issue is that developers running with something like &amp;#39;fsync=off&amp;#39; means that they have completely unrealistic expectations of the performance surrounding something.  If your developers see that when fsync is on, createdb takes x seconds vs. when it&amp;#39;s off, then they&amp;#39;ll know that basing their entire process on that probably isn&amp;#39;t a good idea.  When developers think something is lightning, they tend to base lots of stuff on it, whether it&amp;#39;s production ready or not.   &lt;br&gt;
&lt;br&gt;  &lt;br&gt;--Scott&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;br&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/8.4.1-ubuntu-karmic-slow-createdb-tp26734177p26752114.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26752026</id>
	<title>Re: 8.4.1 ubuntu karmic slow createdb</title>
	<published>2009-12-11T13:57:56Z</published>
	<updated>2009-12-11T13:57:56Z</updated>
	<author>
		<name>Scott Marlowe-2</name>
	</author>
	<content type="html">On Fri, Dec 11, 2009 at 2:39 PM, Nikolas Everett &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26752026&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;nik9000@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; On Fri, Dec 11, 2009 at 3:50 PM, Joshua D. Drake &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26752026&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;jd@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; On Fri, 2009-12-11 at 15:43 -0500, Nikolas Everett wrote:
&lt;br&gt;&amp;gt;&amp;gt; &amp;gt; Turning fsync off on a dev database is a bad idea?  Sure you might
&lt;br&gt;&amp;gt;&amp;gt; &amp;gt; kill it and have to start over, but thats kind of the point in a dev
&lt;br&gt;&amp;gt;&amp;gt; &amp;gt; database.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; My experience is that bad dev practices turn into bad production
&lt;br&gt;&amp;gt;&amp;gt; practices, whether intentionally or not.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Fair enough.  I'm of the opinion that developers need to have their unit
&lt;br&gt;&amp;gt; tests run fast.  If they aren't fast then your just not going to test as
&lt;br&gt;&amp;gt; much as you should.  If your unit tests *have* to createdb then you have to
&lt;br&gt;&amp;gt; do whatever you have to do to get it fast.  It'd probably be better if unit
&lt;br&gt;&amp;gt; tests don't create databases or alter tables at all though.
&lt;/div&gt;&lt;br&gt;This is my big issue. &amp;nbsp;dropping / creating databases for unit tests is
&lt;br&gt;overkill. &amp;nbsp;Running any DDL at all for a unit test seems wrong to me
&lt;br&gt;too. &amp;nbsp;Insert a row if you need it, MAYBE. &amp;nbsp;Unit tests should work with
&lt;br&gt;a test database that HAS the structure and database already in place.
&lt;br&gt;&lt;br&gt;What happens if your unit tests get lose in production and drop a
&lt;br&gt;database, or a table. &amp;nbsp;Not good.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26752026&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/8.4.1-ubuntu-karmic-slow-createdb-tp26734177p26752026.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26751822</id>
	<title>Re: 8.4.1 ubuntu karmic slow createdb</title>
	<published>2009-12-11T13:39:34Z</published>
	<updated>2009-12-11T13:39:34Z</updated>
	<author>
		<name>Nikolas Everett</name>
	</author>
	<content type="html">&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Fri, Dec 11, 2009 at 3:50 PM, Joshua D. Drake &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26751822&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;jd@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;

&lt;div class=&quot;im&quot;&gt;On Fri, 2009-12-11 at 15:43 -0500, Nikolas Everett wrote:&lt;br&gt;
&amp;gt; Turning fsync off on a dev database is a bad idea?  Sure you might&lt;br&gt;
&amp;gt; kill it and have to start over, but thats kind of the point in a dev&lt;br&gt;
&amp;gt; database.&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;My experience is that bad dev practices turn into bad production&lt;br&gt;
practices, whether intentionally or not.&lt;br&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;Fair enough.  I&amp;#39;m of the opinion that developers need to have their unit tests run fast.  If they aren&amp;#39;t fast then your just not going to test as much as you should.  If your unit tests *have* to createdb then you have to do whatever you have to do to get it fast.  It&amp;#39;d probably be better if unit tests don&amp;#39;t create databases or alter tables at all though.&lt;br&gt;

&lt;br&gt;Regardless of what is going on on your dev box you really should leave fsync on on your continuous integration, integration test, and QA machines.  They&amp;#39;re what your really modeling your production on anyway.&lt;br&gt;
&lt;/div&gt;
&lt;/div&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/8.4.1-ubuntu-karmic-slow-createdb-tp26734177p26751822.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26751259</id>
	<title>Re: 8.4.1 ubuntu karmic slow createdb</title>
	<published>2009-12-11T12:50:10Z</published>
	<updated>2009-12-11T12:50:10Z</updated>
	<author>
		<name>Joshua D. Drake</name>
	</author>
	<content type="html">On Fri, 2009-12-11 at 15:43 -0500, Nikolas Everett wrote:
&lt;br&gt;&amp;gt; Turning fsync off on a dev database is a bad idea? &amp;nbsp;Sure you might
&lt;br&gt;&amp;gt; kill it and have to start over, but thats kind of the point in a dev
&lt;br&gt;&amp;gt; database.
&lt;br&gt;&lt;br&gt;My experience is that bad dev practices turn into bad production
&lt;br&gt;practices, whether intentionally or not.
&lt;br&gt;&lt;br&gt;Joshua D. Drake
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;PostgreSQL.org Major Contributor
&lt;br&gt;Command Prompt, Inc: &lt;a href=&quot;http://www.commandprompt.com/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.commandprompt.com/&lt;/a&gt;&amp;nbsp;- 503.667.4564
&lt;br&gt;Consulting, Training, Support, Custom Development, Engineering
&lt;br&gt;If the world pushes look it in the eye and GRR. Then push back harder. - Salamander
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26751259&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/8.4.1-ubuntu-karmic-slow-createdb-tp26734177p26751259.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26751192</id>
	<title>Re: 8.4.1 ubuntu karmic slow createdb</title>
	<published>2009-12-11T12:43:59Z</published>
	<updated>2009-12-11T12:43:59Z</updated>
	<author>
		<name>Nikolas Everett</name>
	</author>
	<content type="html">Turning fsync off on a dev database is a bad idea?  Sure you might kill it and have to start over, but thats kind of the point in a dev database.&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Fri, Dec 11, 2009 at 12:58 PM, Joshua D. Drake &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26751192&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;jd@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;

&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;&lt;div class=&quot;im&quot;&gt;On Thu, 2009-12-10 at 20:38 -0500, Nikolas Everett wrote:&lt;br&gt;
&amp;gt; In my limited experience ext4 as presented by Karmic is not db&lt;br&gt;
&amp;gt; friendly.  I had to carve my swap partition into a swap partition and&lt;br&gt;
&amp;gt; an xfs partition to get better db performance.  Try fsync=off first,&lt;br&gt;
&amp;gt; but if that doesn&amp;#39;t work then try a mini xfs.&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;Do not turn fsync off. That is bad advice. I would not suggest ext4 at&lt;br&gt;
this point for database operations. Use ext3. It is backward compatible.&lt;br&gt;
&lt;br&gt;
Joshua D. Drake&lt;br&gt;
&lt;font color=&quot;#888888&quot;&gt;&lt;br&gt;
&lt;br&gt;
--&lt;br&gt;
PostgreSQL.org Major Contributor&lt;br&gt;
Command Prompt, Inc: &lt;a href=&quot;http://www.commandprompt.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.commandprompt.com/&lt;/a&gt; - 503.667.4564&lt;br&gt;
Consulting, Training, Support, Custom Development, Engineering&lt;br&gt;
If the world pushes look it in the eye and GRR. Then push back harder. - Salamander&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/8.4.1-ubuntu-karmic-slow-createdb-tp26734177p26751192.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26748759</id>
	<title>Re: 8.4.1 ubuntu karmic slow createdb</title>
	<published>2009-12-11T09:58:39Z</published>
	<updated>2009-12-11T09:58:39Z</updated>
	<author>
		<name>Joshua D. Drake</name>
	</author>
	<content type="html">On Thu, 2009-12-10 at 20:38 -0500, Nikolas Everett wrote:
&lt;br&gt;&amp;gt; In my limited experience ext4 as presented by Karmic is not db
&lt;br&gt;&amp;gt; friendly. &amp;nbsp;I had to carve my swap partition into a swap partition and
&lt;br&gt;&amp;gt; an xfs partition to get better db performance. &amp;nbsp;Try fsync=off first,
&lt;br&gt;&amp;gt; but if that doesn't work then try a mini xfs.
&lt;br&gt;&lt;br&gt;Do not turn fsync off. That is bad advice. I would not suggest ext4 at
&lt;br&gt;this point for database operations. Use ext3. It is backward compatible.
&lt;br&gt;&lt;br&gt;Joshua D. Drake
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;PostgreSQL.org Major Contributor
&lt;br&gt;Command Prompt, Inc: &lt;a href=&quot;http://www.commandprompt.com/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.commandprompt.com/&lt;/a&gt;&amp;nbsp;- 503.667.4564
&lt;br&gt;Consulting, Training, Support, Custom Development, Engineering
&lt;br&gt;If the world pushes look it in the eye and GRR. Then push back harder. - Salamander
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26748759&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/8.4.1-ubuntu-karmic-slow-createdb-tp26734177p26748759.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26737869</id>
	<title>Re: Load experimentation</title>
	<published>2009-12-10T18:37:16Z</published>
	<updated>2009-12-10T18:37:16Z</updated>
	<author>
		<name>Scott Carey</name>
	</author>
	<content type="html">&lt;br&gt;&lt;br&gt;&lt;br&gt;On 12/10/09 3:29 PM, &amp;quot;Scott Carey&amp;quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26737869&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;scott@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On 12/7/09 11:12 AM, &amp;quot;Ben Brehmer&amp;quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26737869&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;benbrehmer@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; Thanks for the quick responses. I will respond to all questions in one email:
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; COPY command: Unfortunately I'm stuck with INSERTS due to the nature this
&lt;br&gt;&amp;gt;&amp;gt; data
&lt;br&gt;&amp;gt;&amp;gt; was generated (Hadoop/MapReduce).
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; If you have control over the MapReduce output, you can have that output
&lt;br&gt;&amp;gt; result files in a format that COPY likes.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; If you don't have any control over that its more complicated. &amp;nbsp;I use a final
&lt;br&gt;&amp;gt; pass Hadoop Map only job to go over the output and insert into postgres
&lt;br&gt;&amp;gt; directly from the job, using the :
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; INSERT INTO &amp;lt;table&amp;gt; VALUES (val1, val2, ... ), (val1, val2, ...), ...
&lt;br&gt;&amp;gt; Insert style from Java with about 80 rows per insert statement and a single
&lt;br&gt;&amp;gt; transaction for about a thousand of these. &amp;nbsp;This was faster than batch
&lt;br&gt;&amp;gt; inserts .
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;I should mention that the above is a bit off. &amp;nbsp;There is an important caveat
&lt;br&gt;that each of these individual tasks might run twice in Hadoop (only one will
&lt;br&gt;finish -- speculative execution and retry on error). &amp;nbsp;To deal with this you
&lt;br&gt;can run each job inside a single transaction so that a failure will
&lt;br&gt;rollback, and likely want to turn off speculative execution.
&lt;br&gt;&lt;br&gt;Another option is to run only one map job, with no reduce for this sort of
&lt;br&gt;work in order to ensure duplicate data is not inserted. &amp;nbsp;We are inserting
&lt;br&gt;into a temp table named uniquely per chunk first (sometimes in parallel).
&lt;br&gt;Then while holding a posstgres advisory lock we do a SELECT * FROM &amp;lt;temp&amp;gt;
&lt;br&gt;INTO &amp;lt;destination&amp;gt; type operation, which is fast.
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; On 07/12/2009 10:39 AM, Thom Brown wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 2009/12/7 Kevin Grittner &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26737869&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Kevin.Grittner@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Ben Brehmer &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26737869&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;benbrehmer@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; -7.5 GB memory
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; -4 EC2 Compute Units (2 virtual cores with 2 EC2 Compute Units
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;each)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; -64-bit platform
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; What OS?
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (PostgreSQL 8.1.3)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Why use such an antiquated, buggy version? &amp;nbsp;Newer versions are
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; faster.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; -Kevin
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; I'd agree with trying to use the latest version you can.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; How are you loading this data? &amp;nbsp;I'd make sure you haven't got any indices,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; primary keys, triggers or constraints on your tables before you begin the
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; initial load, just add them after. &amp;nbsp;Also use either the COPY command for
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; loading, or prepared transactions. &amp;nbsp;Individual insert commands will just
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; take
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; way too long.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Regards
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Thom
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26737869&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;&amp;gt; To make changes to your subscription:
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26737869&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Load-experimentation-tp26681483p26737869.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26737455</id>
	<title>Re: 8.4.1 ubuntu karmic slow createdb</title>
	<published>2009-12-10T17:38:25Z</published>
	<updated>2009-12-10T17:38:25Z</updated>
	<author>
		<name>Nikolas Everett</name>
	</author>
	<content type="html">In my limited experience ext4 as presented by Karmic is not db friendly.  I had to carve my swap partition into a swap partition and an xfs partition to get better db performance.  Try fsync=off first, but if that doesn&amp;#39;t work then try a mini xfs.&lt;div&gt;

&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Thu, Dec 10, 2009 at 5:09 PM, Andres Freund &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26737455&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;andres@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;&quot;&gt;

Hi,&lt;br&gt;
&lt;div class=&quot;im&quot;&gt;&lt;br&gt;
On Thursday 10 December 2009 23:01:08 Michael Clemmons wrote:&lt;br&gt;
&amp;gt; Im not sure what that means ppl in my office with slower hd speeds using&lt;br&gt;
&amp;gt;  8.4 can create a db in 2s vs my 8-12s.&lt;br&gt;
&lt;/div&gt;- Possibly their config is different - they could have disabled the &amp;quot;fsync&amp;quot;&lt;br&gt;
parameter which turns the database to be not crashsafe anymore but much faster&lt;br&gt;
in some circumstances.&lt;br&gt;
&lt;br&gt;
- Possibly you have much data in your template1 database?&lt;br&gt;
You could check whether&lt;br&gt;
&lt;br&gt;
CREATE DATABASE speedtest TEMPLATE template1; takes more time than&lt;br&gt;
CREATE DATABASE speedtest TEMPLATE template0;.&lt;br&gt;
&lt;br&gt;
You should issue both multiple times to ensure caching on the template&lt;br&gt;
database doesnt play a role.&lt;br&gt;
&lt;div class=&quot;im&quot;&gt;&lt;br&gt;
&amp;gt;  Could using md5 instead of ident do it?&lt;br&gt;
&lt;/div&gt;Seems unlikely.&lt;br&gt;
Is starting psql near-instantaneus? Are you using &amp;quot;createdb&amp;quot; or are you&lt;br&gt;
issuing &amp;quot;CREATE DATABASE ...&amp;quot;?&lt;br&gt;
&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class=&quot;h5&quot;&gt;&lt;br&gt;
Andres&lt;br&gt;
&lt;br&gt;
--&lt;br&gt;
Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26737455&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)&lt;br&gt;
To make changes to your subscription:&lt;br&gt;
&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/8.4.1-ubuntu-karmic-slow-createdb-tp26734177p26737455.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26736369</id>
	<title>Re: Load experimentation</title>
	<published>2009-12-10T15:29:59Z</published>
	<updated>2009-12-10T15:29:59Z</updated>
	<author>
		<name>Scott Carey</name>
	</author>
	<content type="html">On 12/7/09 11:12 AM, &amp;quot;Ben Brehmer&amp;quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26736369&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;benbrehmer@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; Thanks for the quick responses. I will respond to all questions in one email:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; COPY command: Unfortunately I'm stuck with INSERTS due to the nature this data
&lt;br&gt;&amp;gt; was generated (Hadoop/MapReduce).
&lt;br&gt;&lt;br&gt;If you have control over the MapReduce output, you can have that output
&lt;br&gt;result files in a format that COPY likes.
&lt;br&gt;&lt;br&gt;If you don't have any control over that its more complicated. &amp;nbsp;I use a final
&lt;br&gt;pass Hadoop Map only job to go over the output and insert into postgres
&lt;br&gt;directly from the job, using the :
&lt;br&gt;&lt;br&gt;INSERT INTO &amp;lt;table&amp;gt; VALUES (val1, val2, ... ), (val1, val2, ...), ...
&lt;br&gt;Insert style from Java with about 80 rows per insert statement and a single
&lt;br&gt;transaction for about a thousand of these. &amp;nbsp;This was faster than batch
&lt;br&gt;inserts .
&lt;br&gt;&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; On 07/12/2009 10:39 AM, Thom Brown wrote:
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; 2009/12/7 Kevin Grittner &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26736369&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Kevin.Grittner@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Ben Brehmer &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26736369&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;benbrehmer@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; -7.5 GB memory
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; -4 EC2 Compute Units (2 virtual cores with 2 EC2 Compute Units
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;each)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; -64-bit platform
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; What OS?
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; (PostgreSQL 8.1.3)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Why use such an antiquated, buggy version? &amp;nbsp;Newer versions are
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; faster.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; -Kevin
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; I'd agree with trying to use the latest version you can.
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; How are you loading this data? &amp;nbsp;I'd make sure you haven't got any indices,
&lt;br&gt;&amp;gt;&amp;gt; primary keys, triggers or constraints on your tables before you begin the
&lt;br&gt;&amp;gt;&amp;gt; initial load, just add them after. &amp;nbsp;Also use either the COPY command for
&lt;br&gt;&amp;gt;&amp;gt; loading, or prepared transactions. &amp;nbsp;Individual insert commands will just take
&lt;br&gt;&amp;gt;&amp;gt; way too long.
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; Regards
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; Thom
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26736369&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Load-experimentation-tp26681483p26736369.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26735422</id>
	<title>Re: 8.4.1 ubuntu karmic slow createdb</title>
	<published>2009-12-10T14:09:03Z</published>
	<updated>2009-12-10T14:09:03Z</updated>
	<author>
		<name>Andres Freund</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&lt;br&gt;On Thursday 10 December 2009 23:01:08 Michael Clemmons wrote:
&lt;br&gt;&amp;gt; Im not sure what that means ppl in my office with slower hd speeds using
&lt;br&gt;&amp;gt; &amp;nbsp;8.4 can create a db in 2s vs my 8-12s.
&lt;br&gt;- Possibly their config is different - they could have disabled the &amp;quot;fsync&amp;quot; 
&lt;br&gt;parameter which turns the database to be not crashsafe anymore but much faster 
&lt;br&gt;in some circumstances.
&lt;br&gt;&lt;br&gt;- Possibly you have much data in your template1 database?
&lt;br&gt;You could check whether
&lt;br&gt;&lt;br&gt;CREATE DATABASE speedtest TEMPLATE template1; takes more time than
&lt;br&gt;CREATE DATABASE speedtest TEMPLATE template0;.
&lt;br&gt;&lt;br&gt;You should issue both multiple times to ensure caching on the template 
&lt;br&gt;database doesnt play a role.
&lt;br&gt;&lt;br&gt;&amp;gt; &amp;nbsp;Could using md5 instead of ident do it?
&lt;br&gt;Seems unlikely.
&lt;br&gt;Is starting psql near-instantaneus? Are you using &amp;quot;createdb&amp;quot; or are you 
&lt;br&gt;issuing &amp;quot;CREATE DATABASE ...&amp;quot;?
&lt;br&gt;&lt;br&gt;Andres
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26735422&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/8.4.1-ubuntu-karmic-slow-createdb-tp26734177p26735422.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26735325</id>
	<title>Re: 8.4.1 ubuntu karmic slow createdb</title>
	<published>2009-12-10T14:01:08Z</published>
	<updated>2009-12-10T14:01:08Z</updated>
	<author>
		<name>Michael Clemmons</name>
	</author>
	<content type="html">Im not sure what that means ppl in my office with slower hd speeds using 8.4 can create a db in 2s vs my 8-12s.  Could using md5 instead of ident do it?&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Thu, Dec 10, 2009 at 4:56 PM, Andres Freund &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26735325&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;andres@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class=&quot;h5&quot;&gt;On Thursday 10 December 2009 21:41:08 Michael Clemmons wrote:&lt;br&gt;

&amp;gt; Hey,&lt;br&gt;
&amp;gt; I&amp;#39;ve got a computer which runs but 8.3 and 8.4.  To create a db it takes 4s&lt;br&gt;
&amp;gt; for 8.3 and 9s for 8.4.  I have many unit tests which create databases all&lt;br&gt;
&amp;gt; of the time and now run much slower than 8.3 but it seems to be much longer&lt;br&gt;
&amp;gt; as I remember at one point creating databases I considered an instantaneous&lt;br&gt;
&amp;gt; thing.  Does any on the list know why this is true and if I can get it back&lt;br&gt;
&amp;gt; to normal.&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;Possibly you had fsync=off at the time?&lt;br&gt;
&lt;font color=&quot;#888888&quot;&gt;&lt;br&gt;
Andres&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/8.4.1-ubuntu-karmic-slow-createdb-tp26734177p26735325.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26735257</id>
	<title>Re: 8.4.1 ubuntu karmic slow createdb</title>
	<published>2009-12-10T13:56:59Z</published>
	<updated>2009-12-10T13:56:59Z</updated>
	<author>
		<name>Andres Freund</name>
	</author>
	<content type="html">On Thursday 10 December 2009 21:41:08 Michael Clemmons wrote:
&lt;br&gt;&amp;gt; Hey,
&lt;br&gt;&amp;gt; I've got a computer which runs but 8.3 and 8.4. &amp;nbsp;To create a db it takes 4s
&lt;br&gt;&amp;gt; for 8.3 and 9s for 8.4. &amp;nbsp;I have many unit tests which create databases all
&lt;br&gt;&amp;gt; of the time and now run much slower than 8.3 but it seems to be much longer
&lt;br&gt;&amp;gt; as I remember at one point creating databases I considered an instantaneous
&lt;br&gt;&amp;gt; thing. &amp;nbsp;Does any on the list know why this is true and if I can get it back
&lt;br&gt;&amp;gt; to normal.
&lt;br&gt;Possibly you had fsync=off at the time?
&lt;br&gt;&lt;br&gt;Andres
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26735257&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/8.4.1-ubuntu-karmic-slow-createdb-tp26734177p26735257.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26734177</id>
	<title>8.4.1 ubuntu karmic slow createdb</title>
	<published>2009-12-10T12:41:08Z</published>
	<updated>2009-12-10T12:41:08Z</updated>
	<author>
		<name>Michael Clemmons</name>
	</author>
	<content type="html">&lt;div class=&quot;gmail_quote&quot;&gt;Hey,&lt;br&gt;I&amp;#39;ve got a computer which runs but 8.3 and 8.4.  To create a db it takes 4s for 8.3 and 9s for 8.4.  I have many unit tests which create databases all of the time and now run much slower than 8.3 but it seems to be much longer as I remember at one point creating databases I considered an instantaneous thing.  Does any on the list know why this is true and if I can get it back to normal.&lt;br&gt;
&lt;font color=&quot;#888888&quot;&gt;
-Michael&lt;br&gt;
&lt;/font&gt;&lt;/div&gt;&lt;br&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/8.4.1-ubuntu-karmic-slow-createdb-tp26734177p26734177.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26733950</id>
	<title>Re: Load experimentation</title>
	<published>2009-12-10T12:24:06Z</published>
	<updated>2009-12-10T12:24:06Z</updated>
	<author>
		<name>Ben Brehmer-2</name>
	</author>
	<content type="html">Hi Andy,
&lt;br&gt;&lt;br&gt;Load is chugging along. We've optimized our postgres conf as much as 
&lt;br&gt;possible but are seeing the inevitable I/O bottleneck. I had the same 
&lt;br&gt;thought as you (converting inserts into copy's) a while back but 
&lt;br&gt;unfortunately each file has many inserts into many different tables. 
&lt;br&gt;Potentially I could rip through this with a little MapReduce job on 
&lt;br&gt;50-100 nodes, which is still something I might do.
&lt;br&gt;&lt;br&gt;One thought we are playing with was taking advantage of 4 x 414GB EBS 
&lt;br&gt;devices in a RAID0 configuration. This would spread disk writes across 4 
&lt;br&gt;block devices.
&lt;br&gt;&lt;br&gt;Right now I'm wrapping about 1500 inserts in a transaction block. Since 
&lt;br&gt;its an I/O bottlenecks, COPY statements might not give me much advantage.
&lt;br&gt;&lt;br&gt;Its definitely a work in progress :)
&lt;br&gt;&lt;br&gt;Ben
&lt;br&gt;&lt;br&gt;&lt;br&gt;On 09/12/2009 5:31 AM, Andy Colson wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On 12/07/2009 12:12 PM, Ben Brehmer wrote:
&lt;br&gt;&amp;gt;&amp;gt; Hello All,
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I'm in the process of loading a massive amount of data (500 GB). After
&lt;br&gt;&amp;gt;&amp;gt; some initial timings, I'm looking at 260 hours to load the entire 500GB.
&lt;br&gt;&amp;gt;&amp;gt; 10 days seems like an awfully long time so I'm searching for ways to
&lt;br&gt;&amp;gt;&amp;gt; speed this up. The load is happening in the Amazon cloud (EC2), on a
&lt;br&gt;&amp;gt;&amp;gt; m1.large instance:
&lt;br&gt;&amp;gt;&amp;gt; -7.5 GB memory
&lt;br&gt;&amp;gt;&amp;gt; -4 EC2 Compute Units (2 virtual cores with 2 EC2 Compute Units each)
&lt;br&gt;&amp;gt;&amp;gt; -64-bit platform
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; So far I have modified my postgresql.conf file (PostgreSQL 8.1.3). The
&lt;br&gt;&amp;gt;&amp;gt; modifications I have made are as follows:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; shared_buffers = 786432
&lt;br&gt;&amp;gt;&amp;gt; work_mem = 10240
&lt;br&gt;&amp;gt;&amp;gt; maintenance_work_mem = 6291456
&lt;br&gt;&amp;gt;&amp;gt; max_fsm_pages = 3000000
&lt;br&gt;&amp;gt;&amp;gt; wal_buffers = 2048
&lt;br&gt;&amp;gt;&amp;gt; checkpoint_segments = 200
&lt;br&gt;&amp;gt;&amp;gt; checkpoint_timeout = 300
&lt;br&gt;&amp;gt;&amp;gt; checkpoint_warning = 30
&lt;br&gt;&amp;gt;&amp;gt; autovacuum = off
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; There are a variety of instance types available in the Amazon cloud
&lt;br&gt;&amp;gt;&amp;gt; (&lt;a href=&quot;http://aws.amazon.com/ec2/instance-types/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://aws.amazon.com/ec2/instance-types/&lt;/a&gt;), including high memory and
&lt;br&gt;&amp;gt;&amp;gt; high CPU. High memory instance types come with 34GB or 68GB of memory.
&lt;br&gt;&amp;gt;&amp;gt; High CPU instance types have a lot less memory (7GB max) but up to 8
&lt;br&gt;&amp;gt;&amp;gt; virtual cores. I am more than willing to change to any of the other
&lt;br&gt;&amp;gt;&amp;gt; instance types.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Also, there is nothing else happening on the loading server. It is
&lt;br&gt;&amp;gt;&amp;gt; completely dedicated to the load.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Any advice would be greatly appreciated.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Ben
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I'm kind of curious, how goes the load? &amp;nbsp;Is it done yet? &amp;nbsp;Still 
&lt;br&gt;&amp;gt; looking at days'n'days to finish?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I was thinking... If the .sql files are really nicely formatted, it 
&lt;br&gt;&amp;gt; would not be too hard to whip up a perl script to run as a filter to 
&lt;br&gt;&amp;gt; change the statements into copy's.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Each file would have to only fill one table, and only contain inserts, 
&lt;br&gt;&amp;gt; and all the insert statements would have to set the same fields. &amp;nbsp;(And 
&lt;br&gt;&amp;gt; I'm sure there could be other problems).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Also, just for the load, did you disable fsync?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; -Andy
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26733950&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Load-experimentation-tp26681483p26733950.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26731160</id>
	<title>Re: Fw: Help me put 2 Gigs of RAM to use</title>
	<published>2009-12-10T09:19:44Z</published>
	<updated>2009-12-10T09:19:44Z</updated>
	<author>
		<name>Robert Haas</name>
	</author>
	<content type="html">On Thu, Dec 10, 2009 at 11:45 AM, Greg Smith &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26731160&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;greg@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; So your shared buffers setting is 8192 * 8K = 64MB
&lt;br&gt;&amp;gt; effective_cache_size is 8MB
&lt;br&gt;&amp;gt; work_mem is 4MB.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The first and last of those are reasonable but on the small side, the last
&lt;br&gt;&amp;gt; is...not.
&lt;br&gt;&lt;br&gt;I believe that the second instance of the word &amp;quot;last&amp;quot; in that sentence
&lt;br&gt;should have been &amp;quot;middle&amp;quot;, referring to effective_cache_size. &amp;nbsp;Small
&lt;br&gt;values discourage the planner from using indices in certain
&lt;br&gt;situations.
&lt;br&gt;&lt;br&gt;...Robert
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26731160&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Fw%3A-Help-me-put-2-Gigs-of-RAM-to-use-tp26729654p26731160.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26730571</id>
	<title>Re: Fw: Help me put 2 Gigs of RAM to use</title>
	<published>2009-12-10T08:45:30Z</published>
	<updated>2009-12-10T08:45:30Z</updated>
	<author>
		<name>Greg Smith-21</name>
	</author>
	<content type="html">Mark Stosberg wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; I find the file a bit hard to read because of the lack of units in 
&lt;br&gt;&amp;gt; the examples, but perhaps that's already been addressed in future
&lt;br&gt;&amp;gt; versions.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp;max_connections &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= 400 # Seems to be enough us
&lt;br&gt;&amp;gt; &amp;nbsp;shared_buffers &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = 8192
&lt;br&gt;&amp;gt; &amp;nbsp;effective_cache_size &amp;nbsp; = 1000
&lt;br&gt;&amp;gt; &amp;nbsp;work_mem &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = 4096
&lt;br&gt;&amp;gt; &amp;nbsp;maintenance_work_mem &amp;nbsp; = 160MB
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;/div&gt;It's already addressed in 8.2, as you can note by the fact that 
&lt;br&gt;&amp;quot;maintenance_work_mem&amp;quot; is in there with an easy to read format. &amp;nbsp;
&lt;br&gt;Guessing that someone either pulled in settings from an older version, 
&lt;br&gt;or used some outdated web guide to get starter settings.
&lt;br&gt;&lt;br&gt;To convert the rest of them, you need to know what the units for each 
&lt;br&gt;parameter is. &amp;nbsp;You can find that out like this:
&lt;br&gt;&lt;br&gt;gsmith=# select name,setting,unit from pg_settings where name in 
&lt;br&gt;('shared_buffers','effective_cache_size','work_mem');
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;name &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | setting | unit
&lt;br&gt;----------------------+---------+------
&lt;br&gt;&amp;nbsp;effective_cache_size | 16384 &amp;nbsp; | 8kB
&lt;br&gt;&amp;nbsp;shared_buffers &amp;nbsp; &amp;nbsp; &amp;nbsp; | 4096 &amp;nbsp; &amp;nbsp;| 8kB
&lt;br&gt;&amp;nbsp;work_mem &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | 1024 &amp;nbsp; &amp;nbsp;| kB
&lt;br&gt;&lt;br&gt;So your shared buffers setting is 8192 * 8K = 64MB
&lt;br&gt;effective_cache_size is 8MB
&lt;br&gt;work_mem is 4MB.
&lt;br&gt;&lt;br&gt;The first and last of those are reasonable but on the small side, the 
&lt;br&gt;last is...not. &amp;nbsp;Increasing it won't actually use more memory on your 
&lt;br&gt;server though, it will just change query plans--so you want to be 
&lt;br&gt;careful about increasing it too much in one shot.
&lt;br&gt;&lt;br&gt;The next set of stuff you need to know about general guidelines for 
&lt;br&gt;server sizing is at 
&lt;br&gt;&lt;a href=&quot;http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server&lt;/a&gt;&lt;br&gt;&lt;br&gt;You'd probably want to put shared_buffers at a higher level based on the 
&lt;br&gt;amount of RAM on your server, but I'd suggest you tune the checkpoint 
&lt;br&gt;parameters along with that--just increasing the buffer space along can 
&lt;br&gt;cause problems rather than solve them if you're having checkpoints all 
&lt;br&gt;the time.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Greg Smith &amp;nbsp; &amp;nbsp;2ndQuadrant &amp;nbsp; Baltimore, MD
&lt;br&gt;PostgreSQL Training, Services and Support
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26730571&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;greg@...&lt;/a&gt; &amp;nbsp;www.2ndQuadrant.com
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26730571&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Fw%3A-Help-me-put-2-Gigs-of-RAM-to-use-tp26729654p26730571.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26730558</id>
	<title>Re: Help me put 2 Gigs of RAM to use</title>
	<published>2009-12-10T08:44:32Z</published>
	<updated>2009-12-10T08:44:32Z</updated>
	<author>
		<name>Bugzilla from mark@summersault.com</name>
	</author>
	<content type="html">&lt;br&gt;Thanks for the response, Matthew.
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Thu, 10 Dec 2009, Mark Stosberg wrote:
&lt;br&gt;&amp;gt; &amp;gt; What I'm noticing is that the while the FreeBSD server has 4 Gigs of
&lt;br&gt;&amp;gt; &amp;gt; memory, there are rarely every more than 2 in use-- the memory use
&lt;br&gt;&amp;gt; &amp;gt; graphs as being rather constant. My goal is to make good use of those 2
&lt;br&gt;&amp;gt; &amp;gt; Gigs of memory to improve performance and reduce the CPU usage.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I think you'll find that the RAM is already being used quite effectively 
&lt;br&gt;&amp;gt; as disc cache by the OS. It sounds like the server is actually set up 
&lt;br&gt;&amp;gt; pretty well. You may get slightly better performance by tweaking a thing 
&lt;br&gt;&amp;gt; here or there, but the server needs some OS disc cache to perform well.
&lt;/div&gt;&lt;br&gt;As part of reviewing this status, I it appears that the OS is only
&lt;br&gt;addresses 3 of the 4 Gigs of memory. We'll work on our FreeBSD setup to
&lt;br&gt;cure that.
&lt;br&gt;&lt;br&gt;Here's how &amp;quot;top&amp;quot; reports the memory breakdown:
&lt;br&gt;&lt;br&gt;Mem: 513M Active, 2246M Inact, 249M Wired, 163M Cache, 112M Buf, 7176K
&lt;br&gt;Free Swap: 9216M Total, 1052K Used, 9215M Free
&lt;br&gt;&lt;br&gt;So perhaps the OS disc cache is represented in the &amp;quot;Inactive&amp;quot; memory
&lt;br&gt;statistic? I suppose once we have the 4th Gig of memory actually
&lt;br&gt;available, that would all be doing to the disk cache. 
&lt;br&gt;&lt;br&gt;&amp;gt; &amp;gt; (We currently run 8.2, but are planning an upgrade to 8.4 &amp;quot;soon&amp;quot;).
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Highly recommended.
&lt;br&gt;&lt;br&gt;For performance improvements in particular?
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; Mark
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;&amp;nbsp;. . . . . . . . . . . . . . . . . . . . . . . . . . . 
&lt;br&gt;&amp;nbsp; &amp;nbsp;Mark Stosberg &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Principal Developer &amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26730558&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;mark@...&lt;/a&gt; &amp;nbsp; &amp;nbsp; Summersault, LLC &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp;765-939-9301 ext 202 &amp;nbsp; &amp;nbsp; database driven websites
&lt;br&gt;&amp;nbsp;. . . . . &lt;a href=&quot;http://www.summersault.com/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.summersault.com/&lt;/a&gt;&amp;nbsp;. . . . . . . .
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26730558&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Fw%3A-Help-me-put-2-Gigs-of-RAM-to-use-tp26729654p26730558.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26730507</id>
	<title>Re: big select is resulting in a large amount of disk writing by kjournald</title>
	<published>2009-12-10T08:41:53Z</published>
	<updated>2009-12-10T08:41:53Z</updated>
	<author>
		<name>Kevin Grittner</name>
	</author>
	<content type="html">Joseph S &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26730507&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;jks@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; I just installed a shiny new database server with pg 8.4.1 running
&lt;br&gt;&amp;gt; on CentOS 5.4. After using slony to replicate over my database I
&lt;br&gt;&amp;gt; decided to do some basic performance tests to see how spiffy my
&lt;br&gt;&amp;gt; shiny new server is. &amp;nbsp;This machine has 32G ram, over 31 of which
&lt;br&gt;&amp;gt; is used for the system file cache.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; So I run &amp;quot;select count(*) from large_table&amp;quot; and I see in xosview a
&lt;br&gt;&amp;gt; solid block of write activity. Runtime is 28125.644 ms for the
&lt;br&gt;&amp;gt; first run. &amp;nbsp;The second run does not show a block of write activity
&lt;br&gt;&amp;gt; and takes 3327.441 ms
&lt;/div&gt;&amp;nbsp;
&lt;br&gt;As others have mentioned, this is due to hint bit updates, and doing
&lt;br&gt;an explicit VACUUM after the load and before you start using the
&lt;br&gt;database will avoid run-time issues. &amp;nbsp;You also need statistics, so
&lt;br&gt;be sure to do VACUUM ANALYZE.
&lt;br&gt;&amp;nbsp;
&lt;br&gt;There is one other sneaky surprise awaiting you, however. &amp;nbsp;Since
&lt;br&gt;this stuff was all loaded with a narrow range of transaction IDs,
&lt;br&gt;they will all need to be frozen at about the same time; so somewhere
&lt;br&gt;down the road, either during a routine database vacuum or possibly
&lt;br&gt;in the middle of normal operations, all of these rows will need to
&lt;br&gt;be rewritten *again* to change the transaction IDs used for managing
&lt;br&gt;MVCC to the special &amp;quot;frozen&amp;quot; value. &amp;nbsp;We routinely follow a load with
&lt;br&gt;VACUUM FREEZE ANALYZE of the database to combine the update to
&lt;br&gt;freeze the tuples with the update to set the hint bits and avoid
&lt;br&gt;this problem.
&lt;br&gt;&amp;nbsp;
&lt;br&gt;There has been some talk about possibly writing tuples in a frozen
&lt;br&gt;state with the hint bits already set if they are loaded in the same
&lt;br&gt;database transaction which creates the table, but I'm not aware of
&lt;br&gt;anyone currently working on this.
&lt;br&gt;&amp;nbsp;
&lt;br&gt;-Kevin
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26730507&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/big-select-is-resulting-in-a-large-amount-of-disk-writing-by-kjournald-tp26715264p26730507.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26729880</id>
	<title>Re: Fw: Help me put 2 Gigs of RAM to use</title>
	<published>2009-12-10T08:03:11Z</published>
	<updated>2009-12-10T08:03:11Z</updated>
	<author>
		<name>Matthew Wakeling-3</name>
	</author>
	<content type="html">On Thu, 10 Dec 2009, Mark Stosberg wrote:
&lt;br&gt;&amp;gt; What I'm noticing is that the while the FreeBSD server has 4 Gigs of
&lt;br&gt;&amp;gt; memory, there are rarely every more than 2 in use-- the memory use
&lt;br&gt;&amp;gt; graphs as being rather constant. My goal is to make good use of those 2
&lt;br&gt;&amp;gt; Gigs of memory to improve performance and reduce the CPU usage.
&lt;br&gt;&lt;br&gt;I think you'll find that the RAM is already being used quite effectively 
&lt;br&gt;as disc cache by the OS. It sounds like the server is actually set up 
&lt;br&gt;pretty well. You may get slightly better performance by tweaking a thing 
&lt;br&gt;here or there, but the server needs some OS disc cache to perform well.
&lt;br&gt;&lt;br&gt;&amp;gt; (We currently run 8.2, but are planning an upgrade to 8.4 &amp;quot;soon&amp;quot;).
&lt;br&gt;&lt;br&gt;Highly recommended.
&lt;br&gt;&lt;br&gt;&amp;gt; [I tried to post this yesterday but didn't see it come through. This
&lt;br&gt;&amp;gt; message is a second attempt.)
&lt;br&gt;&lt;br&gt;The mailing list server will silently chuck any message whose subject 
&lt;br&gt;starts with the word &amp;quot;help&amp;quot;, just in case you're asking for help about 
&lt;br&gt;managing the mailing list. The default behaviour is not to inform you that 
&lt;br&gt;it has done so. It is highly annoying - could a list admin please consider 
&lt;br&gt;changing this?
&lt;br&gt;&lt;br&gt;Matthew
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;&amp;nbsp;I would like to think that in this day and age people would know better than
&lt;br&gt;&amp;nbsp;to open executables in an e-mail. I'd also like to be able to flap my arms
&lt;br&gt;&amp;nbsp;and fly to the moon. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-- Tim Mullen
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-performance mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26729880&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-performance@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-performance&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-performance&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Fw%3A-Help-me-put-2-Gigs-of-RAM-to-use-tp26729654p26729880.html" />
</entry>

</feed>
