diff --git "a/pgsql-performance.200606" "b/pgsql-performance.200606" new file mode 100644--- /dev/null +++ "b/pgsql-performance.200606" @@ -0,0 +1,44895 @@ +From pgsql-performance-owner@postgresql.org Thu Jun 1 00:18:21 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id EF70D9FA682 + for ; + Thu, 1 Jun 2006 00:18:20 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 28404-01 + for ; + Thu, 1 Jun 2006 00:18:11 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 25C3F9FA5EA + for ; + Thu, 1 Jun 2006 00:18:08 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id EA83256408; Wed, 31 May 2006 22:18:07 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Wed, 31 May 2006 22:18:06 -0500 +Date: Wed, 31 May 2006 22:18:05 -0500 +From: "Jim C. Nasby" +To: Greg Stark +Cc: Brendan Duddridge , Tom Lane , + PostgreSQL Performance +Subject: Re: App very unresponsive while performing simple update +Message-ID: <20060601031805.GI53487@pervasive.com> +References: <961F6F02-4B00-494C-B071-6DF76A305C14@clickspace.com> + <21B15664-F4EE-462C-88B4-EEEB2B4A979F@clickspace.com> + <874pzanvk6.fsf@stark.xeocode.com> <17733.1148832292@sss.pgh.pa.us> + <3C756C36-DC66-4D13-B2CE-99CFCE7BF390@clickspace.com> + <87hd39n3c4.fsf@stark.xeocode.com> + <20060531062307.GG53487@pervasive.com> + <874pz6jjze.fsf@stark.xeocode.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <874pz6jjze.fsf@stark.xeocode.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: 1:20:060601:gsstark@mit.edu::6n68oiAybN9CKmJh:004ymy +X-Hashcash: + 1:20:060601:brendan@clickspace.com::pIN1rLlVKhBS0/KG:000000000000000 + 000000000000000000000000Bw6/ +X-Hashcash: + 1:20:060601:tgl@sss.pgh.pa.us::2ojmgGbbO7ssy5BR:00000000000000000000 + 0000000000000000000000000aW1 +X-Hashcash: + 1:20:060601:pgsql-performance@postgresql.org::0SXmYTZOFQTqQJqe:00000 + 00000000000000000000000092Jc +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/1 +X-Sequence-Number: 19358 + +On Wed, May 31, 2006 at 11:24:05AM -0400, Greg Stark wrote: +> stark=> begin; +> BEGIN +> stark=> begin; +> BEGIN +> stark=> update t1 set a = 0; +> UPDATE 1 +> stark=> update t1 set a = 1; +> UPDATE 1 +> +> stark=> update t2 set b = 0; +> UPDATE 1 +> stark=> update t2 set b = 2; +> UPDATE 1 +> stark=> commit; +> stark=> commit; +> ERROR: deadlock detected +> DETAIL: Process 16531 waits for ShareLock on transaction 245131; blocked by process 16566 +> Process 16566 waits for ShareLock on transaction 245132; blocked by process 16531. +> CONTEXT: SQL statement "SELECT 1 FROM ONLY "public"."t1" x WHERE "a" = $1 FOR SHARE OF x" +> stark=> > +> COMMIT + +I tried duplicating this but couldn't. What's the data in the tables? +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Thu Jun 1 01:31:12 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 511539FB1BA + for ; + Thu, 1 Jun 2006 01:31:12 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 33972-08 + for ; + Thu, 1 Jun 2006 01:31:08 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by postgresql.org (Postfix) with ESMTP id 905119FB1B8 + for ; + Thu, 1 Jun 2006 01:31:07 -0300 (ADT) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1Flepa-0004yM-00; Thu, 01 Jun 2006 00:30:46 -0400 +To: "Jim C. Nasby" +Cc: Greg Stark , Brendan Duddridge , + Tom Lane , + PostgreSQL Performance +Subject: Re: App very unresponsive while performing simple update +References: <961F6F02-4B00-494C-B071-6DF76A305C14@clickspace.com> + <21B15664-F4EE-462C-88B4-EEEB2B4A979F@clickspace.com> + <874pzanvk6.fsf@stark.xeocode.com> <17733.1148832292@sss.pgh.pa.us> + <3C756C36-DC66-4D13-B2CE-99CFCE7BF390@clickspace.com> + <87hd39n3c4.fsf@stark.xeocode.com> + <20060531062307.GG53487@pervasive.com> + <874pz6jjze.fsf@stark.xeocode.com> + <20060601031805.GI53487@pervasive.com> +In-Reply-To: <20060601031805.GI53487@pervasive.com> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 01 Jun 2006 00:30:46 -0400 +Message-ID: <87hd35ijk9.fsf@stark.xeocode.com> +Lines: 66 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/2 +X-Sequence-Number: 19359 + +"Jim C. Nasby" writes: + +> I tried duplicating this but couldn't. What's the data in the tables? + +Sorry, I had intended to include the definition and data: + +stark=> create table t1 (a integer primary key, b integer); +NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" for table "t1" +CREATE TABLE + +stark=> create table t2 (a integer, b integer primary key); +NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t2_pkey" for table "t2" +CREATE TABLE + +stark=> insert into t1 values (1,2); +INSERT 0 1 + +stark=> insert into t2 values (1,2); +INSERT 0 1 + +stark=> alter table t1 add constraint fk foreign key (b) references t2 deferrable initially deferred ; +ALTER TABLE + +stark=> alter table t2 add constraint fk foreign key (a) references t1 deferrable initially deferred ; +ALTER TABLE + +stark=> \d t1 + Table "public.t1" + Column | Type | Modifiers +--------+---------+----------- + a | integer | not null + b | integer | +Indexes: + "t1_pkey" PRIMARY KEY, btree (a) +Foreign-key constraints: + "fk" FOREIGN KEY (b) REFERENCES t2(b) DEFERRABLE INITIALLY DEFERRED + +stark=> \d t2 + Table "public.t2" + Column | Type | Modifiers +--------+---------+----------- + a | integer | + b | integer | not null +Indexes: + "t2_pkey" PRIMARY KEY, btree (b) +Foreign-key constraints: + "fk" FOREIGN KEY (a) REFERENCES t1(a) DEFERRABLE INITIALLY DEFERRED + + +stark=> select * from t1; + a | b +---+--- + 1 | 2 +(1 row) + +stark=> select * from t2; + a | b +---+--- + 1 | 2 +(1 row) + + + + +-- +greg + + +From pgsql-performance-owner@postgresql.org Thu Jun 1 08:54:14 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id AC8409FA5DC + for ; + Thu, 1 Jun 2006 08:54:13 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 89741-08 + for ; + Thu, 1 Jun 2006 08:54:10 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.173]) + by postgresql.org (Postfix) with ESMTP id 35DA09FA040 + for ; + Thu, 1 Jun 2006 08:54:09 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so134930ugf + for ; + Thu, 01 Jun 2006 04:54:08 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; + b=PcfpxbeHGpDGiqy3wNHmyuJ4MQMHkrDqfExaoMok38vMFDJkC4nywqwKyeEB67Q5ute3vzLpazVyCy5gZYVPtrMmZqfxbCGfoy5kRXm4igwSdwru/1+S2i7mePZPVoaTUMqvzVrsBv+J/MobX26p76A+tsCz55b1VL1Q1l2HhQQ= +Received: by 10.78.45.13 with SMTP id s13mr84227hus; + Thu, 01 Jun 2006 04:54:08 -0700 (PDT) +Received: by 10.78.71.9 with HTTP; Thu, 1 Jun 2006 04:54:08 -0700 (PDT) +Message-ID: <92d3a4950606010454y67293765o56001e8996975b45@mail.gmail.com> +Date: Thu, 1 Jun 2006 13:54:08 +0200 +From: Antoine +To: pgsql-performance@postgresql.org +Subject: vacuuming problems continued +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/3 +X-Sequence-Number: 19360 + +Hi, +We just don't seem to be getting much benefit from autovacuum. Running +a manual vacuum seems to still be doing a LOT, which suggests to me +that I should either run a cron job and disable autovacuum, or just +run a cron job on top of autovacuum. +The problem is that if I run the same query (an update query) on the +db it takes 4 - 6 times longer than on a fresh copy (dumped then +restored to a different name on the same machine/postgres). There is +clearly an issue here... +I have been thinking about strategies and am still a bit lost. Our +apps are up 24/7 and we didn't code for the eventuality of having the +db going offline for maintenance... we live and learn! +Would it be wise to, every week or so, dump then restore the db +(closing all our apps and then restarting them)? The dump is only +about 270MB, and restore is about 10mins (quite a few large indexes). +It seems that we have no real need for vacuum full (I am clutching at +straws here...), so in theory I could just vacuum/analyse/reindex and +things would be OK. Will a fresh restore be much more performant than +a fully vacuumed/analysed/reindexed db? Probably? Possibly? +I believe I understand the autovacuum docs but... +Help! +8-] +Cheers +Antoine + +-- +This is where I should put some witty comment. + +From pgsql-performance-owner@postgresql.org Thu Jun 1 12:06:04 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D4BEA9FA5DC + for ; + Thu, 1 Jun 2006 12:06:03 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 16685-06 + for ; + Thu, 1 Jun 2006 12:05:59 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 5C4079FA040 + for ; + Thu, 1 Jun 2006 12:05:57 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k51F5t1f012385; + Thu, 1 Jun 2006 11:05:55 -0400 (EDT) +To: Antoine +cc: pgsql-performance@postgresql.org +Subject: Re: vacuuming problems continued +In-reply-to: <92d3a4950606010454y67293765o56001e8996975b45@mail.gmail.com> +References: <92d3a4950606010454y67293765o56001e8996975b45@mail.gmail.com> +Comments: In-reply-to Antoine + message dated "Thu, 01 Jun 2006 13:54:08 +0200" +Date: Thu, 01 Jun 2006 11:05:55 -0400 +Message-ID: <12384.1149174355@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/4 +X-Sequence-Number: 19361 + +Antoine writes: +> We just don't seem to be getting much benefit from autovacuum. Running +> a manual vacuum seems to still be doing a LOT, which suggests to me +> that I should either run a cron job and disable autovacuum, or just +> run a cron job on top of autovacuum. + +The default autovac parameters are very unaggressive --- have you +experimented with changing them? Do you have the FSM set large enough? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jun 1 14:37:12 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 620399FA5C8 + for ; + Thu, 1 Jun 2006 14:37:11 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 35959-08 + for ; + Thu, 1 Jun 2006 14:37:03 -0300 (ADT) +X-Greylist: delayed 00:20:00.936809 by SQLgrey- +Received: from dfbsa63.conab.gov.br (dfbsa63.conab.gov.br [200.140.131.205]) + by postgresql.org (Postfix) with ESMTP id 085BC9FA040 + for ; + Thu, 1 Jun 2006 14:37:02 -0300 (ADT) +Received: from gesin293 (unknown [10.1.21.216]) + by dfbsa63.conab.gov.br (Postfix) with SMTP id CB1D74C193 + for ; + Thu, 1 Jun 2006 14:16:58 -0300 (BRT) +Message-ID: <002b01c6859f$4f6a7930$d815010a@gesin293> +From: "Joao" +To: +Subject: help me problems with pg_clog file +Date: Thu, 1 Jun 2006 14:17:50 -0300 +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_NextPart_000_0028_01C68586.2A13A440" +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 6.00.2900.2869 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/5 +X-Sequence-Number: 19362 + +This is a multi-part message in MIME format. + +------=_NextPart_000_0028_01C68586.2A13A440 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + +when i try do \d in psql on a table i get this message! +this happens too when i try to run pg_dump... + +ERROR: could not access status of transaction 4294967295 +DETAIL: could not open file "pg_clog/0FFF": File or directory not found + + +someone could help me?? PleasE! + + + + +------=_NextPart_000_0028_01C68586.2A13A440 +Content-Type: text/html; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + + + + + + + + +
+
when i try do \d in psql on a table i = +get this=20 +message!
+
this happens too when i try to run pg_dump...
+
 
+
ERROR:  could not access status of = +transaction=20 +4294967295
DETAIL:  could not open file "pg_clog/0FFF": File or=20 +directory not found
+
 
+
 
+
someone could help me?? PleasE!
+
 
+
 
+

+ +------=_NextPart_000_0028_01C68586.2A13A440-- + + +From pgsql-performance-owner@postgresql.org Thu Jun 1 15:04:55 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 522109FA040 + for ; + Thu, 1 Jun 2006 15:04:55 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 42078-07 + for ; + Thu, 1 Jun 2006 15:04:49 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from wx-out-0102.google.com (wx-out-0102.google.com [66.249.82.195]) + by postgresql.org (Postfix) with ESMTP id 5FC4D9FA5C8 + for ; + Thu, 1 Jun 2006 15:04:47 -0300 (ADT) +Received: by wx-out-0102.google.com with SMTP id h30so257827wxd + for ; + Thu, 01 Jun 2006 11:04:46 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=ED04lpUyovbvjEDA3d8Mz0HWpvA9DmyBrU4S8wEnaBRPylSzm5wwl2t1Dvzz0vDm+y+6/aXMNnvPbzs6QhXxafTMRg2PTnFVX+g+uFMYotMkkexBFTeGJO+qyRR2K4z+b1FwaejEXOu9kh4kEHl2sb6xd2m+QWGcuGftRO/YcCQ= +Received: by 10.70.40.12 with SMTP id n12mr1111034wxn; + Thu, 01 Jun 2006 11:04:46 -0700 (PDT) +Received: by 10.70.113.12 with HTTP; Thu, 1 Jun 2006 11:04:46 -0700 (PDT) +Message-ID: +Date: Thu, 1 Jun 2006 14:04:46 -0400 +From: "Michael Artz" +To: "Jim C. Nasby" +Subject: Re: Bulk loading/merging +Cc: pgsql-performance@postgresql.org +In-Reply-To: <20060531010922.GC59464@pervasive.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_5871_19810709.1149185086675" +References: + <20060531010922.GC59464@pervasive.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/6 +X-Sequence-Number: 19363 + +------=_Part_5871_19810709.1149185086675 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +On 5/30/06, Jim C. Nasby wrote: + +> Your best bet is to do this as a single, bulk operation if possible. +> That way you can simply do an UPDATE ... WHERE EXISTS followed by an +> INSERT ... SELECT ... WHERE NOT EXISTS. + + + + hmm, I don't quite understand what you are saying and I think my +basic misunderstanding is how to use the UPDATE ... WHERE EXISTS to merge +data in bulk. Assuming that I bulk COPYed the data into a temporary +table, I'd need to issue an UPDATE for each row in the newly created table, +right? + +For example, for a slightly different key,count schema: + +CREATE TABLE kc (key integer, count integer); + +and wanting to merge the following data by just updating the count for a +given key to the equivalent of OLD.count + NEW.count: + +1,10 +2,15 +3,45 +1,30 + +How would I go about using UPDATE ... WHERE EXISTS to update the "master" kc +table from a (temporary) table loaded with the above data? + +------=_Part_5871_19810709.1149185086675 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +
On 5/30/06, Jim C. Nasby <jnasby@pervasive.com> wrote:
+
+
Your best bet is to do this as a single, bulk operation if possible.
That way you can simply do an UPDATE ... WHERE EXISTS followed by an +
INSERT ... SELECT ... WHERE NOT EXISTS.
+
 
+
 
+
+
hmm, I don't quite understand what you are saying and I think my basic misunderstanding is how to use the UPDATE ... WHERE EXISTS to merge data in bulk.  Assuming that I bulk COPYed the data into a temporary table, I'd need to issue an UPDATE for each row in the newly created table, right?  +
+
 
+
For example, for a slightly different key,count schema:
+
 
+
CREATE TABLE kc (key integer, count integer);
+
 
+
and wanting to merge the following data by just updating the count for a given key to the equivalent of OLD.count + NEW.count:
+
 
+
1,10
+
2,15
+
3,45
+
1,30
+
 
+
How would I go about using UPDATE ... WHERE EXISTS to update the "master" kc table from a (temporary) table loaded with the above data?
+
 
+
 
+ +------=_Part_5871_19810709.1149185086675-- + +From pgsql-admin-owner@postgresql.org Fri Jun 2 04:41:34 2006 +X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8DD9A9FA5E9 + for ; + Fri, 2 Jun 2006 04:41:34 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 36578-06 + for ; + Fri, 2 Jun 2006 04:41:29 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.171]) + by postgresql.org (Postfix) with ESMTP id 9B6FD9FA111 + for ; Fri, 2 Jun 2006 04:41:29 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so384648ugf + for ; Fri, 02 Jun 2006 00:41:28 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=FBF8JjscSYoMQrOapFmSfDItMv5H9Rs4bvVcrav0S3ugYXOGTZ1EG4bvF/wAgtO+acb4YsdXE+VsuyBTNtTNSFS47jWkBC71lmYij7agzuuvH+IeN9Ssu6xhfpQ/C9qx4RL7JYld1ZbyqvQyyrGzmfX3WzqojZY+vjqc58pOrQs= +Received: by 10.66.250.17 with SMTP id x17mr506806ugh; + Fri, 02 Jun 2006 00:41:28 -0700 (PDT) +Received: by 10.66.222.12 with HTTP; Fri, 2 Jun 2006 00:41:27 -0700 (PDT) +Message-ID: <674d1f8a0606020041t42878fadxd154cb076a27cdaa@mail.gmail.com> +Date: Fri, 2 Jun 2006 13:11:27 +0530 +From: "Gourish Singbal" +To: Joao +Subject: Re: [PERFORM] help me problems with pg_clog file +Cc: pgsql-performance@postgresql.org, + "pgsql-admin@postgresql.org" +In-Reply-To: <002b01c6859f$4f6a7930$d815010a@gesin293> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_4472_12282173.1149234087932" +References: <002b01c6859f$4f6a7930$d815010a@gesin293> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/7 +X-Sequence-Number: 21969 + +------=_Part_4472_12282173.1149234087932 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Joao, + +If you had send the Email to pgsql-admin mailing list you would have got a +faster answer to ur query.. + +here is what i managed to do:- +1. I deleted the +$ls -lart the pg_clog folder +total 756 +-rw------- 1 postgres users 262144 2006-04-10 17:16 0001 +-rw------- 1 postgres users 262144 2006-04-10 17:16 0000 +drwx------ 2 postgres users 4096 2006-04-10 17:16 . +-rw------- 1 postgres users 229376 2006-05-31 18:17 0002 +drwx------ 10 postgres users 4096 2006-06-02 12:22 .. +$ mv 0002 ../ +$ ls +0000 0001 +$psql regression +regression=# select count(1) from accounts; +ERROR: could not access status of transaction 2225656 +DETAIL: could not open file "pg_clog/0002": No such file or directory +regression=# \q + +This Error came since the 0002 file from the pg_clog folder was missing. +Since the logs are missing from pg_clog folder can perfom pg_resetxlogs to +reset the logs and bring up the database. + +$ /usr/local/pgsql/bin/pg_ctl -D /newdisk/postgres/data -l +/newdisk/postgres/data_log stop +waiting for postmaster to shut down... done +postmaster stopped + +$ /usr/local/pgsql/bin/pg_resetxlog -x 2999800 /newdisk/postgres/data +Transaction log reset + +The Value 2999800 u can get if u see the postgresql output file during +startup or using +grep "next transaction ID" /newdisk/postgres/data_log + +than did the following:- +/usr/local/pgsql/bin/psql regression + +regression=# select count(1) from accounts; + count +--------- + 1000001 +(1 row) + +regression=# \q +You can get more info from +http://unix.business.utah.edu/doc/applications/postgres/postgres-html/app-pgresetxlog.html + +Hope this gives u some usefull information in solving ur recovery condition. + +~gourish + +On 6/1/06, Joao wrote: +> +> when i try do \d in psql on a table i get this message! +> this happens too when i try to run pg_dump... +> +> ERROR: could not access status of transaction 4294967295 +> DETAIL: could not open file "pg_clog/0FFF": File or directory not found +> +> +> someone could help me?? PleasE! +> +> +> +> +> + + + +-- +Best, +Gourish Singbal + +------=_Part_4472_12282173.1149234087932 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +
 
+
Joao,
+
 
+
If you had send the Email to pgsql-admin mailing list you would have got a faster answer to ur query..
+
 
+
here is what i managed to do:-
+
1. I deleted the
+
$ls -lart the pg_clog folder
+
total 756
-rw-------   1 postgres users 262144 2006-04-10 17:16 0001
-rw-------   1 postgres users 262144 2006-04-10 17:16 0000
drwx------   2 postgres users   4096 2006-04-10 17:16 .
-rw-------   1 postgres users 229376 2006-05-31 18:17 0002 +
drwx------  10 postgres users   4096 2006-06-02 12:22 ..
$ mv 0002 ../
$ ls
0000  0001
$psql regression
+
regression=# select count(1) from accounts;
ERROR:  could not access status of transaction 2225656
DETAIL:  could not open file "pg_clog/0002": No such file or directory
regression=# \q

This Error came since the 0002 file from the pg_clog folder was missing. +
Since the logs are missing from pg_clog folder can perfom pg_resetxlogs to reset the logs and bring up the database.
+
 
+
$ /usr/local/pgsql/bin/pg_ctl -D /newdisk/postgres/data -l /newdisk/postgres/data_log stop
waiting for postmaster to shut down... done
postmaster stopped
 
+
$ /usr/local/pgsql/bin/pg_resetxlog -x 2999800 /newdisk/postgres/data
Transaction log reset
 
+
The Value 2999800 u can get if u see the postgresql output file during startup or using  
+
grep "next transaction ID" /newdisk/postgres/data_log
+
 
+
than did the following:-
+
/usr/local/pgsql/bin/psql regression
+
+

regression=# select count(1) from accounts;
  count
---------
 1000001
(1 row)

+

regression=# \q

+
You can get more info from
+ +
 
+
Hope this gives u some usefull information in solving ur recovery condition.
+
 
+
~gourish
+
 
+
On 6/1/06, Joao <joao.junior@conab.gov.br> wrote: +
+
+
+
+
when i try do \d in psql on a table i get this message!
+
this happens too when i try to run pg_dump...
+
 
+
ERROR:  could not access status of transaction 4294967295
DETAIL:  could not open file "pg_clog/0FFF": File or directory not found
+
 
+
 
+
someone could help me?? PleasE!
+
 
+
 
+

 



--
Best,
Gourish Singbal + +------=_Part_4472_12282173.1149234087932-- + +From pgsql-performance-owner@postgresql.org Sat Jun 3 22:24:18 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E94F99FA1A8 + for ; + Fri, 2 Jun 2006 09:43:34 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 53148-08 + for ; + Fri, 2 Jun 2006 09:43:29 -0300 (ADT) +X-Greylist: delayed 00:25:43.135324 by SQLgrey- +Received: from office1.i-free.ru (office1.i-free.ru [81.222.216.82]) + by postgresql.org (Postfix) with ESMTP id 5D16B9FA040 + for ; + Fri, 2 Jun 2006 09:43:29 -0300 (ADT) +Received: from [192.168.0.185] (helo=mail.i-free.local) + by office1.i-free.ru with esmtp (Exim 3.36 #1 (Debian)) + id 1Fm8as-0007AV-00 + for ; Fri, 02 Jun 2006 16:17:34 +0400 +Received: from deepcore.i-free.ru ([192.168.0.250]) by mail.i-free.local with + Microsoft SMTPSVC(6.0.3790.1830); Fri, 2 Jun 2006 16:17:24 +0400 +Date: Fri, 2 Jun 2006 16:17:35 +0400 +From: Evgeny Gridasov +To: pgsql-performance@postgresql.org +Subject: Re: pg_dump issue +Message-Id: <20060602161735.2a24bc5a.eugene@i-free.ru> +In-Reply-To: + <9765373733A7DF4681B12225D2FC44050D6D0C@bosexprod001.bostonstock.local> +References: + <9765373733A7DF4681B12225D2FC44050D6D0C@bosexprod001.bostonstock.local> +Organization: i-free.ru +X-Mailer: Sylpheed version 2.2.5 (GTK+ 2.6.4; i686-pc-linux-gnu) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-OriginalArrivalTime: 02 Jun 2006 12:17:24.0206 (UTC) + FILETIME=[814D50E0:01C6863E] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/27 +X-Sequence-Number: 19384 + + +try to dump-restore your 'slow' database, +this might help if your db or filesystem gets too fragmented. + +On Tue, 30 May 2006 10:31:08 -0400 +"mcelroy, tim" wrote: + +> Good morning, +> +> I have identical postgres installations running on identical machines. Dual +> Core AMD Opteron(tm) Processor 870 , 16GB RAM, Red Hat Linux 3.2.3-20 and +> 120GB worth of disk space on two drives. +> +> Recently, I have noticed that my nightly backups take longer on one machine +> than on the other. I back up five (5) databases totaling 8.6GB in size. On +> Prod001 the backups take app. 7 minutes, on Prod002 the backups take app. 26 +> minutes! Quite a discrepancy. I checked myself than checked with our +> Engineering staff and have been assured that the machines are identical +> hardware wise, CPU, disk, etc. +> +> Question; has anyone run into a similar issue? Here is the command I use +> for the nightly backup on both machines: +> +> pg_dump -F c -f $DB.backup.$DATE $DB +> +> Kind of scratching my head on this one.... +> +> Thank you, +> Tim McElroy +> +> + + +-- +Evgeny Gridasov +Software Engineer +I-Free, Russia + +From pgsql-performance-owner@postgresql.org Fri Jun 2 15:26:00 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B23829FA43C + for ; + Fri, 2 Jun 2006 15:25:59 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 03069-05 + for ; + Fri, 2 Jun 2006 15:25:51 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from buniche.hst.terra.com.br (buniche.hst.terra.com.br + [200.176.10.197]) + by postgresql.org (Postfix) with ESMTP id 5E56E9FA0E5 + for ; + Fri, 2 Jun 2006 15:25:51 -0300 (ADT) +Received: from caliope.hst.terra.com.br (caliope.hst.terra.com.br + [200.176.10.8]) + by buniche.hst.terra.com.br (Postfix) with ESMTP id 620933DD806D + for ; + Fri, 2 Jun 2006 15:25:49 -0300 (BRT) +X-Terra-Karma: -2% +X-Terra-Hash: 8aca679a3c73cf18c4a9f366fd738244 +Received-SPF: pass (caliope.hst.terra.com.br: domain of terra.com.br + designates 200.176.10.8 as permitted sender) + client-ip=200.176.10.8; envelope-from=carlosreimer@terra.com.br; + helo=reimer; +Received: from reimer (unknown [200.180.59.84]) + (authenticated user carlosreimer@terra.com.br) + by caliope.hst.terra.com.br (Postfix) with ESMTP id F35C41BD4146 + for ; + Fri, 2 Jun 2006 15:25:48 -0300 (BRT) +Reply-To: +From: +To: +Subject: Initial database loading and IDE x SCSI +Date: Fri, 2 Jun 2006 15:25:57 -0300 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 8bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +Importance: Normal +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/8 +X-Sequence-Number: 19365 + +Hi, + +I would like to know if my supposition is right. + +Considering an environment with only one hard disk attached to a server, an +initial loading of the database probably is much faster using an IDE/ATA +interface with write-back on than using an SCSI interface. That�s because of +the SCSI command interface overhead. + +Then main advantage of SCSI interfaces, the multiuser environment is lost in +this scenery. + +Am I right? Am I missing something here? + +Even if I�m right, is something that could be done too improove SCSI loading +performance in this scenery? + +Thanks in advance! + +Reimer + + +From pgsql-performance-owner@postgresql.org Fri Jun 2 15:40:22 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2303C9FA43C + for ; + Fri, 2 Jun 2006 15:40:22 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 05232-06 + for ; + Fri, 2 Jun 2006 15:40:13 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 2C50D9FA0E5 + for ; + Fri, 2 Jun 2006 15:40:12 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Fri, 2 Jun 2006 18:40:11 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 02 Jun 2006 13:40:11 -0500 +Subject: Re: Initial database loading and IDE x SCSI +From: Scott Marlowe +To: carlosreimer@terra.com.br +Cc: pgsql-performance@postgresql.org +In-Reply-To: +References: +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: quoted-printable +Message-Id: <1149273611.25526.169.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Fri, 02 Jun 2006 13:40:11 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/9 +X-Sequence-Number: 19366 + +On Fri, 2006-06-02 at 13:25, carlosreimer@terra.com.br wrote: +> Hi, +>=20 +> I would like to know if my supposition is right. +>=20 +> Considering an environment with only one hard disk attached to a server, = +an +> initial loading of the database probably is much faster using an IDE/ATA +> interface with write-back on than using an SCSI interface. That=C2=B4s be= +cause of +> the SCSI command interface overhead. +>=20 +> Then main advantage of SCSI interfaces, the multiuser environment is lost= + in +> this scenery. +>=20 +> Am I right? Am I missing something here? +>=20 +> Even if I=C2=B4m right, is something that could be done too improove SCSI= + loading +> performance in this scenery? + +The answer is yes. And no. + +IDE drives notoriously lie about their cache, so that if you have the +cache enabled, the IDE drive will nominally ack to an fsync before it's +actually written the data. So, the IDE drive will write faster, but +your data probably won't survive a system crash or power loss during a +write. If you turn off the cache, then the IDE drive will be much +slower. + +SCSI overhead isn't really a big issue during loads because you're +usually writing data at a good clip, and the overhead of SCSI is pretty +small by comparison to how much data you'll be slinging. + +However, SCSI drives don't lie about Fsync, so the maximum speed of your +output will be limited by the speed at which your machine can fsync the +pg_xlog output. =20 + +For a single disk system, just doing development or a reporting +database, an IDE drive is often just fine. But under no circumstances +should you put an accounting system on a single drive, especially IDE +with cache turned on. + +From pgsql-performance-owner@postgresql.org Fri Jun 2 15:41:44 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7CD919FA5B5 + for ; + Fri, 2 Jun 2006 15:41:44 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 05333-10 + for ; + Fri, 2 Jun 2006 15:41:35 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) + by postgresql.org (Postfix) with ESMTP id 7F8589FA43C + for ; + Fri, 2 Jun 2006 15:41:33 -0300 (ADT) +Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP + with MS-WebStorage 6.0.6249 +Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; + 02 Jun 2006 11:41:27 -0700 +Subject: Re: Initial database loading and IDE x SCSI +From: Mark Lewis +To: carlosreimer@terra.com.br +Cc: pgsql-performance@postgresql.org +In-Reply-To: +References: +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable +Organization: MIR3, Inc. +Date: Fri, 02 Jun 2006 11:41:27 -0700 +Message-Id: <1149273687.20798.91.camel@archimedes> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-27) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/10 +X-Sequence-Number: 19367 + +On Fri, 2006-06-02 at 15:25 -0300, carlosreimer@terra.com.br wrote: +> Hi, +>=20 +> I would like to know if my supposition is right. +>=20 +> Considering an environment with only one hard disk attached to a server, = +an +> initial loading of the database probably is much faster using an IDE/ATA +> interface with write-back on than using an SCSI interface. That=C2=B4s be= +cause of +> the SCSI command interface overhead. + +No, it's because the SCSI drive is honoring the database's request to +make sure the data is safe. + +> Then main advantage of SCSI interfaces, the multiuser environment is lost= + in +> this scenery. +>=20 +> Am I right? Am I missing something here? +>=20 +> Even if I=C2=B4m right, is something that could be done too improove SCSI= + loading +> performance in this scenery? + +You can perform the initial load in large transactions. The extra +overhead for ensuring that data is safely written to disk will only be +incurred once per transaction, so try to minimize the number of +transactions. + +You could optionally set fsync=3Doff in postgresql.conf, which means that +the SCSI drive will operate with no more safety than an IDE drive. But +you should only do that if you're willing to deal with catastrophic data +corruption. But if this is for a desktop application where you need to +support IDE drives, you'll need to deal with that anyway. + +> Thanks in advance! +>=20 +> Reimer +>=20 +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: explain analyze is your friend + +From pgsql-performance-owner@postgresql.org Fri Jun 2 15:43:10 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6E2E19FA43C + for ; + Fri, 2 Jun 2006 15:43:10 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 06458-07 + for ; + Fri, 2 Jun 2006 15:43:02 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id DF19E9FA5B5 + for ; + Fri, 2 Jun 2006 15:43:01 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k52Ih0vP009065; + Fri, 2 Jun 2006 14:43:00 -0400 (EDT) +To: carlosreimer@terra.com.br +cc: pgsql-performance@postgresql.org +Subject: Re: Initial database loading and IDE x SCSI +In-reply-to: +References: +Comments: In-reply-to + message dated "Fri, 02 Jun 2006 15:25:57 -0300" +Date: Fri, 02 Jun 2006 14:43:00 -0400 +Message-ID: <9064.1149273780@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/11 +X-Sequence-Number: 19368 + + writes: +> I would like to know if my supposition is right. + +> Considering an environment with only one hard disk attached to a server, an +> initial loading of the database probably is much faster using an IDE/ATA +> interface with write-back on than using an SCSI interface. That�s because of +> the SCSI command interface overhead. + +I *seriously* doubt that. + +If you see a difference in practice it's likely got more to do with the +SCSI drive not lying about write-complete ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Jun 2 16:54:52 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 17CB29FA220 + for ; + Fri, 2 Jun 2006 16:54:52 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 14667-02 + for ; + Fri, 2 Jun 2006 16:54:44 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from burta.hst.terra.com.br (burta.hst.terra.com.br + [200.176.10.199]) + by postgresql.org (Postfix) with ESMTP id D10DE9FA0E5 + for ; + Fri, 2 Jun 2006 16:54:43 -0300 (ADT) +Received: from caledonia.hst.terra.com.br (caledonia.hst.terra.com.br + [200.176.10.7]) + by burta.hst.terra.com.br (Postfix) with ESMTP id E0B0A4B78060; + Fri, 2 Jun 2006 16:54:41 -0300 (BRT) +X-Terra-Karma: -2% +X-Terra-Hash: aaf2702f83eeab733eb62c0e76412991 +Received-SPF: pass (caledonia.hst.terra.com.br: domain of terra.com.br + designates 200.176.10.7 as permitted sender) + client-ip=200.176.10.7; envelope-from=carlosreimer@terra.com.br; + helo=reimer; +Received: from reimer (unknown [200.180.59.84]) + (authenticated user carlosreimer@terra.com.br) + by caledonia.hst.terra.com.br (Postfix) with ESMTP id 858EE2338132; + Fri, 2 Jun 2006 16:54:41 -0300 (BRT) +Reply-To: +From: +To: "Tom Lane" +Cc: +Subject: RES: Initial database loading and IDE x SCSI +Date: Fri, 2 Jun 2006 16:54:50 -0300 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 8bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) +In-Reply-To: <9064.1149273780@sss.pgh.pa.us> +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +Importance: Normal +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.144 tagged_above=0 required=5 tests=AWL, BAYES_00, + DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, NO_REAL_NAME, + RCVD_IN_BL_SPAMCOP_NET, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200606/12 +X-Sequence-Number: 19369 + +> writes: +> > I would like to know if my supposition is right. +> +> > Considering an environment with only one hard disk attached to +> a server, an +> > initial loading of the database probably is much faster using an IDE/ATA +> > interface with write-back on than using an SCSI interface. +> That�s because of +> > the SCSI command interface overhead. +> +> I *seriously* doubt that. +> +> If you see a difference in practice it's likely got more to do with the +> SCSI drive not lying about write-complete ... +> + +Many thanks for the answers! There are some more thinks I could not +understand about this issue? + +I was considering it but if you have a lot of writes operations, will not +the disk cache full quickly? + +If it�s full will not the system wait until something could be write to the +disk surface? + +If you have almost all the time the cache full will it not useless? + +Should not, in this scenary, with almost all the time the cache full, IDE +and SCSI write operations have almost the same performance? + +Thanks in advance, + +Reimer + + + +From pgsql-performance-owner@postgresql.org Fri Jun 2 17:14:19 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 71D519FA220 + for ; + Fri, 2 Jun 2006 17:14:19 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 14979-06 + for ; + Fri, 2 Jun 2006 17:14:09 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) + by postgresql.org (Postfix) with ESMTP id 68AC09FA0E5 + for ; + Fri, 2 Jun 2006 17:14:09 -0300 (ADT) +Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP + with MS-WebStorage 6.0.6249 +Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; + 02 Jun 2006 13:13:29 -0700 +Subject: Re: RES: Initial database loading and IDE x SCSI +From: Mark Lewis +To: carlosreimer@terra.com.br +Cc: Tom Lane , pgsql-performance@postgresql.org +In-Reply-To: +References: +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable +Organization: MIR3, Inc. +Date: Fri, 02 Jun 2006 13:13:29 -0700 +Message-Id: <1149279209.20798.108.camel@archimedes> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-27) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/13 +X-Sequence-Number: 19370 + +On Fri, 2006-06-02 at 16:54 -0300, carlosreimer@terra.com.br wrote: +> > writes: +> > > I would like to know if my supposition is right. +> > +> > > Considering an environment with only one hard disk attached to +> > a server, an +> > > initial loading of the database probably is much faster using an IDE/= +ATA +> > > interface with write-back on than using an SCSI interface. +> > That=C2=B4s because of +> > > the SCSI command interface overhead. +> > +> > I *seriously* doubt that. +> > +> > If you see a difference in practice it's likely got more to do with the +> > SCSI drive not lying about write-complete ... +> > +>=20 +> Many thanks for the answers! There are some more thinks I could not +> understand about this issue? +>=20 +> I was considering it but if you have a lot of writes operations, will not +> the disk cache full quickly? +>=20 +> If it=C2=B4s full will not the system wait until something could be write= + to the +> disk surface? +>=20 +> If you have almost all the time the cache full will it not useless? +>=20 +> Should not, in this scenary, with almost all the time the cache full, IDE +> and SCSI write operations have almost the same performance? +>=20 + +This is the ideal case. However, you only get to that case if you use +large transactions or run with fsync=3Doff or run with a write cache (like +IDE drives, or nice RAID controllers which have a battery-backed cache). + +Remember that one of the important qualities of a transaction is that +it's durable, so once you commit it the data is definitely stored on the +disk and one nanosecond later you could power the machine off and it +would still be there. + +To achieve that durability guarantee, the system needs to make sure that +if you commit a transaction, the data is actually written to the +physical platters on the hard drive. + +This means that if you take the naive approach to importing data (one +row at a time, each in its own transaction), then instead of blasting +data onto the hard drive at maximum speed, the application will wait for +the platter to rotate to the right position, write one row's worth of +data, then wait for the platter to rotate to the right position again +and insert another row, etc. This approach is very slow. + +The naive approach works on IDE drives because they don't (usually) +honor the request to write the data immediately, so it can fill its +write cache up with several megabytes of data and write it out to the +disk at its leisure. + +> Thanks in advance, +>=20 +> Reimer +>=20 + +-- Mark + +From pgsql-performance-owner@postgresql.org Fri Jun 2 17:37:05 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 09E869FA220 + for ; + Fri, 2 Jun 2006 17:37:05 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 18162-02 + for ; + Fri, 2 Jun 2006 17:36:57 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from bundure.hst.terra.com.br (bundure.hst.terra.com.br + [200.176.10.195]) + by postgresql.org (Postfix) with ESMTP id 228F29FA0E5 + for ; + Fri, 2 Jun 2006 17:36:56 -0300 (ADT) +Received: from caiguna.hst.terra.com.br (caiguna.hst.terra.com.br + [200.176.10.4]) + by bundure.hst.terra.com.br (Postfix) with ESMTP id 866109A0276; + Fri, 2 Jun 2006 17:36:55 -0300 (BRT) +X-Terra-Karma: -2% +X-Terra-Hash: 298ece97623891779f2a4809626ac184 +Received-SPF: pass (caiguna.hst.terra.com.br: domain of terra.com.br + designates 200.176.10.4 as permitted sender) + client-ip=200.176.10.4; envelope-from=carlosreimer@terra.com.br; + helo=reimer; +Received: from reimer (unknown [200.180.59.84]) + (authenticated user carlosreimer@terra.com.br) + by caiguna.hst.terra.com.br (Postfix) with ESMTP id F240AD28160; + Fri, 2 Jun 2006 17:36:52 -0300 (BRT) +Reply-To: +From: +To: "Mark Lewis" +Cc: "Tom Lane" , + +Subject: RES: RES: Initial database loading and IDE x SCSI +Date: Fri, 2 Jun 2006 17:37:01 -0300 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: quoted-printable +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) +In-Reply-To: <1149279209.20798.108.camel@archimedes> +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +Importance: Normal +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/14 +X-Sequence-Number: 19371 + +Many thanks Mark, + +I will consider fsync=3Doff only to do an initial load, not for a = +database normal operation. + +I was just thinking about this hipotetical scenario:=20 +a) a restore database operation +b) fsync off +c) write-back on (IDE) + +As I could understand, in this sceneraio, it=C2=B4s normal the IDE drive = +be faster than the SCSI, ok? + +Of course, the database is exposed because of the fsync=3Doff, but if = +you consider only the system performance, then it is true. Isn=C2=B4t = +it? + +Thanks, + +Reimer + + + +From pgsql-performance-owner@postgresql.org Fri Jun 2 17:44:40 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5F59A9FA220 + for ; + Fri, 2 Jun 2006 17:44:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 18147-05 + for ; + Fri, 2 Jun 2006 17:44:30 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) + by postgresql.org (Postfix) with ESMTP id 84B549FA0E5 + for ; + Fri, 2 Jun 2006 17:44:30 -0300 (ADT) +Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP + with MS-WebStorage 6.0.6249 +Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; + 02 Jun 2006 13:44:05 -0700 +Subject: Re: RES: RES: Initial database loading and IDE x SCSI +From: Mark Lewis +To: carlosreimer@terra.com.br +Cc: Tom Lane , pgsql-performance@postgresql.org +In-Reply-To: +References: +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable +Organization: MIR3, Inc. +Date: Fri, 02 Jun 2006 13:44:04 -0700 +Message-Id: <1149281044.20798.116.camel@archimedes> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-27) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/15 +X-Sequence-Number: 19372 + +On Fri, 2006-06-02 at 17:37 -0300, carlosreimer@terra.com.br wrote: +> Many thanks Mark, +>=20 +> I will consider fsync=3Doff only to do an initial load, not for a databas= +e normal operation. +>=20 + +This approach works well. You just need to remember to shut down the +database and start it back up again with fsync enabled for it to be safe +after the initial load. + +> I was just thinking about this hipotetical scenario:=20 +> a) a restore database operation +> b) fsync off +> c) write-back on (IDE) +>=20 +> As I could understand, in this sceneraio, it=C2=B4s normal the IDE drive = +be faster than the SCSI, ok? +>=20 + +If fsync is off, then the IDE drive loses its big advantage, so IDE and +SCSI should be about the same speed. + +> Of course, the database is exposed because of the fsync=3Doff, but if you= + consider only the system performance, then it is true. Isn=C2=B4t it? + + + +> Thanks, +>=20 +> Reimer +>=20 +>=20 + +From pgsql-performance-owner@postgresql.org Fri Jun 2 17:55:39 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7EDCA9FA220 + for ; + Fri, 2 Jun 2006 17:55:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 20068-05 + for ; + Fri, 2 Jun 2006 17:55:31 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from buraja.hst.terra.com.br (buraja.hst.terra.com.br + [200.176.10.198]) + by postgresql.org (Postfix) with ESMTP id B3BAE9FA0E5 + for ; + Fri, 2 Jun 2006 17:55:31 -0300 (ADT) +Received: from tacamaca.hst.terra.com.br (tacamaca.hst.terra.com.br + [200.176.10.13]) + by buraja.hst.terra.com.br (Postfix) with ESMTP id 48AB622A40EE; + Fri, 2 Jun 2006 17:55:29 -0300 (BRT) +X-Terra-Karma: -2% +X-Terra-Hash: 24ece3181ad89ea8b2f3aa529865f561 +Received-SPF: pass (tacamaca.hst.terra.com.br: domain of terra.com.br + designates 200.176.10.13 as permitted sender) + client-ip=200.176.10.13; envelope-from=carlosreimer@terra.com.br; + helo=reimer; +Received: from reimer (unknown [200.180.59.84]) + (authenticated user carlosreimer@terra.com.br) + by tacamaca.hst.terra.com.br (Postfix) with ESMTP id 9257243440F5; + Fri, 2 Jun 2006 17:55:29 -0300 (BRT) +Reply-To: +From: +To: "Mark Lewis" +Cc: +Subject: RES: RES: RES: Initial database loading and IDE x SCSI +Date: Fri, 2 Jun 2006 17:55:38 -0300 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: quoted-printable +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) +In-Reply-To: <1149281044.20798.116.camel@archimedes> +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +Importance: Normal +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/16 +X-Sequence-Number: 19373 + +> > Many thanks Mark, +> >=20 +> > I will consider fsync=3Doff only to do an initial load, not for a=20 +> database normal operation. +> >=20 +>=20 +> This approach works well. You just need to remember to shut down the +> database and start it back up again with fsync enabled for it to be = +safe +> after the initial load. +>=20 +> > I was just thinking about this hipotetical scenario:=20 +> > a) a restore database operation +> > b) fsync off +> > c) write-back on (IDE) +> >=20 +> > As I could understand, in this sceneraio, it=C2=B4s normal the IDE=20 +> drive be faster than the SCSI, ok? +> >=20 +>=20 +> If fsync is off, then the IDE drive loses its big advantage, so IDE = +and +> SCSI should be about the same speed. +>=20 +Sorry, I would like to say fsync on instead of fsync off. But I think I = +understood. + +With fsync off the performance should be almost the same (SCSI and IDE), = +and with fsync on=20 +the IDE will be faster, but data are exposed. + +Thanks! + + +From pgsql-performance-owner@postgresql.org Fri Jun 2 21:13:43 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 73EEC9FA30C + for ; + Fri, 2 Jun 2006 21:13:42 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 37366-10 + for ; + Fri, 2 Jun 2006 21:13:32 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from linda-4.paradise.net.nz (bm-4a.paradise.net.nz + [203.96.152.183]) + by postgresql.org (Postfix) with ESMTP id 4B5A99FA2C7 + for ; + Fri, 2 Jun 2006 21:13:31 -0300 (ADT) +Received: from smtp-3.paradise.net.nz + (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by + linda-4.paradise.net.nz (Paradise.net.nz) with ESMTP id + <0J0900CZCCMG77@linda-4.paradise.net.nz> for + pgsql-performance@postgresql.org; Sat, 03 Jun 2006 12:13:28 +1200 (NZST) +Received: from [192.168.1.11] (218-101-29-24.dsl.clear.net.nz [218.101.29.24]) + by smtp-3.paradise.net.nz (Postfix) with ESMTP id 1D2CE12B3467; Sat, + 03 Jun 2006 12:13:28 +1200 (NZST) +Date: Sat, 03 Jun 2006 12:13:27 +1200 +From: Mark Kirkwood +Subject: Re: RES: Initial database loading and IDE x SCSI +In-reply-to: <1149279209.20798.108.camel@archimedes> +To: carlosreimer@terra.com.br +Cc: Mark Lewis , Tom Lane , + pgsql-performance@postgresql.org +Message-id: <4480D427.50207@paradise.net.nz> +MIME-version: 1.0 +Content-type: text/plain; format=flowed; charset=UTF-8 +Content-transfer-encoding: 7bit +User-Agent: Thunderbird 1.5 (X11/20060417) +References: + <1149279209.20798.108.camel@archimedes> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/17 +X-Sequence-Number: 19374 + +Mark Lewis wrote: + +> +> The naive approach works on IDE drives because they don't (usually) +> honor the request to write the data immediately, so it can fill its +> write cache up with several megabytes of data and write it out to the +> disk at its leisure. +> + +FWIW - If you are using MacOS X or Windows, then later SATA (in +particular, not sure about older IDE) will honor the request to write +immediately, even if the disk write cache is enabled. + +I believe that Linux 2.6+ and SATA II will also behave this way (I'm +thinking that write barrier support *is* in 2.6 now - however you would +be wise to follow up on the Linux kernel list if you want to be sure!) + +In these cases data integrity becomes similar to SCSI - however, unless +you buy SATA specifically designed for a server type workload (e.g WD +Raptor), then ATA/SATA tend to fail more quickly if used in this way +(e.g. 24/7, hot/dusty environment etc). + +Cheers + +Mark + +From pgsql-performance-owner@postgresql.org Sat Jun 3 06:36:42 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 137299FA5DC + for ; + Sat, 3 Jun 2006 06:36:42 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 44765-02 + for ; + Sat, 3 Jun 2006 06:36:38 -0300 (ADT) +X-Greylist: delayed 00:05:31.85954 by SQLgrey- +Received: from planetmail5.outgw.tn (planetmail5.outgw.tn [193.95.28.40]) + by postgresql.org (Postfix) with ESMTP id BDE6C9FA3A6 + for ; + Sat, 3 Jun 2006 06:36:38 -0300 (ADT) +Message-Id: <200606030931.k539V38Y007877@smtp2.planet.net.tn> +Content-Type: text/plain +Content-Disposition: inline +Content-Transfer-Encoding: binary +X-Originating-Ip: 193.95.94.68 +X-Http_host: webmail.planet.tn +Date: Sat, 03 Jun 2006 10:31:03 +0100 +MIME-Version: 1.0 +Reply-To: fzied@planet.tn +Subject: scaling up postgres +X-Mailer: EMUmail 5.2.7 (UA Mozilla/5.0 (X11; U; Linux i686; fr; + rv:1.8.0.3) Gecko/20060504 Fedora/1.5.0.3-1.1.fc5 Firefox/1.5.0.3 + pango-text) +From: fzied@planet.tn +To: pgsql-performance@postgresql.org +X-Webmail-User: fzied@planet.tn +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/18 +X-Sequence-Number: 19375 + +Hello, + +I am setting up a postgres server that will hold a critical event witin +the next few weeks. +It's national exam result (140000 students) +the problem is that the first few hours there will be a huge traffic, +(last year 250K requests only the first hour) +I do have 2 identical beasts (4G - biproc Xeon 3.2 - 2 Gig NIC) +One beast will be apache, and the other will be postgres. +I'm using httperf/autobench for measurments and the best result I can get +is that my system can handle a trafiic of almost 1600 New con/sec. + +I cannot scale beyond that value and the funny thing, is that none of the +servers is swapping, or heavy loaded, neither postgres nor apache are +refusing connexions. +my database is only 58M it's a read only DB and will lasts only for a month. +here is my pstgres.conf : +---------------------------- postgres.conf - begin +max_connections = 6000 +shared_buffers = 12288 +work_mem = 512 +maintenance_work_mem = 16384 +effective_cache_size = 360448 +random_page_cost 2 +log_destination 'stderr' +redirect_stderr on +log_min_messages notice +log_error_verbosity default +log_disconnections on +autovacuum off +stats_start_collector off +stats_row_level off +---------------------------- postgres.conf - end +---------------------------- sysctl.conf (postgres) - begin +fs.file-max= 5049800 +net.ipv4.ip_local_port_range= 1024 65000 +net.ipv4.tcp_keepalive_time= 120 +kernel.shmmax= 2147483648 +kernel.sem= 250 96000 100 384 +---------------------------- sysctl.conf (postgres) - end +kernel semaphores are grown as postgres needs. + +vmstat is not showing any "annoyance" I cannot find where is it blocked ! + +please, I need help as it's a very critical deployment :( + +NB : apache when stressed for a static page, i can handle more 16k new con/sec + + + +From pgsql-performance-owner@postgresql.org Sat Jun 3 06:44:10 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 558679FA3A6 + for ; + Sat, 3 Jun 2006 06:44:10 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 39918-10 + for ; + Sat, 3 Jun 2006 06:44:00 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by postgresql.org (Postfix) with ESMTP id 6E3029FA2E6 + for ; + Sat, 3 Jun 2006 06:44:00 -0300 (ADT) +Received: from trofast.sesse.net ([129.241.93.32]) + by cassarossa.samfundet.no with esmtp (Exim 4.50) + id 1FmSfj-0005Qt-Go; Sat, 03 Jun 2006 11:43:56 +0200 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1FmSfj-00065I-00; Sat, 03 Jun 2006 11:43:55 +0200 +Date: Sat, 3 Jun 2006 11:43:55 +0200 +From: "Steinar H. Gunderson" +To: fzied@planet.tn +Cc: pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +Message-ID: <20060603094355.GA23297@uio.no> +Mail-Followup-To: fzied@planet.tn, pgsql-performance@postgresql.org +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +In-Reply-To: <200606030931.k539V38Y007877@smtp2.planet.net.tn> +X-Operating-System: Linux 2.6.16trofastxen on a x86_64 +X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/19 +X-Sequence-Number: 19376 + +On Sat, Jun 03, 2006 at 10:31:03AM +0100, fzied@planet.tn wrote: +> I do have 2 identical beasts (4G - biproc Xeon 3.2 - 2 Gig NIC) +> One beast will be apache, and the other will be postgres. +> I'm using httperf/autobench for measurments and the best result I can get +> is that my system can handle a trafiic of almost 1600 New con/sec. + +What version of PostgreSQL? (8.1 is better than 8.0 is much better than 7.4.) +Have you remembered to turn HT off? Have you considered Opterons instead of +Xeons? (The Xeons generally scale bad with PostgreSQL.) What kind of queries +are you running? Are you using connection pooling? Prepared queries? + +> vmstat is not showing any "annoyance" I cannot find where is it blocked ! + +How many context switches ("cs" in vmstat) do you get per second? + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Sat Jun 3 06:57:45 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C87589FA5DC + for ; + Sat, 3 Jun 2006 06:57:44 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 46176-07 + for ; + Sat, 3 Jun 2006 06:57:31 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from peufeu.com (boutiquenumerique.com [82.67.9.10]) + by postgresql.org (Postfix) with ESMTP id 1D4509FA3A6 + for ; + Sat, 3 Jun 2006 06:57:29 -0300 (ADT) +Received: (qmail 1308 invoked from network); 3 Jun 2006 11:57:51 +0200 +Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) + by boutiquenumerique.com with SMTP; 3 Jun 2006 11:57:51 +0200 +Date: Sat, 03 Jun 2006 11:57:50 +0200 +To: fzied@planet.tn, pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> +From: PFC +Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-ID: +In-Reply-To: <200606030931.k539V38Y007877@smtp2.planet.net.tn> +User-Agent: Opera M2/8.54 (Linux, build 1745) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/20 +X-Sequence-Number: 19377 + + +> One beast will be apache, and the other will be postgres. + +> I'm using httperf/autobench for measurments and the best result I can get +> is that my system can handle a trafiic of almost 1600 New con/sec. + +> NB : apache when stressed for a static page, i can handle more 16k new +> con/sec + + That's not the point. + Here are a few points of advice. + + USE LIGHTTPD DAMMIT ! + + If you want performance, that is. + On my server (Crap Celeron) it handles about 100 hits/s on static files +and 10 hits/s on PHP pages ; CPU utilization is 1-2%, not counting PHP. + lighttpd handles 14K static pages/s on my laptop. That's about as much as +your bi-xeon does with apache... + + You want a web server that uses as little CPU as possible so that more +CPU is left for generating dynamic content. + + Also, you want to have a number of concurrent DB connections which is +neither too high, nor too low. + Apache + mod_php needs to spawn a lot of processes, thus you need a lot +of database connections. + This tends not to be optimal. + + Too few concurrent DB connections -> network latency between DB and +webserver will be a bottleneck. + Too many connections -> excess context switching, suboptimal use of CPU +cache, memory use bloat. + + So, I advise you to use lighttpd fronting PHP as fastcgi (if you use PHP) +; if you use Java or whatever which has a HTTP interface, use lighttpd as +a proxy for your dynamic page generation. + Spawn a reasonable number of PHP processes. The number depends on your +application, but from 10 to 30 is a good starting point. + + USE PERSISTENT DATABASE CONNECTIONS ! + + Postgres will breathe a little better ; now, check if it is still slow. +If it is, you need to find the bottleneck... + I can help you a bit by private email if you want. + +From pgsql-performance-owner@postgresql.org Sat Jun 3 07:52:33 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D18139FA5BA + for ; + Sat, 3 Jun 2006 07:52:32 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 53154-01 + for ; + Sat, 3 Jun 2006 07:52:24 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by postgresql.org (Postfix) with ESMTP id E2F609FA311 + for ; + Sat, 3 Jun 2006 07:52:24 -0300 (ADT) +Received: from trofast.sesse.net ([129.241.93.32]) + by cassarossa.samfundet.no with esmtp (Exim 4.50) + id 1FmTjz-00025e-Av; Sat, 03 Jun 2006 12:52:23 +0200 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1FmTjz-0006hJ-00; Sat, 03 Jun 2006 12:52:23 +0200 +Date: Sat, 3 Jun 2006 12:52:23 +0200 +From: "Steinar H. Gunderson" +To: fzied@planet.tn, pgsql-performance@postgresql.org +Subject: Re: =?utf-8?B?UsOpcG9uZHJl?= +Message-ID: <20060603105223.GB25615@uio.no> +Reply-To: pgsql-performance@postgresql.org +Mail-Followup-To: fzied@planet.tn, pgsql-performance@postgresql.org +References: <200606031038.k53AcAR3014059@smtp2.planet.net.tn> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +In-Reply-To: <200606031038.k53AcAR3014059@smtp2.planet.net.tn> +X-Operating-System: Linux 2.6.16trofastxen on a x86_64 +X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/21 +X-Sequence-Number: 19378 + +On Sat, Jun 03, 2006 at 11:38:10AM +0100, fzied@planet.tn wrote: +>> What version of PostgreSQL? (8.1 is better than 8.0 is much better than 7.4.) +> 8.1.3 on RHEL 4 + +OK, that sounds good. + +>> Have you remembered to turn HT off? +> no !! what is it ? + +HT = Hyperthreading. It usually does more harm than good on databases +(although others have reported differing results). + +>> Have you considered Opterons instead of Xeons? (The Xeons generally +>> scale bad with PostgreSQL.) +> No can't have it + +OK, that's bad -- it's probably the single thing that could have helped +performance the most. + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Sat Jun 3 09:43:39 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 402E99FA5BA + for ; + Sat, 3 Jun 2006 09:43:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 61765-03 + for ; + Sat, 3 Jun 2006 09:43:27 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from skunk.mtbrook.bozemanpass.com (unknown [69.145.82.195]) + by postgresql.org (Postfix) with ESMTP id 34E1E9FA311 + for ; + Sat, 3 Jun 2006 09:43:24 -0300 (ADT) +Received: from [69.145.82.253] (unknown [69.145.82.253]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by skunk.mtbrook.bozemanpass.com (Postfix) with ESMTP id 97A336C8007 + for ; + Sat, 3 Jun 2006 05:43:22 -0700 (PDT) +Message-ID: <448183EC.3030109@boreham.org> +Date: Sat, 03 Jun 2006 06:43:24 -0600 +From: David Boreham +User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> +In-Reply-To: <200606030931.k539V38Y007877@smtp2.planet.net.tn> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/22 +X-Sequence-Number: 19379 + + +>I cannot scale beyond that value and the funny thing, is that none of the +>servers is swapping, or heavy loaded, neither postgres nor apache are +>refusing connexions. +> +> +Hearing a story like this (throughput hits a hard limit, but +hardware doesn't appear to be 100% utilized), I'd suspect +insufficient concurrency to account for the network latency +between the two servers. + +Also check that your disks aren't saturating somewhere (with +iostat or something similar). + +You could run pstack against both processes and see what they're +doing while the system is under load. That might give a clue +(e.g. you might see the apache processs waiting on +a response from PG, and the PG processes waiting +on a new query to process). + +Since you've proved that your test client and apache can +handle a much higher throughput, the problem must lie +somewhere else (in posgresql or the interface between +the web server and postgresql). + + + + + + + + + +From pgsql-performance-owner@postgresql.org Sat Jun 3 12:12:51 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8D5439FA5BA + for ; + Sat, 3 Jun 2006 12:12:51 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 74234-02 + for ; + Sat, 3 Jun 2006 12:12:43 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id D64159FA311 + for ; + Sat, 3 Jun 2006 12:12:42 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k53FCcgr015972; + Sat, 3 Jun 2006 11:12:38 -0400 (EDT) +To: fzied@planet.tn +cc: pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +In-reply-to: <200606030931.k539V38Y007877@smtp2.planet.net.tn> +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> +Comments: In-reply-to fzied@planet.tn + message dated "Sat, 03 Jun 2006 10:31:03 +0100" +Date: Sat, 03 Jun 2006 11:12:38 -0400 +Message-ID: <15971.1149347558@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/23 +X-Sequence-Number: 19380 + +fzied@planet.tn writes: +> I'm using httperf/autobench for measurments and the best result I can get +> is that my system can handle a trafiic of almost 1600 New con/sec. + +As per PFC's comment, if connections/sec is a bottleneck for you then +the answer is to use persistent connections. Launching a new backend +is a fairly heavyweight operation in Postgres. It sounds like there +may be some system-level constraints affecting the process creation +rate as well, but it's silly to spend a lot of effort on this when +you can so easily go around the problem. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sat Jun 3 12:18:55 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id EDC6E9FA5BA + for ; + Sat, 3 Jun 2006 12:18:54 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 72378-10 + for ; + Sat, 3 Jun 2006 12:18:46 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from skunk.mtbrook.bozemanpass.com (unknown [69.145.82.195]) + by postgresql.org (Postfix) with ESMTP id C8FCC9FA311 + for ; + Sat, 3 Jun 2006 12:18:45 -0300 (ADT) +Received: from [69.145.82.253] (unknown [69.145.82.253]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by skunk.mtbrook.bozemanpass.com (Postfix) with ESMTP id 22AEB6C8007 + for ; + Sat, 3 Jun 2006 08:18:45 -0700 (PDT) +Message-ID: <4481A856.7050907@boreham.org> +Date: Sat, 03 Jun 2006 09:18:46 -0600 +From: David Boreham +User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> + <15971.1149347558@sss.pgh.pa.us> +In-Reply-To: <15971.1149347558@sss.pgh.pa.us> +Content-Type: multipart/alternative; + boundary="------------060302020507080308080300" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/24 +X-Sequence-Number: 19381 + +This is a multi-part message in MIME format. +--------------060302020507080308080300 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Tom Lane wrote: + +>fzied@planet.tn writes: +> +> +>>I'm using httperf/autobench for measurments and the best result I can get +>>is that my system can handle a trafiic of almost 1600 New con/sec. +>> +>> +> +>As per PFC's comment, if connections/sec is a bottleneck for you then +>the answer is to use persistent connections. Launching a new backend +>is a fairly heavyweight operation in Postgres. +> +I thought the OP was talking about HTTP connections/s. He didn't say if he +was using persistent database connections or not (obviously better if so). +If it were the case that his setup is new backend launch rate-limited, then +wouldn't the machine show CPU saturation ? (he said it didn't). + + + +--------------060302020507080308080300 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + + + + + + + +Tom Lane wrote: +
+
fzied@planet.tn writes:
+  
+
+
I'm using httperf/autobench for measurments and the best result I can get 
+is that my system can handle a trafiic of almost 1600 New con/sec.
+    
+
+

+As per PFC's comment, if connections/sec is a bottleneck for you then
+the answer is to use persistent connections.  Launching a new backend
+is a fairly heavyweight operation in Postgres.  
+
+I thought the OP was talking about HTTP connections/s. He didn't say if +he
+was using persistent database connections or not (obviously better if +so).
+If it were the case that his setup is new backend launch rate-limited, +then
+wouldn't the machine show CPU saturation ?  (he said it didn't).
+
+
+ + + +--------------060302020507080308080300-- + +From pgsql-performance-owner@postgresql.org Sat Jun 3 12:36:05 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id BA1569FA5BA + for ; + Sat, 3 Jun 2006 12:36:04 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 76566-02 + for ; + Sat, 3 Jun 2006 12:35:56 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.175]) + by postgresql.org (Postfix) with ESMTP id B584F9FA311 + for ; + Sat, 3 Jun 2006 12:35:55 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so824422ugf + for ; + Sat, 03 Jun 2006 08:35:54 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=hqk8a3LNjcEPz671Igvu81EseCKRytyhGMZz4ufsDYLbJ4WoJgC0b2zNAG/anpszxqJq/lXwcPPYnhaDLY7Epy4XWcQEgQEdQp7mHYonUEymveW0gJADpCEnfR9oNhzJ/Bl0F1aS2EpKKF2CA43qz9Dmf+J36m5y8/6zZHnRkpY= +Received: by 10.67.30.6 with SMTP id h6mr1766864ugj; + Sat, 03 Jun 2006 08:35:54 -0700 (PDT) +Received: by 10.67.92.4 with HTTP; Sat, 3 Jun 2006 08:35:54 -0700 (PDT) +Message-ID: +Date: Sat, 3 Jun 2006 16:35:54 +0100 +From: "Neil Saunders" +To: pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +In-Reply-To: <4481A856.7050907@boreham.org> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> + <15971.1149347558@sss.pgh.pa.us> <4481A856.7050907@boreham.org> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/25 +X-Sequence-Number: 19382 + +> +> Tom Lane wrote: +> As per PFC's comment, if connections/sec is a bottleneck for you then +the +> answer is to use persistent connections. Launching a new backend +is a fairly +> heavyweight operation in Postgres. +> + +In which case maybe pgpool could help in this respect? +http://pgpool.projects.postgresql.org/ + +Cheers, + +Neil. + +From pgsql-performance-owner@postgresql.org Sat Jun 3 23:03:51 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 768DF9FB1B7 + for ; + Sat, 3 Jun 2006 23:03:51 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 49962-03 + for ; + Sat, 3 Jun 2006 23:03:41 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from candle.pha.pa.us (candle.pha.pa.us [70.90.9.53]) + by postgresql.org (Postfix) with ESMTP id 5946D9FA315 + for ; + Sat, 3 Jun 2006 23:03:41 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id k54235c23743; + Sat, 3 Jun 2006 22:03:05 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200606040203.k54235c23743@candle.pha.pa.us> +Subject: Re: RES: Initial database loading and IDE x SCSI +In-Reply-To: <4480D427.50207@paradise.net.nz> +To: Mark Kirkwood +Date: Sat, 3 Jun 2006 22:03:05 -0400 (EDT) +CC: carlosreimer@terra.com.br, Mark Lewis , + Tom Lane , pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/28 +X-Sequence-Number: 19385 + +Mark Kirkwood wrote: +> Mark Lewis wrote: +> +> > +> > The naive approach works on IDE drives because they don't (usually) +> > honor the request to write the data immediately, so it can fill its +> > write cache up with several megabytes of data and write it out to the +> > disk at its leisure. +> > +> +> FWIW - If you are using MacOS X or Windows, then later SATA (in +> particular, not sure about older IDE) will honor the request to write +> immediately, even if the disk write cache is enabled. +> +> I believe that Linux 2.6+ and SATA II will also behave this way (I'm +> thinking that write barrier support *is* in 2.6 now - however you would +> be wise to follow up on the Linux kernel list if you want to be sure!) +> +> In these cases data integrity becomes similar to SCSI - however, unless +> you buy SATA specifically designed for a server type workload (e.g WD +> Raptor), then ATA/SATA tend to fail more quickly if used in this way +> (e.g. 24/7, hot/dusty environment etc). + +The definitive guide to servers vs. desktop drives is: + + http://www.seagate.com/content/docs/pdf/whitepaper/D2c_More_than_Interface_ATA_vs_SCSI_042003.pdf + +-- + Bruce Momjian http://candle.pha.pa.us + EnterpriseDB http://www.enterprisedb.com + + + If your life is a hard drive, Christ can be your backup. + + +From pgsql-performance-owner@postgresql.org Sat Jun 3 23:23:51 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E2EF09FA315 + for ; + Sat, 3 Jun 2006 23:23:50 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 52407-03 + for ; + Sat, 3 Jun 2006 23:23:39 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from linda-2.paradise.net.nz (bm-2a.paradise.net.nz + [203.96.152.181]) + by postgresql.org (Postfix) with ESMTP id 1B3689FB1B7 + for ; + Sat, 3 Jun 2006 23:23:40 -0300 (ADT) +Received: from smtp-3.paradise.net.nz + (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by + linda-2.paradise.net.nz (Paradise.net.nz) with ESMTP id + <0J0B00849DB7CV@linda-2.paradise.net.nz> for + pgsql-performance@postgresql.org; Sun, 04 Jun 2006 14:23:32 +1200 (NZST) +Received: from [192.168.1.11] (218-101-29-24.dsl.clear.net.nz [218.101.29.24]) + by smtp-3.paradise.net.nz (Postfix) with ESMTP id 3D3A9746CC; Sun, + 04 Jun 2006 14:21:17 +1200 (NZST) +Date: Sun, 04 Jun 2006 14:21:08 +1200 +From: Mark Kirkwood +Subject: Re: RES: Initial database loading and IDE x SCSI +In-reply-to: <200606040203.k54235c23743@candle.pha.pa.us> +To: Bruce Momjian +Cc: carlosreimer@terra.com.br, Mark Lewis , + Tom Lane , pgsql-performance@postgresql.org +Message-id: <44824394.2050504@paradise.net.nz> +MIME-version: 1.0 +Content-type: text/plain; format=flowed; charset=ISO-8859-1 +Content-transfer-encoding: 7bit +User-Agent: Thunderbird 1.5 (X11/20060417) +References: <200606040203.k54235c23743@candle.pha.pa.us> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/29 +X-Sequence-Number: 19386 + +Bruce Momjian wrote: + +> +> The definitive guide to servers vs. desktop drives is: +> +> http://www.seagate.com/content/docs/pdf/whitepaper/D2c_More_than_Interface_ATA_vs_SCSI_042003.pdf +> + +Yeah - very nice paper, well worth a read (in spite of the fact that it +is also Seagate propaganda, supporting their marketing position and +terminology!) + +Cheers + +Mark + +From pgsql-performance-owner@postgresql.org Sun Jun 4 04:40:28 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 954B29FA5D8 + for ; + Sun, 4 Jun 2006 04:40:27 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 82947-07 + for ; + Sun, 4 Jun 2006 04:40:18 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moutng.kundenserver.de (moutng.kundenserver.de + [212.227.126.171]) + by postgresql.org (Postfix) with ESMTP id 7D05F9FA42B + for ; + Sun, 4 Jun 2006 04:40:18 -0300 (ADT) +Received: from [194.25.154.138] (helo=webserv.wug.de) + by mrelayeu.kundenserver.de (node=mrelayeu1) with ESMTP (Nemesis), + id 0MKwpI-1FmnDc0ntU-0007bQ; Sun, 04 Jun 2006 09:40:16 +0200 +Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) + id 1FmnDa-0000fE-00 + for pgsql-performance@postgresql.org; Sun, 04 Jun 2006 09:40:14 +0200 +Date: Sun, 4 Jun 2006 09:40:14 +0200 +From: "A. Kretschmer" +To: pgsql-performance@postgresql.org +Subject: Re: INSERT OR UPDATE WITHOUT SELECT +Message-ID: <20060604074014.GA2447@webserv.wug-glas.de> +References: <20060530_204747_020181.wmiro@ig.com.br> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20060530_204747_020181.wmiro@ig.com.br> +X-DEST: 208 +X-MSMail-Priority: High +X-Message-Flag: Really, I'm not out to destroy Microsoft. That will just be a + completely unintentional side effect. (Linus Torvalds) +X-OS: Linux - weil ich es mir Wert bin! +X-Info: registrierter Linux-User 97922 http://counter.li.org +User-Agent: mutt-ng 1.5.9i (Linux) +X-Provags-ID: kundenserver.de abuse@kundenserver.de + login:51ea9561fc3f6d9539a2acd743e4748c +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/30 +X-Sequence-Number: 19387 + +am 30.05.2006, um 17:47:47 -0300 mailte wmiro@ig.com.br folgendes: +> Hi, +> +> Is there a command to Insert a record If It does not exists and a update if +> It exists? + +Not a single command, but a solution: +http://developer.postgresql.org/docs/postgres/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING + + +HTH, Andreas +-- +Andreas Kretschmer (Kontakt: siehe Header) +Heynitz: 035242/47215, D1: 0160/7141639 +GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net + === Schollglas Unternehmensgruppe === + +From pgsql-performance-owner@postgresql.org Sun Jun 4 09:13:22 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6D1C39FA43C + for ; + Sun, 4 Jun 2006 09:13:22 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 07744-03 + for ; + Sun, 4 Jun 2006 09:13:09 -0300 (ADT) +X-Greylist: delayed 00:12:28.352778 by SQLgrey- +Received: from ki-communication.com (unknown [202.137.6.59]) + by postgresql.org (Postfix) with ESMTP id CBEE79F9DB0 + for ; + Sun, 4 Jun 2006 09:13:05 -0300 (ADT) +Received: from edp01wks ([192.168.0.127]) by ki-communication.com with + Microsoft SMTPSVC(6.0.3790.1830); Sun, 4 Jun 2006 19:00:32 +0700 +From: "Ahmad Fajar" +To: "'Michael Artz'" +Cc: +Subject: Re: Bulk loading/merging +Date: Sun, 4 Jun 2006 19:00:32 +0700 +Keywords: Postgresql +Message-ID: <003601c687ce$7aee7b20$7f00a8c0@kicommunication.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_NextPart_000_0037_01C68809.274D5320" +X-Mailer: Microsoft Office Outlook 11 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +Thread-Index: AcaFrZrTcvtL9urDRn2k+1Vc8zXc7wCH2sdg +In-reply-to: +X-OriginalArrivalTime: 04 Jun 2006 12:00:32.0795 (UTC) + FILETIME=[7B47BEB0:01C687CE] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/31 +X-Sequence-Number: 19388 + +This is a multi-part message in MIME format. + +------=_NextPart_000_0037_01C68809.274D5320 +Content-Type: text/plain; + charset="US-ASCII" +Content-Transfer-Encoding: 7bit + +On 06/02/2006, Michael Artz wrote: + +hmm, I don't quite understand what you are saying and I think my basic +misunderstanding is how to use the UPDATE ... WHERE EXISTS to merge data in +bulk. Assuming that I bulk COPYed the data into a temporary table, I'd need +to issue an UPDATE for each row in the newly created table, right? + + + +For example, for a slightly different key,count schema: + +CREATE TABLE kc (key integer, count integer); + +and wanting to merge the following data by just updating the count for a +given key to the equivalent of OLD.count + NEW.count: + +1,10 + +2,15 + +3,45 + +1,30 + +How would I go about using UPDATE ... WHERE EXISTS to update the "master" kc +table from a (temporary) table loaded with the above data? + + + +May be, this method could help you: + +CREATE TEMP TABLE clip_temp ( + + cids int8 NOT NULL, + + clip_id int8 NOT NULL, + + mentions int4 DEFAULT 0, + + CONSTRAINT pk_clip_temp PRIMARY KEY (cids, clip_id)) + +) + +insert data into this temporary table... + +then do: + + + +UPDATE clip_category SET mentions=clip_temp.mentions + +FROM clip_temp + +WHERE clip_category.cids=clip_temp.cids + +AND clip_category.clip_id=clip_temp.clip_id + + + +DELETE FROM clip_temp USING clip_category + +WHERE clip_temp.cids=clip_category.cids + +AND clip_temp.clip_id=clip_category.clip_id + + + +INSERT INTO clip_category (cids, clip_id, mentions) + +SELECT * FROM clip_temp + + + +DROP TABLE clip_temp; + + + + + +Best regards, + +ahmad fajar, + + + + + + + + + + +------=_NextPart_000_0037_01C68809.274D5320 +Content-Type: text/html; + charset="US-ASCII" +Content-Transfer-Encoding: quoted-printable + + + + + + + + + + + + +
+ +

On 06/02/2006, Michael Artz wrote: = +

+ +

hmm, I don't quite = +understand what +you are saying and I think my basic misunderstanding is how to use = +the +UPDATE ... WHERE EXISTS to merge data in bulk.  Assuming that = +I bulk +COPYed the data into a temporary table, I'd need to issue an +UPDATE for each row in the newly created table, right?  = +

+ +

 

+ +

For example, for a slightly +different key,count schema:

+ +

CREATE TABLE kc (key = +integer, count +integer);

+ +

and wanting to merge the = +following +data by just updating the count for a given key to the equivalent of = +OLD.count ++ NEW.count:

+ +

1,10

+ +

2,15

+ +

3,45

+ +

1,30

+ +

How would I go about using = +UPDATE +... WHERE EXISTS to update the "master" kc table from a = +(temporary) +table loaded with the above data?

+ +

 

+ +

May be, this method could help = +you:

+ +

CREATE TEMP TABLE clip_temp = +(

+ +

  cids int8 NOT = +NULL,

+ +

  clip_id int8 NOT = +NULL,

+ +

  mentions int4 DEFAULT = +0,

+ +

  CONSTRAINT pk_clip_temp = +PRIMARY KEY +(cids, clip_id))

+ +

)

+ +

insert data into this temporary = +table...

+ +

then = +do:

+ +

 

+ +

UPDATE clip_category SET +mentions=3Dclip_temp.mentions

+ +

FROM = +clip_temp

+ +

WHERE = +clip_category.cids=3Dclip_temp.cids

+ +

AND +clip_category.clip_id=3Dclip_temp.clip_id

+ +

 

+ +

DELETE FROM clip_temp USING = +clip_category

+ +

WHERE = +clip_temp.cids=3Dclip_category.cids

+ +

AND +clip_temp.clip_id=3Dclip_category.clip_id

+ +

 

+ +

INSERT INTO clip_category (cids, = +clip_id, +mentions)

+ +

SELECT * FROM = +clip_temp

+ +

 

+ +

DROP TABLE = +clip_temp;

+ +

 

+ +

 

+ +

Best = +regards,

+ +

= +ahmad +fajar,

+ +

 

+ +

 

+ +
+ +
+ +
+ +

 

+ +
+ +
+ +
+ +

 

+ +
+ +
+ +
+ + + + + +------=_NextPart_000_0037_01C68809.274D5320-- + + +From pgsql-performance-owner@postgresql.org Sun Jun 4 19:34:53 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DF3479FA5BA + for ; + Sun, 4 Jun 2006 19:34:52 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 60079-06 + for ; + Sun, 4 Jun 2006 19:34:44 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from linux.dunaweb.hu (linux.dunaweb.hu [62.77.196.1]) + by postgresql.org (Postfix) with ESMTP id 80A159F9316 + for ; + Sun, 4 Jun 2006 19:34:43 -0300 (ADT) +Received: from localhost (linux.dunaweb.hu [127.0.0.1]) + by linux.dunaweb.hu (Postfix) with ESMTP id 2EB858E059C + for ; + Mon, 5 Jun 2006 00:01:23 +0200 (CEST) +Received: from linux.dunaweb.hu ([127.0.0.1]) + by localhost (linux.dunaweb.hu [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 07882-07 for ; + Mon, 5 Jun 2006 00:01:22 +0200 (CEST) +Received: from [81.17.177.202] (host-81-17-177-202.dunaweb.hu [81.17.177.202]) + by linux.dunaweb.hu (Postfix) with ESMTP id 805D98E066B + for ; + Mon, 5 Jun 2006 00:01:22 +0200 (CEST) +Message-ID: <44835834.2020309@dunaweb.hu> +Date: Mon, 05 Jun 2006 00:01:24 +0200 +From: Zoltan Boszormenyi +User-Agent: Thunderbird 1.5.0.2 (X11/20060501) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: psql -A (unaligned format) eats too much memory +Content-Type: text/plain; charset=ISO-8859-2; format=flowed +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: amavisd-new at dunaweb.hu +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/33 +X-Sequence-Number: 19390 + +Hi, + +I just noticed that psql's unformatted output uses too much +memory. Is it normal? It seems that psql draws all records +of a query off the server before it displays or writes the output. +I would expect this only with formatted output. + +Problem is, I have an export that produces 500'000+ records +which changes frequently. Several (20+) sites run this query +nightly with different parameters and download it. The SELECTs +that run in psql -A -t -c '...' may overlap and the query that runs +in less than 1.5 minutes if it's the only one at the time may take +3+ hours if ten such queries overlap. The time is mostly spent +in swapping, all psql processes take up 300+ MB, so the 1GB +server is brought to its knees quickly, peek swap usage is 1.8 GB. +I watched the progress in top and the postmaster processes finished +their work in about half an hour (that would still be acceptable) +then the psql processes started eating up memory as they read +the records. + +PostgreSQL 8.1.4 was used on RHEL3. + +Is there a way to convince psql to use less memory in unformatted +mode? I know COPY will be able to use arbitrary SELECTs +but until then I am still stuck with redirecting psql's output. + +Best regards, +Zolt�n B�sz�rm�nyi + + +From pgsql-performance-owner@postgresql.org Sun Jun 4 19:32:53 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 1E81E9FA5BA + for ; + Sun, 4 Jun 2006 19:32:53 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 57204-09 + for ; + Sun, 4 Jun 2006 19:32:41 -0300 (ADT) +X-Greylist: delayed 00:31:11.870244 by SQLgrey- +Received: from linux.dunaweb.hu (linux.dunaweb.hu [62.77.196.1]) + by postgresql.org (Postfix) with ESMTP id B46899F9316 + for ; + Sun, 4 Jun 2006 19:32:41 -0300 (ADT) +Received: from localhost (linux.dunaweb.hu [127.0.0.1]) + by linux.dunaweb.hu (Postfix) with ESMTP id 6D8398E08AB + for ; + Mon, 5 Jun 2006 00:32:38 +0200 (CEST) +Received: from linux.dunaweb.hu ([127.0.0.1]) + by localhost (linux.dunaweb.hu [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 12440-05 for ; + Mon, 5 Jun 2006 00:32:36 +0200 (CEST) +Received: from [81.17.177.202] (host-81-17-177-202.dunaweb.hu [81.17.177.202]) + by linux.dunaweb.hu (Postfix) with ESMTP id 27A308E0820 + for ; + Mon, 5 Jun 2006 00:32:36 +0200 (CEST) +Message-ID: <44835F86.5040008@dunaweb.hu> +Date: Mon, 05 Jun 2006 00:32:38 +0200 +From: Zoltan Boszormenyi +User-Agent: Thunderbird 1.5.0.2 (X11/20060501) +MIME-Version: 1.0 +Cc: pgsql-performance@postgresql.org +Subject: Re: psql -A (unaligned format) eats too much memory +References: <44835834.2020309@dunaweb.hu> +In-Reply-To: <44835834.2020309@dunaweb.hu> +Content-Type: text/plain; charset=ISO-8859-2; format=flowed +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: amavisd-new at dunaweb.hu +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/32 +X-Sequence-Number: 19389 + +Hi, + +answering to myself. :-) + +Zoltan Boszormenyi �rta: +> Hi, +> +> I just noticed that psql's unformatted output uses too much +> memory. Is it normal? It seems that psql draws all records +> of a query off the server before it displays or writes the output. +> I would expect this only with formatted output. +> +> Problem is, I have an export that produces 500'000+ records +> which changes frequently. Several (20+) sites run this query +> nightly with different parameters and download it. The SELECTs +> that run in psql -A -t -c '...' may overlap and the query that runs +> in less than 1.5 minutes if it's the only one at the time may take +> 3+ hours if ten such queries overlap. The time is mostly spent +> in swapping, all psql processes take up 300+ MB, so the 1GB +> server is brought to its knees quickly, peek swap usage is 1.8 GB. +> I watched the progress in top and the postmaster processes finished +> their work in about half an hour (that would still be acceptable) +> then the psql processes started eating up memory as they read +> the records. +> +> PostgreSQL 8.1.4 was used on RHEL3. +> +> Is there a way to convince psql to use less memory in unformatted +> mode? I know COPY will be able to use arbitrary SELECTs +> but until then I am still stuck with redirecting psql's output. + +The answer it to use SELECT INTO TEMP and then COPY. +Psql will use much less memory that way. But still... + +Best regards, +Zolt�n B�sz�rm�nyi + + +From pgsql-performance-owner@postgresql.org Mon Jun 5 11:35:45 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2FC239FA5D2 + for ; + Mon, 5 Jun 2006 11:35:45 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 81821-02 + for ; + Mon, 5 Jun 2006 11:35:34 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 577819FA111 + for ; + Mon, 5 Jun 2006 11:35:32 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 82B4F56440; Mon, 5 Jun 2006 09:35:30 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); + Mon, 5 Jun 2006 09:35:29 -0500 +Date: Mon, 5 Jun 2006 09:35:29 -0500 +From: "Jim C. Nasby" +To: Cstdenis +Cc: Nis Jorgensen , pgsql-performance@postgresql.org +Subject: Re: How can I make this query faster (resend) +Message-ID: <20060605143529.GP53487@pervasive.com> +References: <03e001c67b99$8321f010$6401a8c0@chris> + <447177B2.2020109@superlativ.dk> + <013801c6832d$1cf73d90$6401a8c0@chris> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <013801c6832d$1cf73d90$6401a8c0@chris> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060605:cstdenis@voicio.com::lW0v3qK58Ezz50Pq:000000000000000000 + 0000000000000000000000003Ct/ +X-Hashcash: + 1:20:060605:nis@superlativ.dk::HUKuk11Ksyx0yA5E:00000000000000000000 + 0000000000000000000000002bHw +X-Hashcash: + 1:20:060605:pgsql-performance@postgresql.org::OAQF/448u/RJs8fN:00000 + 0000000000000000000000003fm7 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/34 +X-Sequence-Number: 19391 + +On Mon, May 29, 2006 at 07:35:14AM -0700, Cstdenis wrote: +> > To be honest, you're pushing things expecting a machine with only 1G to +> > serve 300 active connections. How large is the database itself? +> +> The database is 3.7G on disk. There is about 1G of actual data in it -- the +> rest is dead tuples and indices. (I vacuum regularly, but a vacuum full +> causes too much downtime to do unless I have to) + +It sounds like you're not vacuuming anywhere near regularly enough if +you have that much dead space. You should at least reindex. + +> > > I know hyperthreading is considered something that can slow down a +> server but with my very high concurancy (averages about 400-500 concurant +> users during peak hours) I am hoping the extra virtual CPUs wil help. Anyone +> have experance that says diferent at high concurancy? +> > +> > Best bet is to try it and see. Generally, people find HT hurts, but I +> > recently saw it double the performance of pgbench on a windows XP +> > machine, so it's possible that windows is just more clever about how to +> > use it than linux is. +> +> Anyone know if those who have found it hurts are low concurancy complex cpu +> intensive queries or high concurancy simple queries or both? I can +> understand it hurting in the former, but not the later. I'll have to give it +> a try I guess. It should at least help my very high load averages. + +The issue is that HT doesn't give you anything close to having 2 CPUs, +so for all but the most trivial and limited cases it's not going to be a +win. + +Incidentally, the only good results I've seen with HT are on windows. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Mon Jun 5 11:44:06 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 29CB69FA2DB + for ; + Mon, 5 Jun 2006 11:44:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 07002-05 + for ; + Mon, 5 Jun 2006 11:43:55 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 9A9929FA111 + for ; + Mon, 5 Jun 2006 11:43:54 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 1A01B56440; Mon, 5 Jun 2006 09:43:50 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); + Mon, 5 Jun 2006 09:43:49 -0500 +Date: Mon, 5 Jun 2006 09:43:49 -0500 +From: "Jim C. Nasby" +To: Tom Lane +Cc: Antoine , pgsql-performance@postgresql.org +Subject: Re: vacuuming problems continued +Message-ID: <20060605144349.GQ53487@pervasive.com> +References: <92d3a4950606010454y67293765o56001e8996975b45@mail.gmail.com> + <12384.1149174355@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <12384.1149174355@sss.pgh.pa.us> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060605:tgl@sss.pgh.pa.us::T8dj1nu738LYJLFJ:00000000000000000000 + 00000000000000000000000015is +X-Hashcash: + 1:20:060605:melser.anton@gmail.com::r6EuYaM5wh4/+hk1:000000000000000 + 0000000000000000000000000Exk +X-Hashcash: + 1:20:060605:pgsql-performance@postgresql.org::zL2A0zCTipY5i1b+:00000 + 0000000000000000000000006qV7 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/35 +X-Sequence-Number: 19392 + +On Thu, Jun 01, 2006 at 11:05:55AM -0400, Tom Lane wrote: +> Antoine writes: +> > We just don't seem to be getting much benefit from autovacuum. Running +> > a manual vacuum seems to still be doing a LOT, which suggests to me +> > that I should either run a cron job and disable autovacuum, or just +> > run a cron job on top of autovacuum. +> +> The default autovac parameters are very unaggressive --- have you +> experimented with changing them? Do you have the FSM set large enough? + +Do any of the tables have a high 'churn rate' (a lot of updates) but are +supposed to be small? In cases like that autovacuum may not be enough. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-admin-owner@postgresql.org Mon Jun 5 11:48:57 2006 +X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E4CBC9FA2DB; + Mon, 5 Jun 2006 11:48:56 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 15117-01; Mon, 5 Jun 2006 11:48:46 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id ECD6A9FA111; + Mon, 5 Jun 2006 11:48:45 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 6638A5644C; Mon, 5 Jun 2006 09:48:44 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); + Mon, 5 Jun 2006 09:48:41 -0500 +Date: Mon, 5 Jun 2006 09:48:41 -0500 +From: "Jim C. Nasby" +To: Gourish Singbal +Cc: Joao , pgsql-performance@postgresql.org, + "pgsql-admin@postgresql.org" +Subject: Re: [PERFORM] help me problems with pg_clog file +Message-ID: <20060605144841.GR53487@pervasive.com> +References: <002b01c6859f$4f6a7930$d815010a@gesin293> + <674d1f8a0606020041t42878fadxd154cb076a27cdaa@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <674d1f8a0606020041t42878fadxd154cb076a27cdaa@mail.gmail.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060605:gourish@gmail.com::zuF0nOdl6bkNDZTY:00000000000000000000 + 000000000000000000000000Icim +X-Hashcash: + 1:20:060605:joao.junior@conab.gov.br::iDwgkLPhChGp1ecc:0000000000000 + 00000000000000000000000030ym +X-Hashcash: + 1:20:060605:pgsql-performance@postgresql.org::jM46oyqnOhyVzSH9:00000 + 0000000000000000000000003dL9 +X-Hashcash: + 1:20:060605:pgsql-admin@postgresql.org::luSKAhIGx/0Pn/ia:00000000000 + 00000000000000000000000076t0 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/15 +X-Sequence-Number: 21977 + +On Fri, Jun 02, 2006 at 01:11:27PM +0530, Gourish Singbal wrote: +> This Error came since the 0002 file from the pg_clog folder was missing. +> Since the logs are missing from pg_clog folder can perfom pg_resetxlogs to +> reset the logs and bring up the database. + +Understand that this will almost certainly lose some of your data. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Mon Jun 5 12:04:52 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id ECCB09FA2DB + for ; + Mon, 5 Jun 2006 12:04:51 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 28161-02 + for ; + Mon, 5 Jun 2006 12:04:43 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id B50B39FA5D2 + for ; + Mon, 5 Jun 2006 12:04:42 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id A2B4156452; Mon, 5 Jun 2006 10:04:26 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); + Mon, 5 Jun 2006 10:04:25 -0500 +Date: Mon, 5 Jun 2006 10:04:25 -0500 +From: "Jim C. Nasby" +To: Michael Artz +Cc: pgsql-performance@postgresql.org +Subject: Re: Bulk loading/merging +Message-ID: <20060605150425.GS53487@pervasive.com> +References: + <20060531010922.GC59464@pervasive.com> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: 1:20:060605:mlartz@gmail.com::Eiw9lbbOWECRegIu:02jTV +X-Hashcash: + 1:20:060605:pgsql-performance@postgresql.org::gft6IQt79wfQaxEo:00000 + 0000000000000000000000009KmO +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/37 +X-Sequence-Number: 19394 + +On Thu, Jun 01, 2006 at 02:04:46PM -0400, Michael Artz wrote: +> On 5/30/06, Jim C. Nasby wrote: +> +> >Your best bet is to do this as a single, bulk operation if possible. +> >That way you can simply do an UPDATE ... WHERE EXISTS followed by an +> >INSERT ... SELECT ... WHERE NOT EXISTS. +> +> +> +> hmm, I don't quite understand what you are saying and I think my +> basic misunderstanding is how to use the UPDATE ... WHERE EXISTS to merge +> data in bulk. Assuming that I bulk COPYed the data into a temporary +> table, I'd need to issue an UPDATE for each row in the newly created table, +> right? +> +> For example, for a slightly different key,count schema: +> +> CREATE TABLE kc (key integer, count integer); +> +> and wanting to merge the following data by just updating the count for a +> given key to the equivalent of OLD.count + NEW.count: +> +> 1,10 +> 2,15 +> 3,45 +> 1,30 +> +> How would I go about using UPDATE ... WHERE EXISTS to update the "master" kc +> table from a (temporary) table loaded with the above data? + +CREATE TEMP TABLE moo () LIKE kc; +COPY ... moo; +BEGIN; + UPDATE kc + SET count=kc.count + moo.count + FROM moo + WHERE moo.key = kc.key + ; + INSERT INTO kc(key, count) + SELECT key, count + FROM moo + WHERE NOT EXISTS ( + SELECT 1 + FROM kc + WHERE kc.key = moo.key + ) + ; +COMMIT; +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-hackers-owner@postgresql.org Mon Jun 5 12:23:11 2006 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 53AE09FA2DB + for ; + Mon, 5 Jun 2006 12:23:11 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 31089-02 + for ; + Mon, 5 Jun 2006 12:23:01 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 7A9429FA111 + for ; + Mon, 5 Jun 2006 12:23:00 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 5453356455; Mon, 5 Jun 2006 10:22:59 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); + Mon, 5 Jun 2006 10:22:59 -0500 +Date: Mon, 5 Jun 2006 10:22:59 -0500 +From: "Jim C. Nasby" +To: Zoltan Boszormenyi +Cc: pgsql-hackers@postgresql.org +Subject: Re: [PERFORM] psql -A (unaligned format) eats too much memory +Message-ID: <20060605152258.GT53487@pervasive.com> +References: <44835834.2020309@dunaweb.hu> <44835F86.5040008@dunaweb.hu> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <44835F86.5040008@dunaweb.hu> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060605:zboszor@dunaweb.hu::TSzwRbnXGASJDQuJ:0000000000000000000 + 000000000000000000000000166Q +X-Hashcash: + 1:20:060605:pgsql-hackers@postgresql.org::PfAX3K+PNHPumADT:000000000 + 00000000000000000000000006H6 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/156 +X-Sequence-Number: 84389 + +Moving to -hackers + +On Mon, Jun 05, 2006 at 12:32:38AM +0200, Zoltan Boszormenyi wrote: +> >I just noticed that psql's unformatted output uses too much +> >memory. Is it normal? It seems that psql draws all records +> >of a query off the server before it displays or writes the output. +> >I would expect this only with formatted output. +> > +> >Problem is, I have an export that produces 500'000+ records +> >which changes frequently. Several (20+) sites run this query +> >nightly with different parameters and download it. The SELECTs +> >that run in psql -A -t -c '...' may overlap and the query that runs +> >in less than 1.5 minutes if it's the only one at the time may take +> >3+ hours if ten such queries overlap. The time is mostly spent +> >in swapping, all psql processes take up 300+ MB, so the 1GB +> >server is brought to its knees quickly, peek swap usage is 1.8 GB. +> >I watched the progress in top and the postmaster processes finished +> >their work in about half an hour (that would still be acceptable) +> >then the psql processes started eating up memory as they read +> >the records. +> > +> >PostgreSQL 8.1.4 was used on RHEL3. +> > +> >Is there a way to convince psql to use less memory in unformatted +> >mode? I know COPY will be able to use arbitrary SELECTs +> >but until then I am still stuck with redirecting psql's output. +> +> The answer it to use SELECT INTO TEMP and then COPY. +> Psql will use much less memory that way. But still... + +I've been able to verify this on 8.1.4; psql -A -t -c 'SELECT * FROM +largetable' > /dev/null results in psql consuming vast quantities of +memory. Why is this? ISTM this is a bug... +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-hackers-owner@postgresql.org Mon Jun 5 12:27:46 2006 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E2DD29FA5BE + for ; + Mon, 5 Jun 2006 12:27:45 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 22053-08 + for ; + Mon, 5 Jun 2006 12:27:37 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 2E3B99FA111 + for ; + Mon, 5 Jun 2006 12:27:37 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k55FRU2c020513; + Mon, 5 Jun 2006 11:27:31 -0400 (EDT) +To: "Jim C. Nasby" +cc: Zoltan Boszormenyi , pgsql-hackers@postgresql.org +Subject: Re: [PERFORM] psql -A (unaligned format) eats too much memory +In-reply-to: <20060605152258.GT53487@pervasive.com> +References: <44835834.2020309@dunaweb.hu> <44835F86.5040008@dunaweb.hu> + <20060605152258.GT53487@pervasive.com> +Comments: In-reply-to "Jim C. Nasby" + message dated "Mon, 05 Jun 2006 10:22:59 -0500" +Date: Mon, 05 Jun 2006 11:27:30 -0400 +Message-ID: <20512.1149521250@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/157 +X-Sequence-Number: 84390 + +"Jim C. Nasby" writes: +> I've been able to verify this on 8.1.4; psql -A -t -c 'SELECT * FROM +> largetable' > /dev/null results in psql consuming vast quantities of +> memory. Why is this? + +Is it different without the -A? + +I'm reading this as just another uninformed complaint about libpq's +habit of buffering the whole query result. It's possible that there's +a memory leak in the -A path specifically, but nothing said so far +provided any evidence for that. + + regards, tom lane + +From pgsql-hackers-owner@postgresql.org Mon Jun 5 12:54:01 2006 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id BC4C29FA5D2 + for ; + Mon, 5 Jun 2006 12:54:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 32800-08 + for ; + Mon, 5 Jun 2006 12:53:51 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id DFA419FA2DB + for ; + Mon, 5 Jun 2006 12:53:50 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id B6DB956450; Mon, 5 Jun 2006 10:53:49 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); + Mon, 5 Jun 2006 10:53:49 -0500 +Date: Mon, 5 Jun 2006 10:53:49 -0500 +From: "Jim C. Nasby" +To: Tom Lane +Cc: Zoltan Boszormenyi , pgsql-hackers@postgresql.org +Subject: Re: [PERFORM] psql -A (unaligned format) eats too much memory +Message-ID: <20060605155349.GU53487@pervasive.com> +References: <44835834.2020309@dunaweb.hu> <44835F86.5040008@dunaweb.hu> + <20060605152258.GT53487@pervasive.com> + <20512.1149521250@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20512.1149521250@sss.pgh.pa.us> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060605:tgl@sss.pgh.pa.us::RmaCK4o+HF1bGUeL:00000000000000000000 + 0000000000000000000000000bNt +X-Hashcash: + 1:20:060605:zboszor@dunaweb.hu::cCxo9N7lZATarRZi:0000000000000000000 + 0000000000000000000000000TvE +X-Hashcash: + 1:20:060605:pgsql-hackers@postgresql.org::B7yTh18swwe1+K+Y:000000000 + 0000000000000000000000003Yay +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/158 +X-Sequence-Number: 84391 + +On Mon, Jun 05, 2006 at 11:27:30AM -0400, Tom Lane wrote: +> "Jim C. Nasby" writes: +> > I've been able to verify this on 8.1.4; psql -A -t -c 'SELECT * FROM +> > largetable' > /dev/null results in psql consuming vast quantities of +> > memory. Why is this? +> +> Is it different without the -A? + +Nope. + +> I'm reading this as just another uninformed complaint about libpq's +> habit of buffering the whole query result. It's possible that there's +> a memory leak in the -A path specifically, but nothing said so far +> provided any evidence for that. + +Certainly seems like it. It seems like it would be good to allow for +libpq not to buffer, since there's cases where it's not needed... +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-hackers-owner@postgresql.org Mon Jun 5 13:00:58 2006 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id AA2B29FA6B1 + for ; + Mon, 5 Jun 2006 13:00:57 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 34410-02 + for ; + Mon, 5 Jun 2006 13:00:42 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id B84509FA2FD + for ; + Mon, 5 Jun 2006 13:00:41 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k55G0Z7D020814; + Mon, 5 Jun 2006 12:00:35 -0400 (EDT) +To: "Jim C. Nasby" +cc: Zoltan Boszormenyi , pgsql-hackers@postgresql.org +Subject: Re: [PERFORM] psql -A (unaligned format) eats too much memory +In-reply-to: <20060605155349.GU53487@pervasive.com> +References: <44835834.2020309@dunaweb.hu> <44835F86.5040008@dunaweb.hu> + <20060605152258.GT53487@pervasive.com> + <20512.1149521250@sss.pgh.pa.us> + <20060605155349.GU53487@pervasive.com> +Comments: In-reply-to "Jim C. Nasby" + message dated "Mon, 05 Jun 2006 10:53:49 -0500" +Date: Mon, 05 Jun 2006 12:00:35 -0400 +Message-ID: <20813.1149523235@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/160 +X-Sequence-Number: 84393 + +"Jim C. Nasby" writes: +> On Mon, Jun 05, 2006 at 11:27:30AM -0400, Tom Lane wrote: +>> I'm reading this as just another uninformed complaint about libpq's +>> habit of buffering the whole query result. It's possible that there's +>> a memory leak in the -A path specifically, but nothing said so far +>> provided any evidence for that. + +> Certainly seems like it. It seems like it would be good to allow for +> libpq not to buffer, since there's cases where it's not needed... + +See past discussions. The problem is that libpq's API says that when it +hands you back the completed query result, the command is complete and +guaranteed not to fail later. A streaming interface could not make that +guarantee, so it's not a transparent substitution. + +I wouldn't have any strong objection to providing a separate API that +operates in a streaming fashion, but defining it is something no one's +bothered to do yet. In practice, if you have to code to a variant API, +it's not that much more trouble to use a cursor... + + regards, tom lane + +From pgsql-hackers-owner@postgresql.org Mon Jun 5 13:41:24 2006 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id ACE479FA5B5 + for ; + Mon, 5 Jun 2006 13:41:23 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 37638-06 + for ; + Mon, 5 Jun 2006 13:41:13 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from trolak.mydnsbox2.com (ns1.mydnsbox2.com [207.44.142.118]) + by postgresql.org (Postfix) with ESMTP id 5A9889FA30C + for ; + Mon, 5 Jun 2006 13:41:12 -0300 (ADT) +Received: from [192.168.1.227] (68.143.134.146.nw.nuvox.net [68.143.134.146]) + (authenticated (0 bits)) + by trolak.mydnsbox2.com (8.11.6/8.11.6) with ESMTP id k55G4Cc18211; + Mon, 5 Jun 2006 11:04:12 -0500 +Message-ID: <44845E86.3080001@dunslane.net> +Date: Mon, 05 Jun 2006 12:40:38 -0400 +From: Andrew Dunstan +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.8.0.1) Gecko/20060201 SeaMonkey/1.0 +MIME-Version: 1.0 +To: Mark Woodward +CC: Tom Lane , "Jim C. Nasby" , + Zoltan Boszormenyi , pgsql-hackers@postgresql.org +Subject: Re: [PERFORM] psql -A (unaligned format) eats too much +References: <44835834.2020309@dunaweb.hu> <44835F86.5040008@dunaweb.hu> + <20060605152258.GT53487@pervasive.com> + <20512.1149521250@sss.pgh.pa.us> + <20060605155349.GU53487@pervasive.com> + <20813.1149523235@sss.pgh.pa.us> + <18006.24.91.171.78.1149526092.squirrel@mail.mohawksoft.com> +In-Reply-To: <18006.24.91.171.78.1149526092.squirrel@mail.mohawksoft.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/162 +X-Sequence-Number: 84395 + +Mark Woodward wrote: +>> "Jim C. Nasby" writes: +>> +>>> On Mon, Jun 05, 2006 at 11:27:30AM -0400, Tom Lane wrote: +>>> +>>>> I'm reading this as just another uninformed complaint about libpq's +>>>> habit of buffering the whole query result. It's possible that there's +>>>> a memory leak in the -A path specifically, but nothing said so far +>>>> provided any evidence for that. +>>>> +>>> Certainly seems like it. It seems like it would be good to allow for +>>> libpq not to buffer, since there's cases where it's not needed... +>>> +>> See past discussions. The problem is that libpq's API says that when it +>> hands you back the completed query result, the command is complete and +>> guaranteed not to fail later. A streaming interface could not make that +>> guarantee, so it's not a transparent substitution. +>> +>> I wouldn't have any strong objection to providing a separate API that +>> operates in a streaming fashion, but defining it is something no one's +>> bothered to do yet. In practice, if you have to code to a variant API, +>> it's not that much more trouble to use a cursor... +>> +>> +> +> Wouldn't the "COPY (select ...) TO STDOUT" format being discussed solve +> this for free? +> +> +> + +It won't solve it in the general case for clients that expect a result +set. ISTM that "use a cursor" is a perfectly reasonable answer, though. + +cheers + +andrew + + +From pgsql-hackers-owner@postgresql.org Mon Jun 5 13:45:35 2006 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0347C9FA30C + for ; + Mon, 5 Jun 2006 13:45:35 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 41833-04 + for ; + Mon, 5 Jun 2006 13:45:24 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from linux.dunaweb.hu (linux.dunaweb.hu [62.77.196.1]) + by postgresql.org (Postfix) with ESMTP id 457819FA12F + for ; + Mon, 5 Jun 2006 13:45:21 -0300 (ADT) +Received: from localhost (linux.dunaweb.hu [127.0.0.1]) + by linux.dunaweb.hu (Postfix) with ESMTP + id 6C06B8E0895; Mon, 5 Jun 2006 18:45:19 +0200 (CEST) +Received: from linux.dunaweb.hu ([127.0.0.1]) + by localhost (linux.dunaweb.hu [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 23503-08; Mon, 5 Jun 2006 18:45:12 +0200 (CEST) +Received: from [81.17.177.202] (host-81-17-177-202.dunaweb.hu [81.17.177.202]) + by linux.dunaweb.hu (Postfix) with ESMTP + id ED5C88E0804; Mon, 5 Jun 2006 18:45:11 +0200 (CEST) +Message-ID: <44845F99.7050306@dunaweb.hu> +Date: Mon, 05 Jun 2006 18:45:13 +0200 +From: Zoltan Boszormenyi +User-Agent: Thunderbird 1.5.0.2 (X11/20060501) +MIME-Version: 1.0 +To: Tom Lane +Cc: "Jim C. Nasby" , + pgsql-hackers@postgresql.org +Subject: Re: [PERFORM] psql -A (unaligned format) eats too much +References: <44835834.2020309@dunaweb.hu> <44835F86.5040008@dunaweb.hu> + <20060605152258.GT53487@pervasive.com> + <20512.1149521250@sss.pgh.pa.us> +In-Reply-To: <20512.1149521250@sss.pgh.pa.us> +Content-Type: text/plain; charset=ISO-8859-2; format=flowed +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: amavisd-new at dunaweb.hu +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/163 +X-Sequence-Number: 84396 + +Hi! + +Tom Lane �rta: +> "Jim C. Nasby" writes: +> +>> I've been able to verify this on 8.1.4; psql -A -t -c 'SELECT * FROM +>> largetable' > /dev/null results in psql consuming vast quantities of +>> memory. Why is this? +>> +> +> Is it different without the -A? +> +> I'm reading this as just another uninformed complaint about libpq's +> habit of buffering the whole query result. It's possible that there's +> a memory leak in the -A path specifically, but nothing said so far +> provided any evidence for that. +> +> regards, tom lane +> + +So, is libpq always buffering the result? Thanks. +I thought psql buffers only because in its formatted output mode +it has to know the widest value for all the columns. + +Then the SELECT INTO TEMP ; COPY TO STDOUT solution +I found is _the_ solution. + +I guess then the libpq-based ODBC driver suffers +from the same problem? It certainly explains the +performance problems I observed: the server +finishes the query, the ODBC driver (or libpq underneath) +fetches all the records and the application receives +the first record after all these. Nice. + +Best regards, +Zolt�n B�sz�rm�nyi + + +From pgsql-hackers-owner@postgresql.org Mon Jun 5 13:34:02 2006 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7746F9FA30C + for ; + Mon, 5 Jun 2006 13:34:01 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 38593-03 + for ; + Mon, 5 Jun 2006 13:33:52 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from outland.mohawksoft.com (unknown [64.46.156.80]) + by postgresql.org (Postfix) with ESMTP id 547959FA12F + for ; + Mon, 5 Jun 2006 13:33:50 -0300 (ADT) +Received: from outland.mohawksoft.com (localhost [127.0.0.1]) + by outland.mohawksoft.com (8.13.6/8.9.3) with ESMTP id k55GmPs1006624; + Mon, 5 Jun 2006 12:48:25 -0400 +Received: (from mohawk@localhost) + by outland.mohawksoft.com (8.13.6/8.13.3/Submit) id k55GmCPj006617; + Mon, 5 Jun 2006 12:48:12 -0400 +X-Authentication-Warning: outland.mohawksoft.com: mohawk set sender to + pgsql@mohawksoft.com using -f +Received: from 24.91.171.78 (SquirrelMail authenticated user pgsql) + by mail.mohawksoft.com with HTTP; + Mon, 5 Jun 2006 12:48:12 -0400 (EDT) +Message-ID: <18006.24.91.171.78.1149526092.squirrel@mail.mohawksoft.com> +In-Reply-To: <20813.1149523235@sss.pgh.pa.us> +References: <44835834.2020309@dunaweb.hu> <44835F86.5040008@dunaweb.hu> + <20060605152258.GT53487@pervasive.com> <20512.1149521250@sss.pgh.pa.us> + <20060605155349.GU53487@pervasive.com> + <20813.1149523235@sss.pgh.pa.us> +Date: Mon, 5 Jun 2006 12:48:12 -0400 (EDT) +Subject: Re: [PERFORM] psql -A (unaligned format) eats too much +From: "Mark Woodward" +To: "Tom Lane" +Cc: "Jim C. Nasby" , + "Zoltan Boszormenyi" , pgsql-hackers@postgresql.org +User-Agent: SquirrelMail/1.4.5 +MIME-Version: 1.0 +Content-Type: text/plain;charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Priority: 3 (Normal) +Importance: Normal +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/161 +X-Sequence-Number: 84394 + +> "Jim C. Nasby" writes: +>> On Mon, Jun 05, 2006 at 11:27:30AM -0400, Tom Lane wrote: +>>> I'm reading this as just another uninformed complaint about libpq's +>>> habit of buffering the whole query result. It's possible that there's +>>> a memory leak in the -A path specifically, but nothing said so far +>>> provided any evidence for that. +> +>> Certainly seems like it. It seems like it would be good to allow for +>> libpq not to buffer, since there's cases where it's not needed... +> +> See past discussions. The problem is that libpq's API says that when it +> hands you back the completed query result, the command is complete and +> guaranteed not to fail later. A streaming interface could not make that +> guarantee, so it's not a transparent substitution. +> +> I wouldn't have any strong objection to providing a separate API that +> operates in a streaming fashion, but defining it is something no one's +> bothered to do yet. In practice, if you have to code to a variant API, +> it's not that much more trouble to use a cursor... +> + +Wouldn't the "COPY (select ...) TO STDOUT" format being discussed solve +this for free? + +From pgsql-hackers-owner@postgresql.org Mon Jun 5 13:47:25 2006 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 06FDD9FA5C8 + for ; + Mon, 5 Jun 2006 13:47:25 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 43221-04 + for ; + Mon, 5 Jun 2006 13:47:16 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from outland.mohawksoft.com (unknown [64.46.156.80]) + by postgresql.org (Postfix) with ESMTP id C35A09FA12F + for ; + Mon, 5 Jun 2006 13:47:15 -0300 (ADT) +Received: from outland.mohawksoft.com (localhost [127.0.0.1]) + by outland.mohawksoft.com (8.13.6/8.9.3) with ESMTP id k55H1oYJ007297; + Mon, 5 Jun 2006 13:01:50 -0400 +Received: (from mohawk@localhost) + by outland.mohawksoft.com (8.13.6/8.13.3/Submit) id k55H1jno007296; + Mon, 5 Jun 2006 13:01:45 -0400 +X-Authentication-Warning: outland.mohawksoft.com: mohawk set sender to + pgsql@mohawksoft.com using -f +Received: from 24.91.171.78 (SquirrelMail authenticated user pgsql) + by mail.mohawksoft.com with HTTP; + Mon, 5 Jun 2006 13:01:45 -0400 (EDT) +Message-ID: <18067.24.91.171.78.1149526905.squirrel@mail.mohawksoft.com> +In-Reply-To: <44845E86.3080001@dunslane.net> +References: <44835834.2020309@dunaweb.hu> <44835F86.5040008@dunaweb.hu> + <20060605152258.GT53487@pervasive.com> <20512.1149521250@sss.pgh.pa.us> + <20060605155349.GU53487@pervasive.com> + <20813.1149523235@sss.pgh.pa.us> + <18006.24.91.171.78.1149526092.squirrel@mail.mohawksoft.com> + <44845E86.3080001@dunslane.net> +Date: Mon, 5 Jun 2006 13:01:45 -0400 (EDT) +Subject: Re: [PERFORM] psql -A (unaligned format) eats too much +From: "Mark Woodward" +To: "Andrew Dunstan" +Cc: "Tom Lane" , "Jim C. Nasby" , + "Zoltan Boszormenyi" , pgsql-hackers@postgresql.org +User-Agent: SquirrelMail/1.4.5 +MIME-Version: 1.0 +Content-Type: text/plain;charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Priority: 3 (Normal) +Importance: Normal +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/164 +X-Sequence-Number: 84397 + +> Mark Woodward wrote: +>>> "Jim C. Nasby" writes: +>>> +>>>> On Mon, Jun 05, 2006 at 11:27:30AM -0400, Tom Lane wrote: +>>>> +>>>>> I'm reading this as just another uninformed complaint about libpq's +>>>>> habit of buffering the whole query result. It's possible that +>>>>> there's +>>>>> a memory leak in the -A path specifically, but nothing said so far +>>>>> provided any evidence for that. +>>>>> +>>>> Certainly seems like it. It seems like it would be good to allow for +>>>> libpq not to buffer, since there's cases where it's not needed... +>>>> +>>> See past discussions. The problem is that libpq's API says that when +>>> it +>>> hands you back the completed query result, the command is complete and +>>> guaranteed not to fail later. A streaming interface could not make +>>> that +>>> guarantee, so it's not a transparent substitution. +>>> +>>> I wouldn't have any strong objection to providing a separate API that +>>> operates in a streaming fashion, but defining it is something no one's +>>> bothered to do yet. In practice, if you have to code to a variant API, +>>> it's not that much more trouble to use a cursor... +>>> +>>> +>> +>> Wouldn't the "COPY (select ...) TO STDOUT" format being discussed solve +>> this for free? +>> +>> +>> +> +> It won't solve it in the general case for clients that expect a result +> set. ISTM that "use a cursor" is a perfectly reasonable answer, though. + +I'm not sure I agree -- surprise! + +psql is often used as a command line tool and using a cursor is not +acceptable. + +Granted, with an unaligned output, perhaps psql should not buffer the +WHOLE result at once, but without rewriting that behavior, a COPY from +query may be close enough. + +From pgsql-hackers-owner@postgresql.org Mon Jun 5 14:03:51 2006 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 018279FA12F + for ; + Mon, 5 Jun 2006 14:03:51 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 43854-06 + for ; + Mon, 5 Jun 2006 14:03:42 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from trolak.mydnsbox2.com (ns1.mydnsbox2.com [207.44.142.118]) + by postgresql.org (Postfix) with ESMTP id B98B09FA30C + for ; + Mon, 5 Jun 2006 14:03:41 -0300 (ADT) +Received: from [192.168.1.227] (68.143.134.146.nw.nuvox.net [68.143.134.146]) + (authenticated (0 bits)) + by trolak.mydnsbox2.com (8.11.6/8.11.6) with ESMTP id k55GQwc19259; + Mon, 5 Jun 2006 11:26:58 -0500 +Message-ID: <448463DC.8030306@dunslane.net> +Date: Mon, 05 Jun 2006 13:03:24 -0400 +From: Andrew Dunstan +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.8.0.1) Gecko/20060201 SeaMonkey/1.0 +MIME-Version: 1.0 +To: Mark Woodward +CC: Tom Lane , "Jim C. Nasby" , + Zoltan Boszormenyi , pgsql-hackers@postgresql.org +Subject: Re: [PERFORM] psql -A (unaligned format) eats too much +References: <44835834.2020309@dunaweb.hu> <44835F86.5040008@dunaweb.hu> + <20060605152258.GT53487@pervasive.com> + <20512.1149521250@sss.pgh.pa.us> + <20060605155349.GU53487@pervasive.com> + <20813.1149523235@sss.pgh.pa.us> + <18006.24.91.171.78.1149526092.squirrel@mail.mohawksoft.com> + <44845E86.3080001@dunslane.net> + <18067.24.91.171.78.1149526905.squirrel@mail.mohawksoft.com> +In-Reply-To: <18067.24.91.171.78.1149526905.squirrel@mail.mohawksoft.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/165 +X-Sequence-Number: 84398 + +Mark Woodward wrote: +>>>> +>>>> +>>>> +>>> Wouldn't the "COPY (select ...) TO STDOUT" format being discussed solve +>>> this for free? +>>> +>>> +>>> +>>> +>> It won't solve it in the general case for clients that expect a result +>> set. ISTM that "use a cursor" is a perfectly reasonable answer, though. +>> +> +> I'm not sure I agree -- surprise! +> +> psql is often used as a command line tool and using a cursor is not +> acceptable. +> +> Granted, with an unaligned output, perhaps psql should not buffer the +> WHOLE result at once, but without rewriting that behavior, a COPY from +> query may be close enough. +> +> + +You have missed my point. Surprise! + +I didn't say it wasn't OK in the psql case, I said it wasn't helpful in +the case of *other* libpq clients. + +Expecting clients generally to split and interpret COPY output is not +reasonable, but if they want large result sets they should use a cursor. + +cheers + +andrew + + +From pgsql-hackers-owner@postgresql.org Mon Jun 5 14:17:45 2006 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 184099FA5B5 + for ; + Mon, 5 Jun 2006 14:17:45 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 48446-10 + for ; + Mon, 5 Jun 2006 14:17:35 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from linux.dunaweb.hu (linux.dunaweb.hu [62.77.196.1]) + by postgresql.org (Postfix) with ESMTP id 248889FA30C + for ; + Mon, 5 Jun 2006 14:17:35 -0300 (ADT) +Received: from localhost (linux.dunaweb.hu [127.0.0.1]) + by linux.dunaweb.hu (Postfix) with ESMTP + id E4DE88E056A; Mon, 5 Jun 2006 19:17:32 +0200 (CEST) +Received: from linux.dunaweb.hu ([127.0.0.1]) + by localhost (linux.dunaweb.hu [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 30692-06; Mon, 5 Jun 2006 19:17:31 +0200 (CEST) +Received: from [81.17.177.202] (host-81-17-177-202.dunaweb.hu [81.17.177.202]) + by linux.dunaweb.hu (Postfix) with ESMTP + id 4D5788E0581; Mon, 5 Jun 2006 19:17:31 +0200 (CEST) +Message-ID: <4484672B.8080606@dunaweb.hu> +Date: Mon, 05 Jun 2006 19:17:31 +0200 +From: Zoltan Boszormenyi +User-Agent: Thunderbird 1.5.0.2 (X11/20060501) +MIME-Version: 1.0 +To: Andrew Dunstan +Cc: Mark Woodward , + Tom Lane , "Jim C. Nasby" , + pgsql-hackers@postgresql.org +Subject: Re: [PERFORM] psql -A (unaligned format) eats too much +References: <44835834.2020309@dunaweb.hu> <44835F86.5040008@dunaweb.hu> + <20060605152258.GT53487@pervasive.com> + <20512.1149521250@sss.pgh.pa.us> + <20060605155349.GU53487@pervasive.com> + <20813.1149523235@sss.pgh.pa.us> + <18006.24.91.171.78.1149526092.squirrel@mail.mohawksoft.com> + <44845E86.3080001@dunslane.net> +In-Reply-To: <44845E86.3080001@dunslane.net> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: amavisd-new at dunaweb.hu +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/166 +X-Sequence-Number: 84399 + +Andrew Dunstan �rta: +> Mark Woodward wrote: +>>> "Jim C. Nasby" writes: +>>> +>>>> On Mon, Jun 05, 2006 at 11:27:30AM -0400, Tom Lane wrote: +>>>> +>>>>> I'm reading this as just another uninformed complaint about libpq's +>>>>> habit of buffering the whole query result. It's possible that +>>>>> there's +>>>>> a memory leak in the -A path specifically, but nothing said so far +>>>>> provided any evidence for that. +>>>>> +>>>> Certainly seems like it. It seems like it would be good to allow for +>>>> libpq not to buffer, since there's cases where it's not needed... +>>>> +>>> See past discussions. The problem is that libpq's API says that +>>> when it +>>> hands you back the completed query result, the command is complete and +>>> guaranteed not to fail later. A streaming interface could not make +>>> that +>>> guarantee, so it's not a transparent substitution. +>>> +>>> I wouldn't have any strong objection to providing a separate API that +>>> operates in a streaming fashion, but defining it is something no one's +>>> bothered to do yet. In practice, if you have to code to a variant API, +>>> it's not that much more trouble to use a cursor... +>>> +>>> +>> +>> Wouldn't the "COPY (select ...) TO STDOUT" format being discussed solve +>> this for free? + +Yes, it would for me. + +> It won't solve it in the general case for clients that expect a result +> set. ISTM that "use a cursor" is a perfectly reasonable answer, though. + +The general case cannot be applied for all particular cases. +E.g. you cannot use cursors from shell scripts and just for +producing an "export file" it's not too reasonable either. +Redirecting psql's output or COPY is enough. + +Best regards, +Zolt�n B�sz�r�nyi + + +From pgsql-hackers-owner@postgresql.org Mon Jun 5 14:52:39 2006 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 13D959FA30C + for ; + Mon, 5 Jun 2006 14:52:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 55192-05 + for ; + Mon, 5 Jun 2006 14:52:30 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) + by postgresql.org (Postfix) with ESMTP id 0F7B89FA12F + for ; + Mon, 5 Jun 2006 14:52:30 -0300 (ADT) +Received: from localhost (mailbox.samurai.com [205.207.28.82]) + by mailbox.samurai.com (Postfix) with ESMTP id 03B9C61E56; + Mon, 5 Jun 2006 13:52:29 -0400 (EDT) +X-Virus-Scanned: by amavisd-new at mailbox.samurai.com +Received: from mailbox.samurai.com ([205.207.28.82]) + by localhost (mailbox.samurai.com [205.207.28.82]) (amavisd-new, + port 10024) + with LMTP id RocapZNHU+2L; Mon, 5 Jun 2006 13:52:27 -0400 (EDT) +Received: from [192.168.1.103] (unknown [69.28.112.26]) + (using TLSv1 with cipher RC4-MD5 (128/128 bits)) + (No client certificate requested) + by mailbox.samurai.com (Postfix) with ESMTP id C241761F82; + Mon, 5 Jun 2006 13:52:26 -0400 (EDT) +Subject: Re: [PERFORM] psql -A (unaligned format) eats too much +From: Neil Conway +To: Zoltan Boszormenyi +Cc: Andrew Dunstan , + Mark Woodward , + Tom Lane , "Jim C. Nasby" , + pgsql-hackers@postgresql.org +In-Reply-To: <4484672B.8080606@dunaweb.hu> +References: <44835834.2020309@dunaweb.hu> <44835F86.5040008@dunaweb.hu> + <20060605152258.GT53487@pervasive.com> <20512.1149521250@sss.pgh.pa.us> + <20060605155349.GU53487@pervasive.com> <20813.1149523235@sss.pgh.pa.us> + <18006.24.91.171.78.1149526092.squirrel@mail.mohawksoft.com> + <44845E86.3080001@dunslane.net> <4484672B.8080606@dunaweb.hu> +Content-Type: text/plain +Date: Mon, 05 Jun 2006 10:52:25 -0700 +Message-Id: <1149529945.5577.5.camel@localhost> +Mime-Version: 1.0 +X-Mailer: Evolution 2.6.1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/167 +X-Sequence-Number: 84400 + +On Mon, 2006-06-05 at 19:17 +0200, Zoltan Boszormenyi wrote: +> The general case cannot be applied for all particular cases. +> E.g. you cannot use cursors from shell scripts + +This could be fixed by adding an option to psql to transparently produce +SELECT result sets via a cursor. + +-Neil + + + +From pgsql-hackers-owner@postgresql.org Mon Jun 5 15:10:45 2006 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 512E09FA5B5 + for ; + Mon, 5 Jun 2006 15:10:45 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 55961-09 + for ; + Mon, 5 Jun 2006 15:10:36 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 69D7E9FA12F + for ; + Mon, 5 Jun 2006 15:10:36 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k55IAOqJ021821; + Mon, 5 Jun 2006 14:10:24 -0400 (EDT) +To: Neil Conway +cc: Zoltan Boszormenyi , + Andrew Dunstan , Mark Woodward , + "Jim C. Nasby" , pgsql-hackers@postgresql.org +Subject: Re: [PERFORM] psql -A (unaligned format) eats too much +In-reply-to: <1149529945.5577.5.camel@localhost> +References: <44835834.2020309@dunaweb.hu> <44835F86.5040008@dunaweb.hu> + <20060605152258.GT53487@pervasive.com> + <20512.1149521250@sss.pgh.pa.us> + <20060605155349.GU53487@pervasive.com> + <20813.1149523235@sss.pgh.pa.us> + <18006.24.91.171.78.1149526092.squirrel@mail.mohawksoft.com> + <44845E86.3080001@dunslane.net> <4484672B.8080606@dunaweb.hu> + <1149529945.5577.5.camel@localhost> +Comments: In-reply-to Neil Conway + message dated "Mon, 05 Jun 2006 10:52:25 -0700" +Date: Mon, 05 Jun 2006 14:10:24 -0400 +Message-ID: <21820.1149531024@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/171 +X-Sequence-Number: 84404 + +Neil Conway writes: +> On Mon, 2006-06-05 at 19:17 +0200, Zoltan Boszormenyi wrote: +>> The general case cannot be applied for all particular cases. +>> E.g. you cannot use cursors from shell scripts + +> This could be fixed by adding an option to psql to transparently produce +> SELECT result sets via a cursor. + +Note of course that such a thing would push the incomplete-result +problem further upstream. For instance in (hypothetical --cursor +switch) + psql --cursor -c "select ..." | myprogram +there would be no very good way for myprogram to find out that it'd +been sent an incomplete result due to error partway through the SELECT. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jun 5 16:17:29 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 9A4149FA5B5 + for ; + Mon, 5 Jun 2006 16:17:28 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 65380-06 + for ; + Mon, 5 Jun 2006 16:17:16 -0300 (ADT) +X-Greylist: delayed 00:12:03.871292 by SQLgrey- +Received: from exchbg03.prounlimited.corp (exchg01.pro-unlimited.com + [67.104.17.130]) + by postgresql.org (Postfix) with ESMTP id 50FC79FA30C + for ; + Mon, 5 Jun 2006 16:17:14 -0300 (ADT) +Received: from bg002441.pro-unlimited.com ([172.16.2.35]) by + exchbg03.prounlimited.corp with Microsoft SMTPSVC(6.0.3790.1830); + Mon, 5 Jun 2006 12:05:08 -0700 +Subject: Some queries starting to hang +From: Chris Beecroft +To: pgsql-performance@postgresql.org +Content-Type: multipart/mixed; boundary="=-UP+pas5olwTgDxYtSNoC" +Message-Id: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.5 (1.4.5-17) +Date: Mon, 05 Jun 2006 12:05:08 -0700 +X-OriginalArrivalTime: 05 Jun 2006 19:05:08.0800 (UTC) + FILETIME=[F6935C00:01C688D2] +X-TM-AS-Product-Ver: SMEX-7.0.0.1345-3.52.1006-14488.003 +X-TM-AS-Result: No--0.900000-8.000000-2 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/38 +X-Sequence-Number: 19395 + + +--=-UP+pas5olwTgDxYtSNoC +Content-Type: text/plain +Content-Transfer-Encoding: 7bit + +Hello, + +I've noticed some posts on hanging queries but haven't seen any +solutions yet so far. + +Our problem is that about a week and a half ago we started to get some +queries that would (seemingly) never return (e.g., normally run in a +couple minutes, but after 2.5 hours, they were still running, the +process pushing the processor up to 99.9% active). + +We are running Postgres 8.1.1 on Redhat 7.3 using Dell poweredge quad +processor boxes with 4 GB of memory. We have a main database that is +replicated via Sloney to a identical system. + +Things we've tried so far: + +We've stopped and restarted postgres and that didn't seem to help, we've +rebuilt all the indexes and that didn't seem to help either. We've +stopped replication between the boxes and that didn't do anything. +We've tried the queries on both the production and the replicated box, +and there is no difference in the queries (or query plans) + +We do have another identical system that is a backup box (same type of +box, Postgres 8.1.1, Redhat 7.3, etc), and there, the query does +complete executing in a short time. We loaded up a current copy of the +production database and it still responded quickly. + +Generally these queries, although not complicated, are on the more +complex side of our application. Second, they have been running up +until a few weeks ago. + +Attached are an example query plan: Query.sql +The query plan from our production sever: QueryPlanBroke.txt +The working query plan from our backup server: QueryPlanWork.txt + +What we found that has worked so far is to remove all the outer joins, +put the results into a temp table and then left join from the temp table +to get our results. Certainly this isn't a solution, but rather +something we have resorted to in a place or to as we limp along. + + +Any help would be greatly appreciated. + +Thanks, +Chris Beecroft + + +--=-UP+pas5olwTgDxYtSNoC +Content-Disposition: attachment; filename=QueryPlanBroke.txt +Content-Type: text/plain; name=QueryPlanBroke.txt; charset= +Content-Transfer-Encoding: 7bit + + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Sort (cost=129334.05..129334.06 rows=1 width=305) + Sort Key: (((uw.name_last)::text || ', '::text) || (uw.name_first)::text), o.job_title + -> Nested Loop (cost=30150.77..129334.04 rows=1 width=305) + -> Nested Loop (cost=30150.77..129329.51 rows=1 width=301) + -> Nested Loop (cost=30150.77..129325.02 rows=1 width=280) + -> Nested Loop (cost=30150.77..129320.54 rows=1 width=266) + -> Nested Loop (cost=30150.77..129316.64 rows=1 width=237) + Join Filter: ("outer".keyf_orderid = "inner".keyp_orderid) + -> Seq Scan on timecard t (cost=0.00..95010.50 rows=1 width=108) + Filter: ((week_ending >= '04/02/2006'::date) AND (week_ending <= '04/30/2006'::date)) + -> Merge Right Join (cost=30150.77..34168.90 rows=10979 width=133) + Merge Cond: ("outer".keyp_departmentid = "inner".keyf_parentid) + -> Index Scan using department_pkey on department d2 (cost=0.00..3775.63 rows=84962 width=22) + -> Sort (cost=30150.77..30178.22 rows=10979 width=119) + Sort Key: d1.keyf_parentid + -> Merge Right Join (cost=25261.41..29413.95 rows=10979 width=119) + Merge Cond: ("outer".keyp_departmentid = "inner".keyf_departmentid) + -> Index Scan using department_pkey on department d1 (cost=0.00..3775.63 rows=84962 width=36) + -> Sort (cost=25261.41..25288.85 rows=10979 width=91) + Sort Key: o.keyf_departmentid + -> Merge Right Join (cost=21271.06..24524.58 rows=10979 width=91) + Merge Cond: ("outer".keyf_managerid = "inner".keyf_managerid) + -> Index Scan using users_managerid on users um (cost=0.00..10381.20 rows=141125 width=23) -> Sort (cost=21271.06..21298.50 rows=10979 width=76) + Sort Key: o.keyf_managerid + -> Merge Right Join (cost=14303.57..20534.23 rows=10979 width=76) + Merge Cond: ("outer".keyf_workerid = "inner".keyf_workerid) + -> Index Scan using users_workerid on users uw (cost=0.00..11586.52 rows=141125 width=23) + -> Sort (cost=14303.57..14331.02 rows=10979 width=57) + Sort Key: o.keyf_workerid + -> Bitmap Heap Scan on orders o (cost=82.43..13566.75 rows=10979 width=57) + Recheck Cond: (keyf_clientid = 8) + -> Bitmap Index Scan on orders_clientid_idx (cost=0.00..82.43 rows=10979 width=0) + Index Cond: (keyf_clientid = 8) + -> Index Scan using address_building_pkey on address_building ab (cost=0.00..3.89 rows=1 width=37) + Index Cond: ("outer".keyf_address_buildingid = ab.keyp_address_buildingid) + -> Index Scan using location_pkey on "location" l (cost=0.00..4.46 rows=1 width=22) + Index Cond: ("outer".keyf_locationid = l.keyp_locationid) + -> Index Scan using supplier_pkey on supplier s (cost=0.00..4.48 rows=1 width=29) + Index Cond: ("outer".keyf_supplierid = s.keyp_supplierid) + -> Index Scan using invoice_pkey on invoice i (cost=0.00..4.51 rows=1 width=8) + Index Cond: ("outer".keyf_invoiceid = i.keyp_invoiceid) +(42 rows) + +--=-UP+pas5olwTgDxYtSNoC +Content-Disposition: attachment; filename=QueryPlanWork.txt +Content-Type: text/plain; name=QueryPlanWork.txt; charset= +Content-Transfer-Encoding: 7bit + + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Sort (cost=125493.83..125498.35 rows=1810 width=306) + Sort Key: (((uw.name_last)::text || ', '::text) || (uw.name_first)::text), o.job_title + -> Hash Join (cost=30904.77..125395.89 rows=1810 width=306) + Hash Cond: ("outer".keyf_locationid = "inner".keyp_locationid) + -> Hash Join (cost=30827.73..125263.35 rows=1929 width=292) + Hash Cond: ("outer".keyf_invoiceid = "inner".keyp_invoiceid) + -> Hash Join (cost=30362.29..123695.58 rows=2001 width=288) + Hash Cond: ("outer".keyf_orderid = "inner".keyp_orderid) + -> Seq Scan on timecard t (cost=0.00..92465.02 rows=42412 width=108) + Filter: ((week_ending >= '2006-04-02'::date) AND (week_ending <= '2006-04-30'::date)) + -> Hash (cost=30344.41..30344.41 rows=7154 width=184) + -> Hash Join (cost=25801.65..30344.41 rows=7154 width=184) + Hash Cond: ("outer".keyf_address_buildingid = "inner".keyp_address_buildingid) + -> Hash Join (cost=25572.65..29853.27 rows=7624 width=155) + Hash Cond: ("outer".keyf_supplierid = "inner".keyp_supplierid) + -> Merge Right Join (cost=25091.38..29151.62 rows=8236 width=133) + Merge Cond: ("outer".keyp_departmentid = "inner".keyf_parentid) + -> Index Scan using department_pkey on department d2 (cost=0.00..3725.11 rows=84901 width=22) + -> Sort (cost=25091.38..25111.97 rows=8236 width=119) + Sort Key: d1.keyf_parentid + -> Merge Right Join (cost=20494.95..24555.72 rows=8236 width=119) + Merge Cond: ("outer".keyp_departmentid = "inner".keyf_departmentid) + -> Index Scan using department_pkey on department d1 (cost=0.00..3725.11 rows=84901 width=36) + -> Sort (cost=20494.95..20515.54 rows=8236 width=91) + Sort Key: o.keyf_departmentid + -> Merge Right Join (cost=16935.57..19959.30 rows=8236 width=91) + Merge Cond: ("outer".keyf_managerid = "inner".keyf_managerid) + -> Index Scan using users_managerid on users um (cost=0.00..9993.43 rows=126903 width=23) + -> Sort (cost=16935.57..16956.16 rows=8236 width=76) + Sort Key: o.keyf_managerid + -> Merge Right Join (cost=11006.83..16399.91 rows=8236 width=76) + Merge Cond: ("outer".keyf_workerid = "inner".keyf_workerid) + -> Index Scan using users_workerid on users uw (cost=0.00..10067.22 rows=126903 width=23) + -> Sort (cost=11006.83..11027.42 rows=8236 width=57) + Sort Key: o.keyf_workerid + -> Bitmap Heap Scan on orders o (cost=48.83..10471.17 rows=8236 width=57) + Recheck Cond: (keyf_clientid = 8) + -> Bitmap Index Scan on orders_clientid_idx (cost=0.00..48.83 rows=8236 width=0) + Index Cond: (keyf_clientid = 8) + -> Hash (cost=449.62..449.62 rows=12662 width=30) + -> Seq Scan on supplier s (cost=0.00..449.62 rows=12662 width=30) + -> Hash (cost=205.40..205.40 rows=9440 width=37) + -> Seq Scan on address_building ab (cost=0.00..205.40 rows=9440 width=37) + -> Hash (cost=420.55..420.55 rows=17955 width=8) + -> Seq Scan on invoice i (cost=0.00..420.55 rows=17955 width=8) + -> Hash (cost=68.03..68.03 rows=3603 width=22) + -> Seq Scan on "location" l (cost=0.00..68.03 rows=3603 width=22) +(47 rows) + + +--=-UP+pas5olwTgDxYtSNoC +Content-Disposition: attachment; filename=Query.sql +Content-Type: text/x-sql; name=Query.sql; charset= +Content-Transfer-Encoding: 7bit + +select +uw.keyf_workerid, +uw.name_last || ', ' || uw.name_first as worker, +um.name_last || ', ' || um.name_first as manager, +o.keyp_orderid as orderid, +o.job_title, +s.name_supplier, +l.city, +l.state, +ab.address1, +ab.address2, +ab.zip, +t.keyp_timecardid, +t.status, +t.week_ending as tc_we, +t.hours_regular, +t.hours_ot, +t.hours_dt, +t.hours_holiday, +t.expenses, +t.sales_tax, +t.adjustment, +t.amount_bill_client, +t.amount_pay_supplier, +i.keyp_invoiceid, +i.week_ending as invoice_we, +o.custom_field01 as "Business Area", +d1.department_number, +d1.name_department as "Home Cost Center", +d2.name_department as "Company Code" +from timecard t + left join invoice i on t.keyf_invoiceid = i.keyp_invoiceid, + supplier s, location l, address_building ab, + orders o + left join users uw on o.keyf_workerid = uw.keyf_workerid + left join users um on o.keyf_managerid = um.keyf_managerid + left join department d1 on o.keyf_departmentid = d1.keyp_departmentid + left join department d2 on d1.keyf_parentid = d2.keyp_departmentid +where +t.keyf_invoiceid = i.keyp_invoiceid and +t.keyf_orderid = o.keyp_orderid and +o.keyf_supplierid = s.keyp_supplierid and +o.keyf_locationid = l.keyp_locationid and +o.keyf_address_buildingid = ab.keyp_address_buildingid and +o.keyf_clientid = 8 and +t.week_ending >= '04/02/2006' and +t.week_ending <='04/30/2006' +order by 2, 5; + + +--=-UP+pas5olwTgDxYtSNoC-- + + +From pgsql-performance-owner@postgresql.org Mon Jun 5 16:29:36 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 241159FA5B5 + for ; + Mon, 5 Jun 2006 16:29:35 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 69247-01 + for ; + Mon, 5 Jun 2006 16:29:26 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id 515569FA30C + for ; + Mon, 5 Jun 2006 16:29:26 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 23E7C313E3; Mon, 5 Jun 2006 21:29:25 +0200 (MET DST) +From: "Andrus" +X-Newsgroups: pgsql.performance +Subject: How to force Postgres to use index on ILIKE +Date: Mon, 5 Jun 2006 22:29:11 +0300 +Organization: Hub.Org Networking Services +Lines: 17 +Message-ID: +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +X-RFC2646: Format=Flowed; Original +To: pgsql-performance@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/39 +X-Sequence-Number: 19396 + +I have UTF-8 Postgres 8.1 database on W2K3 + +Query + +SELECT toode, nimetus +FROM toode +WHERE toode ILIKE 'x10%' ESCAPE '!' +ORDER BY UPPER(toode ),nimetus LIMIT 100 + +runs 1 minute in first time for small table size. + +Toode field type is CHAR(20) + +How to create index on toode field so that query can use it ? + + + + +From pgsql-performance-owner@postgresql.org Mon Jun 5 16:43:12 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3D7A09FA5B5 + for ; + Mon, 5 Jun 2006 16:43:11 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 69204-09 + for ; + Mon, 5 Jun 2006 16:42:59 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from main2.mycybernet.net (main2.mycybernet.net [209.222.63.140]) + by postgresql.org (Postfix) with ESMTP id A76BB9FA30C + for ; + Mon, 5 Jun 2006 16:42:59 -0300 (ADT) +Received: from 227-54-222-209.mycybernet.net ([209.222.54.227] + helo=phlogiston.dydns.org) + by main2.mycybernet.net with esmtp (Exim 4.62) + (envelope-from ) id 1FnL2P-0006sb-5V + for pgsql-performance@postgresql.org; Mon, 05 Jun 2006 15:46:57 -0400 +Received: by phlogiston.dydns.org (Postfix, from userid 1000) + id 8C38E4172; Mon, 5 Jun 2006 15:42:52 -0400 (EDT) +Date: Mon, 5 Jun 2006 15:42:52 -0400 +From: Andrew Sullivan +To: pgsql-performance@postgresql.org +Subject: Re: Some queries starting to hang +Message-ID: <20060605194252.GA7071@phlogiston.dyndns.org> +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/40 +X-Sequence-Number: 19397 + +On Mon, Jun 05, 2006 at 12:05:08PM -0700, Chris Beecroft wrote: +> Our problem is that about a week and a half ago we started to get some +> queries that would (seemingly) never return (e.g., normally run in a +> couple minutes, but after 2.5 hours, they were still running, the +> process pushing the processor up to 99.9% active). + +Are there any locks preventing the query from completing? I can't +recall how you check in 7.3, but if nothing else, you can check with +ps for something WAITING. + +A + + + +-- +Andrew Sullivan | ajs@crankycanuck.ca +Unfortunately reformatting the Internet is a little more painful +than reformatting your hard drive when it gets out of whack. + --Scott Morris + +From pgsql-performance-owner@postgresql.org Mon Jun 5 17:07:31 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3A5BC9FA5C8 + for ; + Mon, 5 Jun 2006 17:07:31 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 73739-05 + for ; + Mon, 5 Jun 2006 17:07:21 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 155B89FA30C + for ; + Mon, 5 Jun 2006 17:07:20 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k55K7J6J022707; + Mon, 5 Jun 2006 16:07:19 -0400 (EDT) +To: Chris Beecroft +cc: pgsql-performance@postgresql.org +Subject: Re: Some queries starting to hang +In-reply-to: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> +Comments: In-reply-to Chris Beecroft + message dated "Mon, 05 Jun 2006 12:05:08 -0700" +Date: Mon, 05 Jun 2006 16:07:19 -0400 +Message-ID: <22706.1149538039@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/41 +X-Sequence-Number: 19398 + +Chris Beecroft writes: +> Our problem is that about a week and a half ago we started to get some +> queries that would (seemingly) never return (e.g., normally run in a +> couple minutes, but after 2.5 hours, they were still running, the +> process pushing the processor up to 99.9% active). + +> Attached are an example query plan: Query.sql +> The query plan from our production sever: QueryPlanBroke.txt +> The working query plan from our backup server: QueryPlanWork.txt + +Note the major difference in estimated row counts. That's the key to +your problem... you need to find out why the "broke" case thinks only +one row is getting selected. + +broke: +> -> Nested Loop (cost=30150.77..129334.04 rows=1 width=305) + +work: +> -> Hash Join (cost=30904.77..125395.89 rows=1810 width=306) + +I'm wondering about out-of-date or nonexistent ANALYZE stats, missing +custom adjustments of statistics target settings, etc. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jun 5 17:39:08 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3B7549FA5B5 + for ; + Mon, 5 Jun 2006 17:39:07 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 77177-01 + for ; + Mon, 5 Jun 2006 17:38:58 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from main2.mycybernet.net (main2.mycybernet.net [209.222.63.140]) + by postgresql.org (Postfix) with ESMTP id 5A2549FA30C + for ; + Mon, 5 Jun 2006 17:38:58 -0300 (ADT) +Received: from 227-54-222-209.mycybernet.net ([209.222.54.227] + helo=phlogiston.dydns.org) + by main2.mycybernet.net with esmtp (Exim 4.62) + (envelope-from ) id 1FnLua-0007Hy-JJ + for pgsql-performance@postgresql.org; Mon, 05 Jun 2006 16:42:56 -0400 +Received: by phlogiston.dydns.org (Postfix, from userid 1000) + id AC3BA4051; Mon, 5 Jun 2006 16:38:51 -0400 (EDT) +Date: Mon, 5 Jun 2006 16:38:51 -0400 +From: Andrew Sullivan +To: pgsql-performance@postgresql.org +Subject: Re: Some queries starting to hang +Message-ID: <20060605203851.GB7071@phlogiston.dyndns.org> +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> + <22706.1149538039@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <22706.1149538039@sss.pgh.pa.us> +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/42 +X-Sequence-Number: 19399 + +On Mon, Jun 05, 2006 at 04:07:19PM -0400, Tom Lane wrote: +> +> broke: +> > -> Nested Loop (cost=30150.77..129334.04 rows=1 width=305) +> +> work: +> > -> Hash Join (cost=30904.77..125395.89 rows=1810 width=306) +> +> I'm wondering about out-of-date or nonexistent ANALYZE stats, missing +> custom adjustments of statistics target settings, etc. + +But even the nested loop shouldn't be a "never returns" case, should +it? For 1800 rows? + +(I've _had_ bad plans that picked nestloop, for sure, but they're +usually for tens of thousands of rows when they take forever). + +A + +-- +Andrew Sullivan | ajs@crankycanuck.ca +Users never remark, "Wow, this software may be buggy and hard +to use, but at least there is a lot of code underneath." + --Damien Katz + +From pgsql-performance-owner@postgresql.org Mon Jun 5 17:39:50 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4CCB59FA30C + for ; + Mon, 5 Jun 2006 17:39:49 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 76184-02 + for ; + Mon, 5 Jun 2006 17:39:40 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchbg03.prounlimited.corp (exchg01.pro-unlimited.com + [67.104.17.130]) + by postgresql.org (Postfix) with ESMTP id 295239FA5B5 + for ; + Mon, 5 Jun 2006 17:39:39 -0300 (ADT) +Received: from bg002441.pro-unlimited.com ([172.16.2.35]) by + exchbg03.prounlimited.corp with Microsoft SMTPSVC(6.0.3790.1830); + Mon, 5 Jun 2006 13:39:38 -0700 +Subject: Re: Some queries starting to hang +From: Chris Beecroft +To: pgsql-performance@postgresql.org +In-Reply-To: <22706.1149538039@sss.pgh.pa.us> +References: <22706.1149538039@sss.pgh.pa.us> +Content-Type: text/plain +Message-Id: <1149539978.8606.51.camel@bg002441.pro-unlimited.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.5 (1.4.5-17) +Date: Mon, 05 Jun 2006 13:39:38 -0700 +Content-Transfer-Encoding: 7bit +X-OriginalArrivalTime: 05 Jun 2006 20:39:38.0517 (UTC) + FILETIME=[29FD8450:01C688E0] +X-TM-AS-Product-Ver: SMEX-7.0.0.1345-3.52.1006-14490.000 +X-TM-AS-Result: No--3.600000-8.000000-31 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/43 +X-Sequence-Number: 19400 + +Thanks Tom, + +I knew you would come through again! + +Query is now returning with results on our replicated database. Will +vacuum analyze production now. So it seems to have done the trick. Now +the question is has our auto vacuum failed or was not set up properly... +A question for my IT people. + +Thanks once again, +Chris Beecroft + +On Mon, 2006-06-05 at 13:07, Tom Lane wrote: +> Chris Beecroft writes: +> > Our problem is that about a week and a half ago we started to get some +> > queries that would (seemingly) never return (e.g., normally run in a +> > couple minutes, but after 2.5 hours, they were still running, the +> > process pushing the processor up to 99.9% active). +> +> > Attached are an example query plan: Query.sql +> > The query plan from our production sever: QueryPlanBroke.txt +> > The working query plan from our backup server: QueryPlanWork.txt +> +> Note the major difference in estimated row counts. That's the key to +> your problem... you need to find out why the "broke" case thinks only +> one row is getting selected. +> +> broke: +> > -> Nested Loop (cost=30150.77..129334.04 rows=1 width=305) +> +> work: +> > -> Hash Join (cost=30904.77..125395.89 rows=1810 width=306) +> +> I'm wondering about out-of-date or nonexistent ANALYZE stats, missing +> custom adjustments of statistics target settings, etc. +> +> regards, tom lane + + +From pgsql-performance-owner@postgresql.org Mon Jun 5 17:42:07 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4AB869FA5B5 + for ; + Mon, 5 Jun 2006 17:42:07 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 75186-06 + for ; + Mon, 5 Jun 2006 17:41:58 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from main2.mycybernet.net (main2.mycybernet.net [209.222.63.140]) + by postgresql.org (Postfix) with ESMTP id F3AA79FA30C + for ; + Mon, 5 Jun 2006 17:41:57 -0300 (ADT) +Received: from 227-54-222-209.mycybernet.net ([209.222.54.227] + helo=phlogiston.dydns.org) + by main2.mycybernet.net with esmtp (Exim 4.62) + (envelope-from ) id 1FnLxU-0007Jb-Ai + for pgsql-performance@postgresql.org; Mon, 05 Jun 2006 16:45:56 -0400 +Received: by phlogiston.dydns.org (Postfix, from userid 1000) + id 8B4164051; Mon, 5 Jun 2006 16:41:51 -0400 (EDT) +Date: Mon, 5 Jun 2006 16:41:51 -0400 +From: Andrew Sullivan +To: pgsql-performance@postgresql.org +Subject: Re: vacuuming problems continued +Message-ID: <20060605204151.GC7071@phlogiston.dyndns.org> +References: <92d3a4950606010454y67293765o56001e8996975b45@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <92d3a4950606010454y67293765o56001e8996975b45@mail.gmail.com> +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/44 +X-Sequence-Number: 19401 + +On Thu, Jun 01, 2006 at 01:54:08PM +0200, Antoine wrote: +> Hi, +> We just don't seem to be getting much benefit from autovacuum. Running +> a manual vacuum seems to still be doing a LOT, which suggests to me +> that I should either run a cron job and disable autovacuum, or just +> run a cron job on top of autovacuum. + +What the others said; but also, which version of autovacuum (== which +version of the database) is this? Because the early versions had a +number of missing bits to them that tended to mean the whole thing +didn't hang together very well. + +> I have been thinking about strategies and am still a bit lost. Our +> apps are up 24/7 and we didn't code for the eventuality of having the +> db going offline for maintenance... we live and learn! + +You shouldn't need to, with anything after 7.4, if your vacuum +regimen is right. There's something of a black art to it, though. + +A +-- +Andrew Sullivan | ajs@crankycanuck.ca +This work was visionary and imaginative, and goes to show that visionary +and imaginative work need not end up well. + --Dennis Ritchie + +From pgsql-performance-owner@postgresql.org Mon Jun 5 18:06:45 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C280B9FA5C8 + for ; + Mon, 5 Jun 2006 18:06:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 76126-10 + for ; + Mon, 5 Jun 2006 18:06:35 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 9D5849FA30C + for ; + Mon, 5 Jun 2006 18:06:34 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k55L6V5O023916; + Mon, 5 Jun 2006 17:06:31 -0400 (EDT) +To: Andrew Sullivan +cc: pgsql-performance@postgresql.org +Subject: Re: Some queries starting to hang +In-reply-to: <20060605203851.GB7071@phlogiston.dyndns.org> +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> + <22706.1149538039@sss.pgh.pa.us> + <20060605203851.GB7071@phlogiston.dyndns.org> +Comments: In-reply-to Andrew Sullivan + message dated "Mon, 05 Jun 2006 16:38:51 -0400" +Date: Mon, 05 Jun 2006 17:06:31 -0400 +Message-ID: <23915.1149541591@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/45 +X-Sequence-Number: 19402 + +Andrew Sullivan writes: +> On Mon, Jun 05, 2006 at 04:07:19PM -0400, Tom Lane wrote: +>> I'm wondering about out-of-date or nonexistent ANALYZE stats, missing +>> custom adjustments of statistics target settings, etc. + +> But even the nested loop shouldn't be a "never returns" case, should +> it? For 1800 rows? + +Well, it's a big query. If it ought to take a second or two, and +instead is taking an hour or two (1800 times the expected runtime), that +might be close enough to "never" to exhaust Chris' patience. Besides, +we don't know whether the 1800 might itself be an underestimate (too bad +Chris didn't provide EXPLAIN ANALYZE results). The hash plan will scale +to larger numbers of rows much more gracefully than the nestloop ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jun 5 18:27:33 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C9BAD9FA5B5 + for ; + Mon, 5 Jun 2006 18:27:32 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 84899-01 + for ; + Mon, 5 Jun 2006 18:27:23 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by postgresql.org (Postfix) with ESMTP id 866809FA30C + for ; + Mon, 5 Jun 2006 18:27:23 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO [192.168.1.27]) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 9530287; Mon, 05 Jun 2006 14:30:32 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: How to force Postgres to use index on ILIKE +Date: Mon, 5 Jun 2006 14:26:56 -0700 +User-Agent: KMail/1.8 +Cc: "Andrus" +References: +In-Reply-To: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200606051426.56789.josh@agliodbs.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/46 +X-Sequence-Number: 19403 + +Andrus, + +> SELECT toode, nimetus +> FROM toode +> WHERE toode ILIKE 'x10%' ESCAPE '!' +> ORDER BY UPPER(toode ),nimetus LIMIT 100 +> +> runs 1 minute in first time for small table size. +> +> Toode field type is CHAR(20) + +1) why are you using CHAR and not VARCHAR or TEXT? CHAR will give you +problems using an index, period. + +2) You can't use an index on ILIKE. You can, however, use an index on +lower(field) if your query is properly phrased and if you've created an +expression index on lower(field). + +-- +--Josh + +Josh Berkus +PostgreSQL @ Sun +San Francisco + +From pgsql-performance-owner@postgresql.org Mon Jun 5 19:22:17 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 406B89FA4D8 + for ; + Mon, 5 Jun 2006 19:22:16 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 87702-08 + for ; + Mon, 5 Jun 2006 19:22:04 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchbg03.prounlimited.corp (exchg01.pro-unlimited.com + [67.104.17.130]) + by postgresql.org (Postfix) with ESMTP id 553E99F9316 + for ; + Mon, 5 Jun 2006 19:22:02 -0300 (ADT) +Received: from bg002441.pro-unlimited.com ([172.16.2.35]) by + exchbg03.prounlimited.corp with Microsoft SMTPSVC(6.0.3790.1830); + Mon, 5 Jun 2006 15:22:00 -0700 +Subject: Re: Some queries starting to hang +From: Chris Beecroft +To: Tom Lane +Cc: Andrew Sullivan , + "pgsql-performance@postgresql.org" +In-Reply-To: <23915.1149541591@sss.pgh.pa.us> +References: <23915.1149541591@sss.pgh.pa.us> +Content-Type: multipart/mixed; boundary="=-4j2L4z1AGF7kuo/cUGXx" +Message-Id: <1149546120.8606.76.camel@bg002441.pro-unlimited.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.5 (1.4.5-17) +Date: Mon, 05 Jun 2006 15:22:00 -0700 +X-OriginalArrivalTime: 05 Jun 2006 22:22:00.0988 (UTC) + FILETIME=[773035C0:01C688EE] +X-TM-AS-Product-Ver: SMEX-7.0.0.1345-3.52.1006-14490.000 +X-TM-AS-Result: No--3.500000-8.000000-31 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/47 +X-Sequence-Number: 19404 + + +--=-4j2L4z1AGF7kuo/cUGXx +Content-Type: text/plain +Content-Transfer-Encoding: 7bit + +On Mon, 2006-06-05 at 14:06, Tom Lane wrote: +> Andrew Sullivan writes: +> > On Mon, Jun 05, 2006 at 04:07:19PM -0400, Tom Lane wrote: +> >> I'm wondering about out-of-date or nonexistent ANALYZE stats, missing +> >> custom adjustments of statistics target settings, etc. +> +> > But even the nested loop shouldn't be a "never returns" case, should +> > it? For 1800 rows? +> +> Well, it's a big query. If it ought to take a second or two, and +> instead is taking an hour or two (1800 times the expected runtime), that +> might be close enough to "never" to exhaust Chris' patience. Besides, +> we don't know whether the 1800 might itself be an underestimate (too bad +> Chris didn't provide EXPLAIN ANALYZE results). The hash plan will scale +> to larger numbers of rows much more gracefully than the nestloop ... +> +> regards, tom lane + +Hello, + +If anyone is curious, I've attached an explain analyze from the now +working replicated database. Explain analyze did not seem return on the +'broken' database (or at least, when we originally tried to test these, +did not return after an hour and a half, which enough time to head right +past patient into crabby...) + +Chris + +--=-4j2L4z1AGF7kuo/cUGXx +Content-Disposition: attachment; filename=explain.out +Content-Type: text/plain; name=explain.out; charset= +Content-Transfer-Encoding: 7bit + + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Sort (cost=130164.68..130169.27 rows=1835 width=306) (actual time=72566.745..72569.586 rows=4525 loops=1) + Sort Key: (((uw.name_last)::text || ', '::text) || (uw.name_first)::text), o.job_title + -> Hash Join (cost=33256.35..130065.21 rows=1835 width=306) (actual time=12028.272..72488.369 rows=4525 loops=1) + Hash Cond: ("outer".keyf_locationid = "inner".keyp_locationid) + -> Hash Join (cost=33179.31..129931.78 rows=1969 width=292) (actual time=12018.508..72456.700 rows=4525 loops=1) + Hash Cond: ("outer".keyf_invoiceid = "inner".keyp_invoiceid) + -> Hash Join (cost=32709.18..128566.26 rows=2026 width=288) (actual time=11965.863..72392.930 rows=4536 loops=1) + Hash Cond: ("outer".keyf_orderid = "inner".keyp_orderid) + -> Seq Scan on timecard t (cost=0.00..94967.49 rows=43467 width=108) (actual time=25.387..60369.749 rows=49875 loops=1) + Filter: ((week_ending >= '04/02/2006'::date) AND (week_ending <= '04/30/2006'::date)) + -> Hash (cost=32691.39..32691.39 rows=7114 width=184) (actual time=11922.816..11922.816 rows=7171 loops=1) + -> Hash Join (cost=28169.31..32691.39 rows=7114 width=184) (actual time=11755.198..11900.670 rows=7171 loops=1) + Hash Cond: ("outer".keyf_address_buildingid = "inner".keyp_address_buildingid) + -> Hash Join (cost=27939.87..32199.91 rows=7636 width=155) (actual time=11725.665..11857.598 rows=7197 loops=1) + Hash Cond: ("outer".keyf_supplierid = "inner".keyp_supplierid) + -> Merge Right Join (cost=27455.86..31494.40 rows=8294 width=133) (actual time=11529.683..11647.691 rows=8111 loops=1) + Merge Cond: ("outer".keyp_departmentid = "inner".keyf_parentid) + -> Index Scan using department_pkey on department d2 (cost=0.00..3702.26 rows=84966 width=22) (actual time=0.130..120.434 rows=76642 loops=1) + -> Sort (cost=27455.86..27476.60 rows=8294 width=119) (actual time=11448.943..11453.804 rows=8111 loops=1) + Sort Key: d1.keyf_parentid + -> Merge Right Join (cost=22877.04..26916.01 rows=8294 width=119) (actual time=11186.887..11410.169 rows=8111 loops=1) + Merge Cond: ("outer".keyp_departmentid = "inner".keyf_departmentid) + -> Index Scan using department_pkey on department d1 (cost=0.00..3702.26 rows=84966 width=36) (actual time=0.005..187.554 rows=84912 loops=1) + -> Sort (cost=22877.04..22897.77 rows=8294 width=91) (actual time=11140.522..11145.456 rows=8111 loops=1) + Sort Key: o.keyf_departmentid + -> Merge Right Join (cost=18887.41..22337.18 rows=8294 width=91) (actual time=10688.334..11104.926 rows=8111 loops=1) + Merge Cond: ("outer".keyf_managerid = "inner".keyf_managerid) + -> Index Scan using users_managerid on users um (cost=0.00..11590.29 rows=127619 width=23) (actual time=0.140..396.424 rows=36638 loops=1) + -> Sort (cost=18887.41..18908.14 rows=8294 width=76) (actual time=10652.067..10657.197 rows=8111 loops=1) + Sort Key: o.keyf_managerid + -> Merge Right Join (cost=12131.35..18347.56 rows=8294 width=76) (actual time=6724.630..10619.888 rows=8111 loops=1) + Merge Cond: ("outer".keyf_workerid = "inner".keyf_workerid) + -> Index Scan using users_workerid on users uw (cost=0.00..11832.81 rows=127619 width=23) (actual time=8.947..5448.600 rows=65485 loops=1) + -> Sort (cost=12131.35..12152.09 rows=8294 width=57) (actual time=5072.195..5077.354 rows=8111 loops=1) + Sort Key: o.keyf_workerid + -> Bitmap Heap Scan on orders o (cost=121.03..11591.50 rows=8294 width=57) (actual time=28.938..5030.277 rows=8111 loops=1) + Recheck Cond: (keyf_clientid = 8) + -> Bitmap Index Scan on orders_clientid_idx (cost=0.00..121.03 rows=8294 width=0) (actual time=18.476..18.476 rows=8111 loops=1) + Index Cond: (keyf_clientid = 8) + -> Hash (cost=452.21..452.21 rows=12721 width=30) (actual time=195.913..195.913 rows=12721 loops=1) + -> Seq Scan on supplier s (cost=0.00..452.21 rows=12721 width=30) (actual time=0.053..177.809 rows=12721 loops=1) + -> Hash (cost=205.75..205.75 rows=9475 width=37) (actual time=29.495..29.495 rows=9475 loops=1) + -> Seq Scan on address_building ab (cost=0.00..205.75 rows=9475 width=37) (actual time=0.052..15.243 rows=9475 loops=1) + -> Hash (cost=424.91..424.91 rows=18091 width=8) (actual time=52.592..52.592 rows=18091 loops=1) + -> Seq Scan on invoice i (cost=0.00..424.91 rows=18091 width=8) (actual time=0.047..30.662 rows=18091 loops=1) + -> Hash (cost=68.03..68.03 rows=3603 width=22) (actual time=9.669..9.669 rows=3603 loops=1) + -> Seq Scan on "location" l (cost=0.00..68.03 rows=3603 width=22) (actual time=0.013..4.870 rows=3603 loops=1) + Total runtime: 72588.500 ms +(48 rows) + + +--=-4j2L4z1AGF7kuo/cUGXx-- + + +From pgsql-performance-owner@postgresql.org Mon Jun 5 21:43:35 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 610709FA4D8 + for ; + Mon, 5 Jun 2006 21:04:33 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 08894-08 + for ; + Mon, 5 Jun 2006 21:04:22 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from ws6-3.us4.outblaze.com (ws6-3.us4.outblaze.com + [205.158.62.199]) + by postgresql.org (Postfix) with SMTP id 474DB9F9316 + for ; + Mon, 5 Jun 2006 21:04:19 -0300 (ADT) +Received: (qmail 29302 invoked from network); 6 Jun 2006 00:04:18 -0000 +Received: from unknown (HELO ?192.168.0.15?) (dan@libby.com@200.122.159.10) + by ws6-3.us4.outblaze.com with SMTP; 6 Jun 2006 00:04:17 -0000 +From: Dan Libby +To: pgsql-performance@postgresql.org +Subject: Problem: query becomes slow when calling a fast user defined + function. +Date: Mon, 5 Jun 2006 18:03:59 -0600 +User-Agent: KMail/1.9.1 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200606051804.00381.dan@libby.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/48 +X-Sequence-Number: 19405 + +Hi, + +Using postgres 8.0.1, I'm having a problem where a user-defined function +that executes quite quickly on its own slows down the calling query, +which ignores at least one index. I don't think this should be happening. + +Please forgive the long explanation below; I'm trying to be clear. + +So -- I have a function (marked STABLE) that takes 1-2 ms to execute when called +via a simple select, eg: + +\timing +select * from ascend_tree_breadcrumb( category_by_topic( 'World' ) ); + category_id | parent_category_id | topic | num_sub_items | num_sub_cats +-------------+--------------------+-------+---------------+-------------- + 1 | | World | 0 | 0 +(1 row) + +Time: 1.311 ms + + +As you can see, there are actually 2 functions being called, and the top-level +function returns a set, containing one row. In practice, it will never return +more than 5 rows. + +For this very simple example, I can return the same data by calling a table directly: + +lyrff=# SELECT * from category c where c.topic = 'World'; + category_id | parent_category_id | topic | num_sub_items | num_sub_cats +-------------+--------------------+-------+---------------+-------------- + 1 | | World | 0 | 0 +(1 row) + +Time: 2.660 ms + + +So far, so good. + +But now, when I join the set that is returned by the function with another +table category_lang, which contains about 40k records, using the primary key +for category_lang, then things become slow. + +lyrff=# SELECT cl.category_id, atb.topic, cl.title +lyrff-# FROM ascend_tree_breadcrumb( category_by_topic( 'World' ) ) atb +lyrff-# inner join category_lang cl on (atb.category_id = cl.category_id and cl.lang_code = 'en'); + category_id | topic | title +-------------+-------+------- + 1 | World | World +(1 row) + +Time: 308.822 ms + + +(Okay, so 308 ms is not a super-long time, but this query is supposed to run +on all pages of a website, so it quickly becomes painful. And anyway, it's +about 300x where it could/should be.) + +So now if I remove the function call and substitute the SQL that +looks directly in the category table, then things are fast again: + +lyrff=# SELECT cl.category_id, c.topic, cl.title +lyrff-# FROM category c +lyrff-# inner join category_lang cl on (c.category_id = cl.category_id and cl.lang_code = 'en') +lyrff-# where +lyrff-# c.topic = 'World'; + category_id | topic | title +-------------+-------+------- + 1 | World | World +(1 row) + +Time: 1.914 ms + + +So clearly the user-defined function is contributing to the slow-down, even though +the function itself executes quite quickly. Here's what explain has to say: + +lyrff=# explain analyze +lyrff-# SELECT cl.category_id, atb.topic, cl.title +lyrff-# FROM ascend_tree_breadcrumb( category_by_topic( 'World' ) ) atb +lyrff-# inner join category_lang cl on (atb.category_id = cl.category_id and cl.lang_code = 'en'); + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------- + Hash Join (cost=1791.79..2854.89 rows=1001 width=532) (actual time=350.935..352.317 rows=1 loops=1) + Hash Cond: ("outer".category_id = "inner".category_id) + -> Function Scan on ascend_tree_breadcrumb atb (cost=0.00..12.50 rows=1000 width=520) (actual time=0.834..0.835 rows=1 loops=1) + -> Hash (cost=1327.33..1327.33 rows=58986 width=16) (actual time=329.393..329.393 rows=0 loops=1) + -> Seq Scan on category_lang cl (cost=0.00..1327.33 rows=58986 width=16) (actual time=0.036..191.442 rows=40603 loops=1) + Filter: (lang_code = 'en'::bpchar) + Total runtime: 352.689 ms + +As you can see, it is doing a Sequential Scan on the category_lang table, +which has 40603 rows now, and will grow. So that's not good. + +Now, let's see the non-function version: + +lyrff=# explain analyze +lyrff-# SELECT cl.category_id, c.topic, cl.title +lyrff-# FROM category c +lyrff-# inner join category_lang cl on (c.category_id = cl.category_id and cl.lang_code = 'en') +lyrff-# where +lyrff-# c.topic = 'World'; + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------- + Nested Loop (cost=0.00..29.23 rows=2 width=72) (actual time=0.104..0.112 rows=1 loops=1) + -> Index Scan using category_topic_key on category c (cost=0.00..9.70 rows=2 width=60) (actual time=0.058..0.060 rows=1 loops=1) + Index Cond: ((topic)::text = 'World'::text) + -> Index Scan using table_lang_pk on category_lang cl (cost=0.00..9.75 rows=1 width=16) (actual time=0.028..0.032 rows=1 loops=1) + Index Cond: (("outer".category_id = cl.category_id) AND (cl.lang_code = 'en'::bpchar)) + Total runtime: 0.312 ms + +This time, it used the index on category_lang, as it should. + +I'm not an expert at reading explain output, so I've probably +missed something important. + +I've tried modifying the query in several ways, eg putting +the function call in a sub-select, and so on. I also tried +disabling the various query plans, but in the end I've only +managed to slow it down even further. + +So, I'm hoping someone can tell me what the magical cure is. +Or failing that, I'd at least like to understand why the planner +is deciding not to use the category_lang index when the result +set is coming from a function instead of a "regular" table. + + +Many thanks in advance. + + +-- +Dan Libby + +From pgsql-performance-owner@postgresql.org Mon Jun 5 23:43:16 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 301829FA4D8 + for ; + Mon, 5 Jun 2006 23:43:16 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 35883-02 + for ; + Mon, 5 Jun 2006 23:43:07 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id A7DCF9F9316 + for ; + Mon, 5 Jun 2006 23:43:07 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k562h2KI009626; + Mon, 5 Jun 2006 22:43:02 -0400 (EDT) +To: Dan Libby +cc: pgsql-performance@postgresql.org +Subject: Re: Problem: query becomes slow when calling a fast user defined + function. +In-reply-to: <200606051804.00381.dan@libby.com> +References: <200606051804.00381.dan@libby.com> +Comments: In-reply-to Dan Libby + message dated "Mon, 05 Jun 2006 18:03:59 -0600" +Date: Mon, 05 Jun 2006 22:43:02 -0400 +Message-ID: <9625.1149561782@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/49 +X-Sequence-Number: 19406 + +Dan Libby writes: +> Or failing that, I'd at least like to understand why the planner +> is deciding not to use the category_lang index when the result +> set is coming from a function instead of a "regular" table. + +The planner defaults to assuming that set-returning functions return +1000 rows (as you can see in the EXPLAIN output). A plan that would +win for a single returned row would lose badly at 1000 rows ... +and vice versa. See the archives for various debates about how to +get a better estimate; it's not an easy problem. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jun 6 06:58:07 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 90CFA9FA111 + for ; + Tue, 6 Jun 2006 06:58:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 51272-02 + for ; + Tue, 6 Jun 2006 06:57:58 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id C9F9B9FA315 + for ; + Tue, 6 Jun 2006 06:57:57 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 86E9131946; Tue, 6 Jun 2006 11:57:56 +0200 (MET DST) +From: "Andrus" +X-Newsgroups: pgsql.performance +Subject: Re: How to force Postgres to use index on ILIKE +Date: Tue, 6 Jun 2006 12:57:31 +0300 +Organization: Hub.Org Networking Services +Lines: 39 +Message-ID: +References: + <200606051426.56789.josh@agliodbs.com> +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +X-RFC2646: Format=Flowed; Original +To: pgsql-performance@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/50 +X-Sequence-Number: 19407 + +>> SELECT toode, nimetus +>> FROM toode +>> WHERE toode ILIKE 'x10%' ESCAPE '!' +>> ORDER BY UPPER(toode ),nimetus LIMIT 100 +>> +>> runs 1 minute in first time for small table size. +>> +>> Toode field type is CHAR(20) +> +> 1) why are you using CHAR and not VARCHAR or TEXT? CHAR will give you +> problems using an index, period. + +1. I haven't seen any example where VARCHAR is better that CHAR for indexing +2. I have a lot of existing code. Changing CHAR to VARCHAR requires probably +re-writing a lot of code, a huge work. + +> 2) You can't use an index on ILIKE. + +I'ts very sad. I expected that lower(toode) index can be used. + + +> You can, however, use an index on +> lower(field) if your query is properly phrased and if you've created an +> expression index on lower(field). + +I tried by Postgres does not use index. Why ? + +create index nimib2 on firma1.klient(lower(nimi) bpchar_pattern_ops); + +explain analyze select nimi from firma1.klient where lower(nimi) like +'mokter%' + +"Seq Scan on klient (cost=0.00..9.79 rows=1 width=74) (actual +time=0.740..0.761 rows=1 loops=1)" +" Filter: (lower((nimi)::text) ~~ 'mokter%'::text)" +"Total runtime: 0.877 ms" + + + + +From pgsql-hackers-owner@postgresql.org Tue Jun 6 09:34:35 2006 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A43AC9FA2E6 + for ; + Tue, 6 Jun 2006 09:34:35 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 86040-08 + for ; + Tue, 6 Jun 2006 09:34:23 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.skype.net (mail.skype.net [195.215.8.149]) + by postgresql.org (Postfix) with ESMTP id 0AD9B9F9316 + for ; + Tue, 6 Jun 2006 09:34:23 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mail.skype.net (Postfix) with ESMTP id C16604DE7D; + Tue, 6 Jun 2006 14:34:21 +0200 (CEST) +Received: from [192.168.0.237] (joltid-gw.joltid.org [195.50.194.24]) + by mail.skype.net (Postfix) with ESMTP id 3DA644DF09; + Tue, 6 Jun 2006 14:34:14 +0200 (CEST) +Subject: Re: [PERFORM] psql -A (unaligned format) eats too much +From: Hannu Krosing +To: Tom Lane +Cc: Neil Conway , Zoltan Boszormenyi , + Andrew Dunstan , Mark Woodward , + "Jim C. Nasby" , pgsql-hackers@postgresql.org +In-Reply-To: <21820.1149531024@sss.pgh.pa.us> +References: <44835834.2020309@dunaweb.hu> <44835F86.5040008@dunaweb.hu> + <20060605152258.GT53487@pervasive.com> <20512.1149521250@sss.pgh.pa.us> + <20060605155349.GU53487@pervasive.com> <20813.1149523235@sss.pgh.pa.us> + <18006.24.91.171.78.1149526092.squirrel@mail.mohawksoft.com> + <44845E86.3080001@dunslane.net> <4484672B.8080606@dunaweb.hu> + <1149529945.5577.5.camel@localhost> <21820.1149531024@sss.pgh.pa.us> +Content-Type: text/plain; charset=utf-8 +Date: Tue, 06 Jun 2006 15:30:12 +0300 +Message-Id: <1149597013.3818.7.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/184 +X-Sequence-Number: 84417 + +Ühel kenal päeval, E, 2006-06-05 kell 14:10, kirjutas Tom Lane: +> Neil Conway writes: +> > On Mon, 2006-06-05 at 19:17 +0200, Zoltan Boszormenyi wrote: +> >> The general case cannot be applied for all particular cases. +> >> E.g. you cannot use cursors from shell scripts +> +> > This could be fixed by adding an option to psql to transparently produce +> > SELECT result sets via a cursor. + +I think this is an excellent idea. + +psql --cursor --fetchby 10000 -c "select ..." | myprogram + +> Note of course that such a thing would push the incomplete-result +> problem further upstream. For instance in (hypothetical --cursor +> switch) +> psql --cursor -c "select ..." | myprogram +> there would be no very good way for myprogram to find out that it'd +> been sent an incomplete result due to error partway through the SELECT. + +would it not learn about it at the point of error ? + +even without --cursor there is still no very good way to find out when +something else goes wrong, like the result inside libpq taking up all +memory and so psql runs out of memory on formatting some longer lines. + + +-- +---------------- +Hannu Krosing +Database Architect +Skype Technologies OÜ +Akadeemia tee 21 F, Tallinn, 12618, Estonia + +Skype me: callto:hkrosing +Get Skype for free: http://www.skype.com + + + +From pgsql-hackers-owner@postgresql.org Tue Jun 6 10:49:10 2006 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B29159FA43C + for ; + Tue, 6 Jun 2006 10:49:10 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 96789-05 + for ; + Tue, 6 Jun 2006 10:49:02 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 2CCDD9F9316 + for ; + Tue, 6 Jun 2006 10:49:01 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k56DmhQP015739; + Tue, 6 Jun 2006 09:48:43 -0400 (EDT) +To: Hannu Krosing +cc: Neil Conway , Zoltan Boszormenyi , + Andrew Dunstan , Mark Woodward , + "Jim C. Nasby" , pgsql-hackers@postgresql.org +Subject: Re: [PERFORM] psql -A (unaligned format) eats too much +In-reply-to: <1149597013.3818.7.camel@localhost.localdomain> +References: <44835834.2020309@dunaweb.hu> <44835F86.5040008@dunaweb.hu> + <20060605152258.GT53487@pervasive.com> + <20512.1149521250@sss.pgh.pa.us> + <20060605155349.GU53487@pervasive.com> + <20813.1149523235@sss.pgh.pa.us> + <18006.24.91.171.78.1149526092.squirrel@mail.mohawksoft.com> + <44845E86.3080001@dunslane.net> <4484672B.8080606@dunaweb.hu> + <1149529945.5577.5.camel@localhost> + <21820.1149531024@sss.pgh.pa.us> + <1149597013.3818.7.camel@localhost.localdomain> +Comments: In-reply-to Hannu Krosing + message dated "Tue, 06 Jun 2006 15:30:12 +0300" +Date: Tue, 06 Jun 2006 09:48:43 -0400 +Message-ID: <15738.1149601723@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/189 +X-Sequence-Number: 84422 + +Hannu Krosing writes: +> Ühel kenal päeval, E, 2006-06-05 kell 14:10, kirjutas Tom Lane: +>> Note of course that such a thing would push the incomplete-result +>> problem further upstream. For instance in (hypothetical --cursor +>> switch) +>> psql --cursor -c "select ..." | myprogram +>> there would be no very good way for myprogram to find out that it'd +>> been sent an incomplete result due to error partway through the SELECT. + +> would it not learn about it at the point of error ? + +No, it would merely see EOF after some number of result rows. (I'm +assuming you're also using -A -t so that the output is unadorned.) + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jun 6 11:24:10 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 223B19FA2E6 + for ; + Tue, 6 Jun 2006 11:24:10 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 01742-01 + for ; + Tue, 6 Jun 2006 11:24:00 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 72BDC9F9316 + for ; + Tue, 6 Jun 2006 11:24:00 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k56ENuaM016927; + Tue, 6 Jun 2006 10:23:56 -0400 (EDT) +To: "Andrus" +cc: pgsql-performance@postgresql.org +Subject: Re: How to force Postgres to use index on ILIKE +In-reply-to: +References: + <200606051426.56789.josh@agliodbs.com> + +Comments: In-reply-to "Andrus" + message dated "Tue, 06 Jun 2006 12:57:31 +0300" +Date: Tue, 06 Jun 2006 10:23:55 -0400 +Message-ID: <16926.1149603835@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/51 +X-Sequence-Number: 19408 + +"Andrus" writes: +>> 1) why are you using CHAR and not VARCHAR or TEXT? CHAR will give you +>> problems using an index, period. + +> 1. I haven't seen any example where VARCHAR is better that CHAR for indexing + +The advice you were given is good, even if the explanation is bad. +CHAR(n) is a poor choice for just about every purpose, because of all +the padding blanks it insists on storing and transmitting. That adds +up to a lot of wasted space, I/O effort, and CPU cycles. + +> I tried by Postgres does not use index. Why ? +> create index nimib2 on firma1.klient(lower(nimi) bpchar_pattern_ops); + +Try to get over this fixation on CHAR. That would work with +text_pattern_ops --- lower() returns TEXT, and TEXT is what the LIKE +operator accepts, so that's the opclass you need to use to optimize +lower() LIKE 'pattern'. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jun 6 11:39:16 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4D6EE9FA2E6 + for ; + Tue, 6 Jun 2006 11:39:16 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 03512-01 + for ; + Tue, 6 Jun 2006 11:39:06 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sand3.gxn.net (sand3.gxn.net [195.147.249.238]) + by postgresql.org (Postfix) with ESMTP id C0DF89F9316 + for ; + Tue, 6 Jun 2006 11:39:06 -0300 (ADT) +Received: from [62.232.55.118] (helo=[192.168.0.2]) + by sand3.gxn.net with esmtp (Exim 4.50) + id 1Fnciz-0004bA-Dy; Tue, 06 Jun 2006 15:40:05 +0100 +Subject: Re: Some queries starting to hang +From: Simon Riggs +To: Tom Lane +Cc: Andrew Sullivan , pgsql-performance@postgresql.org +In-Reply-To: <23915.1149541591@sss.pgh.pa.us> +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> + <22706.1149538039@sss.pgh.pa.us> + <20060605203851.GB7071@phlogiston.dyndns.org> + <23915.1149541591@sss.pgh.pa.us> +Content-Type: text/plain +Date: Tue, 06 Jun 2006 15:39:01 +0100 +Message-Id: <1149604741.2621.487.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.6.1 (2.6.1-1.fc5.2) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/52 +X-Sequence-Number: 19409 + +On Mon, 2006-06-05 at 17:06 -0400, Tom Lane wrote: +> Andrew Sullivan writes: +> > On Mon, Jun 05, 2006 at 04:07:19PM -0400, Tom Lane wrote: +> >> I'm wondering about out-of-date or nonexistent ANALYZE stats, missing +> >> custom adjustments of statistics target settings, etc. +> +> > But even the nested loop shouldn't be a "never returns" case, should +> > it? For 1800 rows? +> +> Well, it's a big query. If it ought to take a second or two, and +> instead is taking an hour or two (1800 times the expected runtime), that +> might be close enough to "never" to exhaust Chris' patience. Besides, +> we don't know whether the 1800 might itself be an underestimate (too bad +> Chris didn't provide EXPLAIN ANALYZE results). + +This is a good example of a case where the inefficiency of EXPLAIN +ANALYZE would be a contributory factor to it not actually being +available for diagnosing a problem. + +Maybe we need something even more drastic than recent proposed changes +to EXPLAIN ANALYZE? + +Perhaps we could annotate the query tree with individual limits. That +way a node that was expecting to deal with 1 row would simply stop +executing the EXPLAIN ANALYZE when it hit N times as many rows +(default=no limit). That way, we would still be able to see a bad plan +even without waiting for the whole query to execute - just stop at a +point where the plan is far enough off track. That would give us what we +need: pinpoint exactly which part of the plan is off-track and see how +far off track it is. If the limits were configurable, we'd be able to +opt for faster-but-less-accurate or slower-yet-100% accuracy behaviour. +We wouldn't need to worry about timing overhead either then. + +e.g. EXPLAIN ANALYZE ERRLIMIT 10 SELECT ... + +-- + Simon Riggs + EnterpriseDB http://www.enterprisedb.com + + +From pgsql-hackers-owner@postgresql.org Tue Jun 6 11:39:34 2006 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 415879FA2E6 + for ; + Tue, 6 Jun 2006 11:39:33 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 00653-10 + for ; + Tue, 6 Jun 2006 11:39:22 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 03FD89F9316 + for ; + Tue, 6 Jun 2006 11:39:22 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 28B9B56445; Tue, 6 Jun 2006 09:39:21 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); + Tue, 6 Jun 2006 09:39:19 -0500 +Date: Tue, 6 Jun 2006 09:39:19 -0500 +From: "Jim C. Nasby" +To: Tom Lane +Cc: Hannu Krosing , Neil Conway , + Zoltan Boszormenyi , + Andrew Dunstan , + Mark Woodward , pgsql-hackers@postgresql.org +Subject: Re: [PERFORM] psql -A (unaligned format) eats too much +Message-ID: <20060606143918.GA53487@pervasive.com> +References: <20512.1149521250@sss.pgh.pa.us> + <20060605155349.GU53487@pervasive.com> + <20813.1149523235@sss.pgh.pa.us> + <18006.24.91.171.78.1149526092.squirrel@mail.mohawksoft.com> + <44845E86.3080001@dunslane.net> <4484672B.8080606@dunaweb.hu> + <1149529945.5577.5.camel@localhost> + <21820.1149531024@sss.pgh.pa.us> + <1149597013.3818.7.camel@localhost.localdomain> + <15738.1149601723@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=unknown-8bit +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +In-Reply-To: <15738.1149601723@sss.pgh.pa.us> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060606:tgl@sss.pgh.pa.us::IeqOyeBvwIr3qK7H:00000000000000000000 + 0000000000000000000000002Xge +X-Hashcash: 1:20:060606:hannu@skype.net::yUnFvt32cQeHu5v2:00632O +X-Hashcash: + 1:20:060606:neilc@samurai.com::o3NIm7wJzH7s4+v+:00000000000000000000 + 0000000000000000000000001mQD +X-Hashcash: + 1:20:060606:zboszor@dunaweb.hu::cpUr4OxPL/l5KtUL:0000000000000000000 + 0000000000000000000000001ZQb +X-Hashcash: + 1:20:060606:andrew@dunslane.net::aQFcjJ690KAEXHms:000000000000000000 + 0000000000000000000000001D7h +X-Hashcash: + 1:20:060606:pgsql@mohawksoft.com::dx+bBOzb4jmPKkfF:00000000000000000 + 0000000000000000000000004djV +X-Hashcash: + 1:20:060606:pgsql-hackers@postgresql.org::AcVER4DL5bdrLdMD:000000000 + 0000000000000000000000000LBu +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/193 +X-Sequence-Number: 84426 + +On Tue, Jun 06, 2006 at 09:48:43AM -0400, Tom Lane wrote: +> Hannu Krosing writes: +> > Ühel kenal päeval, E, 2006-06-05 kell 14:10, kirjutas Tom Lane: +> >> Note of course that such a thing would push the incomplete-result +> >> problem further upstream. For instance in (hypothetical --cursor +> >> switch) +> >> psql --cursor -c "select ..." | myprogram +> >> there would be no very good way for myprogram to find out that it'd +> >> been sent an incomplete result due to error partway through the SELECT. +> +> > would it not learn about it at the point of error ? +> +> No, it would merely see EOF after some number of result rows. (I'm +> assuming you're also using -A -t so that the output is unadorned.) + +So if an error occurs partway through reading a cursor, no error message +is generated? That certainly sounds like a bug to me... +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Tue Jun 6 11:45:06 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5F2259FA2E6 + for ; + Tue, 6 Jun 2006 11:45:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 03938-04 + for ; + Tue, 6 Jun 2006 11:44:57 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id CA4DE9F9316 + for ; + Tue, 6 Jun 2006 11:44:57 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k56EhPHE017149; + Tue, 6 Jun 2006 10:43:25 -0400 (EDT) +To: Simon Riggs +cc: Andrew Sullivan , pgsql-performance@postgresql.org +Subject: Re: Some queries starting to hang +In-reply-to: <1149604741.2621.487.camel@localhost.localdomain> +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> + <22706.1149538039@sss.pgh.pa.us> + <20060605203851.GB7071@phlogiston.dyndns.org> + <23915.1149541591@sss.pgh.pa.us> + <1149604741.2621.487.camel@localhost.localdomain> +Comments: In-reply-to Simon Riggs + message dated "Tue, 06 Jun 2006 15:39:01 +0100" +Date: Tue, 06 Jun 2006 10:43:25 -0400 +Message-ID: <17148.1149605005@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/53 +X-Sequence-Number: 19410 + +Simon Riggs writes: +> On Mon, 2006-06-05 at 17:06 -0400, Tom Lane wrote: +>> Well, it's a big query. If it ought to take a second or two, and +>> instead is taking an hour or two (1800 times the expected runtime), that +>> might be close enough to "never" to exhaust Chris' patience. Besides, +>> we don't know whether the 1800 might itself be an underestimate (too bad +>> Chris didn't provide EXPLAIN ANALYZE results). + +> This is a good example of a case where the inefficiency of EXPLAIN +> ANALYZE would be a contributory factor to it not actually being +> available for diagnosing a problem. + +Huh? The problem is the inefficiency of the underlying query. + + regards, tom lane + +From pgsql-hackers-owner@postgresql.org Tue Jun 6 11:47:50 2006 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 769D89FA43C + for ; + Tue, 6 Jun 2006 11:47:50 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 04005-05 + for ; + Tue, 6 Jun 2006 11:47:41 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 783039FA2E6 + for ; + Tue, 6 Jun 2006 11:47:41 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k56ElUVh017224; + Tue, 6 Jun 2006 10:47:30 -0400 (EDT) +To: "Jim C. Nasby" +cc: Hannu Krosing , Neil Conway , + Zoltan Boszormenyi , + Andrew Dunstan , + Mark Woodward , pgsql-hackers@postgresql.org +Subject: Re: [PERFORM] psql -A (unaligned format) eats too much +In-reply-to: <20060606143918.GA53487@pervasive.com> +References: <20512.1149521250@sss.pgh.pa.us> + <20060605155349.GU53487@pervasive.com> + <20813.1149523235@sss.pgh.pa.us> + <18006.24.91.171.78.1149526092.squirrel@mail.mohawksoft.com> + <44845E86.3080001@dunslane.net> <4484672B.8080606@dunaweb.hu> + <1149529945.5577.5.camel@localhost> + <21820.1149531024@sss.pgh.pa.us> + <1149597013.3818.7.camel@localhost.localdomain> + <15738.1149601723@sss.pgh.pa.us> + <20060606143918.GA53487@pervasive.com> +Comments: In-reply-to "Jim C. Nasby" + message dated "Tue, 06 Jun 2006 09:39:19 -0500" +Date: Tue, 06 Jun 2006 10:47:30 -0400 +Message-ID: <17223.1149605250@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/194 +X-Sequence-Number: 84427 + +"Jim C. Nasby" writes: +> On Tue, Jun 06, 2006 at 09:48:43AM -0400, Tom Lane wrote: +>>> psql --cursor -c "select ..." | myprogram +>>> there would be no very good way for myprogram to find out that it'd +>>> been sent an incomplete result due to error partway through the SELECT. + +> So if an error occurs partway through reading a cursor, no error message +> is generated? That certainly sounds like a bug to me... + +Sure an error is generated. But it goes to stderr. The guy at the +downstream end of the stdout pipe cannot see either the error message, +or the nonzero status that psql will (hopefully) exit with. + +You can theoretically deal with this by having the shell script calling +this combination check psql exit status and discard the results of +myprogram on failure, but it's not easy or simple. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jun 6 11:53:14 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2AE799FA2E6 + for ; + Tue, 6 Jun 2006 11:53:14 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 05296-02 + for ; + Tue, 6 Jun 2006 11:53:04 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sand3.gxn.net (sand3.gxn.net [195.147.249.238]) + by postgresql.org (Postfix) with ESMTP id 1FE529F9316 + for ; + Tue, 6 Jun 2006 11:53:05 -0300 (ADT) +Received: from [62.232.55.118] (helo=[192.168.0.2]) + by sand3.gxn.net with esmtp (Exim 4.50) + id 1FncwX-00053t-1C; Tue, 06 Jun 2006 15:54:05 +0100 +Subject: Re: Some queries starting to hang +From: Simon Riggs +To: Tom Lane +Cc: Andrew Sullivan , pgsql-performance@postgresql.org +In-Reply-To: <17148.1149605005@sss.pgh.pa.us> +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> + <22706.1149538039@sss.pgh.pa.us> + <20060605203851.GB7071@phlogiston.dyndns.org> + <23915.1149541591@sss.pgh.pa.us> + <1149604741.2621.487.camel@localhost.localdomain> + <17148.1149605005@sss.pgh.pa.us> +Content-Type: text/plain +Date: Tue, 06 Jun 2006 15:52:56 +0100 +Message-Id: <1149605576.2621.502.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.6.1 (2.6.1-1.fc5.2) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/54 +X-Sequence-Number: 19411 + +On Tue, 2006-06-06 at 10:43 -0400, Tom Lane wrote: +> Simon Riggs writes: +> > On Mon, 2006-06-05 at 17:06 -0400, Tom Lane wrote: +> >> Well, it's a big query. If it ought to take a second or two, and +> >> instead is taking an hour or two (1800 times the expected runtime), that +> >> might be close enough to "never" to exhaust Chris' patience. Besides, +> >> we don't know whether the 1800 might itself be an underestimate (too bad +> >> Chris didn't provide EXPLAIN ANALYZE results). +> +> > This is a good example of a case where the inefficiency of EXPLAIN +> > ANALYZE would be a contributory factor to it not actually being +> > available for diagnosing a problem. +> +> Huh? The problem is the inefficiency of the underlying query. + +Of course that was the main problem from the OP. + +You mentioned it would be good if the OP had delivered an EXPLAIN +ANALYZE; I agree(d). The lack of EXPLAIN ANALYZE is frequently because +you can't get them to run to completion - more so when the query you +wish to analyze doesn't appear to complete either. + +The idea I just had was: why do we need EXPLAIN ANALYZE to run to +completion? In severe cases like this thread, we might be able to +discover the root cause by a *partial* execution of the plan, as long as +it was properly instrumented. That way, the OP might have been able to +discover the root cause himself... + +-- + Simon Riggs + EnterpriseDB http://www.enterprisedb.com + + +From pgsql-performance-owner@postgresql.org Tue Jun 6 12:03:35 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2E1F69FA2E6 + for ; + Tue, 6 Jun 2006 12:03:35 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 10799-02 + for ; + Tue, 6 Jun 2006 12:03:29 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 110479F9316 + for ; + Tue, 6 Jun 2006 12:03:29 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 5DCC756458; Tue, 6 Jun 2006 10:03:28 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); + Tue, 6 Jun 2006 10:03:26 -0500 +Date: Tue, 6 Jun 2006 10:03:26 -0500 +From: "Jim C. Nasby" +To: Chris Beecroft +Cc: pgsql-performance@postgresql.org +Subject: Re: Some queries starting to hang +Message-ID: <20060606150326.GC53487@pervasive.com> +References: <22706.1149538039@sss.pgh.pa.us> + <1149539978.8606.51.camel@bg002441.pro-unlimited.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1149539978.8606.51.camel@bg002441.pro-unlimited.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060606:cbeecroft@pro-unlimited.com::R/H5GhaiXD4NS7HN:0000000000 + 0000000000000000000000004+ri +X-Hashcash: + 1:20:060606:pgsql-performance@postgresql.org::Aoi/Pbb2IkDqowBV:00000 + 000000000000000000000000AdJY +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/55 +X-Sequence-Number: 19412 + +On Mon, Jun 05, 2006 at 01:39:38PM -0700, Chris Beecroft wrote: +> Thanks Tom, +> +> I knew you would come through again! +> +> Query is now returning with results on our replicated database. Will +> vacuum analyze production now. So it seems to have done the trick. Now +> the question is has our auto vacuum failed or was not set up properly... +> A question for my IT people. + +You should almost certainly be running the autovacuum that's built in +now. If you enable vacuum_cost_delay you should be able to make it so +that vacuum's impact on production is minimal. The other thing you'll +want to do is cut all the vacuum threshold and scale settings in half +(the defaults are very conservative). +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Tue Jun 6 12:06:33 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2235E9F9316 + for ; + Tue, 6 Jun 2006 12:06:33 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 06213-04 + for ; + Tue, 6 Jun 2006 12:06:22 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 834979FA2E6 + for ; + Tue, 6 Jun 2006 12:06:22 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k56F69Qm017427; + Tue, 6 Jun 2006 11:06:09 -0400 (EDT) +To: Simon Riggs +cc: Andrew Sullivan , pgsql-performance@postgresql.org +Subject: Re: Some queries starting to hang +In-reply-to: <1149605576.2621.502.camel@localhost.localdomain> +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> + <22706.1149538039@sss.pgh.pa.us> + <20060605203851.GB7071@phlogiston.dyndns.org> + <23915.1149541591@sss.pgh.pa.us> + <1149604741.2621.487.camel@localhost.localdomain> + <17148.1149605005@sss.pgh.pa.us> + <1149605576.2621.502.camel@localhost.localdomain> +Comments: In-reply-to Simon Riggs + message dated "Tue, 06 Jun 2006 15:52:56 +0100" +Date: Tue, 06 Jun 2006 11:06:09 -0400 +Message-ID: <17426.1149606369@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/56 +X-Sequence-Number: 19413 + +Simon Riggs writes: +> You mentioned it would be good if the OP had delivered an EXPLAIN +> ANALYZE; I agree(d). The lack of EXPLAIN ANALYZE is frequently because +> you can't get them to run to completion - more so when the query you +> wish to analyze doesn't appear to complete either. + +Well, he could have shown EXPLAIN ANALYZE for the server that was +managing to run the query in a reasonable amount of time. + +> The idea I just had was: why do we need EXPLAIN ANALYZE to run to +> completion? In severe cases like this thread, we might be able to +> discover the root cause by a *partial* execution of the plan, as long as +> it was properly instrumented. That way, the OP might have been able to +> discover the root cause himself... + +I don't think that helps, as it just replaces one uncertainty by +another: how far did the EXPLAIN really get towards completion of the +plan? You still don't have any hard data. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jun 6 12:14:33 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E6AC79FA2E6 + for ; + Tue, 6 Jun 2006 12:14:32 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 14564-01 + for ; + Tue, 6 Jun 2006 12:14:24 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id AA67F9F9316 + for ; + Tue, 6 Jun 2006 12:14:24 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 27E6D56451; Tue, 6 Jun 2006 10:14:19 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); + Tue, 6 Jun 2006 10:14:17 -0500 +Date: Tue, 6 Jun 2006 10:14:17 -0500 +From: "Jim C. Nasby" +To: Tom Lane +Cc: Simon Riggs , + Andrew Sullivan , + pgsql-performance@postgresql.org +Subject: Re: Some queries starting to hang +Message-ID: <20060606151416.GD53487@pervasive.com> +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> + <22706.1149538039@sss.pgh.pa.us> + <20060605203851.GB7071@phlogiston.dyndns.org> + <23915.1149541591@sss.pgh.pa.us> + <1149604741.2621.487.camel@localhost.localdomain> + <17148.1149605005@sss.pgh.pa.us> + <1149605576.2621.502.camel@localhost.localdomain> + <17426.1149606369@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <17426.1149606369@sss.pgh.pa.us> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060606:tgl@sss.pgh.pa.us::DndQk2CJYX8dNxW3:00000000000000000000 + 000000000000000000000000A6Hq +X-Hashcash: + 1:20:060606:simon@2ndquadrant.com::Jvm7JbVlMsS8P3VE:0000000000000000 + 0000000000000000000000002p0W +X-Hashcash: + 1:20:060606:ajs@crankycanuck.ca::JYK6VyMTnwsmunYp:000000000000000000 + 00000000000000000000000035xr +X-Hashcash: + 1:20:060606:pgsql-performance@postgresql.org::X9JI2x7QXHKbhZUp:00000 + 0000000000000000000000004gp+ +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/57 +X-Sequence-Number: 19414 + +On Tue, Jun 06, 2006 at 11:06:09AM -0400, Tom Lane wrote: +> > The idea I just had was: why do we need EXPLAIN ANALYZE to run to +> > completion? In severe cases like this thread, we might be able to +> > discover the root cause by a *partial* execution of the plan, as long as +> > it was properly instrumented. That way, the OP might have been able to +> > discover the root cause himself... +> +> I don't think that helps, as it just replaces one uncertainty by +> another: how far did the EXPLAIN really get towards completion of the +> plan? You still don't have any hard data. + +Does that really matter, though? The point is to find the node where the +estimate proved to be fantasy. It might even make sense to highlight +that node in the output, so that users don't have to wade through a sea +of numbers to find it. + +If it is important to report how far along the query got, it seems that +could always be added to the explain output. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Tue Jun 6 12:21:36 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D957F9FA2E6 + for ; + Tue, 6 Jun 2006 12:21:35 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 10531-09 + for ; + Tue, 6 Jun 2006 12:21:26 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from hs5.cfa.cmu.edu (HS5.CFA.cmu.edu [128.2.103.215]) + by postgresql.org (Postfix) with ESMTP id C89F29F9316 + for ; + Tue, 6 Jun 2006 12:21:17 -0300 (ADT) +Received: from webmail.webopticon.org (hs5.cfa.cmu.edu [127.0.0.1]) + by hs5.cfa.cmu.edu (8.12.11.20060308/8.12.11) with ESMTP id + k56FLFcX026886 + for ; Tue, 6 Jun 2006 11:21:15 -0400 +Received: from 216.41.12.254 (SquirrelMail authenticated user agentm) + by webmail.webopticon.org with HTTP; + Tue, 6 Jun 2006 11:21:15 -0400 (EDT) +Message-ID: <47764.216.41.12.254.1149607275.squirrel@webmail.webopticon.org> +In-Reply-To: <1149604741.2621.487.camel@localhost.localdomain> +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> + <22706.1149538039@sss.pgh.pa.us> + <20060605203851.GB7071@phlogiston.dyndns.org> + <23915.1149541591@sss.pgh.pa.us> + <1149604741.2621.487.camel@localhost.localdomain> +Date: Tue, 6 Jun 2006 11:21:15 -0400 (EDT) +Subject: Re: Some queries starting to hang +From: "A.M." +To: pgsql-performance@postgresql.org +User-Agent: SquirrelMail/1.5.1 [CVS] +MIME-Version: 1.0 +Content-Type: text/plain;charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/58 +X-Sequence-Number: 19415 + +Explain analyze could at least put an asterisk around actual time that +deviated by some factor from the estimated time. + +On Tue, June 6, 2006 10:39 am, Simon Riggs wrote: + +> +> This is a good example of a case where the inefficiency of EXPLAIN +> ANALYZE would be a contributory factor to it not actually being +> available for diagnosing a problem. +> +> Maybe we need something even more drastic than recent proposed changes +> to EXPLAIN ANALYZE? +> +> Perhaps we could annotate the query tree with individual limits. That +> way a node that was expecting to deal with 1 row would simply stop +> executing the EXPLAIN ANALYZE when it hit N times as many rows (default=no +> limit). That way, we would still be able to see a bad plan even without +> waiting for the whole query to execute - just stop at a point where the +> plan is far enough off track. That would give us what we need: pinpoint +> exactly which part of the plan is off-track and see how far off track it +> is. If the limits were configurable, we'd be able to opt for +> faster-but-less-accurate or slower-yet-100% accuracy behaviour. We +> wouldn't need to worry about timing overhead either then. +> +> e.g. EXPLAIN ANALYZE ERRLIMIT 10 SELECT ... +> +> -- +> Simon Riggs +> EnterpriseDB http://www.enterprisedb.com +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 5: don't forget to increase your free space map settings +> +> + + + +From pgsql-performance-owner@postgresql.org Tue Jun 6 12:30:11 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 88F149FA2E6 + for ; + Tue, 6 Jun 2006 12:30:10 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 14858-05 + for ; + Tue, 6 Jun 2006 12:30:00 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from main2.mycybernet.net (main2.mycybernet.net [209.222.63.140]) + by postgresql.org (Postfix) with ESMTP id DBB5F9F9316 + for ; + Tue, 6 Jun 2006 12:30:00 -0300 (ADT) +Received: from 227-54-222-209.mycybernet.net ([209.222.54.227] + helo=phlogiston.dydns.org) + by main2.mycybernet.net with esmtp (Exim 4.62) + (envelope-from ) id 1FndZA-0004iy-3E + for pgsql-performance@postgresql.org; Tue, 06 Jun 2006 11:34:00 -0400 +Received: by phlogiston.dydns.org (Postfix, from userid 1000) + id 7AD9E3FAF; Tue, 6 Jun 2006 11:29:49 -0400 (EDT) +Date: Tue, 6 Jun 2006 11:29:49 -0400 +From: Andrew Sullivan +To: pgsql-performance@postgresql.org +Subject: Re: Some queries starting to hang +Message-ID: <20060606152949.GB10018@phlogiston.dyndns.org> +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> + <22706.1149538039@sss.pgh.pa.us> + <20060605203851.GB7071@phlogiston.dyndns.org> + <23915.1149541591@sss.pgh.pa.us> + <1149604741.2621.487.camel@localhost.localdomain> + <17148.1149605005@sss.pgh.pa.us> + <1149605576.2621.502.camel@localhost.localdomain> + <17426.1149606369@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <17426.1149606369@sss.pgh.pa.us> +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/59 +X-Sequence-Number: 19416 + +On Tue, Jun 06, 2006 at 11:06:09AM -0400, Tom Lane wrote: +> > it was properly instrumented. That way, the OP might have been able to +> > discover the root cause himself... +> +> I don't think that helps, as it just replaces one uncertainty by +> another: how far did the EXPLAIN really get towards completion of the +> plan? You still don't have any hard data. + +Well, you _might_ get something useful, if you're trying to work on a +maladjusted production system, because you get to the part that trips +the limit, and then you know, "Well, I gotta fix it that far, +anyway." + +Often, when you're in real trouble, you can't or don't wait for the +full plan to come back from EXPLAIN ANALYSE, because a manager is +helpfully standing over your shoulder asking whether you're there +yet. Being able to say, "Aha, we have the first symptom," might be +helpful to users. Because the impatient simply won't wait for the +full report to come back, and therefore they'll end up flying blind +instead. (Note that "the impatient" is not always the person logged +in and executing the commands.) + +A + +-- +Andrew Sullivan | ajs@crankycanuck.ca +I remember when computers were frustrating because they *did* exactly what +you told them to. That actually seems sort of quaint now. + --J.D. Baldwin + +From pgsql-performance-owner@postgresql.org Tue Jun 6 12:38:20 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DDC5C9FA2E6 + for ; + Tue, 6 Jun 2006 12:38:19 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 13694-06 + for ; + Tue, 6 Jun 2006 12:38:14 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by postgresql.org (Postfix) with ESMTP id 567499F9316 + for ; + Tue, 6 Jun 2006 12:38:13 -0300 (ADT) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1Fndco-0000J7-00; Tue, 06 Jun 2006 11:37:47 -0400 +To: Simon Riggs +Cc: Tom Lane , Andrew Sullivan , + pgsql-performance@postgresql.org +Subject: Re: Some queries starting to hang +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> + <22706.1149538039@sss.pgh.pa.us> + <20060605203851.GB7071@phlogiston.dyndns.org> + <23915.1149541591@sss.pgh.pa.us> + <1149604741.2621.487.camel@localhost.localdomain> + <17148.1149605005@sss.pgh.pa.us> + <1149605576.2621.502.camel@localhost.localdomain> +In-Reply-To: <1149605576.2621.502.camel@localhost.localdomain> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 06 Jun 2006 11:37:46 -0400 +Message-ID: <87ejy29tx1.fsf@stark.xeocode.com> +Lines: 19 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/61 +X-Sequence-Number: 19418 + +Simon Riggs writes: + +> The idea I just had was: why do we need EXPLAIN ANALYZE to run to +> completion? In severe cases like this thread, we might be able to +> discover the root cause by a *partial* execution of the plan, as long as +> it was properly instrumented. That way, the OP might have been able to +> discover the root cause himself... + +An alternate approach would be to implement a SIGINFO handler that prints out +the explain analyze output for the data built up so far. You would be able to +keep hitting C-t and keep getting updates until the query completes or you +decided to hit C-c. + +I'm not sure how easy this would be to implement but it sure would be nice +from a user's point of view. Much nicer than having to specify some arbitrary +limit before running the query. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Tue Jun 6 12:38:10 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 34B539FA2E6 + for ; + Tue, 6 Jun 2006 12:38:10 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 20321-02 + for ; + Tue, 6 Jun 2006 12:38:00 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from hs5.cfa.cmu.edu (HS5.CFA.cmu.edu [128.2.103.215]) + by postgresql.org (Postfix) with ESMTP id 9FE8C9F9316 + for ; + Tue, 6 Jun 2006 12:38:00 -0300 (ADT) +Received: from webmail.webopticon.org (hs5.cfa.cmu.edu [127.0.0.1]) + by hs5.cfa.cmu.edu (8.12.11.20060308/8.12.11) with ESMTP id + k56FbwUC026960 + for ; Tue, 6 Jun 2006 11:37:58 -0400 +Received: from 216.41.12.254 (SquirrelMail authenticated user agentm) + by webmail.webopticon.org with HTTP; + Tue, 6 Jun 2006 11:37:58 -0400 (EDT) +Message-ID: <44027.216.41.12.254.1149608278.squirrel@webmail.webopticon.org> +In-Reply-To: <20060606152949.GB10018@phlogiston.dyndns.org> +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> + <22706.1149538039@sss.pgh.pa.us> + <20060605203851.GB7071@phlogiston.dyndns.org> + <23915.1149541591@sss.pgh.pa.us> + <1149604741.2621.487.camel@localhost.localdomain> + <17148.1149605005@sss.pgh.pa.us> + <1149605576.2621.502.camel@localhost.localdomain> + <17426.1149606369@sss.pgh.pa.us> + <20060606152949.GB10018@phlogiston.dyndns.org> +Date: Tue, 6 Jun 2006 11:37:58 -0400 (EDT) +Subject: Re: Some queries starting to hang +From: "A.M." +To: pgsql-performance@postgresql.org +User-Agent: SquirrelMail/1.5.1 [CVS] +MIME-Version: 1.0 +Content-Type: text/plain;charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/60 +X-Sequence-Number: 19417 + +Hmmm...It could generate NOTICEs whenever there is a drastic difference in +rowcount or actual time... + +On Tue, June 6, 2006 11:29 am, Andrew Sullivan wrote: +> On Tue, Jun 06, 2006 at 11:06:09AM -0400, Tom Lane wrote: +> +>>> it was properly instrumented. That way, the OP might have been able +>>> to discover the root cause himself... +>> +>> I don't think that helps, as it just replaces one uncertainty by +>> another: how far did the EXPLAIN really get towards completion of the +>> plan? You still don't have any hard data. +> +> Well, you _might_ get something useful, if you're trying to work on a +> maladjusted production system, because you get to the part that trips the +> limit, and then you know, "Well, I gotta fix it that far, anyway." +> +> Often, when you're in real trouble, you can't or don't wait for the +> full plan to come back from EXPLAIN ANALYSE, because a manager is helpfully +> standing over your shoulder asking whether you're there yet. Being able +> to say, "Aha, we have the first symptom," might be helpful to users. +> Because the impatient simply won't wait for the +> full report to come back, and therefore they'll end up flying blind +> instead. (Note that "the impatient" is not always the person logged in +> and executing the commands.) +> +> A +> +> +> -- +> Andrew Sullivan | ajs@crankycanuck.ca +> I remember when computers were frustrating because they *did* exactly what +> you told them to. That actually seems sort of quaint now. --J.D. Baldwin +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 4: Have you searched our list archives? +> +> +> http://archives.postgresql.org +> +> + + + +From pgsql-performance-owner@postgresql.org Tue Jun 6 12:41:28 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 97DD59FA2E6 + for ; + Tue, 6 Jun 2006 12:41:28 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 19948-04 + for ; + Tue, 6 Jun 2006 12:41:19 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id BF8539F9316 + for ; + Tue, 6 Jun 2006 12:41:19 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k56FfFD8017759; + Tue, 6 Jun 2006 11:41:15 -0400 (EDT) +To: "Jim C. Nasby" +cc: Simon Riggs , + Andrew Sullivan , + pgsql-performance@postgresql.org +Subject: Re: Some queries starting to hang +In-reply-to: <20060606151416.GD53487@pervasive.com> +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> + <22706.1149538039@sss.pgh.pa.us> + <20060605203851.GB7071@phlogiston.dyndns.org> + <23915.1149541591@sss.pgh.pa.us> + <1149604741.2621.487.camel@localhost.localdomain> + <17148.1149605005@sss.pgh.pa.us> + <1149605576.2621.502.camel@localhost.localdomain> + <17426.1149606369@sss.pgh.pa.us> + <20060606151416.GD53487@pervasive.com> +Comments: In-reply-to "Jim C. Nasby" + message dated "Tue, 06 Jun 2006 10:14:17 -0500" +Date: Tue, 06 Jun 2006 11:41:15 -0400 +Message-ID: <17758.1149608475@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/62 +X-Sequence-Number: 19419 + +"Jim C. Nasby" writes: +> On Tue, Jun 06, 2006 at 11:06:09AM -0400, Tom Lane wrote: +>> I don't think that helps, as it just replaces one uncertainty by +>> another: how far did the EXPLAIN really get towards completion of the +>> plan? You still don't have any hard data. + +> Does that really matter, though? The point is to find the node where the +> estimate proved to be fantasy. + +No, the point is to find out what reality is. Just knowing that the +estimates are wrong doesn't really get you anywhere (we pretty much knew +that before we even started looking at the EXPLAIN, eh?). + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jun 6 13:20:37 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6F0279FAA6E + for ; + Tue, 6 Jun 2006 13:20:37 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 22893-09 + for ; + Tue, 6 Jun 2006 13:20:29 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from main2.mycybernet.net (main2.mycybernet.net [209.222.63.140]) + by postgresql.org (Postfix) with ESMTP id 8A4049FA92E + for ; + Tue, 6 Jun 2006 13:20:30 -0300 (ADT) +Received: from 227-54-222-209.mycybernet.net ([209.222.54.227] + helo=phlogiston.dydns.org) + by main2.mycybernet.net with esmtp (Exim 4.62) + (envelope-from ) id 1FneM1-0005CO-U3 + for pgsql-performance@postgresql.org; Tue, 06 Jun 2006 12:24:30 -0400 +Received: by phlogiston.dydns.org (Postfix, from userid 1000) + id 22A3B417B; Tue, 6 Jun 2006 12:20:19 -0400 (EDT) +Date: Tue, 6 Jun 2006 12:20:19 -0400 +From: Andrew Sullivan +To: pgsql-performance@postgresql.org +Subject: Re: Some queries starting to hang +Message-ID: <20060606162019.GC10018@phlogiston.dyndns.org> +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> + <22706.1149538039@sss.pgh.pa.us> + <20060605203851.GB7071@phlogiston.dyndns.org> + <23915.1149541591@sss.pgh.pa.us> + <1149604741.2621.487.camel@localhost.localdomain> + <17148.1149605005@sss.pgh.pa.us> + <1149605576.2621.502.camel@localhost.localdomain> + <87ejy29tx1.fsf@stark.xeocode.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <87ejy29tx1.fsf@stark.xeocode.com> +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/63 +X-Sequence-Number: 19420 + +On Tue, Jun 06, 2006 at 11:37:46AM -0400, Greg Stark wrote: + +> An alternate approach would be to implement a SIGINFO handler that +> prints out the explain analyze output for the data built up so far. +> You would be able to keep hitting C-t and keep getting updates +> until the query completes or you decided to hit C-c. + +This is even better, and pretty much along the lines I was thinking +in my other mail. If you can see the _first_ spot you break, you can +start working. We all know (or I hope so, anyway) that it would be +better to get the full result, and know everything that needs +attention before starting. As nearly as I can tell, however, they +don't teach Mill's methods to MBAs of a certain stripe, so changes +start getting made without all the data being available. It'd be +nice to be able to bump the set of available data to something +higher than "none". + +(That said, I appreciate that there's precious little reason to spend +a lot of work optimising a feature that is mostly there to counteract +bad management practices.) + +A + +-- +Andrew Sullivan | ajs@crankycanuck.ca +When my information changes, I alter my conclusions. What do you do sir? + --attr. John Maynard Keynes + +From pgsql-performance-owner@postgresql.org Tue Jun 6 14:46:05 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C3CFE9FB1B9 + for ; + Tue, 6 Jun 2006 14:46:04 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 35018-06 + for ; + Tue, 6 Jun 2006 14:45:57 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moonunit2.moonview.localnet (wsip-70-167-125-69.sd.sd.cox.net + [70.167.125.69]) + by postgresql.org (Postfix) with ESMTP id 189089FA13E + for ; + Tue, 6 Jun 2006 14:45:57 -0300 (ADT) +Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) + by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id + k56Hv0PA031298 + for ; Tue, 6 Jun 2006 10:57:01 -0700 +Message-ID: <4485BF25.4080701@modgraph-usa.com> +Date: Tue, 06 Jun 2006 10:45:09 -0700 +From: "Craig A. James" +User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Some queries starting to hang +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> + <22706.1149538039@sss.pgh.pa.us> + <20060605203851.GB7071@phlogiston.dyndns.org> + <23915.1149541591@sss.pgh.pa.us> + <1149604741.2621.487.camel@localhost.localdomain> +In-Reply-To: <1149604741.2621.487.camel@localhost.localdomain> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/64 +X-Sequence-Number: 19421 + +Simon Riggs wrote: +>>Well, it's a big query. If it ought to take a second or two, and +>>instead is taking an hour or two (1800 times the expected runtime), that +>>might be close enough to "never" to exhaust Chris' patience. Besides, +>>we don't know whether the 1800 might itself be an underestimate (too bad +>>Chris didn't provide EXPLAIN ANALYZE results). +> +> This is a good example of a case where the inefficiency of EXPLAIN +> ANALYZE would be a contributory factor to it not actually being +> available for diagnosing a problem. + +This is a frustration I have, but Simon expressed it much more concisely. The first question one gets in this forum is, "did you run EXPLAIN ANALYZE?" But if EXPLAIN ANALYZE never finishes, you can't get the information you need to diagnose the problem. Simon's proposal, + +> e.g. EXPLAIN ANALYZE ERRLIMIT 10 SELECT ... + +or something similar, would be a big help. I.e. "If you can't finish in a reasonable time, at least tell me as much as you can." + +Craig + +From pgsql-performance-owner@postgresql.org Tue Jun 6 14:51:23 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 757AE9FB1B9 + for ; + Tue, 6 Jun 2006 14:51:22 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 35345-04 + for ; + Tue, 6 Jun 2006 14:51:13 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moonunit2.moonview.localnet (wsip-70-167-125-69.sd.sd.cox.net + [70.167.125.69]) + by postgresql.org (Postfix) with ESMTP id 9520D9FA13E + for ; + Tue, 6 Jun 2006 14:51:13 -0300 (ADT) +Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) + by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id + k56I2HGl031416 + for ; Tue, 6 Jun 2006 11:02:17 -0700 +Message-ID: <4485C061.2080206@modgraph-usa.com> +Date: Tue, 06 Jun 2006 10:50:25 -0700 +From: "Craig A. James" +User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Some queries starting to hang +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> + <22706.1149538039@sss.pgh.pa.us> + <20060605203851.GB7071@phlogiston.dyndns.org> + <23915.1149541591@sss.pgh.pa.us> + <1149604741.2621.487.camel@localhost.localdomain> + <17148.1149605005@sss.pgh.pa.us> + <1149605576.2621.502.camel@localhost.localdomain> + <17426.1149606369@sss.pgh.pa.us> +In-Reply-To: <17426.1149606369@sss.pgh.pa.us> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/65 +X-Sequence-Number: 19422 + +Tom Lane wrote: +>>The idea I just had was: why do we need EXPLAIN ANALYZE to run to +>>completion? In severe cases like this thread, we might be able to +>>discover the root cause by a *partial* execution of the plan, as long as +>>it was properly instrumented. That way, the OP might have been able to +>>discover the root cause himself... +> +> +> I don't think that helps, as it just replaces one uncertainty by +> another: how far did the EXPLAIN really get towards completion of the +> plan? You still don't have any hard data. + +But at least you have some data, which is better than no data. Even knowing that the plan got stuck on a particular node of the query plan could be vital information. For a query that never finishes, you can't even find out where it's getting stuck. + +That's why Simon's proposal might help in some particularly difficult situations. + +Regards, +Craig + +From pgsql-performance-owner@postgresql.org Tue Jun 6 14:54:38 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 13C139FB1B9 + for ; + Tue, 6 Jun 2006 14:54:38 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 33896-09 + for ; + Tue, 6 Jun 2006 14:54:28 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 5B2239FA13E + for ; + Tue, 6 Jun 2006 14:54:29 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Tue, 6 Jun 2006 17:54:27 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 06 Jun 2006 12:54:27 -0500 +Subject: Re: Some queries starting to hang +From: Scott Marlowe +To: "Craig A. James" +Cc: pgsql-performance@postgresql.org +In-Reply-To: <4485C061.2080206@modgraph-usa.com> +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> + <22706.1149538039@sss.pgh.pa.us> + <20060605203851.GB7071@phlogiston.dyndns.org> + <23915.1149541591@sss.pgh.pa.us> + <1149604741.2621.487.camel@localhost.localdomain> + <17148.1149605005@sss.pgh.pa.us> + <1149605576.2621.502.camel@localhost.localdomain> + <17426.1149606369@sss.pgh.pa.us> <4485C061.2080206@modgraph-usa.com> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1149616467.25526.213.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Tue, 06 Jun 2006 12:54:27 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/66 +X-Sequence-Number: 19423 + +On Tue, 2006-06-06 at 12:50, Craig A. James wrote: +> Tom Lane wrote: +> >>The idea I just had was: why do we need EXPLAIN ANALYZE to run to +> >>completion? In severe cases like this thread, we might be able to +> >>discover the root cause by a *partial* execution of the plan, as long as +> >>it was properly instrumented. That way, the OP might have been able to +> >>discover the root cause himself... +> > +> > +> > I don't think that helps, as it just replaces one uncertainty by +> > another: how far did the EXPLAIN really get towards completion of the +> > plan? You still don't have any hard data. +> +> But at least you have some data, which is better than no data. Even knowing that the plan got stuck on a particular node of the query plan could be vital information. For a query that never finishes, you can't even find out where it's getting stuck. +> +> That's why Simon's proposal might help in some particularly difficult situations. + +Hmmmmm. I wonder if it be hard to have explain analyze have a timeout +per node qualifier? Something that said if it takes more than x +milliseconds for a node to kill the explain analyze and list the up to +the nasty node that's using all the time up? + +That would be extremely useful. + +From pgsql-performance-owner@postgresql.org Tue Jun 6 15:44:28 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6D32A9FB1B9 + for ; + Tue, 6 Jun 2006 15:44:28 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 42589-09 + for ; + Tue, 6 Jun 2006 15:44:13 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from smtp1.ActiveState.com (gw.activestate.com [209.17.183.249]) + by postgresql.org (Postfix) with ESMTP id C784B9FA13E + for ; + Tue, 6 Jun 2006 15:44:13 -0300 (ADT) +Received: from smtp3.activestate.com (smtp3.activestate.com [192.168.3.19]) + by smtp1.ActiveState.com (8.12.10/8.12.10) with ESMTP id k56Ii3eL029040; + Tue, 6 Jun 2006 11:44:03 -0700 (envelope-from mischa@ca.sophos.com) +Received: from [192.168.99.210] (mallet.activestate.com [192.168.99.210]) + by smtp3.ActiveState.com (8.13.4/8.13.4) with ESMTP id k56Ii3RY007027; + Tue, 6 Jun 2006 11:44:03 -0700 (envelope-from mischa@ca.sophos.com) +Message-ID: <4485CECC.4040207@ca.sophos.com> +Date: Tue, 06 Jun 2006 11:51:56 -0700 +From: Mischa Sandberg +Reply-To: mischa@ca.sophos.com +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: Andrew Sullivan +CC: pgsql-performance@postgresql.org +Subject: Re: vacuuming problems continued +References: <92d3a4950606010454y67293765o56001e8996975b45@mail.gmail.com> + <20060605204151.GC7071@phlogiston.dyndns.org> +In-Reply-To: <20060605204151.GC7071@phlogiston.dyndns.org> +Content-Type: multipart/mixed; boundary="------------020501070308080405020009" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/67 +X-Sequence-Number: 19424 + +This is a multi-part message in MIME format. +--------------020501070308080405020009 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Andrew Sullivan wrote: +> On Thu, Jun 01, 2006 at 01:54:08PM +0200, Antoine wrote: +>> Hi, +>> We just don't seem to be getting much benefit from autovacuum. Running +>> a manual vacuum seems to still be doing a LOT, which suggests to me +>> that I should either run a cron job and disable autovacuum, or just +>> run a cron job on top of autovacuum. + +Don't know if this was covered in an earlier thread. Bear with me if so. + +I'm working with 7.4.8 and 8.0.3 systems, and pg_autovacuum does have some +glitches ... in part solved by the integrated autovac in 8.1: + +- in our env, clients occasionally hit max_connections. This is a known and +(sort of) desired pushback on load. However, that sometimes knocks pg_autovacuum +out. + +- db server goes down for any reason: same problem. + + +Just restarting pg_autovacuum is not good enough; when pg_autovacuum terminates, +it loses its state, so big tables that change less than 50% between such +terminations may never get vacuumed (!) + +For that reason, it's taken a switch to a Perl script run from cron every 5 +minutes, that persists state in a table. The script is not a plug-compatible +match for pg_autovacuum (hardcoded rates; hardcoded distinction between user and +system tables), but you may find it useful. + +-- +Engineers think that equations approximate reality. +Physicists think that reality approximates the equations. +Mathematicians never make the connection. + +--------------020501070308080405020009 +Content-Type: text/plain; + name="autovac" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline; + filename="autovac" + +#!/usr/bin/env perl + +use strict; +use warnings; +use Carp; +use DBI; +use POSIX qw(strftime); + +# Hardcoded (aggressive) autovacuum parameters: +my ($VAC_BASE, $VAC_RATE) = (1000, 0.8); +my ($ANA_BASE, $ANA_RATE) = ( 500, 0.4); + +my $VERBOSE = 'VERBOSE'; +my $start = time; +my $stamp = strftime "==== %FT%T autovac: ", localtime; + +open STDERR, ">&STDOUT"; # Redirect PG "VERBOSE" output. +my $dbh = DBI->connect("dbi:Pg(PrintError=1,RaiseError=1):"); + +# REVISIT: move this to schema: + +my $oid = $dbh->selectall_arrayref(<<"__SQL__")->[0][0]; + SELECT oid FROM pg_class WHERE relname = 'autovac_state'; +__SQL__ + +$dbh->do(<<"__SQL__") if !defined $oid; + CREATE TABLE public.autovac_state( + relid oid NOT NULL PRIMARY KEY, + name text NOT NULL, + analyze_time timestamptz, + vacuum_time timestamptz, + analyze_tups bigint, -- (n_tup_ins+n_tup_upd+n_tup_del) at last ANALYZE + vacuum_tups bigint -- (n_tup_upd+n_tup_del) at last VACUUM + ); +__SQL__ + +# Calculate updates/additions to autovac_state: + +my $anavac = join ";", map {$_->[0]} @{$dbh->selectall_arrayref(<<"__SQL__")}; + + SELECT * INTO TEMP new_state FROM ( + SELECT + relid, -- identify tables by ID, so that (re)created tables always + -- are treated as fresh tables. + name, -- for constructing the vacuum/analyze command + old_relid, -- NULL means this will need a new state table entry + analyze_tups,-- _tups are used to update autovac_state + vacuum_tups, + + CASE WHEN analyze_tups - prev_analyze_tups NOT BETWEEN 0 AND analyze_point + OR old_relid IS NULL + THEN now() + END AS analyze_time, + + CASE WHEN vacuum_tups - prev_vacuum_tups NOT BETWEEN 0 AND vacuum_point + THEN now() + END AS vacuum_time + + FROM ( + SELECT N.nspname || '.' || C.relname AS name, + A.relid AS old_relid, + C.oid AS relid, + S.n_tup_ins + S.n_tup_upd + S.n_tup_del AS analyze_tups, + S.n_tup_upd + S.n_tup_del AS vacuum_tups, + COALESCE(A.analyze_tups,0) AS prev_analyze_tups, + COALESCE(A.vacuum_tups,0) AS prev_vacuum_tups, + CASE WHEN nspname ~ '^pg_' THEN 1.0 ELSE $ANA_RATE END + * C.reltuples + $ANA_BASE AS analyze_point, + CASE WHEN nspname ~ '^pg_' THEN 2.0 ELSE $VAC_RATE END + * C.reltuples + $VAC_BASE AS vacuum_point + FROM pg_class AS C + JOIN pg_namespace AS N ON N.oid = C.relnamespace + JOIN pg_stat_all_tables AS S ON S.relid = C.oid + LEFT JOIN autovac_state AS A ON A.relid = S.relid + WHERE N.nspname NOT LIKE 'pg_temp%' + ) AS X + ) AS X + WHERE analyze_time IS NOT NULL OR vacuum_time IS NOT NULL; + + SELECT CASE WHEN vacuum_time IS NOT NULL + THEN 'VACUUM ANALYZE $VERBOSE ' || name + ELSE 'ANALYZE $VERBOSE ' || name + END + FROM new_state; +__SQL__ + +if ($anavac) { + print STDERR $stamp."start\n"; + + $dbh->do(<<"__SQL__"); + + $anavac; + + UPDATE autovac_state + SET analyze_tups = N.analyze_tups, + vacuum_tups = CASE WHEN N.vacuum_time IS NULL + THEN autovac_state.vacuum_tups + ELSE N.vacuum_tups + END, + analyze_time = COALESCE(N.analyze_time, autovac_state.analyze_time), + vacuum_time = COALESCE(N.vacuum_time, autovac_state.vacuum_time) + FROM new_state AS N + WHERE N.relid = autovac_state.relid; + + INSERT INTO autovac_state + SELECT relid, name, analyze_time, vacuum_time, analyze_tups, vacuum_tups + FROM new_state + WHERE old_relid IS NULL; + + DELETE FROM autovac_state + WHERE analyze_time < now() - '1 day'::INTERVAL + AND relid NOT IN (SELECT oid FROM pg_class); +__SQL__ + + print STDERR $stamp.(time - $start)." secs\n"; +} + +$dbh->do("DROP TABLE new_state"); + +1; +__END__ + +=head1 SYNOPSIS + +autovac - autovacuum with persistent state. + +=head1 DESCRIPTION + +C is a replacement for C. +C does a single C step, then saves its state in +the C table. It should be run from cron, say, +every 5 minutes. + + +C runs more aggressively for user tables +(pg_autovacuum -V 0.8 -v 1000) than for system tables. + +When pg_stats_user_tables.(ins/upd/del) counts have been zeroed, +C vacuums all tables. + +To check when C last analyzed/vacuumed a given table: + + SELECT vacuum_time, analyze_time FROM autovac_state + WHERE name = 'public.message' + +=head1 OUTPUT + +If any action is taken, C prints: + + ==== yyyy-mm-dd hh:mm:ss autovac start + ... VACUUM/ANALYZE VERBOSE output ... + ==== yyyy-mm-dd hh:mm:ss autovac secs + +=head1 PG_AUTOVACUUM + +=cut + +--------------020501070308080405020009-- + +From pgsql-performance-owner@postgresql.org Tue Jun 6 16:21:52 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 48CB09FB1BA + for ; + Tue, 6 Jun 2006 16:21:52 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 45735-04 + for ; + Tue, 6 Jun 2006 16:21:43 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from projects.commandprompt.com (host-130.commandprompt.net + [207.173.203.130]) + by postgresql.org (Postfix) with ESMTP id 1884C9FA13E + for ; + Tue, 6 Jun 2006 16:21:43 -0300 (ADT) +Received: from [192.168.1.50] (or-67-76-146-141.sta.sprint-hsd.net + [67.76.146.141]) (authenticated bits=0) + by projects.commandprompt.com (8.13.6/8.13.6) with ESMTP id + k56JLgoq018497; Tue, 6 Jun 2006 12:21:42 -0700 +Message-ID: <4485D5C3.7010803@commandprompt.com> +Date: Tue, 06 Jun 2006 12:21:39 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Thunderbird 1.5.0.2 (X11/20060521) +MIME-Version: 1.0 +To: mischa@ca.sophos.com +CC: Andrew Sullivan , pgsql-performance@postgresql.org +Subject: Re: vacuuming problems continued +References: <92d3a4950606010454y67293765o56001e8996975b45@mail.gmail.com> + <20060605204151.GC7071@phlogiston.dyndns.org> + <4485CECC.4040207@ca.sophos.com> +In-Reply-To: <4485CECC.4040207@ca.sophos.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: ClamAV version 0.88.2, + clamav-milter version 0.88.2 on projects.commandprompt.com +X-Virus-Status: Clean +X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by + milter-greylist-1.6 (projects.commandprompt.com + [192.168.2.159]); Tue, 06 Jun 2006 12:21:43 -0700 (PDT) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/68 +X-Sequence-Number: 19425 + +Mischa Sandberg wrote: +> Andrew Sullivan wrote: +>> On Thu, Jun 01, 2006 at 01:54:08PM +0200, Antoine wrote: +>>> Hi, +>>> We just don't seem to be getting much benefit from autovacuum. Running +>>> a manual vacuum seems to still be doing a LOT, which suggests to me +>>> that I should either run a cron job and disable autovacuum, or just +>>> run a cron job on top of autovacuum. +> +> Don't know if this was covered in an earlier thread. Bear with me if so. +> +> I'm working with 7.4.8 and 8.0.3 systems, and pg_autovacuum does have +> some glitches ... in part solved by the integrated autovac in 8.1: +> +> - in our env, clients occasionally hit max_connections. This is a known +> and (sort of) desired pushback on load. However, that sometimes knocks +> pg_autovacuum out. + +That is when you use: + +superuser_reserved_connections + +In the postgresql.conf + +> - db server goes down for any reason: same problem. + +I believe you can use + +stats_reset_on_server_start = on + +For that little problem. + +Joshua D. Drake + +-- + + === The PostgreSQL Company: Command Prompt, Inc. === +Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 + Providing the most comprehensive PostgreSQL solutions since 1997 + http://www.commandprompt.com/ + + + +From pgsql-performance-owner@postgresql.org Tue Jun 6 16:30:28 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 230F49FB1BB + for ; + Tue, 6 Jun 2006 16:30:28 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 46552-06 + for ; + Tue, 6 Jun 2006 16:30:18 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from smtp1.ActiveState.com (gw.activestate.com [209.17.183.249]) + by postgresql.org (Postfix) with ESMTP id 178FD9FA13E + for ; + Tue, 6 Jun 2006 16:30:18 -0300 (ADT) +Received: from smtp3.activestate.com (smtp3.activestate.com [192.168.3.19]) + by smtp1.ActiveState.com (8.12.10/8.12.10) with ESMTP id k56JUGIW000633 + for ; Tue, 6 Jun 2006 12:30:16 -0700 + (envelope-from mischa@ca.sophos.com) +Received: from [192.168.99.210] (mallet.activestate.com [192.168.99.210]) + by smtp3.ActiveState.com (8.13.4/8.13.4) with ESMTP id k56JUG1C016583 + for ; Tue, 6 Jun 2006 12:30:16 -0700 + (envelope-from mischa@ca.sophos.com) +Message-ID: <4485D9A1.30807@ca.sophos.com> +Date: Tue, 06 Jun 2006 12:38:09 -0700 +From: Mischa Sandberg +Reply-To: mischa@ca.sophos.com +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: vacuuming problems continued +References: <92d3a4950606010454y67293765o56001e8996975b45@mail.gmail.com> + <20060605204151.GC7071@phlogiston.dyndns.org> + <4485CECC.4040207@ca.sophos.com> + <4485D5C3.7010803@commandprompt.com> +In-Reply-To: <4485D5C3.7010803@commandprompt.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/69 +X-Sequence-Number: 19426 + +Joshua D. Drake wrote: +>> - in our env, clients occasionally hit max_connections. This is a +>> known and (sort of) desired pushback on load. However, that sometimes +>> knocks pg_autovacuum out. +> +> That is when you use: +> +> superuser_reserved_connections + +Blush. Good point. Though, when we hit max_connections on 7.4.8 systems, +it's been a lemonade-from-lemons plus that vacuuming didn't fire up on top of +everything else :-) + +>> - db server goes down for any reason: same problem. +> +> I believe you can use +> stats_reset_on_server_start = on + +We do. The problem is not the loss of pg_stat_user_tables.(n_tup_ins,...) +It's the loss of pg_autovacuum's CountAtLastVacuum (and ...Analyze) +numbers, which are kept in process memory. Never considered patching +pg_autovacuum to just sleep and try again, rather than exit, on a failed +db connection. + +-- +Engineers think that equations approximate reality. +Physicists think that reality approximates the equations. +Mathematicians never make the connection. + +From pgsql-performance-owner@postgresql.org Tue Jun 6 17:51:28 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8A08C9FB1B9 + for ; + Tue, 6 Jun 2006 17:51:28 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 55052-05 + for ; + Tue, 6 Jun 2006 17:51:22 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id E5EBA9FB1BA + for ; + Tue, 6 Jun 2006 17:51:21 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 9E2A356457; Tue, 6 Jun 2006 15:51:19 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); + Tue, 6 Jun 2006 15:51:17 -0500 +Date: Tue, 6 Jun 2006 15:51:17 -0500 +From: "Jim C. Nasby" +To: Scott Marlowe +Cc: "Craig A. James" , + pgsql-performance@postgresql.org +Subject: Re: Some queries starting to hang +Message-ID: <20060606205117.GB45331@pervasive.com> +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> + <22706.1149538039@sss.pgh.pa.us> + <20060605203851.GB7071@phlogiston.dyndns.org> + <23915.1149541591@sss.pgh.pa.us> + <1149604741.2621.487.camel@localhost.localdomain> + <17148.1149605005@sss.pgh.pa.us> + <1149605576.2621.502.camel@localhost.localdomain> + <17426.1149606369@sss.pgh.pa.us> + <4485C061.2080206@modgraph-usa.com> + <1149616467.25526.213.camel@state.g2switchworks.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1149616467.25526.213.camel@state.g2switchworks.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060606:smarlowe@g2switchworks.com::pQ8VzSoLqeJC8FNi:00000000000 + 0000000000000000000000000bF5 +X-Hashcash: + 1:20:060606:cjames@modgraph-usa.com::ppC+bkFPWG52E2Xw:00000000000000 + 0000000000000000000000001Vze +X-Hashcash: + 1:20:060606:pgsql-performance@postgresql.org::SjzWrc0snZEds5m2:00000 + 000000000000000000000000Cv+0 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/70 +X-Sequence-Number: 19427 + +On Tue, Jun 06, 2006 at 12:54:27PM -0500, Scott Marlowe wrote: +> On Tue, 2006-06-06 at 12:50, Craig A. James wrote: +> > Tom Lane wrote: +> > >>The idea I just had was: why do we need EXPLAIN ANALYZE to run to +> > >>completion? In severe cases like this thread, we might be able to +> > >>discover the root cause by a *partial* execution of the plan, as long as +> > >>it was properly instrumented. That way, the OP might have been able to +> > >>discover the root cause himself... +> > > +> > > +> > > I don't think that helps, as it just replaces one uncertainty by +> > > another: how far did the EXPLAIN really get towards completion of the +> > > plan? You still don't have any hard data. +> > +> > But at least you have some data, which is better than no data. Even knowing that the plan got stuck on a particular node of the query plan could be vital information. For a query that never finishes, you can't even find out where it's getting stuck. +> > +> > That's why Simon's proposal might help in some particularly difficult situations. +> +> Hmmmmm. I wonder if it be hard to have explain analyze have a timeout +> per node qualifier? Something that said if it takes more than x +> milliseconds for a node to kill the explain analyze and list the up to +> the nasty node that's using all the time up? +> +> That would be extremely useful. + +Maybe, maybe not. It would be very easy for this to croak on the first +sort it hits. I suspect the original proposal of aborting once a +rowcount estimate proves to be way off is a better idea. + +For the record, I also think being able to get a current snapshot is +great, too. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Tue Jun 6 18:02:33 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 164489FA13E + for ; + Tue, 6 Jun 2006 18:02:33 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 54965-06 + for ; + Tue, 6 Jun 2006 18:02:22 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id A32639FB1B9 + for ; + Tue, 6 Jun 2006 18:02:23 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Tue, 6 Jun 2006 21:02:21 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 06 Jun 2006 16:02:21 -0500 +Subject: Re: Some queries starting to hang +From: Scott Marlowe +To: "Jim C. Nasby" +Cc: "Craig A. James" , + pgsql-performance@postgresql.org +In-Reply-To: <20060606205117.GB45331@pervasive.com> +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> + <22706.1149538039@sss.pgh.pa.us> + <20060605203851.GB7071@phlogiston.dyndns.org> + <23915.1149541591@sss.pgh.pa.us> + <1149604741.2621.487.camel@localhost.localdomain> + <17148.1149605005@sss.pgh.pa.us> + <1149605576.2621.502.camel@localhost.localdomain> + <17426.1149606369@sss.pgh.pa.us> <4485C061.2080206@modgraph-usa.com> + <1149616467.25526.213.camel@state.g2switchworks.com> + <20060606205117.GB45331@pervasive.com> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1149627741.25526.224.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Tue, 06 Jun 2006 16:02:21 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/71 +X-Sequence-Number: 19428 + +On Tue, 2006-06-06 at 15:51, Jim C. Nasby wrote: +> On Tue, Jun 06, 2006 at 12:54:27PM -0500, Scott Marlowe wrote: +> > On Tue, 2006-06-06 at 12:50, Craig A. James wrote: +> > > Tom Lane wrote: +> > > >>The idea I just had was: why do we need EXPLAIN ANALYZE to run to +> > > >>completion? In severe cases like this thread, we might be able to +> > > >>discover the root cause by a *partial* execution of the plan, as long as +> > > >>it was properly instrumented. That way, the OP might have been able to +> > > >>discover the root cause himself... +> > > > +> > > > +> > > > I don't think that helps, as it just replaces one uncertainty by +> > > > another: how far did the EXPLAIN really get towards completion of the +> > > > plan? You still don't have any hard data. +> > > +> > > But at least you have some data, which is better than no data. Even knowing that the plan got stuck on a particular node of the query plan could be vital information. For a query that never finishes, you can't even find out where it's getting stuck. +> > > +> > > That's why Simon's proposal might help in some particularly difficult situations. +> > +> > Hmmmmm. I wonder if it be hard to have explain analyze have a timeout +> > per node qualifier? Something that said if it takes more than x +> > milliseconds for a node to kill the explain analyze and list the up to +> > the nasty node that's using all the time up? +> > +> > That would be extremely useful. +> +> Maybe, maybe not. It would be very easy for this to croak on the first +> sort it hits. I suspect the original proposal of aborting once a +> rowcount estimate proves to be way off is a better idea. +> +> For the record, I also think being able to get a current snapshot is +> great, too. + +I can see value in both. + +Just because the row count is right doesn't mean it won't take a +fortnight of processing. :) + +The problem with the row count estimate being off from the real thing is +you only get it AFTER the set is retrieved for that node. + +The cost of aborting on the first sort is minimal. You just turn up the +number for the timeout and run it again. 1 minute or so wasted. + +The cost of not aborting on the first sort is that you may never see +what the part of the plan is that's killing your query, since you never +get the actual plan. + +From pgsql-performance-owner@postgresql.org Tue Jun 6 18:11:25 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0BFE49FB1B9 + for ; + Tue, 6 Jun 2006 18:11:25 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 59310-01 + for ; + Tue, 6 Jun 2006 18:11:19 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id E925E9FA13E + for ; + Tue, 6 Jun 2006 18:11:19 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k56LBEss023271; + Tue, 6 Jun 2006 17:11:14 -0400 (EDT) +To: Scott Marlowe +cc: "Jim C. Nasby" , + "Craig A. James" , + pgsql-performance@postgresql.org +Subject: Re: Some queries starting to hang +In-reply-to: <1149627741.25526.224.camel@state.g2switchworks.com> +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> + <22706.1149538039@sss.pgh.pa.us> + <20060605203851.GB7071@phlogiston.dyndns.org> + <23915.1149541591@sss.pgh.pa.us> + <1149604741.2621.487.camel@localhost.localdomain> + <17148.1149605005@sss.pgh.pa.us> + <1149605576.2621.502.camel@localhost.localdomain> + <17426.1149606369@sss.pgh.pa.us> + <4485C061.2080206@modgraph-usa.com> + <1149616467.25526.213.camel@state.g2switchworks.com> + <20060606205117.GB45331@pervasive.com> + <1149627741.25526.224.camel@state.g2switchworks.com> +Comments: In-reply-to Scott Marlowe + message dated "Tue, 06 Jun 2006 16:02:21 -0500" +Date: Tue, 06 Jun 2006 17:11:14 -0400 +Message-ID: <23270.1149628274@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/72 +X-Sequence-Number: 19429 + +Scott Marlowe writes: +> The cost of not aborting on the first sort is that you may never see +> what the part of the plan is that's killing your query, since you never +> get the actual plan. + +Well, you can get the plan without waiting a long time; that's what +plain EXPLAIN is for. But I still disagree with the premise that you +can extrapolate anything very useful from an unfinished EXPLAIN ANALYZE +run. As an example, if the plan involves setup steps such as sorting or +loading a hashtable, cancelling after a minute might make it look like +the setup step is the big problem, distracting you from the possibility +that the *rest* of the plan would take weeks to run if you ever got to +it. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jun 6 18:15:00 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id AC5889FB1B9 + for ; + Tue, 6 Jun 2006 18:14:58 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 58799-05 + for ; + Tue, 6 Jun 2006 18:14:49 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 2E1229FA13E + for ; + Tue, 6 Jun 2006 18:14:49 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Tue, 6 Jun 2006 21:14:47 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 06 Jun 2006 16:14:48 -0500 +Subject: Re: Some queries starting to hang +From: Scott Marlowe +To: Tom Lane +Cc: "Jim C. Nasby" , + "Craig A. James" , + pgsql-performance@postgresql.org +In-Reply-To: <23270.1149628274@sss.pgh.pa.us> +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> + <22706.1149538039@sss.pgh.pa.us> + <20060605203851.GB7071@phlogiston.dyndns.org> + <23915.1149541591@sss.pgh.pa.us> + <1149604741.2621.487.camel@localhost.localdomain> + <17148.1149605005@sss.pgh.pa.us> + <1149605576.2621.502.camel@localhost.localdomain> + <17426.1149606369@sss.pgh.pa.us> <4485C061.2080206@modgraph-usa.com> + <1149616467.25526.213.camel@state.g2switchworks.com> + <20060606205117.GB45331@pervasive.com> + <1149627741.25526.224.camel@state.g2switchworks.com> + <23270.1149628274@sss.pgh.pa.us> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1149628487.25526.228.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Tue, 06 Jun 2006 16:14:48 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/73 +X-Sequence-Number: 19430 + +On Tue, 2006-06-06 at 16:11, Tom Lane wrote: +> Scott Marlowe writes: +> > The cost of not aborting on the first sort is that you may never see +> > what the part of the plan is that's killing your query, since you never +> > get the actual plan. +> +> Well, you can get the plan without waiting a long time; that's what +> plain EXPLAIN is for. But I still disagree with the premise that you +> can extrapolate anything very useful from an unfinished EXPLAIN ANALYZE +> run. As an example, if the plan involves setup steps such as sorting or +> loading a hashtable, cancelling after a minute might make it look like +> the setup step is the big problem, distracting you from the possibility +> that the *rest* of the plan would take weeks to run if you ever got to +> it. + +Sure, but it would be nice to see it report the partial work. + +i.e. I got to using a nested loop, thought there would be 20 rows, +processed 250,000 or so, timed out at 10 minutes, and gave up. + +I would find that useful. + +From pgsql-performance-owner@postgresql.org Tue Jun 6 20:27:32 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0B6699FA3A6 + for ; + Tue, 6 Jun 2006 20:27:32 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 17702-06 + for ; + Tue, 6 Jun 2006 20:27:20 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id AB14B9FA0E5 + for ; + Tue, 6 Jun 2006 20:27:21 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 8BD7231F48; Wed, 7 Jun 2006 01:27:19 +0200 (MET DST) +From: Ron Mayer +X-Newsgroups: pgsql.performance +Subject: Re: lowering priority automatically at connection +Date: Tue, 06 Jun 2006 16:27:16 -0700 +Organization: Hub.Org Networking Services +Lines: 47 +Message-ID: <44860F54.7080401@cheapcomplexdevices.com> +References: <1148573784.6017.26.camel@dell.home.lan> + <13758.1148574403@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@news.hub.org +To: Tom Lane +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +In-Reply-To: <13758.1148574403@sss.pgh.pa.us> +To: pgsql-performance@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/74 +X-Sequence-Number: 19431 + +Tom Lane wrote: +> That guy doesn't actually have the foggiest idea what he's doing. +> The reason there is no built-in capability to do that is that it *does +> not work well*. Search the list archives for "priority inversion" to +> find out why not. + +I agree that that particular author seems clueless, but better +researched papers do show benefits as well: + +The CMU paper +"Priority Mechanisms for OLTP and Transactional Web Applications" [1] +studied both TPC-C and TPC-W workloads on postgresql (as well as DB2). +For PostgreSQL they found that without priority inheritance they +had factor-of-2 benefits for high-priority transactions; +and with priority inheritance they had factor-of-6 benefits +for high priority transactions -- both with negligible harm +to the low priority transactions. + +Unless there's something wrong with that paper (and at first glance +it looks like their methodologies apply at least to many workloads) +it seems that "it *does not work well*" is a bit of a generalization; +and that databases with TPC-C and TPC-W like workloads may indeed +be cases where this feature would be useful. + +[1] http://www.cs.cmu.edu/~harchol/Papers/actual-icde-submission.pdf +" + ...This paper analyzes and proposes prioritization for + transactional workloads in conventional DBMS...This paper + provides a detailed resource utilization breakdown for + OLTP workloads executing on a range of database platforms + including IBM DB2[14], Shore[16], and PostgreSQL[17].... + ... + For DBMS using MVCC (with TPC-C or TPC-W workloads) and + for TPC-W workloads (with any concurrency control mechanism), + we find that lock scheduling is largely ineffective (even + preemptive lock scheduling) and CPU scheduling is highly + effective. For example, we find that for PostgreSQL + running under TPC-C, the simplest CPU scheduling + algorithm CPU-Prio provides a factor of 2 improvement + for the high-priority transactions, and adding priority + inheritance (CPU-Prio-Inherit) brings this up to a factor + of near 6 improvement under high loads, while hardly + penalizing low-priority transactions. +" + + Or am I missing something? + Ron + +From pgsql-performance-owner@postgresql.org Wed Jun 7 08:42:37 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8395E9FA5EA + for ; + Wed, 7 Jun 2006 08:42:37 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 99555-10 + for ; + Wed, 7 Jun 2006 08:42:32 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sand2.gxn.net (sand2.gxn.net [195.147.249.208]) + by postgresql.org (Postfix) with ESMTP id A9D829FA5D3 + for ; + Wed, 7 Jun 2006 08:42:32 -0300 (ADT) +Received: from [62.232.55.118] (helo=[192.168.0.2]) + by sand2.gxn.net with esmtp (Exim 4.50) + id 1FnwSE-0002Bq-OK; Wed, 07 Jun 2006 12:44:06 +0100 +Subject: Re: Some queries starting to hang +From: Simon Riggs +To: Tom Lane +Cc: "Jim C. Nasby" , + Andrew Sullivan , pgsql-performance@postgresql.org +In-Reply-To: <17758.1149608475@sss.pgh.pa.us> +References: <1149534308.3583.56.camel@bg002441.pro-unlimited.com> + <22706.1149538039@sss.pgh.pa.us> + <20060605203851.GB7071@phlogiston.dyndns.org> + <23915.1149541591@sss.pgh.pa.us> + <1149604741.2621.487.camel@localhost.localdomain> + <17148.1149605005@sss.pgh.pa.us> + <1149605576.2621.502.camel@localhost.localdomain> + <17426.1149606369@sss.pgh.pa.us> <20060606151416.GD53487@pervasive.com> + <17758.1149608475@sss.pgh.pa.us> +Content-Type: text/plain +Date: Wed, 07 Jun 2006 12:42:28 +0100 +Message-Id: <1149680548.2621.600.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.6.1 (2.6.1-1.fc5.2) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/75 +X-Sequence-Number: 19432 + +On Tue, 2006-06-06 at 11:41 -0400, Tom Lane wrote: +> "Jim C. Nasby" writes: +> > On Tue, Jun 06, 2006 at 11:06:09AM -0400, Tom Lane wrote: +> >> I don't think that helps, as it just replaces one uncertainty by +> >> another: how far did the EXPLAIN really get towards completion of the +> >> plan? You still don't have any hard data. +> +> > Does that really matter, though? The point is to find the node where the +> > estimate proved to be fantasy. +> +> No, the point is to find out what reality is. + +My point is knowing reality with less than 100% certainty is still very +frequently useful. + +> Just knowing that the +> estimates are wrong doesn't really get you anywhere (we pretty much knew +> that before we even started looking at the EXPLAIN, eh?). + +We were lucky enough to have two EXPLAINS that could be examined for +differences. Often, you have just one EXPLAIN and no idea which estimate +is incorrect, or whether they are all exactly correct. That is when an +EXPLAIN ANALYZE becomes essential - yet a *full* execution isn't +required in order to tell you what you need to know. + +-- + Simon Riggs + EnterpriseDB http://www.enterprisedb.com + + +From pgsql-performance-owner@postgresql.org Wed Jun 7 09:43:18 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8544F9FA5F0 + for ; + Wed, 7 Jun 2006 09:43:18 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 08876-01 + for ; + Wed, 7 Jun 2006 09:43:14 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from hu-out-0102.google.com (hu-out-0102.google.com [72.14.214.206]) + by postgresql.org (Postfix) with ESMTP id 42C219F9EF3 + for ; + Wed, 7 Jun 2006 09:43:14 -0300 (ADT) +Received: by hu-out-0102.google.com with SMTP id 23so931530huc + for ; + Wed, 07 Jun 2006 05:43:12 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:mime-version:content-type; + b=l+22BM1V/Mg/YiSG2RrscPR9TNMcORGa5FviAfHFlo35eP7WRRVZW0RbdJnpJG80fmrEycmEOKEg+qqNoBNtvMida+/mt5qrJStDBtqo0bxDkxLNrWS5uEOw5EhfoeD+O1rfY6N051kqBS5LN7pG4NqURb/E9/ZiwwrlL8gDpEQ= +Received: by 10.35.41.14 with SMTP id t14mr659235pyj; + Wed, 07 Jun 2006 05:43:11 -0700 (PDT) +Received: by 10.35.8.14 with HTTP; Wed, 7 Jun 2006 05:43:11 -0700 (PDT) +Message-ID: <9f2e40a90606070543l1066f162v19fc0887d916e2bb@mail.gmail.com> +Date: Wed, 7 Jun 2006 18:13:11 +0530 +From: "soni de" +To: pgsql-performance@postgresql.org +Subject: Regarding ALTER Command +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_1858_22786569.1149684191734" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/76 +X-Sequence-Number: 19433 + +------=_Part_1858_22786569.1149684191734 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hello, + + + +We have database on which continueous operations of INSERT, DELETE, UPDATE +are going on, In the mean time irrespective of INSERT and UPDATE we want to +ALTER some filelds from the table can we do that? + +Would the ALTER command on heavily loaded database create any perfomance +problem? + +Is it feasible to do ALTER when lots of INSERT operations are going on? + + + +Postgresql version we are using is -- PostgreSQL 7.2.4 + + + +Please provide me some help regarding this. + + + +Thanks, + +Soni + +------=_Part_1858_22786569.1149684191734 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +
 
+
+

Hello,

+

 

+

We have database on which continueous operations of INSERT, DELETE, UPDATE are going on, In the mean time irrespective of INSERT and UPDATE we want to ALTER some filelds from the table can we do that? +

+

Would the ALTER command on heavily loaded database create any perfomance problem?

+

Is it feasible to do ALTER when lots of INSERT operations are going on?

+

 

+

Postgresql version we are using is -- PostgreSQL 7.2.4

+

 

+

Please provide me some help regarding this.

+

 

+

Thanks,

+

Soni

+ +------=_Part_1858_22786569.1149684191734-- + +From pgsql-performance-owner@postgresql.org Wed Jun 7 11:50:32 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5E06C9FA5F0 + for ; + Wed, 7 Jun 2006 11:50:32 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 20784-09 + for ; + Wed, 7 Jun 2006 11:50:23 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 30C839FA5D3 + for ; + Wed, 7 Jun 2006 11:50:22 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 48A0556453; Wed, 7 Jun 2006 09:50:21 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); + Wed, 7 Jun 2006 09:50:20 -0500 +Date: Wed, 7 Jun 2006 09:50:20 -0500 +From: "Jim C. Nasby" +To: soni de +Cc: pgsql-performance@postgresql.org +Subject: Re: Regarding ALTER Command +Message-ID: <20060607145020.GT45331@pervasive.com> +References: <9f2e40a90606070543l1066f162v19fc0887d916e2bb@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <9f2e40a90606070543l1066f162v19fc0887d916e2bb@mail.gmail.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060607:soni.de@gmail.com::6r0Nl6lL6Pl/2ime:00000000000000000000 + 0000000000000000000000004yIH +X-Hashcash: + 1:20:060607:pgsql-performance@postgresql.org::UAzeuVqJNJTRzbqx:00000 + 0000000000000000000000000cYF +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/77 +X-Sequence-Number: 19434 + +On Wed, Jun 07, 2006 at 06:13:11PM +0530, soni de wrote: +> Hello, +> +> +> +> We have database on which continueous operations of INSERT, DELETE, UPDATE +> are going on, In the mean time irrespective of INSERT and UPDATE we want to +> ALTER some filelds from the table can we do that? +> +> Would the ALTER command on heavily loaded database create any perfomance +> problem? +> +> Is it feasible to do ALTER when lots of INSERT operations are going on? + +The problem you'll run into is that ALTER will grab an exclusive table +lock. If *all* the transactions hitting the table are very short, this +shouldn't be too big of an issue; the ALTER will block all new accesses +to the table while it waits for all the pending ones to complete, but if +all the pending ones complete quickly it shouldn't be a big issue. + +If one of the pending statements takes a long time though... + +> Postgresql version we are using is -- PostgreSQL 7.2.4 + +You very badly need to upgrade. 7.2 is no longer supported, and there +have been over a half-dozen data loss bugs fixed since then. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Wed Jun 7 16:58:49 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 955F49FA3AD + for ; + Wed, 7 Jun 2006 16:58:49 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 70534-02 + for ; + Wed, 7 Jun 2006 16:58:44 -0300 (ADT) +X-Greylist: delayed 00:31:06.430331 by SQLgrey- +Received: from lara.cc.fer.hr (lara.cc.fer.hr [161.53.72.113]) + by postgresql.org (Postfix) with ESMTP id 014C49FA2E6 + for ; + Wed, 7 Jun 2006 16:58:43 -0300 (ADT) +Received: from [127.0.0.1] (localhost.cc.fer.hr [127.0.0.1]) + by lara.cc.fer.hr (8.13.6/8.13.4) with ESMTP id k57JQIfw021055 + for ; + Wed, 7 Jun 2006 21:26:23 +0200 (CEST) (envelope-from ivoras@fer.hr) +Message-ID: <4487285A.5050104@fer.hr> +Date: Wed, 07 Jun 2006 21:26:18 +0200 +From: Ivan Voras +User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050921) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Curious sorting puzzle +Content-Type: text/plain; charset=ISO-8859-2; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/78 +X-Sequence-Number: 19435 + +The situation is this: we're using a varchar column to store +alphanumeric codes which are by themselves 7-bit clean. But we are +operating under a locale which has its own special collation rules, and +is also utf-8 encoded. Recently we've discovered a serious "d'oh!"-type +bug which we tracked down to the fact that when we sort by this column +the collation respects locale sorting rules, which is messing up other +parts of the application. + +The question is: what is the most efficient way to solve this problem +(the required operation is to sort data using binary "collation" - i.e. +compare byte by byte)? Since this field gets queried a lot it must have +an index. Some of the possible solutions we thought of are: replacing +the varchar type with numeric and do magical transcoding (bad, needs +changes thoughout the application) and inserting spaces after every +character (not as bad, but still requires modifying both the application +and the data). An ideal solution would be to have a +"not-locale-affected-varchar" field type :) + + +From pgsql-performance-owner@postgresql.org Wed Jun 7 17:52:40 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7D14B9FA3AD + for ; + Wed, 7 Jun 2006 17:52:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 72703-10 + for ; + Wed, 7 Jun 2006 17:52:31 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.169]) + by postgresql.org (Postfix) with ESMTP id 926909FA2E6 + for ; + Wed, 7 Jun 2006 17:52:29 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so501966ugf + for ; + Wed, 07 Jun 2006 13:52:27 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=GAjAH2TZrqMv06WdQYZSXPCK6Az3tjyJfVxNrn5lPdA3G+CPcFmNKv9NYhJ6mI4iqJgtwQDot4fvahikdpMKgUsdBPbtFtl2rNkAY3aDft5owG04vk8CEFSnMwAeV5uVqy50bg7OEmQ392UxsY9ZJFunwtDBV/vXaJ3j6cZIybY= +Received: by 10.78.47.9 with SMTP id u9mr313750huu; + Wed, 07 Jun 2006 13:52:26 -0700 (PDT) +Received: by 10.78.71.9 with HTTP; Wed, 7 Jun 2006 13:52:26 -0700 (PDT) +Message-ID: <92d3a4950606071352u7aa25789q9f1dbc57fd14847e@mail.gmail.com> +Date: Wed, 7 Jun 2006 22:52:26 +0200 +From: Antoine +To: mischa@ca.sophos.com +Subject: Re: vacuuming problems continued +Cc: pgsql-performance@postgresql.org +In-Reply-To: <4485D9A1.30807@ca.sophos.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <92d3a4950606010454y67293765o56001e8996975b45@mail.gmail.com> + <20060605204151.GC7071@phlogiston.dyndns.org> + <4485CECC.4040207@ca.sophos.com> <4485D5C3.7010803@commandprompt.com> + <4485D9A1.30807@ca.sophos.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/79 +X-Sequence-Number: 19436 + +Hi all and thanks for your responses. I haven't yet had a chance to +tweak the autovac settings but I really don't think that things can be +maxing out even the default settings. +We have about 4 machines that are connected 24/7 - they were doing +constant read/inserts (24/7) but that was because the code was +rubbish. I managed to whinge enough to get the programme to read, do +the work, then insert, and that means they are accessing (connected +but idle) for less than 5% of the day. We have about another 10 +machines that access (reads and updates) from 8-5. It is running on a +P4 with 256 or 512meg of ram and I simply refuse to believe this load +is anything significant... :-(. +There are only two tables that see any action, and the smaller one is +almost exclusively inserts. +Much as I believe it shouldn't be possible the ratio of 5:1 for the db +vs fresh copy has given me a taste for a copy/drop scenario... +I will try and increase settings and keep you posted. +Cheers +Antoine + + +-- +This is where I should put some witty comment. + +From pgsql-performance-owner@postgresql.org Wed Jun 7 18:16:29 2006 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E10F09FA3AD + for ; + Wed, 7 Jun 2006 18:16:28 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 79879-03 + for ; + Wed, 7 Jun 2006 18:16:17 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 973269FA2E6 + for ; + Wed, 7 Jun 2006 18:16:17 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k57LGEsi017523; + Wed, 7 Jun 2006 17:16:14 -0400 (EDT) +To: Ivan Voras +cc: pgsql-performance@postgresql.org +Subject: Re: Curious sorting puzzle +In-reply-to: <4487285A.5050104@fer.hr> +References: <4487285A.5050104@fer.hr> +Comments: In-reply-to Ivan Voras + message dated "Wed, 07 Jun 2006 21:26:18 +0200" +Date: Wed, 07 Jun 2006 17:16:13 -0400 +Message-ID: <17522.1149714973@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/80 +X-Sequence-Number: 19437 + +Ivan Voras writes: +> The situation is this: we're using a varchar column to store +> alphanumeric codes which are by themselves 7-bit clean. But we are +> operating under a locale which has its own special collation rules, and +> is also utf-8 encoded. Recently we've discovered a serious "d'oh!"-type +> bug which we tracked down to the fact that when we sort by this column +> the collation respects locale sorting rules, which is messing up other +> parts of the application. + +> The question is: what is the most efficient way to solve this problem +> (the required operation is to sort data using binary "collation" - i.e. +> compare byte by byte)? Since this field gets queried a lot it must have +> an index. Some of the possible solutions we thought of are: replacing +> the varchar type with numeric and do magical transcoding (bad, needs +> changes thoughout the application) and inserting spaces after every +> character (not as bad, but still requires modifying both the application +> and the data). An ideal solution would be to have a +> "not-locale-affected-varchar" field type :) + +If you're just storing ASCII then I think bytea might work for this. +Do you need any actual text operations (like concatenation), or this +just a store-and-retrieve field? + +If you need text ops too then probably the best answer is to make your +own datatype. It's not that hard --- look at the citext datatype (on +pgfoundry IIRC, or else gborg) for a closely related example. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Jun 7 19:17:43 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7B0C59FA6B4 + for ; + Wed, 7 Jun 2006 19:17:42 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 84622-06 for + ; + Wed, 7 Jun 2006 19:17:33 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 06FF09FA6B3 + for ; + Wed, 7 Jun 2006 19:17:32 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 7C6815647E; Wed, 7 Jun 2006 17:17:26 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); + Wed, 7 Jun 2006 17:17:25 -0500 +Date: Wed, 7 Jun 2006 17:17:25 -0500 +From: "Jim C. Nasby" +To: Antoine +Cc: mischa@ca.sophos.com, pgsql-performance@postgresql.org +Subject: Re: vacuuming problems continued +Message-ID: <20060607221724.GC45331@pervasive.com> +References: <92d3a4950606010454y67293765o56001e8996975b45@mail.gmail.com> + <20060605204151.GC7071@phlogiston.dyndns.org> + <4485CECC.4040207@ca.sophos.com> + <4485D5C3.7010803@commandprompt.com> <4485D9A1.30807@ca.sophos.com> + <92d3a4950606071352u7aa25789q9f1dbc57fd14847e@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <92d3a4950606071352u7aa25789q9f1dbc57fd14847e@mail.gmail.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060607:melser.anton@gmail.com::+3KS5tarTmHGlGTh:000000000000000 + 0000000000000000000000003haG +X-Hashcash: + 1:20:060607:mischa@ca.sophos.com::/WetfTuq8iJ27l7h:00000000000000000 + 0000000000000000000000007SUf +X-Hashcash: + 1:20:060607:pgsql-performance@postgresql.org::bhmo935Wa5GM7SIv:00000 + 0000000000000000000000003N4J +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/81 +X-Sequence-Number: 19438 + +Bloat doesn't depend on your update/delete rate; it depends on how many +update/deletes occur between vacuums. Long running transactions also +come into play. + +As for performance, a P4 with 512M of ram is pretty much a toy in the +database world; it wouldn't be very hard to swamp it. + +But without actual details there's no way to know. + +On Wed, Jun 07, 2006 at 10:52:26PM +0200, Antoine wrote: +> Hi all and thanks for your responses. I haven't yet had a chance to +> tweak the autovac settings but I really don't think that things can be +> maxing out even the default settings. +> We have about 4 machines that are connected 24/7 - they were doing +> constant read/inserts (24/7) but that was because the code was +> rubbish. I managed to whinge enough to get the programme to read, do +> the work, then insert, and that means they are accessing (connected +> but idle) for less than 5% of the day. We have about another 10 +> machines that access (reads and updates) from 8-5. It is running on a +> P4 with 256 or 512meg of ram and I simply refuse to believe this load +> is anything significant... :-(. +> There are only two tables that see any action, and the smaller one is +> almost exclusively inserts. +> Much as I believe it shouldn't be possible the ratio of 5:1 for the db +> vs fresh copy has given me a taste for a copy/drop scenario... +> I will try and increase settings and keep you posted. +> Cheers +> Antoine +> +> +> -- +> This is where I should put some witty comment. +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: Don't 'kill -9' the postmaster +> + +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Wed Jun 7 20:06:12 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5EFF49FA5CE + for ; + Wed, 7 Jun 2006 20:06:12 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 91767-10 for + ; + Wed, 7 Jun 2006 20:06:07 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from lara.cc.fer.hr (lara.cc.fer.hr [161.53.72.113]) + by postgresql.org (Postfix) with ESMTP id 5B5889FA3C0 + for ; + Wed, 7 Jun 2006 20:06:07 -0300 (ADT) +Received: from [127.0.0.1] (localhost.cc.fer.hr [127.0.0.1]) + by lara.cc.fer.hr (8.13.6/8.13.4) with ESMTP id k57N4rDp026917; + Thu, 8 Jun 2006 01:04:53 +0200 (CEST) (envelope-from ivoras@fer.hr) +Message-ID: <44875B95.5000005@fer.hr> +Date: Thu, 08 Jun 2006 01:04:53 +0200 +From: Ivan Voras +User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050921) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Tom Lane +CC: pgsql-performance@postgresql.org +Subject: Re: Curious sorting puzzle +References: <4487285A.5050104@fer.hr> <17522.1149714973@sss.pgh.pa.us> +In-Reply-To: <17522.1149714973@sss.pgh.pa.us> +Content-Type: text/plain; charset=ISO-8859-2; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/82 +X-Sequence-Number: 19439 + +Tom Lane wrote: + +>>An ideal solution would be to have a +>>"not-locale-affected-varchar" field type :) +> +> +> If you're just storing ASCII then I think bytea might work for this. +> Do you need any actual text operations (like concatenation), or this +> just a store-and-retrieve field? + +I've just tested bytea and it looks like a perfect solution - it supports: + +- character-like syntax +- indexes +- uses indexes with LIKE 'x%' queries +- SUBSTRING() + +That's good enough for us - it seems it's just what we need - a +string-like type with byte collation. + +Thanks! + +From pgsql-performance-owner@postgresql.org Thu Jun 8 03:07:53 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E84D79FA5BA + for ; + Thu, 8 Jun 2006 03:07:52 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 75182-06 for + ; + Thu, 8 Jun 2006 03:07:46 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from py-out-1112.google.com (py-out-1112.google.com + [64.233.166.178]) + by postgresql.org (Postfix) with ESMTP id 496F29FA3CD + for ; + Thu, 8 Jun 2006 03:07:46 -0300 (ADT) +Received: by py-out-1112.google.com with SMTP id b29so398035pya + for ; + Wed, 07 Jun 2006 23:07:45 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=uZ7zWvSU9QmLPwB+b2NOr41sx7F0Oy+ZqSfU0xB6gGAnzwDmM2fKEghJt33aEmuUSsiybRlnKlHZW5QOhmKDaH+0FvWwf1nCu0opAgyY2ge47yMpPjLViTSL72VxS4SdK8/TRMqqqB8G8BwmJm/hR7kICumxPMrY6fb7IhEYXlw= +Received: by 10.35.106.18 with SMTP id i18mr446175pym; + Wed, 07 Jun 2006 23:07:45 -0700 (PDT) +Received: by 10.35.8.14 with HTTP; Wed, 7 Jun 2006 23:07:44 -0700 (PDT) +Message-ID: <9f2e40a90606072307s7107630eh60e01c4f792fe3a8@mail.gmail.com> +Date: Thu, 8 Jun 2006 11:37:44 +0530 +From: "soni de" +To: "Jim C. Nasby" +Subject: Re: Regarding ALTER Command +Cc: pgsql-performance@postgresql.org +In-Reply-To: <20060607145020.GT45331@pervasive.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_15750_2229363.1149746864911" +References: <9f2e40a90606070543l1066f162v19fc0887d916e2bb@mail.gmail.com> + <20060607145020.GT45331@pervasive.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/83 +X-Sequence-Number: 19440 + +------=_Part_15750_2229363.1149746864911 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hello, + + +We are planning to use latest postgres version. I have one query as below: + + + +One more thing I have to mention is that we are using 2 postmasters running +on different machines and both are accessing same data directory. (i.e both +the machines uses same tables or the databases) + +In that case if from first machine, continuous INSERT operation on any table +are going on and from the second we have to update the same table using +ALTER command. + +Would this create any problem because INSERT and ALTER operations are +executed from the two different postmasters but for a same data directory? + +Would there be any data loss or in this case also ALTER will block all the +new accesses to the table? + + +Thanks, +Soni + + +On 6/7/06, Jim C. Nasby wrote: +> +> On Wed, Jun 07, 2006 at 06:13:11PM +0530, soni de wrote: +> > Hello, +> > +> > +> > +> > We have database on which continueous operations of INSERT, DELETE, +> UPDATE +> > are going on, In the mean time irrespective of INSERT and UPDATE we want +> to +> > ALTER some filelds from the table can we do that? +> > +> > Would the ALTER command on heavily loaded database create any perfomance +> > problem? +> > +> > Is it feasible to do ALTER when lots of INSERT operations are going on? +> +> The problem you'll run into is that ALTER will grab an exclusive table +> lock. If *all* the transactions hitting the table are very short, this +> shouldn't be too big of an issue; the ALTER will block all new accesses +> to the table while it waits for all the pending ones to complete, but if +> all the pending ones complete quickly it shouldn't be a big issue. +> +> If one of the pending statements takes a long time though... +> +> > Postgresql version we are using is -- PostgreSQL 7.2.4 +> +> You very badly need to upgrade. 7.2 is no longer supported, and there +> have been over a half-dozen data loss bugs fixed since then. +> -- +> Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +> Pervasive Software http://pervasive.com work: 512-231-6117 +> vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 +> + +------=_Part_15750_2229363.1149746864911 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +
Hello,
+
 
+

We are planning to use latest postgres version. I have one query as below:

+

 

+

One more thing I have to mention is that we are using 2 postmasters running on different machines and both are accessing same data directory. ( +i.e both the machines uses same tables or the databases)

+

In that case if from first machine, continuous INSERT operation on any table are going on and from the second we have to update the same table using ALTER command. +

+

Would this create any problem because INSERT and ALTER operations are executed from the two different postmasters but for a same data directory? +

+

Would there be any data loss or in this case also ALTER will block all the new accesses to the table?

+

 

+
Thanks,
+
Soni

 
+
On 6/7/06, Jim C. Nasby <jnasby@pervasive.com> wrote: +
On Wed, Jun 07, 2006 at 06:13:11PM +0530, soni de wrote:
> Hello,
>
>
>
> We have database on which continueous operations of INSERT, DELETE, UPDATE +
> are going on, In the mean time irrespective of INSERT and UPDATE we want to
> ALTER some filelds from the table can we do that?
>
> Would the ALTER command on heavily loaded database create any perfomance +
> problem?
>
> Is it feasible to do ALTER when lots of INSERT operations are going on?

The problem you'll run into is that ALTER will grab an exclusive table
lock. If *all* the transactions hitting the table are very short, this +
shouldn't be too big of an issue; the ALTER will block all new accesses
to the table while it waits for all the pending ones to complete, but if
all the pending ones complete quickly it shouldn't be a big issue. +

If one of the pending statements takes a long time though...

> Postgresql version we are using is -- PostgreSQL 7.2.4

You very badly need to upgrade. 7.2 is no longer supported, and there
have been over a half-dozen data loss bugs fixed since then. +
--
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117 +
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461

+ +------=_Part_15750_2229363.1149746864911-- + +From pgsql-performance-owner@postgresql.org Thu Jun 8 03:10:01 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C0E9A9FA3CD + for ; + Thu, 8 Jun 2006 03:10:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 79379-03 for + ; + Thu, 8 Jun 2006 03:09:49 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from py-out-1112.google.com (py-out-1112.google.com + [64.233.166.178]) + by postgresql.org (Postfix) with ESMTP id E39189FA5BA + for ; + Thu, 8 Jun 2006 03:09:49 -0300 (ADT) +Received: by py-out-1112.google.com with SMTP id z74so444422pyg + for ; + Wed, 07 Jun 2006 23:09:48 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:mime-version:content-type; + b=Hf0ac/s1CA9R1S4AKakNBXzs8bf+1jv+/fdiWjKTTtm6yyXQZb7TEwj/lwSOZYyAU2qtWsgrqRmsoaM9kI6s8DtufrXPVFYuPUuSdXRNWbxuysW7EuLm2OqI0xV8XyLbT///unTuVO+JUnAXSROZWbbkxkh94owHoM2Lb9TSeRA= +Received: by 10.35.99.5 with SMTP id b5mr1921287pym; + Wed, 07 Jun 2006 23:09:48 -0700 (PDT) +Received: by 10.35.8.14 with HTTP; Wed, 7 Jun 2006 23:09:48 -0700 (PDT) +Message-ID: <9f2e40a90606072309v4c5b2623k8bda2614cd575835@mail.gmail.com> +Date: Thu, 8 Jun 2006 11:39:48 +0530 +From: "soni de" +To: pgsql-performance@postgresql.org +Subject: Regarding pg_dump utility +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_15766_6251708.1149746988718" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/84 +X-Sequence-Number: 19441 + +------=_Part_15766_6251708.1149746988718 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hello, + + + +We have to take a backup of database and we know the pg_dump utility of +postgresql. + +But may I know, is there any API for this pg_dump utility so that we can +call it from the C program? Or only script support is possible for this. + + + +I think script support is bit risky because if anything goes wrong while +taking backup using pg_dump then user will not understand the problem of +falling + +If only script support is possible then what should we prefer perl or shell? + + + +Please provide me some help regarding this + + + +Thanks, + +Soni + +------=_Part_15766_6251708.1149746988718 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +
 
+
+

Hello,

+

 

+

We have to take a backup of database and we know the pg_dump utility of postgresql.

+

But may I know, is there any API for this pg_dump utility so that we can call it from the C program? Or only script support is possible for this. +

+

 

+

I think script support is bit risky because if anything goes wrong while taking backup using pg_dump then user will not understand the problem of falling +

+

If only script support is possible then what should we prefer perl or shell?

+

 

+

Please provide me some help regarding this

+

 

+

Thanks,

+

Soni

+ +------=_Part_15766_6251708.1149746988718-- + +From pgsql-performance-owner@postgresql.org Thu Jun 8 08:41:01 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id ECDC19FA5C8 + for ; + Thu, 8 Jun 2006 08:41:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 20257-01 for + ; + Thu, 8 Jun 2006 08:40:48 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moutng.kundenserver.de (moutng.kundenserver.de + [212.227.126.186]) + by postgresql.org (Postfix) with ESMTP id 5D3A09F9EF3 + for ; + Thu, 8 Jun 2006 08:40:45 -0300 (ADT) +Received: from [84.143.10.74] (helo=pse.dyndns.org) + by mrelayeu.kundenserver.de (node=mrelayeu8) with ESMTP (Nemesis), + id 0ML2ov-1FoIsV49N9-0000nk; Thu, 08 Jun 2006 13:40:44 +0200 +Received: from [192.168.0.103] (helo=[192.168.0.103]) + by pse.dyndns.org with esmtp (Exim 4.44) id 1FoIsU-0006ml-Rn + for pgsql-performance@postgresql.org; Thu, 08 Jun 2006 13:40:42 +0200 +Message-ID: <44880CB1.90307@pse-consulting.de> +Date: Thu, 08 Jun 2006 13:40:33 +0200 +From: Andreas Pflug +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: JOIN with inherited table ignores indexes +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Provags-ID: kundenserver.de abuse@kundenserver.de + login:0ce7ee5c3478b8d72edd8e05ccd40b70 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/85 +X-Sequence-Number: 19442 + +I have this table setup on a 8.1.4 server: + +pj_info_attach(attachment_nr, some more cols) -- index, 50k rows +pj_info_attach_compressable() INHERITS (pj_info_attach) -- index, 1M rows +pj_info_attach_not_compressable() INHERITS (pj_info_attach) -- index, 0 +rows + +EXPLAIN ANALYZE SELECT aes FROM pj_info_attach + WHERE attachment_nr in (.. 20 numeric key values.. ) +yields a big bitmap index scan plan, 1.8ms total runtime, that's fine. + +Using a subselect on zz_attachment_graustufentest, which has 20 rows of +exactly the key values entered manually in the query above: + +EXPLAIN ANALYZE SELECT aes FROM pj_info_attach + WHERE attachment_nr in +(SELECT attachment_nr FROM zz_attachment_graustufentest) +gives 49s runtime, and full table scans. + +Merge Join (cost=158472.98..164927.22 rows=107569 width=8) + (actual time=49714.702..49715.142 rows=20 loops=1) + Merge Cond: ("outer"."?column2?" = "inner"."?column3?") + -> Sort (cost=2.16..2.21 rows=20 width=13)(actual time=0.752..0.830 +rows=20 loops=1) + Sort Key: (zz_attachment_graustufentest.attachment_nr)::numeric + -> Result (cost=1.63..1.73 rows=20 width=13) (actual +time=0.220..0.637 rows=20 loops=1) + -> Unique (cost=1.63..1.73 rows=20 width=13) (actual +time=0.210..0.459 rows=20 loops=1) + -> Sort (cost=1.63..1.68 rows=20 width=13) (actual +time=0.202..0.281 rows=20 loops=1) + Sort Key: +zz_attachment_graustufentest.attachment_nr + -> Seq Scan on zz_attachment_graustufentest +(cost=0.00..1.20 rows=20 width=13) + +(actual time=0.007..0.092 rows=20 loops=1) + -> Sort (cost=158470.81..161160.04 rows=1075690 width=40) + (actual time=44705.196..47222.685 rows=589842 loops=1) + Sort Key: (public.pj_info_attach.attachment_nr)::numeric + -> Result (cost=0.00..32736.90 rows=1075690 width=40) + (actual time=0.023..21958.761 rows=1074930 loops=1) + -> Append (cost=0.00..32736.90 rows=1075690 width=40) + (actual time=0.015..13485.153 +rows=1074930 loops=1) + -> Seq Scan on pj_info_attach (cost=0.00..1433.57 +rows=49957 width=21) + +(actual time=0.008..214.308 rows=49957 loops=1) + -> Seq Scan on pj_info_attach_compressable +pj_info_attach (cost=0.00..31285.73 rows=1024973 width=21) + +(actual time=0.032..4812.090 rows=1024973 loops=1) + -> Seq Scan on pj_info_attach_not_compressable +pj_info_attach (cost=0.00..17.60 rows=760 width=40) + +(actual time=0.005..0.005 rows=0 loops=1) +Total runtime: 49747.630 ms + +Any explanation for this horror? + +Regards, +Andreas + + +From pgsql-performance-owner@postgresql.org Thu Jun 8 12:04:35 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 893E89FA5C8 + for ; + Thu, 8 Jun 2006 12:04:34 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 60447-08 for + ; + Thu, 8 Jun 2006 12:04:26 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 01B649F9EF3 + for ; + Thu, 8 Jun 2006 12:04:25 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k58F4JB8027637; + Thu, 8 Jun 2006 11:04:19 -0400 (EDT) +To: "soni de" +cc: "Jim C. Nasby" , pgsql-performance@postgresql.org +Subject: Re: Regarding ALTER Command +In-reply-to: <9f2e40a90606072307s7107630eh60e01c4f792fe3a8@mail.gmail.com> +References: <9f2e40a90606070543l1066f162v19fc0887d916e2bb@mail.gmail.com> + <20060607145020.GT45331@pervasive.com> + <9f2e40a90606072307s7107630eh60e01c4f792fe3a8@mail.gmail.com> +Comments: In-reply-to "soni de" + message dated "Thu, 08 Jun 2006 11:37:44 +0530" +Date: Thu, 08 Jun 2006 11:04:19 -0400 +Message-ID: <27636.1149779059@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/86 +X-Sequence-Number: 19443 + +"soni de" writes: +> One more thing I have to mention is that we are using 2 postmasters running +> on different machines and both are accessing same data directory. (i.e both +> the machines uses same tables or the databases) + +The above is guaranteed NOT to work. I'm surprised you haven't already +observed wholesale data corruption. But don't worry, you will soon. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jun 8 12:06:10 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 763A59F9EF3 + for ; + Thu, 8 Jun 2006 12:06:09 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 66301-08 for + ; + Thu, 8 Jun 2006 12:06:06 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id EE7839FA5C8 + for ; + Thu, 8 Jun 2006 12:06:05 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k58F6455027684; + Thu, 8 Jun 2006 11:06:04 -0400 (EDT) +To: "soni de" +cc: pgsql-performance@postgresql.org +Subject: Re: Regarding pg_dump utility +In-reply-to: <9f2e40a90606072309v4c5b2623k8bda2614cd575835@mail.gmail.com> +References: <9f2e40a90606072309v4c5b2623k8bda2614cd575835@mail.gmail.com> +Comments: In-reply-to "soni de" + message dated "Thu, 08 Jun 2006 11:39:48 +0530" +Date: Thu, 08 Jun 2006 11:06:04 -0400 +Message-ID: <27683.1149779164@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/87 +X-Sequence-Number: 19444 + +"soni de" writes: +> We have to take a backup of database and we know the pg_dump utility of +> postgresql. + +> But may I know, is there any API for this pg_dump utility so that we can +> call it from the C program? Or only script support is possible for this. + +There's always system(3) .... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jun 8 12:17:10 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id BD5CC9F9EF3 + for ; + Thu, 8 Jun 2006 12:17:09 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 65144-06 for + ; + Thu, 8 Jun 2006 12:17:00 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 194739FA5C8 + for ; + Thu, 8 Jun 2006 12:16:59 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 27CAC56453; Thu, 8 Jun 2006 10:16:59 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); + Thu, 8 Jun 2006 10:16:58 -0500 +Date: Thu, 8 Jun 2006 10:16:57 -0500 +From: "Jim C. Nasby" +To: soni de +Cc: pgsql-performance@postgresql.org +Subject: Re: Regarding pg_dump utility +Message-ID: <20060608151657.GL45331@pervasive.com> +References: <9f2e40a90606072309v4c5b2623k8bda2614cd575835@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <9f2e40a90606072309v4c5b2623k8bda2614cd575835@mail.gmail.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060608:soni.de@gmail.com::ns9X695JcQitVlRm:00000000000000000000 + 0000000000000000000000004X9a +X-Hashcash: + 1:20:060608:pgsql-performance@postgresql.org::IHJ1fZ97dCSPRV9o:00000 + 0000000000000000000000007hTo +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/88 +X-Sequence-Number: 19445 + +On Thu, Jun 08, 2006 at 11:39:48AM +0530, soni de wrote: +> We have to take a backup of database and we know the pg_dump utility of +> postgresql. +> +> But may I know, is there any API for this pg_dump utility so that we can +> call it from the C program? Or only script support is possible for this. + +It probably wouldn't be terribly difficult to put the guts of pg_dump +into a library that you could interface with via C. I'm not sure if the +community would accept such a patch; though, I seem to recall other +people asking for this on occasion. + +> I think script support is bit risky because if anything goes wrong while +> taking backup using pg_dump then user will not understand the problem of +> falling +> +> If only script support is possible then what should we prefer perl or shell? + +Depends on what you're trying to accomplish. Perl is a much more capable +language than shell, obviously. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Thu Jun 8 12:22:22 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 066859FA5C8 + for ; + Thu, 8 Jun 2006 12:22:22 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 65333-08 for + ; + Thu, 8 Jun 2006 12:22:17 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 161249F9EF3 + for ; + Thu, 8 Jun 2006 12:22:16 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 1582656453; Thu, 8 Jun 2006 10:22:16 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); + Thu, 8 Jun 2006 10:22:15 -0500 +Date: Thu, 8 Jun 2006 10:22:15 -0500 +From: "Jim C. Nasby" +To: Andreas Pflug +Cc: pgsql-performance@postgresql.org +Subject: Re: JOIN with inherited table ignores indexes +Message-ID: <20060608152215.GM45331@pervasive.com> +References: <44880CB1.90307@pse-consulting.de> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <44880CB1.90307@pse-consulting.de> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060608:pgadmin@pse-consulting.de::xcXtGksk9ylK6eLP:000000000000 + 0000000000000000000000003kyU +X-Hashcash: + 1:20:060608:pgsql-performance@postgresql.org::hOuccI8T7WXHDBiI:00000 + 0000000000000000000000000sAA +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/89 +X-Sequence-Number: 19446 + +On Thu, Jun 08, 2006 at 01:40:33PM +0200, Andreas Pflug wrote: +> I have this table setup on a 8.1.4 server: +> +> pj_info_attach(attachment_nr, some more cols) -- index, 50k rows +> pj_info_attach_compressable() INHERITS (pj_info_attach) -- index, 1M rows +> pj_info_attach_not_compressable() INHERITS (pj_info_attach) -- index, 0 +> rows +> +> EXPLAIN ANALYZE SELECT aes FROM pj_info_attach +> WHERE attachment_nr in (.. 20 numeric key values.. ) +> yields a big bitmap index scan plan, 1.8ms total runtime, that's fine. +> +> Using a subselect on zz_attachment_graustufentest, which has 20 rows of +> exactly the key values entered manually in the query above: + +I'm pretty sure the issue is that the planner doesn't know what values +will be coming back from the subselect at plan time, so if the +distribution of values in attachment_nr isn't fairly constant you can g +et some pretty bad plans. Unfortunately, no one's figured out a good way +to fix this yet. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Thu Jun 8 12:42:51 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4F7969FA5C8 + for ; + Thu, 8 Jun 2006 12:42:51 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 68578-04 for + ; + Thu, 8 Jun 2006 12:42:42 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from www.3times25.net (duck.3times25.net [66.23.211.34]) + by postgresql.org (Postfix) with ESMTP id A1CEF9F9EF3 + for ; + Thu, 8 Jun 2006 12:42:42 -0300 (ADT) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by www.3times25.net (Postfix) with ESMTP id 2DA5254A89 + for ; + Thu, 8 Jun 2006 11:42:41 -0400 (EDT) +Message-ID: <44884570.8030705@3times25.net> +Date: Thu, 08 Jun 2006 11:42:40 -0400 +From: Geoffrey +User-Agent: Thunderbird 1.5 (X11/20051201) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Regarding pg_dump utility +References: <9f2e40a90606072309v4c5b2623k8bda2614cd575835@mail.gmail.com> + <27683.1149779164@sss.pgh.pa.us> +In-Reply-To: <27683.1149779164@sss.pgh.pa.us> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/90 +X-Sequence-Number: 19447 + +Tom Lane wrote: +> "soni de" writes: +>> We have to take a backup of database and we know the pg_dump utility of +>> postgresql. +> +>> But may I know, is there any API for this pg_dump utility so that we can +>> call it from the C program? Or only script support is possible for this. +> +> There's always system(3) .... + +fork(), exec()... + +-- +Until later, Geoffrey + +Any society that would give up a little liberty to gain a little +security will deserve neither and lose both. - Benjamin Franklin + +From pgsql-performance-owner@postgresql.org Thu Jun 8 13:06:36 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 34BEA9FA6B1 + for ; + Thu, 8 Jun 2006 13:06:36 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 74620-02 for + ; + Thu, 8 Jun 2006 13:06:26 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 5D3189FA6B0 + for ; + Thu, 8 Jun 2006 13:06:26 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k58G6PUi028436; + Thu, 8 Jun 2006 12:06:25 -0400 (EDT) +To: Andreas Pflug +cc: pgsql-performance@postgresql.org +Subject: Re: JOIN with inherited table ignores indexes +In-reply-to: <44880CB1.90307@pse-consulting.de> +References: <44880CB1.90307@pse-consulting.de> +Comments: In-reply-to Andreas Pflug + message dated "Thu, 08 Jun 2006 13:40:33 +0200" +Date: Thu, 08 Jun 2006 12:06:25 -0400 +Message-ID: <28435.1149782785@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/91 +X-Sequence-Number: 19448 + +Andreas Pflug writes: +> Any explanation for this horror? + +Existing releases aren't smart about planning joins to inheritance +trees. CVS HEAD is better... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jun 8 13:23:38 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D30329FA4D8 + for ; + Thu, 8 Jun 2006 13:23:37 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 76025-02 for + ; + Thu, 8 Jun 2006 13:23:29 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from alvh.no-ip.org (201-221-200-231.bk11-dsl.surnet.cl + [201.221.200.231]) + by postgresql.org (Postfix) with ESMTP id 237269FA1A4 + for ; + Thu, 8 Jun 2006 13:23:29 -0300 (ADT) +Received: by alvh.no-ip.org (Postfix, from userid 1000) + id EF1C3C3A216; Thu, 8 Jun 2006 12:23:27 -0400 (CLT) +Date: Thu, 8 Jun 2006 12:23:27 -0400 +From: Alvaro Herrera +To: "Jim C. Nasby" +Cc: soni de , pgsql-performance@postgresql.org +Subject: Re: Regarding pg_dump utility +Message-ID: <20060608162327.GD17421@surnet.cl> +Mail-Followup-To: "Jim C. Nasby" , + soni de , pgsql-performance@postgresql.org +References: <9f2e40a90606072309v4c5b2623k8bda2614cd575835@mail.gmail.com> + <20060608151657.GL45331@pervasive.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20060608151657.GL45331@pervasive.com> +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.162 tagged_above=0 required=5 tests=AWL, BAYES_00, + DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO, + RCVD_IN_SORBS_DUL +X-Spam-Level: +X-Archive-Number: 200606/92 +X-Sequence-Number: 19449 + +Jim C. Nasby wrote: +> On Thu, Jun 08, 2006 at 11:39:48AM +0530, soni de wrote: +> > We have to take a backup of database and we know the pg_dump utility of +> > postgresql. +> > +> > But may I know, is there any API for this pg_dump utility so that we can +> > call it from the C program? Or only script support is possible for this. +> +> It probably wouldn't be terribly difficult to put the guts of pg_dump +> into a library that you could interface with via C. I'm not sure if the +> community would accept such a patch; though, I seem to recall other +> people asking for this on occasion. + +Personally I think it would be neat. For example the admin-tool guys +would be able to get a dump without invoking an external program. +Second it would really be independent of core releases (other than being +tied to the output format.) pg_dump would be just a simple caller of +such a library, and anyone else would be able to get dumps easily, in +whatever format. + +-- +Alvaro Herrera http://www.CommandPrompt.com/ +PostgreSQL Replication, Consulting, Custom Development, 24x7 support + +From pgsql-performance-owner@postgresql.org Thu Jun 8 13:33:40 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B8AC79FA4D8 + for ; + Thu, 8 Jun 2006 13:33:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 76215-07 for + ; + Thu, 8 Jun 2006 13:33:34 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moutng.kundenserver.de (moutng.kundenserver.de + [212.227.126.186]) + by postgresql.org (Postfix) with ESMTP id 73DEA9FA1A4 + for ; + Thu, 8 Jun 2006 13:33:34 -0300 (ADT) +Received: from [84.143.10.74] (helo=pse.dyndns.org) + by mrelayeu.kundenserver.de (node=mrelayeu10) with ESMTP (Nemesis), + id 0ML31I-1FoNRq1jJe-0000aA; Thu, 08 Jun 2006 18:33:31 +0200 +Received: from pse1 ([192.168.0.3]) by pse.dyndns.org with esmtp (Exim 4.44) + id 1FoNRp-0006yM-7d; Thu, 08 Jun 2006 18:33:29 +0200 +Message-ID: <44885158.9020209@pse-consulting.de> +Date: Thu, 08 Jun 2006 18:33:28 +0200 +From: Andreas Pflug +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Alvaro Herrera +CC: "Jim C. Nasby" , soni de , + pgsql-performance@postgresql.org +Subject: Re: Regarding pg_dump utility +References: <9f2e40a90606072309v4c5b2623k8bda2614cd575835@mail.gmail.com> + <20060608151657.GL45331@pervasive.com> + <20060608162327.GD17421@surnet.cl> +In-Reply-To: <20060608162327.GD17421@surnet.cl> +X-Enigmail-Version: 0.89.5.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Provags-ID: kundenserver.de abuse@kundenserver.de + login:0ce7ee5c3478b8d72edd8e05ccd40b70 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/93 +X-Sequence-Number: 19450 + +Alvaro Herrera wrote: + +> +> +> Personally I think it would be neat. For example the admin-tool guys +> would be able to get a dump without invoking an external program. +> Second it would really be independent of core releases (other than being +> tied to the output format.) pg_dump would be just a simple caller of +> such a library, and anyone else would be able to get dumps easily, in +> whatever format. + +pgAdmin currently invokes pg_dump/restore externally with pipes attached +to stdin/out/err, but a library implementation would solve some +headaches (esp. concerning portability) managing background +execution/GUI updates/process control. I'd like a libpgdumprestore +library, with pg_dump/pg_restore being lean wrapper programs. + +Regards, +Andreas + +From pgsql-performance-owner@postgresql.org Thu Jun 8 13:35:14 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A18279FA5DD + for ; + Thu, 8 Jun 2006 13:35:12 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 75913-08-2 + for ; + Thu, 8 Jun 2006 13:35:03 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 9A0D09FABE7 + for ; + Thu, 8 Jun 2006 13:35:03 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id AD23E56475; Thu, 8 Jun 2006 11:35:02 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); + Thu, 8 Jun 2006 11:35:01 -0500 +Date: Thu, 8 Jun 2006 11:35:01 -0500 +From: "Jim C. Nasby" +To: Andreas Pflug +Cc: Alvaro Herrera , + soni de , pgsql-performance@postgresql.org +Subject: Re: Regarding pg_dump utility +Message-ID: <20060608163501.GT45331@pervasive.com> +References: <9f2e40a90606072309v4c5b2623k8bda2614cd575835@mail.gmail.com> + <20060608151657.GL45331@pervasive.com> + <20060608162327.GD17421@surnet.cl> + <44885158.9020209@pse-consulting.de> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <44885158.9020209@pse-consulting.de> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060608:pgadmin@pse-consulting.de::cdWFXZKAUnZmWzYu:000000000000 + 0000000000000000000000000VE6 +X-Hashcash: + 1:20:060608:alvherre@commandprompt.com::Ze3Ja8mmFN7uNsdR:00000000000 + 00000000000000000000000008Wc +X-Hashcash: + 1:20:060608:soni.de@gmail.com::g8upgpFksv+EWb5N:00000000000000000000 + 0000000000000000000000002Ncn +X-Hashcash: + 1:20:060608:pgsql-performance@postgresql.org::K3UtT5UuiAfeytiW:00000 + 0000000000000000000000006KW+ +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/94 +X-Sequence-Number: 19451 + +On Thu, Jun 08, 2006 at 06:33:28PM +0200, Andreas Pflug wrote: +> Alvaro Herrera wrote: +> +> > +> > +> >Personally I think it would be neat. For example the admin-tool guys +> >would be able to get a dump without invoking an external program. +> >Second it would really be independent of core releases (other than being +> >tied to the output format.) pg_dump would be just a simple caller of +> >such a library, and anyone else would be able to get dumps easily, in +> >whatever format. +> +> pgAdmin currently invokes pg_dump/restore externally with pipes attached +> to stdin/out/err, but a library implementation would solve some +> headaches (esp. concerning portability) managing background +> execution/GUI updates/process control. I'd like a libpgdumprestore +> library, with pg_dump/pg_restore being lean wrapper programs. + +Would a pg_dumpall library also make sense? +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Thu Jun 8 13:38:43 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 142A09FA4D8 + for ; + Thu, 8 Jun 2006 13:38:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 76662-09 for + ; + Thu, 8 Jun 2006 13:38:40 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from alvh.no-ip.org (201-221-200-231.bk11-dsl.surnet.cl + [201.221.200.231]) + by postgresql.org (Postfix) with ESMTP id EB3D39FA1A4 + for ; + Thu, 8 Jun 2006 13:38:39 -0300 (ADT) +Received: by alvh.no-ip.org (Postfix, from userid 1000) + id CF96DC3A216; Thu, 8 Jun 2006 12:38:38 -0400 (CLT) +Date: Thu, 8 Jun 2006 12:38:38 -0400 +From: Alvaro Herrera +To: "Jim C. Nasby" +Cc: Andreas Pflug , soni de , + pgsql-performance@postgresql.org +Subject: Re: Regarding pg_dump utility +Message-ID: <20060608163838.GF17421@surnet.cl> +Mail-Followup-To: "Jim C. Nasby" , + Andreas Pflug , + soni de , pgsql-performance@postgresql.org +References: <9f2e40a90606072309v4c5b2623k8bda2614cd575835@mail.gmail.com> + <20060608151657.GL45331@pervasive.com> + <20060608162327.GD17421@surnet.cl> + <44885158.9020209@pse-consulting.de> + <20060608163501.GT45331@pervasive.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20060608163501.GT45331@pervasive.com> +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.166 tagged_above=0 required=5 tests=AWL, BAYES_00, + DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO, + RCVD_IN_SORBS_DUL +X-Spam-Level: +X-Archive-Number: 200606/95 +X-Sequence-Number: 19452 + +Jim C. Nasby wrote: +> On Thu, Jun 08, 2006 at 06:33:28PM +0200, Andreas Pflug wrote: +> > Alvaro Herrera wrote: +> > +> > > +> > > +> > >Personally I think it would be neat. For example the admin-tool guys +> > >would be able to get a dump without invoking an external program. +> > >Second it would really be independent of core releases (other than being +> > >tied to the output format.) pg_dump would be just a simple caller of +> > >such a library, and anyone else would be able to get dumps easily, in +> > >whatever format. +> > +> > pgAdmin currently invokes pg_dump/restore externally with pipes attached +> > to stdin/out/err, but a library implementation would solve some +> > headaches (esp. concerning portability) managing background +> > execution/GUI updates/process control. I'd like a libpgdumprestore +> > library, with pg_dump/pg_restore being lean wrapper programs. +> +> Would a pg_dumpall library also make sense? + +One would think that libpgdump should take care of this as well ... + +-- +Alvaro Herrera http://www.CommandPrompt.com/ +PostgreSQL Replication, Consulting, Custom Development, 24x7 support + +From pgsql-performance-owner@postgresql.org Thu Jun 8 13:42:33 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 630FD9FA4D8 + for ; + Thu, 8 Jun 2006 13:42:33 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 79566-02 for + ; + Thu, 8 Jun 2006 13:42:29 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moutng.kundenserver.de (moutng.kundenserver.de + [212.227.126.177]) + by postgresql.org (Postfix) with ESMTP id 8ABBF9FA1A4 + for ; + Thu, 8 Jun 2006 13:42:28 -0300 (ADT) +Received: from [84.143.10.74] (helo=pse.dyndns.org) + by mrelayeu.kundenserver.de (node=mrelayeu3) with ESMTP (Nemesis), + id 0MKxQS-1FoNaV1BDg-0001WO; Thu, 08 Jun 2006 18:42:27 +0200 +Received: from pse1 ([192.168.0.3]) by pse.dyndns.org with esmtp (Exim 4.44) + id 1FoNaU-0006z7-9Z; Thu, 08 Jun 2006 18:42:26 +0200 +Message-ID: <44885371.5020201@pse-consulting.de> +Date: Thu, 08 Jun 2006 18:42:25 +0200 +From: Andreas Pflug +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Tom Lane +CC: pgsql-performance@postgresql.org +Subject: Re: JOIN with inherited table ignores indexes +References: <44880CB1.90307@pse-consulting.de> + <28435.1149782785@sss.pgh.pa.us> +In-Reply-To: <28435.1149782785@sss.pgh.pa.us> +X-Enigmail-Version: 0.89.5.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Provags-ID: kundenserver.de abuse@kundenserver.de + login:0ce7ee5c3478b8d72edd8e05ccd40b70 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/96 +X-Sequence-Number: 19453 + +Tom Lane wrote: +> Andreas Pflug writes: +> +>>Any explanation for this horror? +> +> +> Existing releases aren't smart about planning joins to inheritance +> trees. + +Using a view that UNIONs SELECT .. ONLY as replacement for the parent +table isn't any better. Is that improved too? + +> CVS HEAD is better... + +Customers like HEAD versions for production purposes :-) + +Regards, +Andreas + +From pgsql-performance-owner@postgresql.org Thu Jun 8 15:55:20 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 50DC39FA634 + for ; + Thu, 8 Jun 2006 15:55:20 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 13355-07 for + ; + Thu, 8 Jun 2006 15:55:11 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id C49DC9FA1A4 + for ; + Thu, 8 Jun 2006 15:55:10 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id BCFB731968; Thu, 8 Jun 2006 20:55:09 +0200 (MET DST) +From: "Andrus" +X-Newsgroups: pgsql.performance +Subject: Why date index is not used +Date: Thu, 8 Jun 2006 21:53:17 +0300 +Organization: Hub.Org Networking Services +Lines: 31 +Message-ID: +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +X-RFC2646: Format=Flowed; Original +To: pgsql-performance@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/97 +X-Sequence-Number: 19454 + +Why Postgres 8.1 does not use makse_kuupaev_idx index in the following query +? + +How to speed this query up ? + +explain analyze select * from makse order by kuupaev desc, kellaaeg desc +limit 100 + +"Limit (cost=62907.94..62908.19 rows=100 width=876) (actual +time=33699.551..33701.001 rows=100 loops=1)" +" -> Sort (cost=62907.94..63040.49 rows=53022 width=876) (actual +time=33699.534..33700.129 rows=100 loops=1)" +" Sort Key: kuupaev, kellaaeg" +" -> Seq Scan on makse (cost=0.00..2717.22 rows=53022 width=876) +(actual time=0.020..308.502 rows=53028 loops=1)" +"Total runtime: 37857.177 ms" + + +CREATE TABLE makse( + kuupaev date, + kellaaeg char(6) NOT NULL DEFAULT ''::bpchar, + guid char(36) NOT NULL, + CONSTRAINT makse_pkey PRIMARY KEY (guid) ) + + +CREATE INDEX makse_kuupaev_idx ON makse USING btree (kuupaev); + + +Andrus. + + + +From pgsql-performance-owner@postgresql.org Thu Jun 8 16:17:48 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 367199FA4D8 + for ; + Thu, 8 Jun 2006 16:17:48 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 18844-02 for + ; + Thu, 8 Jun 2006 16:17:43 -0300 (ADT) +X-Greylist: delayed 00:06:39.98921 by SQLgrey- +Received: from zeus.gigaweb.cz (zeus.gigaweb.cz [81.0.236.19]) + by postgresql.org (Postfix) with SMTP id DA7B09FA1A4 + for ; + Thu, 8 Jun 2006 16:17:42 -0300 (ADT) +Received: (qmail 30752 invoked from network); 8 Jun 2006 19:11:01 -0000 +Received: from unknown (HELO ?192.168.1.101?) (89.102.195.181) + by 0 with SMTP; 8 Jun 2006 19:11:01 -0000 +Message-ID: <44887642.2040701@fuzzy.cz> +Date: Thu, 08 Jun 2006 21:10:58 +0200 +From: Tomas Vondra +User-Agent: Mail/News 1.5 (X11/20060424) +MIME-Version: 1.0 +CC: pgsql-performance@postgresql.org +Subject: Re: Why date index is not used +References: +In-Reply-To: +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-2 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/98 +X-Sequence-Number: 19455 + +If you want to benefit from the usage of an index, the query has to +contain some WHERE conditions (on the indexed columns). This is a +'select all' query - there is no way to speed it up using index. + +Tomas + +> > Why Postgres 8.1 does not use makse_kuupaev_idx index in the +following query +> > ? +> > +> > How to speed this query up ? +> > +> > explain analyze select * from makse order by kuupaev desc, kellaaeg +desc +> > limit 100 +> > +> > "Limit (cost=62907.94..62908.19 rows=100 width=876) (actual +> > time=33699.551..33701.001 rows=100 loops=1)" +> > " -> Sort (cost=62907.94..63040.49 rows=53022 width=876) (actual +> > time=33699.534..33700.129 rows=100 loops=1)" +> > " Sort Key: kuupaev, kellaaeg" +> > " -> Seq Scan on makse (cost=0.00..2717.22 rows=53022 +width=876) +> > (actual time=0.020..308.502 rows=53028 loops=1)" +> > "Total runtime: 37857.177 ms" +> > +> > +> > CREATE TABLE makse( +> > kuupaev date, +> > kellaaeg char(6) NOT NULL DEFAULT ''::bpchar, +> > guid char(36) NOT NULL, +> > CONSTRAINT makse_pkey PRIMARY KEY (guid) ) +> > +> > +> > CREATE INDEX makse_kuupaev_idx ON makse USING btree (kuupaev); + +From pgsql-performance-owner@postgresql.org Thu Jun 8 16:20:29 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 1F1F19FA5DD + for ; + Thu, 8 Jun 2006 16:20:29 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 16943-10 for + ; + Thu, 8 Jun 2006 16:20:25 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from zeus.gigaweb.cz (zeus.gigaweb.cz [81.0.236.19]) + by postgresql.org (Postfix) with SMTP id 965249FA4D8 + for ; + Thu, 8 Jun 2006 16:20:24 -0300 (ADT) +Received: (qmail 374 invoked from network); 8 Jun 2006 19:20:24 -0000 +Received: from unknown (HELO ?192.168.1.101?) (89.102.195.181) + by 0 with SMTP; 8 Jun 2006 19:20:24 -0000 +Message-ID: <44887875.8000502@fuzzy.cz> +Date: Thu, 08 Jun 2006 21:20:21 +0200 +From: Tomas Vondra +User-Agent: Mail/News 1.5 (X11/20060424) +MIME-Version: 1.0 +To: Andrus +CC: pgsql-performance@postgresql.org +Subject: Re: Why date index is not used +References: +In-Reply-To: +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-2 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/99 +X-Sequence-Number: 19456 + +More precisely - the Postgres could use the index to speed up the +sorting, but in this case the sorting is very fast (less than one +second according to the output), so Postgres probably decided not +to use the index because it would be slower. + +Btw. have you run ANALYZE on the table recently? What is the number +of distinct values in the 'kuupaev' column? + +Tomas + +> Why Postgres 8.1 does not use makse_kuupaev_idx index in the following query +> ? +> +> How to speed this query up ? +> +> explain analyze select * from makse order by kuupaev desc, kellaaeg desc +> limit 100 +> +> "Limit (cost=62907.94..62908.19 rows=100 width=876) (actual +> time=33699.551..33701.001 rows=100 loops=1)" +> " -> Sort (cost=62907.94..63040.49 rows=53022 width=876) (actual +> time=33699.534..33700.129 rows=100 loops=1)" +> " Sort Key: kuupaev, kellaaeg" +> " -> Seq Scan on makse (cost=0.00..2717.22 rows=53022 width=876) +> (actual time=0.020..308.502 rows=53028 loops=1)" +> "Total runtime: 37857.177 ms" +> +> +> CREATE TABLE makse( +> kuupaev date, +> kellaaeg char(6) NOT NULL DEFAULT ''::bpchar, +> guid char(36) NOT NULL, +> CONSTRAINT makse_pkey PRIMARY KEY (guid) ) +> +> +> CREATE INDEX makse_kuupaev_idx ON makse USING btree (kuupaev); +> +> +> Andrus. + + +From pgsql-performance-owner@postgresql.org Thu Jun 8 16:21:06 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id AC5CD9FA5DD + for ; + Thu, 8 Jun 2006 16:21:05 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 16897-10 for + ; + Thu, 8 Jun 2006 16:21:00 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 8B23D9FA1A4 + for ; + Thu, 8 Jun 2006 16:20:59 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k58JKtk9000197; + Thu, 8 Jun 2006 15:20:55 -0400 (EDT) +To: "Andrus" +cc: pgsql-performance@postgresql.org +Subject: Re: Why date index is not used +In-reply-to: +References: +Comments: In-reply-to "Andrus" + message dated "Thu, 08 Jun 2006 21:53:17 +0300" +Date: Thu, 08 Jun 2006 15:20:55 -0400 +Message-ID: <196.1149794455@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/100 +X-Sequence-Number: 19457 + +"Andrus" writes: +> Why Postgres 8.1 does not use makse_kuupaev_idx index in the following query +> ? + +Because it doesn't help --- the system still has to do the sort. +You'd need a two-column index on both of the ORDER BY columns to avoid +sorting. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jun 8 17:07:57 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 811929FA5DD + for ; + Thu, 8 Jun 2006 17:07:57 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 23178-04 for + ; + Thu, 8 Jun 2006 17:07:46 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from globalrelay.com (mail1.globalrelay.com [216.18.71.77]) + by postgresql.org (Postfix) with ESMTP id 5FDE29FA1A4 + for ; + Thu, 8 Jun 2006 17:07:45 -0300 (ADT) +X-Virus-Scanned: Scanned by GRC-AntiVirus Gateway +X-GR-Acctd: YES +Received: from [63.226.156.118] (HELO DaveEMachine) + by globalrelay.com (CommuniGate Pro SMTP 4.2.3) + with ESMTP id 93068675; Thu, 08 Jun 2006 13:07:43 -0700 +From: "Dave Dutcher" +To: "'Tomas Vondra'" , + "'Andrus'" +Cc: +Subject: Re: Why date index is not used +Date: Thu, 8 Jun 2006 15:07:42 -0500 +Message-ID: <01de01c68b37$33e22a80$8300a8c0@tridecap.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook, Build 10.0.2627 +In-Reply-To: <44887875.8000502@fuzzy.cz> +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +Importance: Normal +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/101 +X-Sequence-Number: 19458 + +Actually It looks to me like the sorting is the slow part of this query. +Maybe if you did create an index on both kuupaev and kellaaeg it might +make the sorting faster. Or maybe you could try increasing the server's +work mem. The sort will be much slower if the server can't do the whole +thing in ram. + + + +> -----Original Message----- +> From: pgsql-performance-owner@postgresql.org +> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of +> Tomas Vondra +> Sent: Thursday, June 08, 2006 2:20 PM +> To: Andrus +> Cc: pgsql-performance@postgresql.org +> Subject: Re: [PERFORM] Why date index is not used +> +> +> More precisely - the Postgres could use the index to speed up the +> sorting, but in this case the sorting is very fast (less than one +> second according to the output), so Postgres probably decided not +> to use the index because it would be slower. +> +> Btw. have you run ANALYZE on the table recently? What is the number +> of distinct values in the 'kuupaev' column? +> +> Tomas +> +> > Why Postgres 8.1 does not use makse_kuupaev_idx index in +> the following query +> > ? +> > +> > How to speed this query up ? +> > +> > explain analyze select * from makse order by kuupaev desc, +> kellaaeg desc +> > limit 100 +> > +> > "Limit (cost=62907.94..62908.19 rows=100 width=876) (actual +> > time=33699.551..33701.001 rows=100 loops=1)" +> > " -> Sort (cost=62907.94..63040.49 rows=53022 width=876) (actual +> > time=33699.534..33700.129 rows=100 loops=1)" +> > " Sort Key: kuupaev, kellaaeg" +> > " -> Seq Scan on makse (cost=0.00..2717.22 +> rows=53022 width=876) +> > (actual time=0.020..308.502 rows=53028 loops=1)" +> > "Total runtime: 37857.177 ms" +> > +> > +> > CREATE TABLE makse( +> > kuupaev date, +> > kellaaeg char(6) NOT NULL DEFAULT ''::bpchar, +> > guid char(36) NOT NULL, +> > CONSTRAINT makse_pkey PRIMARY KEY (guid) ) +> > +> > +> > CREATE INDEX makse_kuupaev_idx ON makse USING btree (kuupaev); +> > +> > +> > Andrus. +> +> +> ---------------------------(end of +> broadcast)--------------------------- +> TIP 4: Have you searched our list archives? +> + http://archives.postgresql.org + + +From pgsql-performance-owner@postgresql.org Thu Jun 8 18:57:57 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A25659FA4D8 + for ; + Thu, 8 Jun 2006 18:57:57 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 36875-05 for + ; + Thu, 8 Jun 2006 18:57:48 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 938059FA1A4 + for ; + Thu, 8 Jun 2006 18:57:48 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 5CD3B5644C; Thu, 8 Jun 2006 16:57:47 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); + Thu, 8 Jun 2006 16:57:45 -0500 +Date: Thu, 8 Jun 2006 16:57:45 -0500 +From: "Jim C. Nasby" +To: Tom Lane +Cc: Andrus , pgsql-performance@postgresql.org +Subject: Re: Why date index is not used +Message-ID: <20060608215745.GE45331@pervasive.com> +References: <196.1149794455@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <196.1149794455@sss.pgh.pa.us> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060608:tgl@sss.pgh.pa.us::O4QXnMxZRJLHA20F:00000000000000000000 + 0000000000000000000000002L9q +X-Hashcash: + 1:20:060608:eetasoft@online.ee::LJG+/UpxG9vTiCgg:0000000000000000000 + 00000000000000000000000098Ly +X-Hashcash: + 1:20:060608:pgsql-performance@postgresql.org::V3W5TgIBa0tPH141:00000 + 0000000000000000000000009T1h +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/102 +X-Sequence-Number: 19459 + +On Thu, Jun 08, 2006 at 03:20:55PM -0400, Tom Lane wrote: +> "Andrus" writes: +> > Why Postgres 8.1 does not use makse_kuupaev_idx index in the following query +> > ? +> +> Because it doesn't help --- the system still has to do the sort. +> You'd need a two-column index on both of the ORDER BY columns to avoid +> sorting. + +And even then you better have a pretty high correlation on the first +column, otherwise you'll still get a seqscan. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Thu Jun 8 19:19:51 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 28E6A9FA5C3 + for ; + Thu, 8 Jun 2006 19:19:50 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 36363-10 for + ; + Thu, 8 Jun 2006 19:19:46 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 6B1879FA3CD + for ; + Thu, 8 Jun 2006 19:19:45 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k58MJfRW002269; + Thu, 8 Jun 2006 18:19:41 -0400 (EDT) +To: "Jim C. Nasby" +cc: Andrus , pgsql-performance@postgresql.org +Subject: Re: Why date index is not used +In-reply-to: <20060608215745.GE45331@pervasive.com> +References: <196.1149794455@sss.pgh.pa.us> + <20060608215745.GE45331@pervasive.com> +Comments: In-reply-to "Jim C. Nasby" + message dated "Thu, 08 Jun 2006 16:57:45 -0500" +Date: Thu, 08 Jun 2006 18:19:41 -0400 +Message-ID: <2268.1149805181@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/103 +X-Sequence-Number: 19460 + +"Jim C. Nasby" writes: +> And even then you better have a pretty high correlation on the first +> column, otherwise you'll still get a seqscan. + +Not with the LIMIT. (If he were fetching the whole table, very possibly +the sort would be the right plan anyway.) + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jun 8 22:14:29 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C3B4E9FA5C3 + for ; + Thu, 8 Jun 2006 22:14:28 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 61113-01 for + ; + Thu, 8 Jun 2006 22:14:19 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from houston.familyhealth.com.au (iihouston.familyhealth.com.au + [203.59.102.239]) + by postgresql.org (Postfix) with ESMTP id CFE389FA3CD + for ; + Thu, 8 Jun 2006 22:14:19 -0300 (ADT) +Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) + by houston.familyhealth.com.au (Postfix) with ESMTP id F3E6525741; + Fri, 9 Jun 2006 09:14:16 +0800 (WST) +Received: from [127.0.0.1] (work-48.internal [192.168.0.48]) + by houston.familyhealth.com.au (Postfix) with ESMTP id D567D2573F; + Fri, 9 Jun 2006 09:14:15 +0800 (WST) +Message-ID: <4488CBF3.9040101@calorieking.com> +Date: Fri, 09 Jun 2006 09:16:35 +0800 +From: Christopher Kings-Lynne +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: "Jim C. Nasby" +Cc: soni de , pgsql-performance@postgresql.org +Subject: Re: Regarding pg_dump utility +References: <9f2e40a90606072309v4c5b2623k8bda2614cd575835@mail.gmail.com> + <20060608151657.GL45331@pervasive.com> +In-Reply-To: <20060608151657.GL45331@pervasive.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-familyhealth-MailScanner-Information: Please contact the ISP for more + information +X-familyhealth-MailScanner: Found to be clean +X-familyhealth-MailScanner-From: chris.kings-lynne@calorieking.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/104 +X-Sequence-Number: 19461 + +> It probably wouldn't be terribly difficult to put the guts of pg_dump +> into a library that you could interface with via C. I'm not sure if the +> community would accept such a patch; though, I seem to recall other +> people asking for this on occasion. +> +>> I think script support is bit risky because if anything goes wrong while +>> taking backup using pg_dump then user will not understand the problem of +>> falling +>> +>> If only script support is possible then what should we prefer perl or shell? +> +> Depends on what you're trying to accomplish. Perl is a much more capable +> language than shell, obviously. + + +In phpPgAdmin we just execute pg_dump as a child process and capture its +output.... + + +From pgsql-performance-owner@postgresql.org Thu Jun 8 22:17:09 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B317D9FA5C3 + for ; + Thu, 8 Jun 2006 22:17:08 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 61118-03 for + ; + Thu, 8 Jun 2006 22:16:59 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from houston.familyhealth.com.au (iihouston.familyhealth.com.au + [203.59.102.239]) + by postgresql.org (Postfix) with ESMTP id E931B9FA3CD + for ; + Thu, 8 Jun 2006 22:16:59 -0300 (ADT) +Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 0F73125740; + Fri, 9 Jun 2006 09:16:58 +0800 (WST) +Received: from [127.0.0.1] (work-48.internal [192.168.0.48]) + by houston.familyhealth.com.au (Postfix) with ESMTP id B95082573A; + Fri, 9 Jun 2006 09:16:55 +0800 (WST) +Message-ID: <4488CC93.5040709@calorieking.com> +Date: Fri, 09 Jun 2006 09:19:15 +0800 +From: Christopher Kings-Lynne +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: "Jim C. Nasby" , + soni de , pgsql-performance@postgresql.org +Subject: Re: Regarding pg_dump utility +References: <9f2e40a90606072309v4c5b2623k8bda2614cd575835@mail.gmail.com> + <20060608151657.GL45331@pervasive.com> + <20060608162327.GD17421@surnet.cl> +In-Reply-To: <20060608162327.GD17421@surnet.cl> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-familyhealth-MailScanner-Information: Please contact the ISP for more + information +X-familyhealth-MailScanner: Found to be clean +X-familyhealth-MailScanner-From: chris.kings-lynne@calorieking.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/105 +X-Sequence-Number: 19462 + +> Personally I think it would be neat. For example the admin-tool guys +> would be able to get a dump without invoking an external program. +> Second it would really be independent of core releases (other than being +> tied to the output format.) pg_dump would be just a simple caller of +> such a library, and anyone else would be able to get dumps easily, in +> whatever format. + +What about fully completing our SQL API for dumping? + +ie. We finish adding pg_get_blahdef() for all objects, add a function +that returns the proper ordering of all objects in the database, and +then somehow drop out a dump with a single JOIN :D + +Chris + + +From pgsql-performance-owner@postgresql.org Fri Jun 9 06:52:47 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id BC6219FA6B1 + for ; + Fri, 9 Jun 2006 06:52:46 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 09996-03 for + ; + Fri, 9 Jun 2006 06:52:43 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id 1089F9FA5D2 + for ; + Fri, 9 Jun 2006 06:52:43 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id C9EF131DC6; Fri, 9 Jun 2006 11:52:41 +0200 (MET DST) +From: "Andrus" +X-Newsgroups: pgsql.performance +Subject: Re: Why date index is not used +Date: Fri, 9 Jun 2006 12:06:47 +0300 +Organization: Hub.Org Networking Services +Lines: 20 +Message-ID: +References: <44887875.8000502@fuzzy.cz> +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +X-RFC2646: Format=Flowed; Original +To: pgsql-performance@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/106 +X-Sequence-Number: 19463 + +> Btw. have you run ANALYZE on the table recently? + +I have autovacuum with default statitics settings running so I expect that +it is analyzed. + +> What is the number +> of distinct values in the 'kuupaev' column? + +select count(distinct kuupaev) from makse + +returns 61 + +kuupaev is sales date. + +So this can contain 365 distinct values per year and max 10 year database, +total can be 3650 distinct values after 10 years. + +Andrus + + + +From pgsql-performance-owner@postgresql.org Fri Jun 9 06:52:49 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 263579FA5D2 + for ; + Fri, 9 Jun 2006 06:52:48 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 09806-05 for + ; + Fri, 9 Jun 2006 06:52:44 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id 01F8E9FA5D8 + for ; + Fri, 9 Jun 2006 06:52:43 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 9390031DC7; Fri, 9 Jun 2006 11:52:42 +0200 (MET DST) +From: "Andrus" +X-Newsgroups: pgsql.performance +Subject: Re: Why date index is not used +Date: Fri, 9 Jun 2006 12:40:26 +0300 +Organization: Hub.Org Networking Services +Lines: 33 +Message-ID: +References: <44887875.8000502@fuzzy.cz> + <01de01c68b37$33e22a80$8300a8c0@tridecap.com> +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +X-RFC2646: Format=Flowed; Original +To: pgsql-performance@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/107 +X-Sequence-Number: 19464 + +> Actually It looks to me like the sorting is the slow part of this query. +> Maybe if you did create an index on both kuupaev and kellaaeg it might +> make the sorting faster. + +Thank you. It makes query fast. + +> Or maybe you could try increasing the server's +> work mem. The sort will be much slower if the server can't do the whole +> thing in ram. + +I have W2K server with 0.5 GB RAM +there are only 6 connections open ( 6 point of sales) to this server. +shared_buffes is 10000 +I see approx 10 postgres processes in task manager each taking about 30 MB +ram + +Server prefomance is very slow: Windows swap file size is 1 GB + +For each sale a new row will be inserted to this table. So the file size +grows rapidly every day. +Changing work_mem by 1 MB increares memory requirment by 10 MB since I may +have 10 processes running. Sorting in memory this table requires very large +amout of work_mem for each process address space. + +I think that if I increase work_mem then swap file will became bigger and +perfomance will decrease even more. + +How to increase perfomance ? + +Andrus. + + + + +From pgsql-performance-owner@postgresql.org Fri Jun 9 06:52:50 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6A2929FA5D2 + for ; + Fri, 9 Jun 2006 06:52:49 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 10910-01 for + ; + Fri, 9 Jun 2006 06:52:45 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id A972F9FA61D + for ; + Fri, 9 Jun 2006 06:52:45 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id EDB0031DC6; Fri, 9 Jun 2006 11:52:43 +0200 (MET DST) +From: "Andrus" +X-Newsgroups: pgsql.performance +Subject: Re: Why date index is not used +Date: Fri, 9 Jun 2006 12:52:21 +0300 +Organization: Hub.Org Networking Services +Lines: 25 +Message-ID: +References: <196.1149794455@sss.pgh.pa.us> +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +X-RFC2646: Format=Flowed; Original +To: pgsql-performance@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/108 +X-Sequence-Number: 19465 + +Tom, + +> Because it doesn't help --- the system still has to do the sort. + +It can help a lot in this case. + +kuupaev is sales date +kellaaeg is sales time + +Postgres can use kuupaev index to fetch first 100 rows plus a number of more +rows whose kellaaeg value is equal to kellaaeg in 100 th row. I have 500 +sales per day. +So it can fetch 600 rows using index on kuupaev column. + +After that it can sort those 600 rows fast. +Currently it sorts blindly all 54000 rows in table. + +> You'd need a two-column index on both of the ORDER BY columns to avoid +> sorting. + +Thank you. It works. + +Andrus. + + + +From pgsql-performance-owner@postgresql.org Fri Jun 9 09:29:54 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 222AF9FA634 + for ; + Fri, 9 Jun 2006 09:29:54 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 25954-04 for + ; + Fri, 9 Jun 2006 09:29:48 -0300 (ADT) +X-Greylist: delayed 00:06:35.682059 by SQLgrey- +Received: from grinbox.salriva (host77-191.pool8172.interbusiness.it + [81.72.191.77]) by postgresql.org (Postfix) with SMTP id 6B7419FA621 + for ; + Fri, 9 Jun 2006 09:29:48 -0300 (ADT) +Received: (qmail 5092 invoked from network); 9 Jun 2006 12:23:06 -0000 +Received: from unknown (HELO PC14) (192.168.1.14) + by 192.168.1.254 with SMTP; 9 Jun 2006 12:23:06 -0000 +Reply-To: +From: "Domenico - Sal. F.lli Riva" +To: +Subject: pgsql_tmp and postgres settings +Date: Fri, 9 Jun 2006 14:23:04 +0200 +Organization: Salumificio F.lli Riva S.p.A. +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +X-Mailer: Microsoft Office Outlook, Build 11.0.6353 +Thread-Index: AcaLvmhLMQ2vaugQRRWudHRUm0t0LgAAMa9w +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-AntiVirus: scanned for viruses by AMaViS 0.2.1 (http://amavis.org/) +Message-Id: <20060609122948.6B7419FA621@postgresql.org> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/109 +X-Sequence-Number: 19466 + +Hello, + + + +During insert or update, potgresql write in pgsql_tmp directory and so +performance are very poor. + + + +My configuration is: + +Work mem 10240 + +Effective_cache_size 30000 + +Shared buffers 9000 + +Max_fsm_pages 35000 + +Wal Buffers 24 + +Autovacuum on + + + +Manual vacuum analyze and vacuum full analyze every day + + + + + +Server: + +1 Xeon processor + +2500 MB ram + +Red Hat Enterprise ES 3 + +Postgresql (RPM from official website) 8.1.0 + + + + + +Tables are vacuumed frequently and now fsm is very low (only 3000 pages). + + + +Updates and inserts on this database are infrequent, and files to import +aren't so big (7-50 Mb for 2000-20000 record in a txt file). + + + +On this server are installed and active also Apache - Tomcat - Java 1.4.2 +which provide data to import. + + + +Tables interested have only max 4 index. + + + +Are parameters adapted? + + + + + + + + + +Thanks + + + +Domenico Mozzanica + + + +From pgsql-performance-owner@postgresql.org Fri Jun 9 11:22:57 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5FD959FA61D + for ; + Fri, 9 Jun 2006 11:22:57 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 41808-07 for + ; + Fri, 9 Jun 2006 11:22:51 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.198]) + by postgresql.org (Postfix) with ESMTP id 2AE049F9316 + for ; + Fri, 9 Jun 2006 11:22:51 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id l1so712374nzf + for ; + Fri, 09 Jun 2006 07:22:50 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; + b=R1rMipeLPqskOa5xELM2eq+SjuBEJEbrro3FTeJ7krGBwDxEQEWs2u4upHRJ/GgDep6vHDZxpnmtXyfJQ9wpciav3bZka/huXFEx4gsMwqU+pbAe725pv2PXKECFL3y12BtwG2kB/9plmfWFfD4EwPkEdf99CJl3+alFvUH8RZ4= +Received: by 10.37.2.14 with SMTP id e14mr4143687nzi; + Fri, 09 Jun 2006 07:22:50 -0700 (PDT) +Received: by 10.37.14.7 with HTTP; Fri, 9 Jun 2006 07:22:50 -0700 (PDT) +Message-ID: <866624ef0606090722n3779b835l316035b2a04b75e1@mail.gmail.com> +Date: Fri, 9 Jun 2006 10:22:50 -0400 +From: "Paul S" +To: pgsql-performance@postgresql.org +Subject: Re: Regarding pg_dump utility +In-Reply-To: <4488CC93.5040709@calorieking.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_10764_6572683.1149862970257" +References: <9f2e40a90606072309v4c5b2623k8bda2614cd575835@mail.gmail.com> + <20060608151657.GL45331@pervasive.com> + <20060608162327.GD17421@surnet.cl> <4488CC93.5040709@calorieking.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/110 +X-Sequence-Number: 19467 + +------=_Part_10764_6572683.1149862970257 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +I think that having an API for backup functionality would definitely be +useful. + +Just my 2 cents... + +Paul + + + + +On 6/8/06, Christopher Kings-Lynne +wrote: +> +> > Personally I think it would be neat. For example the admin-tool guys +> > would be able to get a dump without invoking an external program. +> > Second it would really be independent of core releases (other than being +> > tied to the output format.) pg_dump would be just a simple caller of +> > such a library, and anyone else would be able to get dumps easily, in +> > whatever format. +> +> What about fully completing our SQL API for dumping? +> +> ie. We finish adding pg_get_blahdef() for all objects, add a function +> that returns the proper ordering of all objects in the database, and +> then somehow drop out a dump with a single JOIN :D +> +> Chris +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: explain analyze is your friend +> + +------=_Part_10764_6572683.1149862970257 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +
I think that having an API for backup functionality would definitely be useful. 
+
 
+
Just my 2 cents...
+
 
+
Paul
+
 
+


 
+
On 6/8/06, Christopher Kings-Lynne <chris.kings-lynne@calorieking.com> wrote: +
> Personally I think it would be neat.  For example the admin-tool guys
> would be able to get a dump without invoking an external program. +
> Second it would really be independent of core releases (other than being
> tied to the output format.)  pg_dump would be just a simple caller of
> such a library, and anyone else would be able to get dumps easily, in +
> whatever format.

What about fully completing our SQL API for dumping?

ie. We finish adding pg_get_blahdef() for all objects, add a function
that returns the proper ordering of all objects in the database, and +
then somehow drop out a dump with a single JOIN :D

Chris


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

+ +------=_Part_10764_6572683.1149862970257-- + +From pgsql-performance-owner@postgresql.org Fri Jun 9 12:54:13 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 227579FA098 + for ; + Fri, 9 Jun 2006 12:54:13 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 55229-02 for + ; + Fri, 9 Jun 2006 12:54:04 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 0AE919FA61D + for ; + Fri, 9 Jun 2006 12:54:03 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id EB80C56431; Fri, 9 Jun 2006 10:54:02 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); + Fri, 9 Jun 2006 10:54:02 -0500 +Date: Fri, 9 Jun 2006 10:54:02 -0500 +From: "Jim C. Nasby" +To: Andrus +Cc: pgsql-performance@postgresql.org +Subject: Re: Why date index is not used +Message-ID: <20060609155402.GW45331@pervasive.com> +References: <44887875.8000502@fuzzy.cz> + <01de01c68b37$33e22a80$8300a8c0@tridecap.com> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060609:eetasoft@online.ee::E0Xeva1CIcauBl73:0000000000000000000 + 0000000000000000000000000oLA +X-Hashcash: + 1:20:060609:pgsql-performance@postgresql.org::ugroJHljo2vvd5J6:00000 + 0000000000000000000000002OKc +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/111 +X-Sequence-Number: 19468 + +On Fri, Jun 09, 2006 at 12:40:26PM +0300, Andrus wrote: +> > Actually It looks to me like the sorting is the slow part of this query. +> > Maybe if you did create an index on both kuupaev and kellaaeg it might +> > make the sorting faster. +> +> Thank you. It makes query fast. +> +> > Or maybe you could try increasing the server's +> > work mem. The sort will be much slower if the server can't do the whole +> > thing in ram. +> +> I have W2K server with 0.5 GB RAM +> there are only 6 connections open ( 6 point of sales) to this server. +> shared_buffes is 10000 +> I see approx 10 postgres processes in task manager each taking about 30 MB +> ram +> +> Server prefomance is very slow: Windows swap file size is 1 GB +> +> For each sale a new row will be inserted to this table. So the file size +> grows rapidly every day. +> Changing work_mem by 1 MB increares memory requirment by 10 MB since I may +> have 10 processes running. Sorting in memory this table requires very large +> amout of work_mem for each process address space. +> +> I think that if I increase work_mem then swap file will became bigger and +> perfomance will decrease even more. +> +> How to increase perfomance ? + +Do you have effective_cache_size set correctly? You might try dropping +random_page_cost down to 2 or so. + +Of course you could just put more memory in the machine, too. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Fri Jun 9 13:00:09 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 9AD189FA6B0 + for ; + Fri, 9 Jun 2006 13:00:08 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 55822-02 for + ; + Fri, 9 Jun 2006 12:59:58 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 1E0FF9FA646 + for ; + Fri, 9 Jun 2006 12:59:57 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id B76E35647E; Fri, 9 Jun 2006 10:59:54 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); + Fri, 9 Jun 2006 10:59:53 -0500 +Date: Fri, 9 Jun 2006 10:59:53 -0500 +From: "Jim C. Nasby" +To: "Domenico - Sal. F.lli Riva" +Cc: pgsql-performance@postgresql.org +Subject: Re: pgsql_tmp and postgres settings +Message-ID: <20060609155953.GX45331@pervasive.com> +References: <20060609122948.6B7419FA621@postgresql.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20060609122948.6B7419FA621@postgresql.org> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060609:domenico.mozzanica@fratelliriva.it::elY1cuFl6PGndMz7:000 + 0000000000000000000000002X5A +X-Hashcash: + 1:20:060609:pgsql-performance@postgresql.org::H9OVxGdTcjGib07P:00000 + 0000000000000000000000007lkh +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/112 +X-Sequence-Number: 19469 + +On Fri, Jun 09, 2006 at 02:23:04PM +0200, Domenico - Sal. F.lli Riva wrote: +> Hello, +> +> During insert or update, potgresql write in pgsql_tmp directory and so +> performance are very poor. + +pgsql_tmp is used if a query runs out of work_mem, so you can try +increasing that. + +> My configuration is: +> +> Work mem 10240 +> +> Effective_cache_size 30000 +You're off by a factor of 10. + +> Shared buffers 9000 +I'd suggest bumping that up to at least 30000. + +> Postgresql (RPM from official website) 8.1.0 + +You should upgrade to 8.1.4. There's a number of data loss bugs waiting +to bite you. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Fri Jun 9 16:41:29 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 473CD9FA5DD + for ; + Fri, 9 Jun 2006 16:41:29 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 78172-07 for + ; + Fri, 9 Jun 2006 16:41:18 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id D39729FA1A8 + for ; + Fri, 9 Jun 2006 16:41:18 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 661315647F; Fri, 9 Jun 2006 14:41:17 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); + Fri, 9 Jun 2006 14:41:16 -0500 +Date: Fri, 9 Jun 2006 14:41:16 -0500 +From: "Jim C. Nasby" +To: pgsql-performance@postgresql.org +Subject: pg_xlog on data partition with BBU RAID +Message-ID: <20060609194116.GD57289@pervasive.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060609:pgsql-performance@postgresql.org::T64R+KyxNvLyHY2b:00000 + 0000000000000000000000005yh6 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/113 +X-Sequence-Number: 19470 + +AFAIK, the reason why seperating pg_xlog from the base files provides so +much performance is because the latency on pg_xlog is critical: a +transaction can't commit until all of it's log data is written to disk +via fsync, and if you're trying to fsync frequently on the same drive as +the data tables are on, you'll have a big problem with the activity on +the data drives competing with trying to fsync pg_xlog rapidly. + +But if you have a raid array with a battery-backed controller, this +shouldn't be anywhere near as big an issue. The fsync on the log will +return very quickly thanks to the cache, and the controller is then free +to batch up writes to pg_xlog. Or at least that's the theory. + +Has anyone actually done any testing on this? Specifically, I'm +wondering if the benefit of adding 2 more drives to a RAID10 outweighs +whatever penalties there are to having pg_xlog on that RAID10 with all +the rest of the data. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Fri Jun 9 17:21:33 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 10D7B9FA5DD + for ; + Fri, 9 Jun 2006 17:21:33 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 85023-03 for + ; + Fri, 9 Jun 2006 17:21:23 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id D959C9FA1A8 + for ; + Fri, 9 Jun 2006 17:21:23 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Fri, 9 Jun 2006 20:21:22 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 09 Jun 2006 15:21:22 -0500 +Subject: Re: pg_xlog on data partition with BBU RAID +From: Scott Marlowe +To: "Jim C. Nasby" +Cc: pgsql-performance@postgresql.org +In-Reply-To: <20060609194116.GD57289@pervasive.com> +References: <20060609194116.GD57289@pervasive.com> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1149884482.27878.4.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Fri, 09 Jun 2006 15:21:22 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/114 +X-Sequence-Number: 19471 + +On Fri, 2006-06-09 at 14:41, Jim C. Nasby wrote: +> AFAIK, the reason why seperating pg_xlog from the base files provides so +> much performance is because the latency on pg_xlog is critical: a +> transaction can't commit until all of it's log data is written to disk +> via fsync, and if you're trying to fsync frequently on the same drive as +> the data tables are on, you'll have a big problem with the activity on +> the data drives competing with trying to fsync pg_xlog rapidly. +> +> But if you have a raid array with a battery-backed controller, this +> shouldn't be anywhere near as big an issue. The fsync on the log will +> return very quickly thanks to the cache, and the controller is then free +> to batch up writes to pg_xlog. Or at least that's the theory. +> +> Has anyone actually done any testing on this? Specifically, I'm +> wondering if the benefit of adding 2 more drives to a RAID10 outweighs +> whatever penalties there are to having pg_xlog on that RAID10 with all +> the rest of the data. + +I tested it WAY back when 7.4 first came out on a machine with BBU, and +it didn't seem to make any difference HOW I set up the hard drives, +RAID-5, 1+0, 1 it was all about the same. With BBU the transactions per +second varied very little. If I recall correctly, it was something like +600 or so tps with pgbench (scaling and num clients was around 20 I +believe) It's been a while. + +In the end, that server ran with a pair of 18 Gig drives in a RAID-1 and +was plenty fast for what we used it for. Due to corporate shenanigans +it was still running pgsql 7.2.x at the time. ugh. + +I've not got access to a couple of Dell servers I might be able to test +this on... After our security audit maybe. + +From pgsql-performance-owner@postgresql.org Fri Jun 9 23:29:12 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D41919FA5F8 + for ; + Fri, 9 Jun 2006 23:29:11 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 49916-07 for + ; + Fri, 9 Jun 2006 23:29:05 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from ausimss.pervasive.com (ausimss.pervasive.com [66.45.103.246]) + by postgresql.org (Postfix) with ESMTP id 85D559FA38F + for ; + Fri, 9 Jun 2006 23:29:05 -0300 (ADT) +Received: from ausbayes2.aus.pervasive.com ([172.16.8.6]) by + ausimss.pervasive.com with InterScan Messaging Security Suite; + Fri, 09 Jun 2006 21:28:54 -0500 +Received: from AUSOWA.aus.pervasive.com ([172.16.4.8]) by + ausbayes2.aus.pervasive.com with Microsoft SMTPSVC(5.0.2195.6713); + Fri, 9 Jun 2006 21:28:54 -0500 +Received: from ausmailid.aus.pervasive.com ([172.16.4.64]) by + AUSOWA.aus.pervasive.com with Microsoft SMTPSVC(6.0.3790.1830); + Fri, 9 Jun 2006 21:28:05 -0500 +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: FW: pg_xlog on data partition with BBU RAID +Date: Fri, 9 Jun 2006 21:24:47 -0500 +Message-ID: + <4D27CB1096EF1C408F4BFAB0046EC7B608C241@ausmailid.aus.pervasive.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] pg_xlog on data partition with BBU RAID +Thread-Index: AcaMJoyVS8iJwIVhROOh5hfPEg0x7gADn7Tm +References: <20060609194116.GD57289@pervasive.com> + <200606091709.55745@hal.medialogik.com> +From: "Jim Nasby" +To: +X-OriginalArrivalTime: 10 Jun 2006 02:28:05.0645 (UTC) + FILETIME=[814313D0:01C68C35] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/115 +X-Sequence-Number: 19472 + +Forwarding to -performance + +From: Alan Hodgson [mailto:ahodgson@simkin.ca] + +On Friday 09 June 2006 12:41, "Jim C. Nasby" = +wrote: +> Has anyone actually done any testing on this? Specifically, I'm +> wondering if the benefit of adding 2 more drives to a RAID10 outweighs +> whatever penalties there are to having pg_xlog on that RAID10 with all +> the rest of the data. + +I have an external array with 1GB of write-back cache, and testing on it = + +before deployment showed no difference under any workload I could = +generate=20 +between having pg_xlog on a separate RAID-1 or having it share a RAID-10 = + +with the default tablespace. I left it on the RAID-10, and it has been=20 +fine there. We have a very write-heavy workload. + +--=20 +"If a nation expects to be ignorant and free, in a state of = +civilization, +it expects what never was and never will be." -- Thomas Jefferson + + + +From pgsql-performance-owner@postgresql.org Sun Jun 11 03:35:30 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2F3339FA2B4 + for ; + Sun, 11 Jun 2006 03:35:30 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 61890-02 for + ; + Sun, 11 Jun 2006 03:35:21 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.201]) + by postgresql.org (Postfix) with ESMTP id 4C1979FA1A8 + for ; + Sun, 11 Jun 2006 03:35:20 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id s1so971038nze + for ; + Sat, 10 Jun 2006 23:35:20 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:mime-version:content-type; + b=PkbIgeilC1FkgKHIN11s7PnXdhF8VW1WNszNL2fwYoyxgX6a/Dfx2zEgsM/q5MYIjFh0M5Sf1w2TOTt8MZPMCAZ3fdDfcDSIkiJ73Uvvn2eczMk/hlfsQ+BYWHbEWs9iyH4R5A5RoMW22YKGALXYJAG6w8jXHP5Uhp/4+1uCNGQ= +Received: by 10.65.152.9 with SMTP id e9mr3971252qbo; + Sat, 10 Jun 2006 23:35:20 -0700 (PDT) +Received: by 10.65.147.19 with HTTP; Sat, 10 Jun 2006 23:35:20 -0700 (PDT) +Message-ID: <5809b390606102335j41f734d8j@mail.gmail.com> +Date: Sun, 11 Jun 2006 09:35:20 +0300 +From: "John Top-k apad" +To: pgsql-performance@postgresql.org +Subject: Variation between query runtimes +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_41350_12071152.1150007720013" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/116 +X-Sequence-Number: 19473 + +------=_Part_41350_12071152.1150007720013 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hi, + +I have the following quering plans: + +"Seq Scan on ind_uni_100 (cost=0.00..27242.00 rows=1000000 width=104) +(actual time=0.272..2444.667 rows=1000000 loops=1)" +"Total runtime: 4229.449 ms" + +and + +"Bitmap Heap Scan on ind_uni_100 (cost=314.00..18181.00 rows=50000 +width=104) (actual time=74.106..585.368 rows=49758 loops=1)" +" Recheck Cond: (b = 1)" +" -> Bitmap Index Scan on index_b_ind_uni_100 +(cost=0.00..314.00rows=50000 width=0) (actual time= +61.814..61.814 rows=49758 loops=1)" +" Index Cond: (b = 1)" +"Total runtime: 638.787 ms" + +from pg_stast_get_blocks_fetched i can see that both queries need almost the +same number of disk fetches which is quite reasonable ( the index is +unclustered). + +But as you can see there is a great variation between query +runtimes.Cansomeone explain this differnce? + +Thanks! + +------=_Part_41350_12071152.1150007720013 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hi,

I have the following quering plans:

"Seq Scan on ind_uni_100 (cost=0.00..27242.00 rows=1000000 width=104) (actual time=0.272..2444.667 rows=1000000 loops=1)"
"Total runtime: 4229.449 ms" +

and

"Bitmap Heap Scan on ind_uni_100  (cost=314.00..18181.00 rows=50000 width=104) (actual time=74.106..585.368 rows=49758 loops=1)"
"  Recheck Cond: (b = 1)"
"  ->  Bitmap Index Scan on index_b_ind_uni_100  (cost= +0.00..314.00 rows=50000 width=0) (actual time=61.814..61.814 rows=49758 loops=1)"
"        Index Cond: (b = 1)"
"Total runtime: 638.787 ms"

from pg_stast_get_blocks_fetched i can see that both queries need almost the same number of disk fetches which is quite reasonable ( the index is unclustered). +

But as you can see there is a great variation between query runtimes.Can someone explain this differnce?

Thanks! + +------=_Part_41350_12071152.1150007720013-- + +From pgsql-performance-owner@postgresql.org Sun Jun 11 14:19:31 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7D3049FA5DD + for ; + Sun, 11 Jun 2006 14:19:30 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 17246-09 for + ; + Sun, 11 Jun 2006 14:19:25 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moonunit2.moonview.localnet (wsip-70-167-125-69.sd.sd.cox.net + [70.167.125.69]) + by postgresql.org (Postfix) with ESMTP id 36CD89FA3D7 + for ; + Sun, 11 Jun 2006 14:19:24 -0300 (ADT) +Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) + by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id + k5BHUvOI016869 + for ; Sun, 11 Jun 2006 10:30:58 -0700 +Message-ID: <448C505C.2080504@modgraph-usa.com> +Date: Sun, 11 Jun 2006 10:18:20 -0700 +From: "Craig A. James" +User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: function not called if part of aggregate +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/117 +X-Sequence-Number: 19474 + +My application has a function, call it "foo()", that requires initialization from a table of about 800 values. Rather than build these values into the C code, it seemed like a good idea to put them on a PG table and create a second function, call it "foo_init()", which is called for each value, like this: + + select foo_init(value) from foo_init_table order by value_id; + +This works well, but it requires me to actually retrieve the function's value 800 times. So I thought I'd be clever: + + select count(1) from (select foo_init(value) from foo_init_table order by value_id) as foo; + +And indeed, it count() returns 800, as expected. But my function foo_init() never gets called! Apparently the optimizer figures out that foo_init() must return one value for each row, so it doesn't bother to actually call the function. + +db=> explain select count(1) from (select foo_init(value) from foo_init_table order by db_no) as foo; + query plan +---------------------------------------------------------------------------------------------------- + aggregate (cost=69.95..69.95 rows=1 width=0) + -> Subquery Scan foo (cost=0.00..67.93 rows=806 width=0) + -> Index Scan using foo_init_table_pkey on foo_init_table (cost=0.00..59.87 rows=806 width=30) + +This doesn't seem right to me -- how can the optimizer possibly know that a function doesn't have a side effect, as in my case? Functions could do all sorts of things, such as logging activity, filling in other tables, etc, etc. + +Am I missing something here? + +Thanks, +Craig + +From pgsql-performance-owner@postgresql.org Sun Jun 11 14:32:10 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 535EE9FA5DD + for ; + Sun, 11 Jun 2006 14:32:09 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 25088-02 for + ; + Sun, 11 Jun 2006 14:31:58 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by postgresql.org (Postfix) with ESMTP id BDFB79FA3D7 + for ; + Sun, 11 Jun 2006 14:31:58 -0300 (ADT) +Received: from [2001:700:300:dc0f:216:3eff:fe40:5a47] (helo=trofast.sesse.net) + by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1FpTn2-0000BG-1w + for pgsql-performance@postgresql.org; Sun, 11 Jun 2006 19:31:56 +0200 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1FpTn1-0002Pr-00 + for ; Sun, 11 Jun 2006 19:31:55 +0200 +Date: Sun, 11 Jun 2006 19:31:55 +0200 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Re: function not called if part of aggregate +Message-ID: <20060611173155.GA9244@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <448C505C.2080504@modgraph-usa.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +In-Reply-To: <448C505C.2080504@modgraph-usa.com> +X-Operating-System: Linux 2.6.16trofastxen on a x86_64 +X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/118 +X-Sequence-Number: 19475 + +On Sun, Jun 11, 2006 at 10:18:20AM -0700, Craig A. James wrote: +> This works well, but it requires me to actually retrieve the function's +> value 800 times. + +Is this actually a problem? + +> So I thought I'd be clever: +> +> select count(1) from (select foo_init(value) from foo_init_table order by +> value_id) as foo; + +Why not just count(foo_init(value))? + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Sun Jun 11 14:39:36 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 542669FA5DD + for ; + Sun, 11 Jun 2006 14:39:36 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 26044-02 for + ; + Sun, 11 Jun 2006 14:39:32 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 812EF9FA3D7 + for ; + Sun, 11 Jun 2006 14:39:32 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5BHdU8F018420; + Sun, 11 Jun 2006 13:39:30 -0400 (EDT) +To: "Craig A. James" +cc: pgsql-performance@postgresql.org +Subject: Re: function not called if part of aggregate +In-reply-to: <448C505C.2080504@modgraph-usa.com> +References: <448C505C.2080504@modgraph-usa.com> +Comments: In-reply-to "Craig A. James" + message dated "Sun, 11 Jun 2006 10:18:20 -0700" +Date: Sun, 11 Jun 2006 13:39:30 -0400 +Message-ID: <18419.1150047570@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/119 +X-Sequence-Number: 19476 + +"Craig A. James" writes: +> select count(1) from (select foo_init(value) from foo_init_table order by value_id) as foo; + +> And indeed, it count() returns 800, as expected. But my function foo_init() never gets called! + +Really? With the ORDER BY in there, it does get called, in my +experiments. What PG version is this exactly? + +However, the short answer to your question is that PG does not guarantee +to evaluate parts of the query not needed to determine the result. You +could do something like + +select count(x) from (select foo_init(value) as x from foo_init_table order by value_id) as foo; + +to ensure that foo_init() must be evaluated. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sun Jun 11 14:48:48 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id ACCC69FA3D7 + for ; + Sun, 11 Jun 2006 14:48:48 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 25088-10 for + ; + Sun, 11 Jun 2006 14:48:39 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id D66DB9FA5DD + for ; + Sun, 11 Jun 2006 14:48:39 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id B533456440; Sun, 11 Jun 2006 12:48:38 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Sun, 11 Jun 2006 12:48:37 -0500 +Date: Sun, 11 Jun 2006 12:48:37 -0500 +From: "Jim C. Nasby" +To: "Craig A. James" +Cc: pgsql-performance@postgresql.org +Subject: Re: function not called if part of aggregate +Message-ID: <20060611174837.GF34196@pervasive.com> +References: <448C505C.2080504@modgraph-usa.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <448C505C.2080504@modgraph-usa.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060611:cjames@modgraph-usa.com::7wQoMOMi5EHEqHEL:00000000000000 + 000000000000000000000000EbFA +X-Hashcash: + 1:20:060611:pgsql-performance@postgresql.org::DqbVMo3oh3kTxj63:00000 + 0000000000000000000000002ZKB +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/120 +X-Sequence-Number: 19477 + +On Sun, Jun 11, 2006 at 10:18:20AM -0700, Craig A. James wrote: +> This doesn't seem right to me -- how can the optimizer possibly know that a +> function doesn't have a side effect, as in my case? Functions could do all +> sorts of things, such as logging activity, filling in other tables, etc, +> etc. +> +> Am I missing something here? + +Read about function stability in the docs. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Sun Jun 11 15:00:52 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6700F9FA5DD + for ; + Sun, 11 Jun 2006 15:00:52 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 28969-01 for + ; + Sun, 11 Jun 2006 15:00:48 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by postgresql.org (Postfix) with ESMTP id 898BA9FA3D7 + for ; + Sun, 11 Jun 2006 15:00:46 -0300 (ADT) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1FpUEo-0001u5-00; Sun, 11 Jun 2006 14:00:38 -0400 +To: "Craig A. James" +Cc: pgsql-performance@postgresql.org +Subject: Re: function not called if part of aggregate +References: <448C505C.2080504@modgraph-usa.com> +In-Reply-To: <448C505C.2080504@modgraph-usa.com> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 11 Jun 2006 14:00:38 -0400 +Message-ID: <87ac8jfu7t.fsf@stark.xeocode.com> +Lines: 17 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/121 +X-Sequence-Number: 19478 + + +"Craig A. James" writes: + +> This doesn't seem right to me -- how can the optimizer possibly know that a +> function doesn't have a side effect, as in my case? Functions could do all +> sorts of things, such as logging activity, filling in other tables, etc, etc. + +The optimizer can know this if the user tells it so by marking the function +IMMUTABLE. If the function is marked VOLATILE then the optimizer can know it +might have side effects. + +However that's not enough to explain what you've shown. How about you show the +actual query and actual plan you're working with? The plan you've shown can't +result from the query you sent. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Sun Jun 11 19:01:51 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D20079FA5E6 + for ; + Sun, 11 Jun 2006 19:01:49 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 61362-01 for + ; + Sun, 11 Jun 2006 19:01:40 -0300 (ADT) +X-Greylist: delayed 00:18:58.367688 by SQLgrey- +Received: from ls405.htnet.hr (ls405.t-com.hr [195.29.150.135]) + by postgresql.org (Postfix) with ESMTP id C1D929F9CAA + for ; + Sun, 11 Jun 2006 19:01:40 -0300 (ADT) +Received: from ls422.t-com.hr (ls422.t-com.hr [195.29.150.237]) + by ls405.htnet.hr (Postfix) with ESMTP id 2D8261443F4; + Sun, 11 Jun 2006 23:42:40 +0200 (CEST) +Received: from ls422.t-com.hr (localhost.localdomain [127.0.0.1]) + by ls422.t-com.hr (Qmlai) with ESMTP id CB812C90048; + Sun, 11 Jun 2006 23:42:39 +0200 (CEST) +X-Envelope-Sender: mario.splivalo@mobart.hr +X-Envelope-Sender: mario.splivalo@mobart.hr +Received: from 89-172-6-239.adsl.net.t-com.hr + (89-172-6-239.adsl.net.t-com.hr [89.172.6.239])by ls422.t-com.hr + (Qmlai) + with ESMTP id 2819F1308042;Sun, 11 Jun 2006 23:42:36 +0200 (CEST) +Subject: Re: scaling up postgres +From: Mario Splivalo +Reply-To: mario.splivalo@mobart.hr +To: "Steinar H. Gunderson" +Cc: pgsql-performance@postgresql.org +In-Reply-To: <20060603094355.GA23297@uio.no> +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> + <20060603094355.GA23297@uio.no> +Content-Type: text/plain +Organization: Mob-Art +Date: Sun, 11 Jun 2006 23:42:20 +0200 +Message-Id: <1150062140.23423.0.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.6.1 +Content-Transfer-Encoding: 7bit +X-imss-version: 2.040 +X-imss-result: Passed +X-imss-scores: Clean:99.90000 C:2 M:4 S:5 R:5 +X-imss-settings: Baseline:1 C:1 M:1 S:1 R:1 (0.0000 0.0000) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/123 +X-Sequence-Number: 19480 + +On Sat, 2006-06-03 at 11:43 +0200, Steinar H. Gunderson wrote: +> On Sat, Jun 03, 2006 at 10:31:03AM +0100, fzied@planet.tn wrote: +> > I do have 2 identical beasts (4G - biproc Xeon 3.2 - 2 Gig NIC) +> > One beast will be apache, and the other will be postgres. +> > I'm using httperf/autobench for measurments and the best result I can get +> > is that my system can handle a trafiic of almost 1600 New con/sec. +> +> What version of PostgreSQL? (8.1 is better than 8.0 is much better than 7.4.) +> Have you remembered to turn HT off? Have you considered Opterons instead of +> Xeons? (The Xeons generally scale bad with PostgreSQL.) What kind of queries + +Could you point out to some more detailed reading on why Xeons are +poorer choice than Opterons when used with PostgreSQL? + + Mario + + +From pgsql-performance-owner@postgresql.org Sun Jun 11 18:43:50 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 9F2FE9FA5DD + for ; + Sun, 11 Jun 2006 18:43:49 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 57868-07 for + ; + Sun, 11 Jun 2006 18:43:45 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by postgresql.org (Postfix) with ESMTP id 8408E9FA3D7 + for ; + Sun, 11 Jun 2006 18:43:45 -0300 (ADT) +Received: from trofast.sesse.net ([129.241.93.32]) + by cassarossa.samfundet.no with esmtp (Exim 4.50) + id 1FpXig-0001Hs-HK; Sun, 11 Jun 2006 23:43:43 +0200 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1FpXif-0002oA-00; Sun, 11 Jun 2006 23:43:41 +0200 +Date: Sun, 11 Jun 2006 23:43:41 +0200 +From: "Steinar H. Gunderson" +To: Mario Splivalo +Cc: pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +Message-ID: <20060611214341.GA10747@uio.no> +Mail-Followup-To: Mario Splivalo , + pgsql-performance@postgresql.org +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> + <20060603094355.GA23297@uio.no> + <1150062140.23423.0.camel@localhost.localdomain> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +In-Reply-To: <1150062140.23423.0.camel@localhost.localdomain> +X-Operating-System: Linux 2.6.16trofastxen on a x86_64 +X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/122 +X-Sequence-Number: 19479 + +On Sun, Jun 11, 2006 at 11:42:20PM +0200, Mario Splivalo wrote: +> Could you point out to some more detailed reading on why Xeons are +> poorer choice than Opterons when used with PostgreSQL? + +There are lots of theories, none conclusive, but the benchmarks certainly +point that way consistently. Read the list archives for the details. + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Sun Jun 11 20:21:29 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 9E3D79F9CAA + for ; + Sun, 11 Jun 2006 20:21:29 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 61983-10 for + ; + Sun, 11 Jun 2006 20:21:24 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from projects.commandprompt.com (host-130.commandprompt.net + [207.173.203.130]) + by postgresql.org (Postfix) with ESMTP id A0A559FA60C + for ; + Sun, 11 Jun 2006 20:21:24 -0300 (ADT) +Received: from [192.168.1.100] (or-67-76-146-141.sta.sprint-hsd.net + [67.76.146.141]) (authenticated bits=0) + by projects.commandprompt.com (8.13.6/8.13.6) with ESMTP id + k5BNLE85018743; Sun, 11 Jun 2006 16:21:15 -0700 +Message-ID: <448CA592.4040506@commandprompt.com> +Date: Sun, 11 Jun 2006 16:21:54 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Thunderbird 1.5.0.2 (X11/20060522) +MIME-Version: 1.0 +To: mario.splivalo@mobart.hr +CC: "Steinar H. Gunderson" , + pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> + <20060603094355.GA23297@uio.no> + <1150062140.23423.0.camel@localhost.localdomain> +In-Reply-To: <1150062140.23423.0.camel@localhost.localdomain> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: ClamAV version 0.88.2, + clamav-milter version 0.88.2 on projects.commandprompt.com +X-Virus-Status: Clean +X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by + milter-greylist-1.6 (projects.commandprompt.com + [192.168.2.159]); Sun, 11 Jun 2006 16:21:15 -0700 (PDT) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/124 +X-Sequence-Number: 19481 + +Mario Splivalo wrote: +> On Sat, 2006-06-03 at 11:43 +0200, Steinar H. Gunderson wrote: +>> On Sat, Jun 03, 2006 at 10:31:03AM +0100, fzied@planet.tn wrote: +>>> I do have 2 identical beasts (4G - biproc Xeon 3.2 - 2 Gig NIC) +>>> One beast will be apache, and the other will be postgres. +>>> I'm using httperf/autobench for measurments and the best result I can get +>>> is that my system can handle a trafiic of almost 1600 New con/sec. +>> What version of PostgreSQL? (8.1 is better than 8.0 is much better than 7.4.) +>> Have you remembered to turn HT off? Have you considered Opterons instead of +>> Xeons? (The Xeons generally scale bad with PostgreSQL.) What kind of queries +> +> Could you point out to some more detailed reading on why Xeons are +> poorer choice than Opterons when used with PostgreSQL? + +It isn't just PostgreSQL. It is any database. Opterons can move memory +and whole lot faster then Xeons. + +Joshua D. Drake + +> +> Mario +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: Don't 'kill -9' the postmaster +> + + +-- + + === The PostgreSQL Company: Command Prompt, Inc. === + Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 + Providing the most comprehensive PostgreSQL solutions since 1997 + http://www.commandprompt.com/ + + + +From pgsql-performance-owner@postgresql.org Sun Jun 11 23:50:51 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6DAFA9FA5E6 + for ; + Sun, 11 Jun 2006 23:50:51 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 87932-06 for + ; + Sun, 11 Jun 2006 23:50:48 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id 6AD269F9CAA + for ; + Sun, 11 Jun 2006 23:50:48 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id E59EE3093C; Mon, 12 Jun 2006 04:50:46 +0200 (MET DST) +From: "Qingqing Zhou" +X-Newsgroups: pgsql.performance +Subject: Re: Variation between query runtimes +Date: Mon, 12 Jun 2006 10:50:28 +0800 +Organization: Hub.Org Networking Services +Lines: 20 +Message-ID: +References: <5809b390606102335j41f734d8j@mail.gmail.com> +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2800.1807 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/125 +X-Sequence-Number: 19482 + + +""John Top-k apad"" wrote +> +> from pg_stast_get_blocks_fetched i can see that both queries need almost +the +> same number of disk fetches which is quite reasonable ( the index is +> unclustered). +> +> But as you can see there is a great variation between query +> runtimes.Cansomeone explain this differnce? +> + +Can you give a self-contained example (including what you did to clear the +file system cache (maybe unmount?) to *not* let the 2nd query to use the +file content from the 1st query)? + +Regards, +Qingqing + + + +From pgsql-performance-owner@postgresql.org Mon Jun 12 02:56:35 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 354089FA2E6 + for ; + Mon, 12 Jun 2006 02:56:34 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 06731-05 for + ; + Mon, 12 Jun 2006 02:56:25 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.170]) + by postgresql.org (Postfix) with ESMTP id A28739FA38F + for ; + Mon, 12 Jun 2006 02:56:25 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id m2so2149454ugc + for ; + Sun, 11 Jun 2006 22:56:23 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; + b=NlNEemGSSSaZe2K182fv4lH0qR+JNtends7jHtdw/8HsAdw0nFAmppBBXxdhpnddYnjVddItKJM9xHSB/Ur/0SMHmBwdyAZSl4We/NFesKs3pMtgDR83bfveULuqCVwMiw0Pu0gyptGRHHXss/pKmSiQHWs7pWKxxyJjh/cEmi8= +Received: by 10.66.216.20 with SMTP id o20mr4822496ugg; + Sun, 11 Jun 2006 22:56:23 -0700 (PDT) +Received: by 10.66.222.12 with HTTP; Sun, 11 Jun 2006 22:56:23 -0700 (PDT) +Message-ID: <674d1f8a0606112256t71b38395gc894fcbca45afedc@mail.gmail.com> +Date: Mon, 12 Jun 2006 11:26:23 +0530 +From: "Gourish Singbal" +To: pgsql-performance@postgresql.org +Subject: Re: pgsql_tmp and postgres settings +In-Reply-To: <20060609155953.GX45331@pervasive.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_2517_10345714.1150091783502" +References: <20060609122948.6B7419FA621@postgresql.org> + <20060609155953.GX45331@pervasive.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/126 +X-Sequence-Number: 19483 + +------=_Part_2517_10345714.1150091783502 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Where is the pgsql_tmp folder present ?. i am unable to see it in the data +directory of postgresql. + +~gourish + +On 6/9/06, Jim C. Nasby wrote: +> +> On Fri, Jun 09, 2006 at 02:23:04PM +0200, Domenico - Sal. F.lli Riva +> wrote: +> > Hello, +> > +> > During insert or update, potgresql write in pgsql_tmp directory and so +> > performance are very poor. +> +> pgsql_tmp is used if a query runs out of work_mem, so you can try +> increasing that. +> +> > My configuration is: +> > +> > Work mem 10240 +> > +> > Effective_cache_size 30000 +> You're off by a factor of 10. +> +> > Shared buffers 9000 +> I'd suggest bumping that up to at least 30000. +> +> > Postgresql (RPM from official website) 8.1.0 +> +> You should upgrade to 8.1.4. There's a number of data loss bugs waiting +> to bite you. +> -- +> Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +> Pervasive Software http://pervasive.com work: 512-231-6117 +> vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 4: Have you searched our list archives? +> +> http://archives.postgresql.org +> + + + +-- +Best, +Gourish Singbal + +------=_Part_2517_10345714.1150091783502 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +
 
+
Where is the pgsql_tmp folder present ?.  i am unable to see it in the data directory of postgresql.
+
 
+
~gourish
 
+
On 6/9/06, Jim C. Nasby <jnasby@pervasive.com> wrote: +
On Fri, Jun 09, 2006 at 02:23:04PM +0200, Domenico - Sal. F.lli Riva wrote:
> Hello,
>
> During insert or update, potgresql write in pgsql_tmp directory and so +
> performance are very poor.

pgsql_tmp is used if a query runs out of work_mem, so you can try
increasing that.

> My configuration is:
>
> Work mem                    10240
>
+> Effective_cache_size      30000
You're off by a factor of 10.

> Shared buffers              9000
I'd suggest bumping that up to at least 30000.

> Postgresql (RPM from official website) 8.1.0 +

You should upgrade to 8.1.4. There's a number of data loss bugs waiting
to bite you.
--
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software       +http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461

---------------------------(end of broadcast)--------------------------- +
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org



--
Best,
Gourish Singbal + +------=_Part_2517_10345714.1150091783502-- + +From pgsql-performance-owner@postgresql.org Mon Jun 12 07:14:58 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id CC9F39FA430 + for ; + Mon, 12 Jun 2006 07:14:57 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 33209-08 for + ; + Mon, 12 Jun 2006 07:14:50 -0300 (ADT) +X-Greylist: delayed 00:18:40.125698 by SQLgrey- +Received: from mail.advfn.com (mail.advfn.com [212.161.99.149]) + by postgresql.org (Postfix) with ESMTP id A8F4B9FA42B + for ; + Mon, 12 Jun 2006 07:14:51 -0300 (ADT) +Received: from [192.168.0.63] (gw.advfn.com [213.86.19.101]) + by mail.advfn.com (Postfix) with ESMTP id 74DC31DEC91 + for ; + Mon, 12 Jun 2006 09:56:08 +0000 (GMT) +Mime-Version: 1.0 (Apple Message framework v750) +In-Reply-To: <448CA592.4040506@commandprompt.com> +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> + <20060603094355.GA23297@uio.no> + <1150062140.23423.0.camel@localhost.localdomain> + <448CA592.4040506@commandprompt.com> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <7F68FB62-82C4-4DF6-ADF9-9CF37875A6E8@advfn.com> +Content-Transfer-Encoding: 7bit +From: Alex Stapleton +Subject: Re: scaling up postgres +Date: Mon, 12 Jun 2006 10:56:07 +0100 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/128 +X-Sequence-Number: 19485 + +On 12 Jun 2006, at 00:21, Joshua D. Drake wrote: + +> Mario Splivalo wrote: +>> On Sat, 2006-06-03 at 11:43 +0200, Steinar H. Gunderson wrote: +>>> On Sat, Jun 03, 2006 at 10:31:03AM +0100, fzied@planet.tn wrote: +>>>> I do have 2 identical beasts (4G - biproc Xeon 3.2 - 2 Gig NIC) +>>>> One beast will be apache, and the other will be postgres. +>>>> I'm using httperf/autobench for measurments and the best result +>>>> I can get is that my system can handle a trafiic of almost 1600 +>>>> New con/sec. +>>> What version of PostgreSQL? (8.1 is better than 8.0 is much +>>> better than 7.4.) +>>> Have you remembered to turn HT off? Have you considered Opterons +>>> instead of +>>> Xeons? (The Xeons generally scale bad with PostgreSQL.) What kind +>>> of queries +>> Could you point out to some more detailed reading on why Xeons are +>> poorer choice than Opterons when used with PostgreSQL? +> +> It isn't just PostgreSQL. It is any database. Opterons can move +> memory and whole lot faster then Xeons. + +A whole lot faster indeed. + +http://www.amd.com/us-en/Processors/ProductInformation/ +0,,30_118_8796_8799,00.html +http://www.theinquirer.net/?article=10797 + +Although apparently the dual core ones are a little better than the +old ones + +http://www.anandtech.com/IT/showdoc.aspx?i=2644 + +(Just to provide some evidence ;) + +From pgsql-performance-owner@postgresql.org Mon Jun 12 07:01:52 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 015149FA430 + for ; + Mon, 12 Jun 2006 07:01:47 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 33320-03 for + ; + Mon, 12 Jun 2006 07:01:40 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.aeccom.com (port-83-236-156-26.static.qsc.de + [83.236.156.26]) + by postgresql.org (Postfix) with ESMTP id E0FAD9FA42B + for ; + Mon, 12 Jun 2006 07:01:39 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mail.aeccom.com (Postfix) with ESMTP id AEB431CEAD; + Mon, 12 Jun 2006 12:01:36 +0200 (CEST) +Received: from mail.aeccom.com ([127.0.0.1]) + by localhost (gate6.aeccom.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 05403-02-17; Mon, 12 Jun 2006 12:01:35 +0200 (CEST) +Received: from azul.core.aeccom.com (azul.core.aeccom.com [192.168.2.2]) + by mail.aeccom.com (Postfix) with ESMTP id 9E0B11CEAE; + Mon, 12 Jun 2006 12:01:29 +0200 (CEST) +Received: from [192.168.2.247] (unknown [192.168.2.247]) + by azul.core.aeccom.com (Postfix) with ESMTP + id 7B97E10172; Mon, 12 Jun 2006 12:01:09 +0200 (CEST) +Message-ID: <448D3B65.7090709@aeccom.com> +Date: Mon, 12 Jun 2006 12:01:09 +0200 +From: Sven Geisler +Organization: AEC/communications GmbH +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: mario.splivalo@mobart.hr +Cc: "Steinar H. Gunderson" , + pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> + <20060603094355.GA23297@uio.no> + <1150062140.23423.0.camel@localhost.localdomain> +In-Reply-To: <1150062140.23423.0.camel@localhost.localdomain> +Content-Type: multipart/mixed; boundary="------------020504090803020209070803" +X-Virus-Scanned: amavisd-new at aeccom.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/127 +X-Sequence-Number: 19484 + +This is a multi-part message in MIME format. +--------------020504090803020209070803 +Content-Type: text/plain; charset=ISO-8859-15; format=flowed +Content-Transfer-Encoding: 7bit + +Hi Mario, + +I did run pgbench on several production servers: +HP DL585 - 4-way AMD Opteron 875 +HP DL585 - 4-way AMD Opteron 880 +HP DL580 G3 - 4-way Intel XEON MP 3.0 GHz +FSC RX600 S2 - 4-way Intel XEON MP DC 2.66 GHz +FSC RX600 - 4-way Intel XEON MP 2.5 GHz + +This test has been done with 8.1.4. I increased the number of clients. +I attached the result as diagram. I included not all test system but the +gap between XEON and Opteron is always the same. + +The experiences with production systems were the same. We replaced the +XEON box with Opteron box with a dramatic change of performance. + +Best regards +Sven. + + +Mario Splivalo schrieb: +> On Sat, 2006-06-03 at 11:43 +0200, Steinar H. Gunderson wrote: +>> On Sat, Jun 03, 2006 at 10:31:03AM +0100, fzied@planet.tn wrote: +>>> I do have 2 identical beasts (4G - biproc Xeon 3.2 - 2 Gig NIC) +>>> One beast will be apache, and the other will be postgres. +>>> I'm using httperf/autobench for measurments and the best result I can get +>>> is that my system can handle a trafiic of almost 1600 New con/sec. +>> What version of PostgreSQL? (8.1 is better than 8.0 is much better than 7.4.) +>> Have you remembered to turn HT off? Have you considered Opterons instead of +>> Xeons? (The Xeons generally scale bad with PostgreSQL.) What kind of queries +> +> Could you point out to some more detailed reading on why Xeons are +> poorer choice than Opterons when used with PostgreSQL? +> +> Mario +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: Don't 'kill -9' the postmaster + +-- +/This email and any files transmitted with it are confidential and +intended solely for the use of the individual or entity to whom they +are addressed. If you are not the intended recipient, you should not +copy it, re-transmit it, use it or disclose its contents, but should +return it to the sender immediately and delete your copy from your +system. Thank you for your cooperation./ + +Sven Geisler Tel +49.30.5362.1627 Fax .1638 +Senior Developer, AEC/communications GmbH Berlin, Germany + +--------------020504090803020209070803 +Content-Type: image/gif; + name="test_pgbench_23130_image001.gif" +Content-Transfer-Encoding: base64 +Content-Disposition: inline; + filename="test_pgbench_23130_image001.gif" + +R0lGODlhygNbAncAMSH+GlNvZnR3YXJlOiBNaWNyb3NvZnQgT2ZmaWNlACH5BAEAAAAALBEA +GQCrAy4ChAAAAAAAAAsJCgcGBwYFBQcGBgMDAwsKCgoICQgHBwkICAUEBAkHCAwKCwAAgAD/ +/4CAgMDAwP8A////AP///wECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwX/ICCO +ZGmeaKqubOu+cCzPdG3feK7vcxDwKB8QIBj4CIKRb/lbCQoqQ1N0MAYGh1HVhx16v+CweEwu +m8/otHrNbrvf8N4ULOQJmD4EET8P9klWJFJLBiODPoVxiouMjY6PkJGSk5SVljF1YZk6Rgki +CgELAAhXMJsjAgRLI6ADIkYKAK2vAbGXt7i5uru8vb6/wDw+AguhSajFBQd1w8ULxyLExkoB +RT6eqKoByiJCDAEG2CsJUuEmBXNCoLYteCV5mejHd1Dy0dssqT7cJMuJAFKyBBtIsKDBgwgT +KlzDp9q9JcWaNJyH51hDV3uYYOTCRBwKdB1V3CEAwEjEAtD8/6wigQRApk1CYP4pcUejiW8M +AHxjt7Cnz59Agwod2uiaiASlSgbAFsjl0qNJjSS5s/FKA1l1OmXstvQqqJkkfFytqUKVHm1M +Up449W6KTKdhwY7QStZEMVIkierdy7ev379ExYpowCzAVQCEJRoeXOcQIq6H4UpuG5ltCWcM +9KQ4UAxbAQOakeZNYZmaadNvVZQmUTOAQMCwY8ueTbt2mtS40yl2N1my5dRxhXAmpLnEASke +25pg0nu5W9292TJfLSjAaNvYs2vfzr22YMTgIDNWfJhwot/Qm3ON6zzTAQVG/mmRknMEusp/ +psudbG9PPYf+tfcDdSKQkkd3CCao4P+CDPayD1QYaQUASFxBAQBSET51hyjRNUFXKOudRppD +y/whRXG0YIThCtRlMotSsbwIywofclgCfeE1qOOOPPbooyZ8CNSadYVV9NASFqU3ZC0hNomC +FUskhxQfABzHhAGRoTAIRs5VR4ghV+aDB09QeWJEfT+mqeaabKbZjHUpSeNKYdI8w1oxoIk4 +mTQGsANcCuSAkxxADVEBUhcrICCFhV2O0IAViCIG6Wsi4UnmHv8E1OamnHbqaWylDVMgiJ+W +auqpqKYKKlggMXGpqrDGKuustE6yWgIRLYBmrbz26uuvwAYr7LDEFmvsscgmq+yyzDbr7LPQ +RivttNRWa+3/tdhmq+223Hbr7bfghivuuOSWa+656Kar7rrstuvuu/DGK++89NZr77345qvv +vvz26++/AAcs8MAEF2zwwQgnrPDCDDfs8MMQRyzxxBRXbPHFGGes8cYcd+zxxyCHLDI1DZVs +8skop6zyyiy37PLLMMcs88w012zzzTjnXPPIPO8QAAVABy300EQXbfTRSCet9NJMN+3001BH +LfXUVFdt9dVYZ6110Pv17HU7W4ct9thkl2322WinrbbZXX/tdhBrxy333HTXbffdeC/d9tt8 +K5H334AHLvjghNe9d998/1z44ow37vjjix+OuNuKh80H0JVjTgETXC/RuQ9G4/F5/+Z0X775 +0D9zjrnnq4NetOitk6650KmbXjrqsbuOuuqz064677AbDjvptesOPOt6T678WmMT33vqtJ/O +tfS9Tx995rLH7Tz10E+PPfXgV3/697hHb/3d229v/vNEqy999rebX3n3mn9PvtKSL88z/Fan +733711vf+cQXPrn5r34A/N8AxSe7BpaPgHM74ALDpzgHCrCCgJMg/Qa4Qf6hTn8gdEnzHtg9 +CyJwgh6E4NrUV8IEnpCAKSyg+2KINgnCsHzuq94G8cbC97lwfAJEWv5CCDIaRm2G3nOd/YLY +uqMZkWxIrJ8SAzjBzenuh7m74hPL1hAGYhGDvkPe73hnuP8Hcs+KYHxhAUNHxOWRzgFwjKMc +50jHOI7uitybH/g6KEQTQk0CgAykIAdJyEDekYV6XGIVO4dFLy6SaROIpCQnSclKSnKBFQxe +ENOowz16MmoPCKUoR0nKUorykCRMJBVV2L42Ki9zdYylLB1wPudxko/3cyITm1bIXvpSArXE +3S09mcvQ7ZKCx1yaJZfJzAlgkpXPXKMCbwg1U1rzmg8IJhUVqUYjDtGVHNui0+6nymkCEYUk +/Bs5zYlLJvbQmBfMmw3haT0P8tGMEVxfObv5SfyBE3HibNo6+clNGeIwg/pkJzHdeVBdxpOH +DRViQuNZ0IBubaDnJGgyP/jPxI3/cJVSNJ4Ykbc71tkufuYc30hFisc7ZvGLG1XbPF9Hxssd +j6UWvagwhbnS+ZE0ad/sKMZyCrmiGvWoSE0q5oT6NqIq9alQjapU0xZUplbMqVPNqla3ylV/ +WtVrWO2qWMdKVqVW9asSC2tZ18rWtmYQrT1Tq1vnSte6chGu+7OrXvfK1wjidWQ6C6xgB0vY +whr2sIhNrGIR+9fGOvaxkI2sZCdL2cpa9rKYzaxmN8vZznr2s6ANrWhHS9rSmva0qE2talfL +2ta69rWwja1sZ0vb2tr2trjNrW53y9ve+va3wGUDc7jykpU4hUDBTa7F0uGSsDRXCc/thnKn +G07nMve6/86lrnYvhl3odle62w3vxJ4T3eZ+t7ziTW/DVjEg67oXugIKAATmS9/62ve++M2v +fvfL3/76978ADrCAB0zgAhv4wAhOsIIXzOAGO/jBEI6whCdM4Qpb+MIYzrCGMfyO8rbXu9kl +TQRGTOISm/jEKE6xilfM4ha7+MUwjrGMZ0zjGtv4xjjOsY53zOMe+/jHQA6ykIdM5CIb+chI +TrKSjwyBDp/3w+AV8ZKnTOUqW/nKWM6ylrfM5S57+ctgDrOYsQwBt0TZvO8981rGzOY2u/nN +cI6znOdM5zrb+c5ebrJxj/uc4iI3AHgOtKAHTehCG/rQiE60orncZDIAetGQjv+0pCdN6Upb ++tKYxnGjx/DoTHv606AOtahHTepS53jTYui0qVfN6la7+tWwjjWjy6BqWdv61rjOta53zWpU +a4LXwA62sIdN7GKP2dd0MLayl83sZjv72StG9hdqDe1qW/va2M52pqXtBWpr+9vgDre4xw1m +bg/B2+ROt7rXze5209jcQEC3u+dN73rbO9vwFsa9983vfvs72Pn22b8HTvCCG9zTAdeBvA/O +8IY7/OFsTngOFg7xilv84hgfssRxQPGMe/zjIA95ijd+g46L/OQoTznDSW4Dk6v85TCPebtZ +XgOXy/zmOM85tGlOA5vr/OdAD3qued4DoRv96EjHNdH/ZeDzpDv96VBP9NIxEfWqW/3qUqc1 +1rfO9a7Heeqm8LrYx072LIP9BU0vu9rXzvYYn90FaW+73Oc+97e3g+54z7veTWx3FsR974AP +fNL7ziLBG/7wXCe8ahDP+MY7XfFSdrzkJ49zyAeB8pjPfMotv2bNe/7zF+f8ckBP+tIfXPTv +ML3qV79v1IeF9bCP/bpdrwTZ2/722tazcYfLZ5K17e+4D77wYV3mNKMZxPCN/PCXz/xdFx/5 +0n1y4ZtP/erH+vnRNz6U0Tt663v/+6TWPTO07+Hpg//86Lc09o+ffehzn8+Ljb/850//+tv/ +/vjPv/73z//++///ABiAOLN+/9tXgOW3eOmXgAqoaARYftKHgAsYgRKIZw0ofcwFgROYgRro +ZuLXZx7oe363gSI4guWmdSR4gihoZbTXDSnYgi7IZCb4gjI4gzy2gi5BgziYgzVmg8Cngz7Y +gjz4gzFHSUKodDFYhCLXTEhIfEe4hB43SSRWSU7Ya004hRUHhSgmhVYoakG4hVeIhSqmhV64 +bVU4hgRHhDCGhmZYaV24hmcIhjImhm64aG04h/0GhzUmh3ZoaHW4h/WGhzmmh35IgWU4iOqm +hj4miIY4Z324iOSGiEIGiY4IZ404id8miUSmiJYYZpW4iYq2TFQGiEimiZ44a45WipHWTJj4 +Y6I4Zf+kiIoqWIiwiGeCqISs2IpV9oqzqGSduIt0posjZos3topapoq46Is91ovI6GbAmGLC +mIbHyGXGOI3LqGmyWI1i1owv9ozOKEmENo3GiI0qpoziKI3EqGPcGAHReGjgGEkRGI5aRo7l +eGWWpGTguGra+G/eOGntCIpkdo3zmIvneGT+6Gr5eG/rOGf9uI/dyJBUJo8BOYoD6W8HOW/e +6I6/uJATYGMTKWQQGZGZ2JFvmJAWuZHqaJJypopBRpI/9pEgeYsseXAV+YgoeZIKWZMSiZFJ +5pIvuWMz2XA/qW0OqZNvRpT2GJOnBpA96ZMi+YRBWW0OGYw4yWZGuWRNaY3/p7iUK/mUGMeV +zBaVUjmVYVaVoYiU76aUWhmHXglyazlsYBmFYvllbymQc7ljPJmWYdiWJ6eXvEaWJeaXXQaY +VnaVboeWeNmQZgl0fHlrgimVVBmXxZiYLHaXh1mPZbeYsFaXfwmZkfmYmjljlLmUlil3mImP +jQmX2ciZgSmZJxaaETmaeVeQxvaZJnaaZamaXsaaJVZmvMF7vrlnl3eYWViaUSebwUabtWmb +VombYKabEYBqEkF+F6h8wgmbkmecuaacyZmbzDmWrAmdZ2aA0xmclUmcl2mdsqadJ6aeRsae +cpmYm2Zm7meAGNiT6Gl62MlqyNmN5jhohBmfycd+/wLaNT04ifcZe8zUavuZl5HZnUXJno02 +nuIZYsEhgBZ6oRiaoYtlSRraoR76oSWzTCBaWJJUM5Gkfyc6ojoToRQ6oQHaeeVonpqXn5W2 +oCzmnrc4anrWYfN5gNTpizJaejSaig7aYjYKZDiKaDvaog5IoTAKpIQJfkPKjkXqYknKlOHH +fb/pZ78Hpc4ppV/6oFVqpWPKlGWadVmJikFKfVcKZ0e6jWcaiHGqpIa5hmtqfW3KjHm6Yns6 +Y31aaK6JhAeqg3/anIU6nMtpaoH6g3eKfofKnUX2qDc6p2jKaYPYqAooqZ0ZqZo6nJRKp2nq +hpi6gJ1Kj6W6ne35qaBqqf92GqWMqqqrCatwyqmttqgpOKoaeKrLKauzGpK1WqcyiKsiqKtJ +9qboyKvriayACqwu6KpbSKwEqay9iqTQWme2uoHGaobV6qsCuZWvdq0TGKZTuK2RSK7Jqqzm +yojMSoLiaoXp2mPZCq/oKq3LGqqE+q4viK/HSq9+yqv6Sonriq3/2qz8OmTxmqNmen0Bm4EH +u4cDm4cFS2N/+rAcuLDv2LB+SLExprGbeay2Bq7n165zyLFkGrEQK6cfa7EJiLGGSLKTarIQ +O6cue2wq66gzS7BtxrLlypE3y4k1C6Yw64U9i6qpebK3BrJsqrMGGrQ8m7NlOrQ+a6/sqrRL +O2b/UNuxajl0P5u0TNuqRaunWau1UiuwXSuqZbuxZzuMDkq1k4a0wse2ntizV3uu02qEYyuB +IguLNzu3yUqmvOa2tpe3epu2k5qRRkq4gQa4CMq39wqpN1m4f7u1twe3UNqfdQaYlNu2kit7 +mbuLJMu4/Bm6kXu3Idu5lZtloMugfQtwm7t6gouNFGu60TqVqVuCpOt9sruMD1u7qouawqa4 +oJe7uou4jumfKCm8kAa8noe8yDiwvMunx0u8hKa8mPe6IKmvz1u42ftlHQiCxPWB5vd91nu9 +iLu9DGq+XVaB0umk3Se+6OuE7/q+DWls6xeeTfqi7Wt4Grm/0uu5aSu//55Kv/mxvvibeoLH +v/wrnIl4tgB8bcW3EhbIvga8d8KqwChbrP07cLzZow/YFir6wSD8MpUUwiRcwiZ8wvWXooml +wijcwvunvhwswa9HdxVswfIqkYkXwT1an+c5vjaMw6nadTDcfkT8fjOsdjX8w9TKqRlMcN37 +vd7be+HrdUmsxN7KrYnXui83qFZsuAbbxAVHvWzprF38mF8sdmLclWRcxk67s2isxR9XxWwM +xAjrdWnscHI8xxi8xGN3xzK5xnocZ5rawODmxwOXx4HsishKyIUMx0Dpw4nsnQtcdoZMkWAc +yYrMY4zcyLcLc5uMyWiryZd8eo5scMwLyo57wf+UXMoF98moDI0eq3aVjJCj/MpHqcqr3Mko +d8q2nMoS68rfNst/WMu9vMdNy3bCXJLF/GlJCsyczKo3x8vLvJpGi8ysfIfEPM10HMpyl8zs +5sza7Ldh23befIjgHM6QC8t1d820jM7MXKTnHMzsPMzu/M7qvM667JT17GnaGc/ynM9qvM/2 +fLh5V87iJs0CbbnpjM/QnHL+nNC9K7p0Z9Dg9tAQLdF0W9Dz/M0WfdGIitEMnWoq19Eevbom +rdEA/XAkXdJE29J4R9HYhtAsrdC+u3cwfW0rPdNYu9N6d9NQmc06bczFC3g+/WwyHdRbRpQ5 +nXsbPW5LjdRD/dT41tT/4SbVUG2TWB14Rf2VVg3V7tjVDgx/UDzWUszDFgfWXn3UMbekAeqi +apa/F4fWaQ3UHsfW9tvB5BnXco3Uar3WAxzDBXzEen3V5cibEEzAbz3BZ03XhC2BQzygPlqh +LjzZLFOilH3ZmJ3Zmr3ZnN3Z9udrbg3ZZv3IjV3YTobYRlx7i13aha3DRUygi83YrL2AT1zW +W9qlXzjb4rjVxynbuq2AvA1se/3bhxfcuzbcxG14xp2dyJ3cWk3Vztbczk3U0M3V012Ny21r +fX3dJJjd6enb3H1+3p2Z4B3e4DfeBind5o3SDX3I5b3e3ofe+vne8G198m1q213fG3jfpabe +//o90dUtbP793yH9a5Y84AROzgGua4Cc4FbI35nW4A7+4Av+3fk94ftd4eSN4Bhe4MnmbpDc +4T4I4UR64SIugiT+iSF+4iOu4aMm4SxuhileaDAe4zLu4vy84jYuhDNOizq+4zyO4zX640Ae +5Cnd2yZe5EAo5CVO30pO20yu4hz+5Mod5VSa5FTugj3umVOe5VV+5LFW414+iFtuqF0+5sVt +5T7u5GiegWUeq22Ol29O03Hek+BJ1rcdggLO5nU+gfEZnYCd2IJ93Gfe51/uG6gN28Jd6IYu +eCwK6K8d2U/K3Hze6BH46HdNfqMd5oxu6c8N6K79fp5NWCw86qZ+6v+onuqqvuqsnjNLCumQ +PZ6Trt2V7umXTiWhrui4huW2LoN3nutTzOm13uvAHWJ5TtY/+mq8TuwvOOdHOezMnoDOLtTR +budqbrXQXu3pN+2pmu3aLt7XbubfrpXc/sXePu7nHe5wju5LWe5XzO7WDuZDDu/kru4NSu/t +bu9Ytuz4noLuLsrn3u/xre90KfD5Lu+Q1ukG39MEn8kLH+/t/c4B//DV9+9qO/EUT30WH7MZ +D/EiDWr83vEnuPH9GnSzREci/2wkz80od/IuH0spv2wrD6cYr2Uvf/M4n/Oz9GIoH/PENvOH +W/NTpvNEX/Sy5GM9r2hGP0c+H20Nb+66lvP/EeBLhFZHdbb0WJ/0GQ/0eSn0SI/zJfZLhFT1 +Wm/zWe8AOHb2au/yGM71IB1qYH9iv4RihUT2cnRlRI/3a7/3fB9HCe32Jw1qbK9ic+9idT9o +ZT9kJ/9qfd/4N+9mRb98gL+ZXg9jR89ihV9jhx9oVv9ji89ujp/3SRb6TD/6kV95T7/Alc9i +l79imb9jm49nnV9jgy9zak/7om/5uS9jpJ/4IDf5J7n6KNb6Kfb6Qhb7d+b7KVb7Udf7xA9k +zg/zvB/3GAf8D/38ck/1U4b8dub7n093WN9l4V9kUj9mjl+vEZ9o54z9dD/2W8b9dKbz4Rz9 +9F//X5f6+4po7F/8/4I0ZvB/YyAgiSNZmlKUqivbpg4cxy5d2zee6zvf+z8wKBwSi8ajUaZc +MpvOJxSGjESr1iuzBwFwu94vOCzmBqbm42RyXuucvRL7fNKd6va7Pa7f8/v+P2Cg4CChHtYh +ltbYIqNYWWFfGuSRmw/cJBCeZl3m5iUmaKjoKGmp6Snq1FYja+Nj6lCaGuxN1o8JbY6nCOCu +7+9crvAwcbHxMfFq63LYKzKOJPKSEO6zNTB2Noo1d7f3N7jxVgB5QFe5OVn5+Tqjc3hKNN8D +/UOSEjUJ/D6btj4/wIACBxKMACEdGQAIFTI81zDhonfhZPWpV0/ItHwjCnKU449Xx5AiR/+S +jKMs4UJzKR+ybBZQnp6LESz6yBjkU8mcSD7yBKnzJ9CgtE4yXGnUy0KX/GDGkZnCor0c+Ibg +FGp1Ss+s/65y7er1x6p2Rx2ujLiU6RqnK6DWsHlz69e4prTekWv3bkiiKpGy3OsQDLrAggcT +Lmz4MOLEaRIzNlzP8ePASxoXLkH5MubMmjdz7uz5M+jQotHRHW36NOrUqlezbu36tWm9fWeX +HSOxG9ozamvQdNsJLt7gBLEJL27clOyxKPmanZh7ym4bUGdQrXr8+nBg2LdzX3OQr/KizG3D +e36E5g4Y6DX67O4+JPH38ue7GNdO4X107Mi5ch4zOg3TrPcGcPT/GdiRPwcqiBdRzDh4GzIU +sQGgC26xtYN1C2ooUk8beihSgw4uA+Ex5hVB4Qq+rTUgC5x8+OJVHcI4IzIhisgKicWYSASK +L0x1w3p40DikXQkSeaQoNt7ojjcS6kaPDT/uYFEwSFp5XHxXamnSkiLmOMyOQqAopQ0nXLgl +mu5lGeOaafqhZJeO4DbLk1G1QGYLmjzVo5t9YkkXoLtgFaiLfp4BZ5yAceMkdFDeKQMNQvLG +p6GV/kkoppkWiqGglgaBaKJILUpno3aqQKakOpzpKautsqcVH764egOooZJhTZhA7IZqlbqy +OCuwwQak6S/01Wrrl6kwep6jPlK3QoE8/1IqLLXVckMsrHEdG2qyqOTqg1N4Rstss9aae25x +2Ko7yraJdmvKtz3IJO64SEA1Lbr56iuXuv3KykO7cb5LyrInQknvRn7cu2ooC+N7oMMRSxzx +vhVziK0itvZnTLxT0oNnBPVWJPEgE1P8ockpq3yyxS0vGHCXA4vSsaofPwttwqKYnNbOLji8 +IMNmrPyry0ULB/OSMoNSsJj13KxChqP0/EPK4N47X9B/DP2w0V2DqPHGYJIqrc2R5kzMxNJN +TTbRwmUNytblej13R0jfqPQkNANZtgsiox132/YubFzgqQDONd2Jw2K3l2KPHYQDTpt9djhr +A/KzXYUjc/jbiv97niTYTAqjd4WRyw213yhf3VXnAnGu+eexs8H4g6M/XpN6p6eQOo2DB9X6 +T68jLjvxtIbeHCxM8xADgLwjiflIwN8lvO7FW88C7czgPQjpKeZu6u7Oawk9QdK/Rz341yue +/Yi0dO+s6emL3yf58JgP48rqf85+K9sDorxUvge++Vmqfty4n5tWp79noC99DfPdDviHo+Td +rg0KDBkBXWXAvw0vgQhc4B4aiD5B5A9gxyOPtyqYgwtGrWIbNBzsgHVBEDZFhGyzXNNURgQJ +hq0UAFRbdDKIrhdKrYOtmiENgwA4TAxthSVUxQnldAq9BU2ILiRiIWI4RC2qToRY5MH/EjnY +wDdFUSk+VKHPptMiKxbtiwrjYr6Q2B0v0rGOcCzGEwXBQ9ER7Fv3ckCeKJdEN/LMiFu8I1eo +958xGmqPyBtFrqYjBZy1J4ktIKQRPmg0OXolbZbUgyNRCEk07ukiN2vhJ1dkx6rRkJPBI1kq ++xBKKc7MPFeDVPgEGUsgrtKV+tPkPnC4yz3M0oyheM7qcInBSg6zmToDJgM96cxAFFNRtUyj +Wp7Fxmlys4aIFIY0uzmIan7Bf2tYFsOog0pxspOE0KRaL4XZTmrihz/qsGc9EaIfPuZNHkhU +py7nKdCSxbOgrBwoJr5DFvAw9C+ihISE/jmDbSK0ooIzqAMt/xqQ5DR0OQ6lJUTV8DYZrFOj +Jj0psDi60JVC5KGEkETgYlBSlNK0po0sJ2062hJrFkIWPZJpQG0q1KG66STpCI9fWooU2BzG +p/QwDAxIwNSpUrWqVr0qVrOq1a1ytate/SpYw/pVZehTp0ndaTl7moYxOWCmRH0rXGkUlvGI +h6VoFRX31lo9KrQ1qHH9K2BfNA6c2vWsSeFpIGCaUSpQNLCOfWxxDhKYe+ozP/dxqR8UWwO3 +QraznjUOOfH6P706kLOfPS1qtVVGxEaCtH3za2pjK1uvhPYco51AEEcAyNnytrdfqe2tMuva +NTLTt8Y9bkmAq5A/DJeSu0UudKObl//VprW1uZXAc6Wr3e3yQ7nm7EFzUYdd7pK3vN/wLh/C +m8vsmre97hUGevXg1ECO9732vS8q4suG+RKXvfj9L4ALod9z4lZuug0wghOsR+qK9gzqPbCC +IyxhLjE4uA4u8ABF4N8Jc7jDn6qwhafwYA17uMQmBguIl2uGEdf3xC5+cQ0GbAQWTxLGNr6x +jIuA4f5u+MY+9nCOY7Eb3fb4x0aWcJCDoFceH7nJJU7yD5bs3CI7ucr/hTJ4dyzeGlu5ywjG +8g5GzGUvkxm/YNaBllE35jKz2b1nhsaQSdzmOb/3zTZI83rprOf22pkGeF4mlfcsaN/2uQV/ +hvCgEx3dQq//4NByVjSkj8toFRS4v5G+tHEnHYFKOxfTnubtpPGM6E+T+rSMFvWjS63qzjJa +LaNeNawD22pTvTrWtoarprcc6Fvz2qS5BvSuey1shOaayMM+tk01bWxkM/ukZF0qPveZzx7S +QcPBbja2nRmWshZ2No/UhbWzLW5i1zWn3f42DsI97nW389lKNay3MVuLNbO73sN0t7k9qlRj +BtDe/p4mvpEab2iLteAGPzjCE67whTO84Q5/OMQjjpiAm3Xg/P43xitK8W7XBqQZ/7hAN67v +ct/VtiA/+TzxPW3K7uewrEU5zJv565jT3HMzrznOvXbznPO8ZTvvOdDz9fOgE71a/0MvOtJn +dfSkM91SS2861Iua4u9Gvep+errVs04krGu964KdutfDHiyui73sxgK72dN+UxBTXe1uPzvb +3y53LZF97na3S93vrveu5H3vfg9K3/8u+OSiffCGf0/gD6/4gSR+8Y7fR+MfL3lvRH7ylq9R +4S+v+atUfvOeX1zmPy96knR+9KYPRelPr3oBh371rod8618ve8rHfva2x3zcb697a6R+974v +Qu9/L3wgBH/4xo+gwC7r8eMzH/Uxo+vFmy991icN+i+fPvbpWf2PRj/73ucD4zre/e+T3zvP +5z5lJa7+9bO//e5/P/zjL//5Lzz81ifsal0eOv2Djf8a8/8/sjAYAHKLABYgdQ2guxhg/ilg +GSGgwDBgFDng+S3gAULgCUng9lHg3dwfB/afBR4PBm5gBY6gBjbgB+7fCXogCZrgCkZgCv7f +CwZgC15gDBLgDI5IB+4bDd4gCvKgCpagC/ogDAqhDALhDhohCNZgAhKhDSJhDzrhD7IgFOKI +8jWDEj4gEy7hFBahFHZhEG5hE3rhEYphEmYhFoKhFpLhE6phFH4hG6YYHMahHM4hHdahHd4h +HuahHu4hH/ahH/4hIAaiIA4iIRaiIR4iIiaiIi4iIzaiIz4iJEaiJE4iJVaiJV4iJmaiJm4i +J3aiJ34iKIaiKI4iKZaiKZ4iKqb/oiquIiu2oiu+IizGoizOIi3Woi3eIi7moi7uIi/2oi/+ +IjAGozAOIzEWozEeIzImozIuIzM2ozM+IzRO4AVW4f9R4xrun7RhIz5pozW6Szd64zYOIcuJ +I/qd4cpxYTamYTlmYD6FoG0Q3A8KBjmmoznS491YVjgmjfK5oyPgIz8Chj8iSxX+Yzn5I0Hi +YT7O4xgepDsw5DuWoENGhBtGJP6V3D1+VESGY0LqI0YKZEdyy2FtpJeIH0h+pDdaoUe+W0pa +nJdUXD2yAzqy5IO4pDSmhEOWBUXa4VmhoTmCYE5W5Bhe4Uyu40vCILfpYEuGxwPq303eVVOG +ZEbK5PMd/6VRomQCUuVTmmQAkiQW7iQXIqU0giU7iuT2/aROsp1QzqRZiiU5mmFLEmVNlqFU +vmUO0iVQhiVcag9O5SRVxqMbsiVdcqUIzuUGCuZYBqVF2iVgDiXJbeUkrqVV+iRkjlz/2SMB +fmMYSiZkVpZcGiZj5uVn1iUOQlsbeuUETpY4qgRZhmZifqZlDiZneqBn2uVahuQTYmZgtqZa +vqYhTqZoZuYQbuZvPkhftuEabiZ/mCVWtqVujuZd4uVi9g9z8KVWnmG0taVyVmdNJqcKzqZe +DqdzguZ3PmcGHlUPeqcg+mZ0AqcMqud6jmdzKuZxpiWOaCc7vmd9kud9imd+Qv8EdUamdYKn +O+hneQqoRALoaRroQyrogTLoghIofJonc+KnH6qne/Kn9qAmT0boX8plfO6nFqJnf2LoiH5o +iZJog8rjV6LogoqoKzhoisIoeUalfcqniTYoi+IohEpny60mjyIoIvqmhcroiy6kkSLmfHbm +EbrogO4ohyppjgLpfxLmeDIpjtZmjeYmhTpCRTYlkA5mlHIpXXnpl4amlfbhZKqoZtLniOCm +PvooiHJjA8Ipbbrpj4apVappGvIma97og/JphNrpiGJpy0WhoEYEagKqK2ionwKkfujpPe6T +ojZkOt5koh5qNGaqpm4qp3aqp34qqIaqqI4qqZaqqZ7/KqqmqqquKqu2qqu+KqzGqqzOKq3W +qq3eKq7mqq7uKq/2qq/+KrAGq7AOK7EWq7EeK7Imq7IuK7M2q7M+K7RGq7ROK7VWq7VeK7Zm +q7ZuK7d2q7d+K7i6Ip06CAIYQAAQQEOqw2oJwAKIwQIIQLjGq7zG67gyg7lSobo6iAAUACss +QAKIQQK067wOLMFia722Kb7GzAAKQAAggBggQADAa8FOLMXKKjkIgAEYgMPiR76SQ7kagAIo +QMZurMcaAL92wQCQAwOwQwGg6xcwgLmu7Dl2AcwGQAEcAMfmLACkbADILH5grMbm0wEQADnc +7BckQMQewLlyAdEeAMP+a8VG/63UpqrHKq0BdOxRNWwDkIMCKK3AkkMCQCzUIi0CQKwCqIPE +eoECNKzZ5qsXMEDDKi2/2pM9kW3b4gcCWK26LoA5KK3LdgHRcsHaIsDanq1C/O3UJq7ieird +Zi3WPm7OBsDVAsC9KsTXuhzfksHlgkHlwmTOVm4AbG7kmoO5EsDGFmQXLEDGCqzOLq7rvq4z +Ni7kyu7oYq2kuhzt5qNGOm478q7slis5BO1SdQHE9qznwi7yJq8x5q7vNm/HTm7nHq8XZK7l +um0XRG/tUi5UQi4ACADSTu7xGsAAFIABNID1Ki/6pu8u0i7fHsDaOu/ohm0AjG3chu75Ci7b +BoDh5oEj3Obt0tIu2Xrt7JpD024t63JBAaQD3ArA05LByaovBEcwLdJuub4r82ItxiIu0tos +zrbu22aszyYk3HJw9gLABhtt9kIsATQAzxJAB9Ns0tosAkcsw/qsBN8wDsur0p7uF0DsC+cw +EAfxti6ADb8t4goxEiextLKru6atEnNqCAAAOw== +--------------020504090803020209070803-- + +From pgsql-performance-owner@postgresql.org Mon Jun 12 08:21:13 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 91E539FA430 + for ; + Mon, 12 Jun 2006 08:21:13 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 39541-05 for + ; + Mon, 12 Jun 2006 08:21:08 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.aeccom.com (port-83-236-156-26.static.qsc.de + [83.236.156.26]) + by postgresql.org (Postfix) with ESMTP id 0B8229FA42B + for ; + Mon, 12 Jun 2006 08:21:08 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mail.aeccom.com (Postfix) with ESMTP id F169C1CEC3; + Mon, 12 Jun 2006 13:21:06 +0200 (CEST) +Received: from mail.aeccom.com ([127.0.0.1]) + by localhost (gate6.aeccom.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 06776-03-4; Mon, 12 Jun 2006 13:21:06 +0200 (CEST) +Received: from [192.168.2.247] (dhcp-07.core.aeccom.com [192.168.2.247]) + by mail.aeccom.com (Postfix) with ESMTP id 0D89C1CEBC; + Mon, 12 Jun 2006 13:21:06 +0200 (CEST) +Message-ID: <448D4E21.3010604@aeccom.com> +Date: Mon, 12 Jun 2006 13:21:05 +0200 +From: Sven Geisler +Organization: AEC/communications GmbH +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: "Joshua D. Drake" +CC: mario.splivalo@mobart.hr, "Steinar H. Gunderson" , + pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> + <20060603094355.GA23297@uio.no> + <1150062140.23423.0.camel@localhost.localdomain> + <448CA592.4040506@commandprompt.com> +In-Reply-To: <448CA592.4040506@commandprompt.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: amavisd-new at aeccom.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/129 +X-Sequence-Number: 19486 + +Hi all, + +Joshua D. Drake schrieb: +> Mario Splivalo wrote: +>> Could you point out to some more detailed reading on why Xeons are +>> poorer choice than Opterons when used with PostgreSQL? +> +> It isn't just PostgreSQL. It is any database. Opterons can move memory +> and whole lot faster then Xeons. + +Yes. You can run good old memtest86 and you see the difference. +Here my numbers with memtest86 (blocksize 128 MB). +HP DL580 G3 (4-way XEON MP - DDR RAM) => 670 MByte/sec +FSC RX600 S2 (4-way XEOM MP DC - DDR2-400 PC2-3200) => 1300 MByte/sec +HP DL585 (4-way Opteron DDR2-400 PC2-3200) => 1500 MByte/sec +I used memxfer5b.cpp. + +Cheers Sven. + +From pgsql-performance-owner@postgresql.org Mon Jun 12 11:39:18 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A6A969FA42B + for ; + Mon, 12 Jun 2006 11:39:17 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 61743-01 for + ; + Mon, 12 Jun 2006 11:39:11 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.rentalia.net (mail.rentalia.com [213.192.209.8]) + by postgresql.org (Postfix) with ESMTP id DFAE29F9316 + for ; + Mon, 12 Jun 2006 11:39:11 -0300 (ADT) +Received: (qmail 20852 invoked by uid 514); 12 Jun 2006 16:39:07 +0200 +Received: from 62.37.216.115 by rigodon (envelope-from , + uid 512) with qmail-scanner-1.25-st-qms + (clamdscan: 0.88/1284. spamassassin: 3.0.2. perlscan: 1.25-st-qms. + Clear:RC:0(62.37.216.115):SA:0(-1.1/5.0):. + Processed in 4.763714 secs); 12 Jun 2006 14:39:07 -0000 +X-Antivirus-MYDOMAIN-Mail-From: ruben@rentalia.com via rigodon +X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:0(62.37.216.115):SA:0(-1.1/5.0):. + Processed in 4.763714 secs Process 20599) +Received: from 62-37-216-115.mad1.adsl.uni2.es (HELO ?192.168.2.28?) + (ruben@rentalia.com@62.37.216.115) + by mail.rentalia.net with SMTP; 12 Jun 2006 16:39:02 +0200 +Message-ID: <448D7C81.1000108@rentalia.com> +Date: Mon, 12 Jun 2006 16:38:57 +0200 +From: Ruben Rubio Rey +User-Agent: Mozilla Thunderbird 1.0.8 (X11/20060503) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Posrgres speed problem +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/130 +X-Sequence-Number: 19487 + + +Hi, + +Im having a problem with postgres 8.1.3 on a Fedora Core 3 (kernel +2.6.9-1.667smp) + +I have two similar servers, one in production and another for testing +purposes. +Databases are equal (with a difference of some hours) + +In the testing server, an sql sentence takes arround 1 sec. +In production server (low server load) takes arround 50 secs, and uses +too much resources. + +Explain analyze takes too much load, i had to cancel it! + +Could it be a it a bug? +Any ideas? + +Thanks in advance + + + +From pgsql-performance-owner@postgresql.org Mon Jun 12 11:45:40 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id F40BC9FA42B + for ; + Mon, 12 Jun 2006 11:45:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 58691-10 for + ; + Mon, 12 Jun 2006 11:45:29 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from globalrelay.com (mail1.globalrelay.com [216.18.71.77]) + by postgresql.org (Postfix) with ESMTP id 485579F9316 + for ; + Mon, 12 Jun 2006 11:45:29 -0300 (ADT) +X-Virus-Scanned: Scanned by GRC-AntiVirus Gateway +X-GR-Acctd: YES +Received: from [63.226.156.118] (HELO DaveEMachine) + by globalrelay.com (CommuniGate Pro SMTP 4.2.3) + with ESMTP id 93326344; Mon, 12 Jun 2006 07:45:25 -0700 +From: "Dave Dutcher" +To: "'Ruben Rubio Rey'" , + +Subject: Re: Posrgres speed problem +Date: Mon, 12 Jun 2006 09:45:23 -0500 +Message-ID: <024c01c68e2e$d7441180$8300a8c0@tridecap.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook, Build 10.0.2627 +In-Reply-To: <448D7C81.1000108@rentalia.com> +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +Importance: Normal +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/131 +X-Sequence-Number: 19488 + +Do you run analyze on the production server regularly? + + +> -----Original Message----- +> From: pgsql-performance-owner@postgresql.org +> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of +> Ruben Rubio Rey +> Sent: Monday, June 12, 2006 9:39 AM +> To: pgsql-performance@postgresql.org +> Subject: [PERFORM] Posrgres speed problem +> +> +> +> Hi, +> +> Im having a problem with postgres 8.1.3 on a Fedora Core 3 (kernel +> 2.6.9-1.667smp) +> +> I have two similar servers, one in production and another for testing +> purposes. +> Databases are equal (with a difference of some hours) +> +> In the testing server, an sql sentence takes arround 1 sec. +> In production server (low server load) takes arround 50 secs, +> and uses +> too much resources. +> +> Explain analyze takes too much load, i had to cancel it! +> +> Could it be a it a bug? +> Any ideas? +> +> Thanks in advance +> +> +> +> ---------------------------(end of +> broadcast)--------------------------- +> TIP 3: Have you checked our extensive FAQ? +> + http://www.postgresql.org/docs/faq + + +From pgsql-performance-owner@postgresql.org Mon Jun 12 11:59:13 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 07CC99FA42B + for ; + Mon, 12 Jun 2006 11:59:13 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 62575-04 for + ; + Mon, 12 Jun 2006 11:59:02 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.rentalia.net (mail.rentalia.com [213.192.209.8]) + by postgresql.org (Postfix) with ESMTP id 4D62B9F9316 + for ; + Mon, 12 Jun 2006 11:59:03 -0300 (ADT) +Received: (qmail 19109 invoked by uid 514); 12 Jun 2006 16:58:59 +0200 +Received: from 62.37.216.115 by rigodon (envelope-from , + uid 512) with qmail-scanner-1.25-st-qms + (clamdscan: 0.88/1284. spamassassin: 3.0.2. perlscan: 1.25-st-qms. + Clear:RC:0(62.37.216.115):SA:0(-2.2/5.0):. + Processed in 5.096413 secs); 12 Jun 2006 14:58:59 -0000 +X-Antivirus-MYDOMAIN-Mail-From: ruben@rentalia.com via rigodon +X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:0(62.37.216.115):SA:0(-2.2/5.0):. + Processed in 5.096413 secs Process 18813) +Received: from 62-37-216-115.mad1.adsl.uni2.es (HELO ?192.168.2.28?) + (ruben@rentalia.com@62.37.216.115) + by mail.rentalia.net with SMTP; 12 Jun 2006 16:58:54 +0200 +Message-ID: <448D8129.9010302@rentalia.com> +Date: Mon, 12 Jun 2006 16:58:49 +0200 +From: Ruben Rubio Rey +User-Agent: Mozilla Thunderbird 1.0.8 (X11/20060503) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: =?ISO-8859-1?Q?G=E1briel_=C1kos?= +CC: pgsql-performance@postgresql.org +Subject: Re: Posrgres speed problem +References: <448D7C81.1000108@rentalia.com> <448D7DD9.10400@i-logic.hu> +In-Reply-To: <448D7DD9.10400@i-logic.hu> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/132 +X-Sequence-Number: 19489 + +G�briel �kos wrote: + +> Ruben Rubio Rey wrote: +> +>> +>> Hi, +>> +>> Im having a problem with postgres 8.1.3 on a Fedora Core 3 (kernel +>> 2.6.9-1.667smp) +>> +>> I have two similar servers, one in production and another for testing +>> purposes. +>> Databases are equal (with a difference of some hours) +>> +>> In the testing server, an sql sentence takes arround 1 sec. +>> In production server (low server load) takes arround 50 secs, and +>> uses too much resources. +>> +>> Explain analyze takes too much load, i had to cancel it! +>> +>> Could it be a it a bug? +>> Any ideas? +> +> +> vacuum full analyse the database. +> +> +I use to do it all nights +Its an script with content: + +DIREC=/usr/local/pgsql/bin/ +DIRLOGS=/var/log/rentalia +LOGBIN=/usr/sbin/cronolog +echo "vacuum vacadb..." | $LOGBIN $DIRLOGS/%Y-%m-%d_limpieza.log +date | $LOGBIN $DIRLOGS/%Y-%m-%d_limpieza.log +$DIREC/vacuumdb -f -v --analyze vacadb 2>&1 | $LOGBIN +$DIRLOGS/%Y-%m-%d_limpieza.log +echo "reindex database vacadb;" | $DIREC/psql vacadb 2>&1 | $LOGBIN +$DIRLOGS/%Y-%m-%d_limpieza.log +date | $LOGBIN $DIRLOGS/%Y-%m-%d_limpieza.log + +No errors or warnings are reported. instead repeating it now, I preffer +to wait at tomorrow to check again the logs + +From pgsql-performance-owner@postgresql.org Mon Jun 12 12:02:48 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id F31B79FA430 + for ; + Mon, 12 Jun 2006 12:02:47 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 61679-08 for + ; + Mon, 12 Jun 2006 12:02:41 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.rentalia.net (mail.rentalia.com [213.192.209.8]) + by postgresql.org (Postfix) with ESMTP id 2A6449FA42B + for ; + Mon, 12 Jun 2006 12:02:41 -0300 (ADT) +Received: (qmail 26032 invoked by uid 514); 12 Jun 2006 17:02:38 +0200 +Received: from 62.37.216.115 by rigodon (envelope-from , + uid 512) with qmail-scanner-1.25-st-qms + (clamdscan: 0.88/1284. spamassassin: 3.0.2. perlscan: 1.25-st-qms. + Clear:RC:0(62.37.216.115):SA:0(-2.2/5.0):. + Processed in 5.094653 secs); 12 Jun 2006 15:02:38 -0000 +X-Antivirus-MYDOMAIN-Mail-From: ruben@rentalia.com via rigodon +X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:0(62.37.216.115):SA:0(-2.2/5.0):. + Processed in 5.094653 secs Process 25838) +Received: from 62-37-216-115.mad1.adsl.uni2.es (HELO ?192.168.2.28?) + (ruben@rentalia.com@62.37.216.115) + by mail.rentalia.net with SMTP; 12 Jun 2006 17:02:32 +0200 +Message-ID: <448D8204.80303@rentalia.com> +Date: Mon, 12 Jun 2006 17:02:28 +0200 +From: Ruben Rubio Rey +User-Agent: Mozilla Thunderbird 1.0.8 (X11/20060503) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Jonah H. Harris" +CC: pgsql-performance@postgresql.org +Subject: Re: Posrgres speed problem +References: <448D7C81.1000108@rentalia.com> + <36e682920606120749l7da92ff8k6b9f702029cd5d3a@mail.gmail.com> +In-Reply-To: <36e682920606120749l7da92ff8k6b9f702029cd5d3a@mail.gmail.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/133 +X-Sequence-Number: 19490 + +Jonah H. Harris wrote: + +> On 6/12/06, Ruben Rubio Rey wrote: +> +>> I have two similar servers, one in production and another +>> for testing purposes. In testing server ~1sec ... in +>> production ~50 secs +> +> +> What ver of PostgreSQL? + +Version 8.1.3 + +> Same ver on both systems? + +Yes + +> Are there any +> locks currently held on the resources needed in your Production +> environment? + +How to check it? + +> Have you analyzed both databases? + +I have restores testing server today. Full Analyce included. +Production server all nights is done. (i have posted the script in other +message to the mailing list) + +> Any sequential scans +> running? + +In the table, there is several scans. + +vacadb=# \d grupoforo + Table "public.grupoforo" + Column | Type +| Modifiers +------------------+-----------------------------+--------------------------------------------------------------- + idmensaje | integer | not null default +nextval('grupoforo_idmensaje_seq'::regclass) + idusuario | integer | not null + idgrupo | integer | not null + idmensajetema | integer | not null default -1 + mensaje | character varying(4000) | + asunto | character varying(255) | not null + fechalocal | timestamp without time zone | default now() + webenabled | integer | not null default 1 + por | character varying(255) | + estadocomentario | character(1) | default 'D'::bpchar + idlenguaje | character(2) | default 'ES'::bpchar + fechacreacion | timestamp without time zone | default now() + hijos | integer | + hijoreciente | timestamp without time zone | + valoracion | integer | default 0 + codigo | character varying(100) | +Indexes: + "pk_grupoforo" PRIMARY KEY, btree (idmensaje) + "grupoforo_asunto_idx" btree (asunto) + "grupoforo_codigo_idx" btree (codigo) + "grupoforo_estadocomentario_idx" btree (estadocomentario) + "grupoforo_idgrupo_idx" btree (idgrupo) + "grupoforo_idlenguaje_idx" btree (idlenguaje) + "grupoforo_idmensajetema_idx" btree (idmensajetema) + "grupoforo_idusuario_idx" btree (idusuario) + "idx_grupoforo_webenabled" btree (webenabled) + + +> If so, have you vacuumed? + +Yes. + +> +> Send the explain analyze from your test database. + +Tomorrow morning i ll send it ... now it could be a disaster ... + +> +> + + +From pgsql-performance-owner@postgresql.org Mon Jun 12 12:05:22 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 46C8A9FA42B + for ; + Mon, 12 Jun 2006 12:05:22 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 63613-06 for + ; + Mon, 12 Jun 2006 12:05:12 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) + by postgresql.org (Postfix) with ESMTP id 1D53F9F9316 + for ; + Mon, 12 Jun 2006 12:05:12 -0300 (ADT) +Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) + by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id k5CF57sg041487 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); + Mon, 12 Jun 2006 09:05:09 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: from winnie.fuhr.org (localhost [127.0.0.1]) + by winnie.fuhr.org (8.13.6/8.13.6) with ESMTP id k5CF56gQ050859; + Mon, 12 Jun 2006 09:05:06 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: (from mfuhr@localhost) + by winnie.fuhr.org (8.13.6/8.13.6/Submit) id k5CF56U7050858; + Mon, 12 Jun 2006 09:05:06 -0600 (MDT) (envelope-from mfuhr) +Date: Mon, 12 Jun 2006 09:05:06 -0600 +From: Michael Fuhr +To: Ruben Rubio Rey +Cc: pgsql-performance@postgresql.org +Subject: Re: Posrgres speed problem +Message-ID: <20060612150506.GA50764@winnie.fuhr.org> +References: <448D7C81.1000108@rentalia.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <448D7C81.1000108@rentalia.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/134 +X-Sequence-Number: 19491 + +On Mon, Jun 12, 2006 at 04:38:57PM +0200, Ruben Rubio Rey wrote: +> I have two similar servers, one in production and another for testing +> purposes. +> Databases are equal (with a difference of some hours) +> +> In the testing server, an sql sentence takes arround 1 sec. +> In production server (low server load) takes arround 50 secs, and uses +> too much resources. +> +> Explain analyze takes too much load, i had to cancel it! + +The EXPLAIN ANALYZE output would be helpful, but if you don't want +to run it to completion then please post the output of EXPLAIN +ANALYZE for the fast system and EXPLAIN (without ANALYZE) for the +slow one. + +As someone else asked, are you running ANALYZE regularly? What +about VACUUM? + +-- +Michael Fuhr + +From pgsql-performance-owner@postgresql.org Mon Jun 12 12:15:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7C7689FA42B + for ; + Mon, 12 Jun 2006 12:15:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 65968-04 for + ; + Mon, 12 Jun 2006 12:15:32 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 763289F9316 + for ; + Mon, 12 Jun 2006 12:15:33 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 01C5356441; Mon, 12 Jun 2006 10:15:30 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Mon, 12 Jun 2006 10:15:30 -0500 +Date: Mon, 12 Jun 2006 10:15:30 -0500 +From: "Jim C. Nasby" +To: Gourish Singbal +Cc: pgsql-performance@postgresql.org +Subject: Re: pgsql_tmp and postgres settings +Message-ID: <20060612151530.GR34196@pervasive.com> +References: <20060609122948.6B7419FA621@postgresql.org> + <20060609155953.GX45331@pervasive.com> + <674d1f8a0606112256t71b38395gc894fcbca45afedc@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <674d1f8a0606112256t71b38395gc894fcbca45afedc@mail.gmail.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060612:gourish@gmail.com::nNIudJ4aNTpy/zDn:00000000000000000000 + 0000000000000000000000000T1j +X-Hashcash: + 1:20:060612:pgsql-performance@postgresql.org::Yhb/uJw4sPuyUIfR:00000 + 0000000000000000000000000cHW +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/135 +X-Sequence-Number: 19492 + +On Mon, Jun 12, 2006 at 11:26:23AM +0530, Gourish Singbal wrote: +> Where is the pgsql_tmp folder present ?. i am unable to see it in the data +> directory of postgresql. + +It will be under the *database* directory, under $PGDATA/base. SELECT +oid,* FROM pg_database; will tell you what directory to look in for your +database. + +> On 6/9/06, Jim C. Nasby wrote: +> > +> >On Fri, Jun 09, 2006 at 02:23:04PM +0200, Domenico - Sal. F.lli Riva +> >wrote: +> >> Hello, +> >> +> >> During insert or update, potgresql write in pgsql_tmp directory and so +> >> performance are very poor. +> > +> >pgsql_tmp is used if a query runs out of work_mem, so you can try +> >increasing that. +> > +> >> My configuration is: +> >> +> >> Work mem 10240 +> >> +> >> Effective_cache_size 30000 +> >You're off by a factor of 10. +> > +> >> Shared buffers 9000 +> >I'd suggest bumping that up to at least 30000. +> > +> >> Postgresql (RPM from official website) 8.1.0 +> > +> >You should upgrade to 8.1.4. There's a number of data loss bugs waiting +> >to bite you. +> >-- +> >Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +> >Pervasive Software http://pervasive.com work: 512-231-6117 +> >vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 +> > +> >---------------------------(end of broadcast)--------------------------- +> >TIP 4: Have you searched our list archives? +> > +> > http://archives.postgresql.org +> > +> +> +> +> -- +> Best, +> Gourish Singbal + +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Mon Jun 12 12:18:11 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4AABE9FA42B + for ; + Mon, 12 Jun 2006 12:18:11 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 66079-05 for + ; + Mon, 12 Jun 2006 12:18:00 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id BDADD9F9316 + for ; + Mon, 12 Jun 2006 12:18:01 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 97A2056441; Mon, 12 Jun 2006 10:17:59 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Mon, 12 Jun 2006 10:17:58 -0500 +Date: Mon, 12 Jun 2006 10:17:58 -0500 +From: "Jim C. Nasby" +To: Ruben Rubio Rey +Cc: G?briel ?kos , + pgsql-performance@postgresql.org +Subject: Re: Posrgres speed problem +Message-ID: <20060612151757.GS34196@pervasive.com> +References: <448D7C81.1000108@rentalia.com> <448D7DD9.10400@i-logic.hu> + <448D8129.9010302@rentalia.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <448D8129.9010302@rentalia.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060612:ruben@rentalia.com::0j9vMpOnuz5NG2dy:0000000000000000000 + 00000000000000000000000064DV +X-Hashcash: + 1:20:060612:akos.gabriel@i-logic.hu::XUjqDRe/+7+dfWNq:00000000000000 + 0000000000000000000000004KzR +X-Hashcash: + 1:20:060612:pgsql-performance@postgresql.org::5bcJF/G+TN3K9tMI:00000 + 0000000000000000000000007B8X +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/136 +X-Sequence-Number: 19493 + +On Mon, Jun 12, 2006 at 04:58:49PM +0200, Ruben Rubio Rey wrote: +> $DIREC/vacuumdb -f -v --analyze vacadb 2>&1 | $LOGBIN +> $DIRLOGS/%Y-%m-%d_limpieza.log +> echo "reindex database vacadb;" | $DIREC/psql vacadb 2>&1 | $LOGBIN +> $DIRLOGS/%Y-%m-%d_limpieza.log +> date | $LOGBIN $DIRLOGS/%Y-%m-%d_limpieza.log + +Ugh. Is there some reason you're not using the built-in autovacuum? If +you enable it and cut the thresholds in half you'll most likely never +need to vacuum manually, let alone reindex. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Mon Jun 12 12:22:29 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B97669FA42B + for ; + Mon, 12 Jun 2006 12:22:28 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 66072-02 for + ; + Mon, 12 Jun 2006 12:22:18 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.rentalia.net (mail.rentalia.com [213.192.209.8]) + by postgresql.org (Postfix) with ESMTP id D9A339F9316 + for ; + Mon, 12 Jun 2006 12:22:18 -0300 (ADT) +Received: (qmail 18246 invoked by uid 514); 12 Jun 2006 17:22:14 +0200 +Received: from 62.37.216.115 by rigodon (envelope-from , + uid 512) with qmail-scanner-1.25-st-qms + (clamdscan: 0.88/1284. spamassassin: 3.0.2. perlscan: 1.25-st-qms. + Clear:RC:0(62.37.216.115):SA:0(-2.2/5.0):. + Processed in 4.882579 secs); 12 Jun 2006 15:22:14 -0000 +X-Antivirus-MYDOMAIN-Mail-From: ruben@rentalia.com via rigodon +X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:0(62.37.216.115):SA:0(-2.2/5.0):. + Processed in 4.882579 secs Process 18232) +Received: from 62-37-216-115.mad1.adsl.uni2.es (HELO ?192.168.2.28?) + (ruben@rentalia.com@62.37.216.115) + by mail.rentalia.net with SMTP; 12 Jun 2006 17:22:09 +0200 +Message-ID: <448D869D.5000908@rentalia.com> +Date: Mon, 12 Jun 2006 17:22:05 +0200 +From: Ruben Rubio Rey +User-Agent: Mozilla Thunderbird 1.0.8 (X11/20060503) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Posrgres speed problem +References: <448D7C81.1000108@rentalia.com> <448D7DD9.10400@i-logic.hu> + <448D8129.9010302@rentalia.com> + <20060612151757.GS34196@pervasive.com> +In-Reply-To: <20060612151757.GS34196@pervasive.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/137 +X-Sequence-Number: 19494 + +Jim C. Nasby wrote: + +>On Mon, Jun 12, 2006 at 04:58:49PM +0200, Ruben Rubio Rey wrote: +> +> +>>$DIREC/vacuumdb -f -v --analyze vacadb 2>&1 | $LOGBIN +>>$DIRLOGS/%Y-%m-%d_limpieza.log +>>echo "reindex database vacadb;" | $DIREC/psql vacadb 2>&1 | $LOGBIN +>>$DIRLOGS/%Y-%m-%d_limpieza.log +>>date | $LOGBIN $DIRLOGS/%Y-%m-%d_limpieza.log +>> +>> +> +>Ugh. Is there some reason you're not using the built-in autovacuum? +> +How do I execute built-in autovacuum? + + + +From pgsql-performance-owner@postgresql.org Mon Jun 12 12:24:08 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 624C59FA42B + for ; + Mon, 12 Jun 2006 12:24:08 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 64145-07 for + ; + Mon, 12 Jun 2006 12:23:57 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 7AC0E9F9316 + for ; + Mon, 12 Jun 2006 12:23:58 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 24EE756450; Mon, 12 Jun 2006 10:23:56 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Mon, 12 Jun 2006 10:23:55 -0500 +Date: Mon, 12 Jun 2006 10:23:54 -0500 +From: "Jim C. Nasby" +To: Michael Fuhr +Cc: Ruben Rubio Rey , pgsql-performance@postgresql.org +Subject: Re: Posrgres speed problem +Message-ID: <20060612152354.GT34196@pervasive.com> +References: <448D7C81.1000108@rentalia.com> + <20060612150506.GA50764@winnie.fuhr.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20060612150506.GA50764@winnie.fuhr.org> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: 1:20:060612:mike@fuhr.org::iy9sJ45wE8CLqXjA:00000fqS +X-Hashcash: + 1:20:060612:ruben@rentalia.com::hAQGFt9k6Ohdoigd:0000000000000000000 + 0000000000000000000000005cB2 +X-Hashcash: + 1:20:060612:pgsql-performance@postgresql.org::NOi6taDdn9EdZfIq:00000 + 0000000000000000000000004Qzg +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/138 +X-Sequence-Number: 19495 + +On Mon, Jun 12, 2006 at 09:05:06AM -0600, Michael Fuhr wrote: +> On Mon, Jun 12, 2006 at 04:38:57PM +0200, Ruben Rubio Rey wrote: +> > I have two similar servers, one in production and another for testing +> > purposes. +> > Databases are equal (with a difference of some hours) +> > +> > In the testing server, an sql sentence takes arround 1 sec. +> > In production server (low server load) takes arround 50 secs, and uses +> > too much resources. +> > +> > Explain analyze takes too much load, i had to cancel it! +> +> The EXPLAIN ANALYZE output would be helpful, but if you don't want +> to run it to completion then please post the output of EXPLAIN +> ANALYZE for the fast system and EXPLAIN (without ANALYZE) for the +> slow one. +> +> As someone else asked, are you running ANALYZE regularly? What +> about VACUUM? + +For the next vacuum, can you add the -v (verbose) switch and email the +last few lines of output? + +INFO: free space map contains 39 pages in 56 relations +DETAIL: A total of 896 page slots are in use (including overhead). +896 page slots are required to track all free space. +Current limits are: 20000 page slots, 1000 relations, using 223 KB. +VACUUM +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Mon Jun 12 12:26:02 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DDF939FA42B + for ; + Mon, 12 Jun 2006 12:26:01 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 66114-05 for + ; + Mon, 12 Jun 2006 12:25:54 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 379349F9316 + for ; + Mon, 12 Jun 2006 12:25:56 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id C7DC05649B; Mon, 12 Jun 2006 10:25:53 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Mon, 12 Jun 2006 10:25:53 -0500 +Date: Mon, 12 Jun 2006 10:25:53 -0500 +From: "Jim C. Nasby" +To: Ruben Rubio Rey +Cc: pgsql-performance@postgresql.org +Subject: Re: Posrgres speed problem +Message-ID: <20060612152552.GU34196@pervasive.com> +References: <448D7C81.1000108@rentalia.com> <448D7DD9.10400@i-logic.hu> + <448D8129.9010302@rentalia.com> + <20060612151757.GS34196@pervasive.com> + <448D869D.5000908@rentalia.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <448D869D.5000908@rentalia.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060612:ruben@rentalia.com::sUzPbNgTF1Kjr7M/:0000000000000000000 + 0000000000000000000000001/Qi +X-Hashcash: + 1:20:060612:pgsql-performance@postgresql.org::fQsWbd7jDxaZtM7x:00000 + 0000000000000000000000002Q+6 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/139 +X-Sequence-Number: 19496 + +On Mon, Jun 12, 2006 at 05:22:05PM +0200, Ruben Rubio Rey wrote: +> Jim C. Nasby wrote: +> +> >On Mon, Jun 12, 2006 at 04:58:49PM +0200, Ruben Rubio Rey wrote: +> > +> > +> >>$DIREC/vacuumdb -f -v --analyze vacadb 2>&1 | $LOGBIN +> >>$DIRLOGS/%Y-%m-%d_limpieza.log +> >>echo "reindex database vacadb;" | $DIREC/psql vacadb 2>&1 | $LOGBIN +> >>$DIRLOGS/%Y-%m-%d_limpieza.log +> >>date | $LOGBIN $DIRLOGS/%Y-%m-%d_limpieza.log +> >> +> >> +> > +> >Ugh. Is there some reason you're not using the built-in autovacuum? +> > +> How do I execute built-in autovacuum? + +Make the following changes to postgresql.conf: + +autovacuum = on # enable autovacuum subprocess? +autovacuum_vacuum_threshold = 500 # min # of tuple updates before + # vacuum +autovacuum_analyze_threshold = 200 # min # of tuple updates before +autovacuum_vacuum_scale_factor = 0.2 # fraction of rel size before + # vacuum +autovacuum_analyze_scale_factor = 0.1 # fraction of rel size before +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Mon Jun 12 12:33:31 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C67829FA42B + for ; + Mon, 12 Jun 2006 12:33:30 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 68136-04 for + ; + Mon, 12 Jun 2006 12:33:23 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.aeccom.com (port-83-236-156-26.static.qsc.de + [83.236.156.26]) + by postgresql.org (Postfix) with ESMTP id 351339F9316 + for ; + Mon, 12 Jun 2006 12:33:24 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mail.aeccom.com (Postfix) with ESMTP id 126231CEFF; + Mon, 12 Jun 2006 17:33:22 +0200 (CEST) +Received: from mail.aeccom.com ([127.0.0.1]) + by localhost (gate6.aeccom.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 11042-03-6; Mon, 12 Jun 2006 17:33:21 +0200 (CEST) +Received: from [192.168.2.247] (dhcp-07.core.aeccom.com [192.168.2.247]) + by mail.aeccom.com (Postfix) with ESMTP id 25ED91CEE5; + Mon, 12 Jun 2006 17:33:21 +0200 (CEST) +Message-ID: <448D8940.4050209@aeccom.com> +Date: Mon, 12 Jun 2006 17:33:20 +0200 +From: Sven Geisler +Organization: AEC/communications GmbH +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: Ruben Rubio Rey +CC: pgsql-performance@postgresql.org +Subject: Re: Posrgres speed problem +References: <448D7C81.1000108@rentalia.com> +In-Reply-To: <448D7C81.1000108@rentalia.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: amavisd-new at aeccom.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/140 +X-Sequence-Number: 19497 + +Hi Ruben, + +Ruben Rubio Rey schrieb: +> +> Hi, +> +> Im having a problem with postgres 8.1.3 on a Fedora Core 3 (kernel +> 2.6.9-1.667smp) +> +> I have two similar servers, one in production and another for testing +> purposes. +> Databases are equal (with a difference of some hours) +> +> In the testing server, an sql sentence takes arround 1 sec. +> In production server (low server load) takes arround 50 secs, and uses +> too much resources. +> +> Explain analyze takes too much load, i had to cancel it! +> +> Could it be a it a bug? +> Any ideas? + +How do you load the data to the testing server? (Dump, Copy, etc) +As you wrote the difference are some hours. I think you copy something. + +It is possible that you production database as too much deleted tuples. +Vacuum full does only rebuild the table an not the index. You may also +run reindex on certain tables. I guess, this may the issue if you use +dump/restore to get your production copy. + +Is three a huge difference in the result of this queries: +select relname,relpages,reltuples from pg_class order by relpages desc; +and +select relname,relpages,reltuples from pg_class where relname like +'%index' order by relpages desc; + +Cheers Sven. + +From pgsql-performance-owner@postgresql.org Mon Jun 12 16:41:19 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 21E2D9FA3CD + for ; + Mon, 12 Jun 2006 16:41:19 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 94710-08 for + ; + Mon, 12 Jun 2006 16:41:07 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from peufeu.com (boutiquenumerique.com [82.67.9.10]) + by postgresql.org (Postfix) with ESMTP id 4A87E9FA159 + for ; + Mon, 12 Jun 2006 16:41:07 -0300 (ADT) +Received: (qmail 4316 invoked from network); 12 Jun 2006 21:42:01 +0200 +Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) + by boutiquenumerique.com with SMTP; 12 Jun 2006 21:42:01 +0200 +To: pgsql-performance@postgresql.org +Subject: Interesting slow query +References: <003601c687ce$7aee7b20$7f00a8c0@kicommunication.com> +Message-ID: +Date: Mon, 12 Jun 2006 21:42:00 +0200 +From: PFC +Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <003601c687ce$7aee7b20$7f00a8c0@kicommunication.com> +User-Agent: Opera M2/8.54 (Linux, build 1745) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/141 +X-Sequence-Number: 19498 + + + Here are two ways to phrase a query... the planner choses very different +plans as you will see. Everything is freshly ANALYZEd. + + +EXPLAIN ANALYZE SELECT r.* FROM raw_annonces r LEFT JOIN annonces a ON +a.id=r.id LEFT JOIN archive_data d ON d.id=r.id WHERE a.id IS NULL AND +d.id IS NULL AND r.id >1130306 order by id limit 1; + QUERY +PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (cost=0.00..2.54 rows=1 width=627) (actual time=708.167..708.168 +rows=1 loops=1) + -> Merge Left Join (cost=0.00..128497.77 rows=50539 width=627) +(actual time=708.165..708.165 rows=1 loops=1) + Merge Cond: ("outer".id = "inner".id) + Filter: ("inner".id IS NULL) + -> Merge Left Join (cost=0.00..27918.92 rows=50539 width=627) +(actual time=144.519..144.519 rows=1 loops=1) + Merge Cond: ("outer".id = "inner".id) + Filter: ("inner".id IS NULL) + -> Index Scan using raw_annonces_pkey on raw_annonces r +(cost=0.00..11222.32 rows=50539 width=627) (actual time=0.040..0.040 +rows=1 loops=1) + Index Cond: (id > 1130306) + -> Index Scan using annonces_pkey on annonces a +(cost=0.00..16118.96 rows=65376 width=4) (actual time=0.045..133.272 +rows=65376 loops=1) + -> Index Scan using archive_data_pkey on archive_data d +(cost=0.00..98761.01 rows=474438 width=4) (actual time=0.060..459.995 +rows=474438 loops=1) + Total runtime: 708.316 ms + +EXPLAIN ANALYZE SELECT * FROM raw_annonces r WHERE r.id>1130306 AND NOT +EXISTS( SELECT id FROM annonces WHERE id=r.id ) AND NOT EXISTS( SELECT id + FROM archive_data WHERE id=r.id ) ORDER BY id LIMIT 1; + QUERY +PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (cost=0.00..38.12 rows=1 width=627) (actual time=0.040..0.041 +rows=1 loops=1) + -> Index Scan using raw_annonces_pkey on raw_annonces r +(cost=0.00..481652.07 rows=12635 width=627) (actual time=0.039..0.039 +rows=1 loops=1) + Index Cond: (id > 1130306) + Filter: ((NOT (subplan)) AND (NOT (subplan))) + SubPlan + -> Index Scan using archive_data_pkey on archive_data +(cost=0.00..3.66 rows=1 width=4) (actual time=0.007..0.007 rows=0 loops=1) + Index Cond: (id = $0) + -> Index Scan using annonces_pkey on annonces +(cost=0.00..5.65 rows=1 width=4) (actual time=0.006..0.006 rows=0 loops=1) + Index Cond: (id = $0) + Total runtime: 0.121 ms + + + Ideas ? + +From pgsql-performance-owner@postgresql.org Tue Jun 13 01:06:07 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 553459F9CAA + for ; + Tue, 13 Jun 2006 01:06:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 20144-05 for + ; + Tue, 13 Jun 2006 01:05:54 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from planetmail2.outgw.tn (planetmail2.outgw.tn [193.95.28.39]) + by postgresql.org (Postfix) with ESMTP id 9FA759F9316 + for ; + Tue, 13 Jun 2006 01:05:52 -0300 (ADT) +Received: from smtp2.planet.net.tn (smtp-in.planet.tn [193.95.123.26]) +Received: from MailGateway.planettunisie.com ([193.95.123.23]) + by smtp2.planet.net.tn (Switch-3.1.8/Switch-3.1.7) with ESMTP id + k5CLlADR026492 for ; + Mon, 12 Jun 2006 23:47:10 +0200 (CEST) +Received: from [192.168.0.1] ([196.203.239.215]) (authenticated bits=0) + by MailGateway.planettunisie.com with ESMTP id k5CLm7XC006715 + for ; Mon, 12 Jun 2006 21:48:08 GMT +Message-ID: <448DE0DB.1020107@planet.tn> +Date: Mon, 12 Jun 2006 23:47:07 +0200 +From: Zydoon +User-Agent: Thunderbird 1.5.0.2 (X11/20060501) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> + <20060603094355.GA23297@uio.no> + <1150062140.23423.0.camel@localhost.localdomain> + <448D3B65.7090709@aeccom.com> +In-Reply-To: <448D3B65.7090709@aeccom.com> +X-Enigmail-Version: 0.94.0.0 +OpenPGP: id=8BE92B3F; + url=hkp://subkeys.pgp.net +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/161 +X-Sequence-Number: 19518 + +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +Sven Geisler wrote: +> Hi Mario, +> +> I did run pgbench on several production servers: +> HP DL585 - 4-way AMD Opteron 875 +> HP DL585 - 4-way AMD Opteron 880 +> HP DL580 G3 - 4-way Intel XEON MP 3.0 GHz +> FSC RX600 S2 - 4-way Intel XEON MP DC 2.66 GHz +> FSC RX600 - 4-way Intel XEON MP 2.5 GHz +> +> This test has been done with 8.1.4. I increased the number of clients. +> I attached the result as diagram. I included not all test system but the +> gap between XEON and Opteron is always the same. +> +> The experiences with production systems were the same. We replaced the +> XEON box with Opteron box with a dramatic change of performance. +> +> Best regards +> Sven. +> +> +> Mario Splivalo schrieb: +>> On Sat, 2006-06-03 at 11:43 +0200, Steinar H. Gunderson wrote: +>>> On Sat, Jun 03, 2006 at 10:31:03AM +0100, fzied@planet.tn wrote: +>>>> I do have 2 identical beasts (4G - biproc Xeon 3.2 - 2 Gig NIC) +>>>> One beast will be apache, and the other will be postgres. +>>>> I'm using httperf/autobench for measurments and the best result I +>>>> can get is that my system can handle a trafiic of almost 1600 New +>>>> con/sec. +>>> What version of PostgreSQL? (8.1 is better than 8.0 is much better +>>> than 7.4.) +>>> Have you remembered to turn HT off? Have you considered Opterons +>>> instead of +>>> Xeons? (The Xeons generally scale bad with PostgreSQL.) What kind of +>>> queries +>> +>> Could you point out to some more detailed reading on why Xeons are +>> poorer choice than Opterons when used with PostgreSQL? +>> +>> Mario +>> +>> +>> ---------------------------(end of broadcast)--------------------------- +>> TIP 2: Don't 'kill -9' the postmaster +> +> +> ------------------------------------------------------------------------ +> +> +> ------------------------------------------------------------------------ +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 5: don't forget to increase your free space map settings +Thank you for sharing this. +Coming back to my problem :) A very faithful partner accepted to +gracefully borrow us 3 Pseries (bi-ppc + 2G RAM not more). with linux on +them. +Now I'm trying to make my tests, and I'm not that sure I will make the +switch to the PSeries, since my dual xeon with 4 G RAM can handle 3500 +concurrent postmasters consuming 3.7 G of the RAM. I cannot reach this +number on the PSeries with 2 G. + +can someone give me advice ? +BTW, I promise, at the end of my tests, I'll publish my report. + +- -- +Zied Fakhfakh +GPG Key : gpg --keyserver subkeys.pgp.net --recv-keys F06B55B5 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.3 (GNU/Linux) +Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org + +iD8DBQFEjeDbS1DO7ovpKz8RAnLGAJ96/1ndGoc+HhBvOfrmlQnJcfxa6QCfQK9w +i6/GGUCBGk5pdNUDAmVN5RQ= +=5Mns +-----END PGP SIGNATURE----- + +From pgsql-performance-owner@postgresql.org Mon Jun 12 20:00:29 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7CC499FA4A8 + for ; + Mon, 12 Jun 2006 20:00:29 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 41355-04 for + ; + Mon, 12 Jun 2006 20:00:19 -0300 (ADT) +X-Greylist: delayed 00:31:57.684 by SQLgrey- +Received: from fire1.inventconnect.com (fire1.inventorshelpline.info + [66.155.165.134]) + by postgresql.org (Postfix) with ESMTP id 19CA89FA10A + for ; + Mon, 12 Jun 2006 20:00:20 -0300 (ADT) +Received: from nas1.inventconnect.com (nas.inventconnect.com [192.168.2.30]) + by fire1.inventconnect.com (8.12.8/8.12.8) with ESMTP id k5D03kWE026119 + for ; Mon, 12 Jun 2006 20:03:46 -0400 +Received: from monster1.resolution.com ([192.168.5.100]) + by nas1.inventconnect.com (8.13.1/8.13.1) with ESMTP id k5CKpKXR020809 + for ; Mon, 12 Jun 2006 16:51:20 -0400 +Received: from tigger (tigger [192.168.5.10]) + by monster1.resolution.com (8.13.1/8.13.1) with ESMTP id k5D0ChsZ024964 + for ; Mon, 12 Jun 2006 19:12:43 -0500 +Subject: 64-bit vs 32-bit performance ... backwards? +From: Anthony Presley +To: pgsql-performance@postgresql.org +Content-Type: text/plain +Date: Mon, 12 Jun 2006 17:28:02 -0500 +Message-Id: <1150151282.14661.42.camel@tigger> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) +Content-Transfer-Encoding: 7bit +X-resolutionsystems-MailScanner-Information: Please contact the ISP for more + information +X-resolutionsystems-MailScanner: Found to be clean +X-resolutionsystems-MailScanner-From: anthony@resolution.com +X-PTI-MailScanner-Information: Please contact the ISP for more information +X-PTI-MailScanner: Found to be clean +X-MailScanner-From: anthony@resolution.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/143 +X-Sequence-Number: 19500 + +Hi all! + +I had an interesting discussion today w/ an Enterprise DB developer and +sales person, and was told, twice, that the 64-bit linux version of +Enterprise DB (which is based on the 64-bit version of PostgreSQL 8.1) +is SIGNIFICANTLY SLOWER than the 32-bit version. Since the guys of EDB +are PostgreSQL ..... has anyone seen that the 64-bit is slower than the +32-bit version? + +I was told that the added 32-bits puts a "strain" and extra "overhead" +on the processor / etc.... which actually slows down the pointers and +necessary back-end "stuff" on the database. + +I'm curious if anyone can back this up .... or debunk it. It's about +the polar opposite of everything I've heard from every other database +vendor for the past several years, and would be quite an eye-opener for +me. + +Anyone? + +Thanks. + +-- +Anthony + + +From pgsql-performance-owner@postgresql.org Mon Jun 12 19:53:19 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 22C269FA4A8 + for ; + Mon, 12 Jun 2006 19:53:17 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 40490-05 for + ; + Mon, 12 Jun 2006 19:53:11 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id D79869FA10A + for ; + Mon, 12 Jun 2006 19:53:12 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5CMr8lY013393; + Mon, 12 Jun 2006 18:53:08 -0400 (EDT) +To: PFC +cc: pgsql-performance@postgresql.org +Subject: Re: Interesting slow query +In-reply-to: +References: <003601c687ce$7aee7b20$7f00a8c0@kicommunication.com> + +Comments: In-reply-to PFC + message dated "Mon, 12 Jun 2006 21:42:00 +0200" +Date: Mon, 12 Jun 2006 18:53:08 -0400 +Message-ID: <13392.1150152788@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/142 +X-Sequence-Number: 19499 + +PFC writes: +> Here are two ways to phrase a query... the planner choses very different +> plans as you will see. Everything is freshly ANALYZEd. + +Usually we get complaints the other way around (that the NOT EXISTS +approach is a lot slower). You did not show any statistics, but I +suspect the key point here is that the condition id > 1130306 excludes +most or all of the A and D tables. The planner is not smart about +making transitive inequality deductions, but you could help it along +by adding the implied clauses yourself: + +EXPLAIN ANALYZE SELECT r.* FROM raw_annonces r + LEFT JOIN annonces a ON (a.id=r.id AND a.id > 1130306) + LEFT JOIN archive_data d ON (d.id=r.id AND d.id > 1130306) + WHERE a.id IS NULL AND d.id IS NULL AND r.id > 1130306 + order by id limit 1; + +Whether this is worth doing in your app depends on how often you do +searches at the end of the ID range ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jun 12 20:17:10 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7C9849FA4A8 + for ; + Mon, 12 Jun 2006 20:17:09 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 42728-08 for + ; + Mon, 12 Jun 2006 20:16:58 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by postgresql.org (Postfix) with ESMTP id 367DE9FA10A + for ; + Mon, 12 Jun 2006 20:17:00 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO [192.168.1.27]) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 9572110; Mon, 12 Jun 2006 16:20:09 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: 64-bit vs 32-bit performance ... backwards? +Date: Mon, 12 Jun 2006 16:16:35 -0700 +User-Agent: KMail/1.8 +Cc: Anthony Presley +References: <1150151282.14661.42.camel@tigger> +In-Reply-To: <1150151282.14661.42.camel@tigger> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200606121616.36009.josh@agliodbs.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/144 +X-Sequence-Number: 19501 + +Anthony, + +> I'm curious if anyone can back this up .... or debunk it. It's about +> the polar opposite of everything I've heard from every other database +> vendor for the past several years, and would be quite an eye-opener for +> me. + +I generally see a 20% "free" gain in performance on 64-bit (Opteron, +actually). Possibly EDB is still using ICC to compile, and ICC is bad at +64-bit? + +I have seen some applications which failed to gain any performance from +64-bit, but have never personally dealt with one which was slower. + +-- +--Josh + +Josh Berkus +PostgreSQL @ Sun +San Francisco + +From pgsql-performance-owner@postgresql.org Mon Jun 12 20:19:56 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id AC4AD9FA4A8 + for ; + Mon, 12 Jun 2006 20:19:56 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 40234-10 for + ; + Mon, 12 Jun 2006 20:19:45 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from skunk.mtbrook.bozemanpass.com (unknown [69.145.82.195]) + by postgresql.org (Postfix) with ESMTP id 335DA9FA10A + for ; + Mon, 12 Jun 2006 20:19:46 -0300 (ADT) +Received: from [69.145.82.218] (unknown [69.145.82.218]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by skunk.mtbrook.bozemanpass.com (Postfix) with ESMTP id A28025582AA + for ; + Mon, 12 Jun 2006 16:19:43 -0700 (PDT) +Message-ID: <448DF692.3070906@boreham.org> +Date: Mon, 12 Jun 2006 17:19:46 -0600 +From: David Boreham +Reply-To: david_list@boreham.org +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: 64-bit vs 32-bit performance ... backwards? +References: <1150151282.14661.42.camel@tigger> +In-Reply-To: <1150151282.14661.42.camel@tigger> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/145 +X-Sequence-Number: 19502 + +Anthony Presley wrote: + +>I had an interesting discussion today w/ an Enterprise DB developer and +>sales person, and was told, twice, that the 64-bit linux version of +>Enterprise DB (which is based on the 64-bit version of PostgreSQL 8.1) +>is SIGNIFICANTLY SLOWER than the 32-bit version. Since the guys of EDB +>are PostgreSQL ..... has anyone seen that the 64-bit is slower than the +>32-bit version? +> +>I was told that the added 32-bits puts a "strain" and extra "overhead" +>on the processor / etc.... which actually slows down the pointers and +>necessary back-end "stuff" on the database. +> +>I'm curious if anyone can back this up .... or debunk it. It's about +>the polar opposite of everything I've heard from every other database +>vendor for the past several years, and would be quite an eye-opener for +>me. +> +> +What they are saying is strictly true : 64-bit pointers tend to increase +the working set size +of an application vs. 32-bit pointers. This means that any caches will +have somewhat lower +hit ratio. Also the bytes/s between the CPU and memory will be higher +due to moving those larger pointers. +In the case of a 32-bit OS this also applies to the kernel so the effect +will be system-wide. + +However, an application that needs to work on > around 2G of data will +in the end be +much faster 64-bit due to reduced I/O (it can keep more of the data in +memory). + +I worked on porting a large database application from 32-bit to 64-bit. One +of our customers required us to retain the 32-bit version because of +this phenomenon. + +In measurements I conducted on that application, the performance +difference wasn't +great (10% or so), but it was measurable. This was with Sun Sparc hardware. +It is possible that more modern CPU designs have more efficient 64-bit +implementation than 32-bit, so the opposite might be seen too. + +Whether or not PG would show the same thing I can't say for sure. +Probably it would though. + + + + + + + + + + +From pgsql-performance-owner@postgresql.org Mon Jun 12 20:27:02 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id EE3109FA4A8 + for ; + Mon, 12 Jun 2006 20:27:01 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 45637-01 for + ; + Mon, 12 Jun 2006 20:26:50 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from m.wordtothewise.com (goliath.word-to-the-wise.com + [208.187.80.130]) + by postgresql.org (Postfix) with ESMTP id 8BF229FA10A + for ; + Mon, 12 Jun 2006 20:26:52 -0300 (ADT) +Received: from [10.3.2.7] (184.word-to-the-wise.com [208.187.80.184]) + (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by m.wordtothewise.com (Postfix) with ESMTP id 2BC38106BC + for ; + Mon, 12 Jun 2006 16:26:49 -0700 (PDT) +Mime-Version: 1.0 (Apple Message framework v750) +In-Reply-To: <1150151282.14661.42.camel@tigger> +References: <1150151282.14661.42.camel@tigger> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <54CA6A16-AB42-440D-B5DB-BC43AE283ED8@blighty.com> +Content-Transfer-Encoding: 7bit +From: Steve Atkins +Subject: Re: 64-bit vs 32-bit performance ... backwards? +Date: Mon, 12 Jun 2006 16:26:47 -0700 +To: "Pgsql-Performance ((E-mail))" +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/146 +X-Sequence-Number: 19503 + + +On Jun 12, 2006, at 3:28 PM, Anthony Presley wrote: + +> Hi all! +> +> I had an interesting discussion today w/ an Enterprise DB developer +> and +> sales person, and was told, twice, that the 64-bit linux version of +> Enterprise DB (which is based on the 64-bit version of PostgreSQL 8.1) +> is SIGNIFICANTLY SLOWER than the 32-bit version. Since the guys of +> EDB +> are PostgreSQL ..... has anyone seen that the 64-bit is slower than +> the +> 32-bit version? +> +> I was told that the added 32-bits puts a "strain" and extra "overhead" +> on the processor / etc.... which actually slows down the pointers and +> necessary back-end "stuff" on the database. +> +> I'm curious if anyone can back this up .... or debunk it. It's about +> the polar opposite of everything I've heard from every other database +> vendor for the past several years, and would be quite an eye-opener +> for +> me. +> +> Anyone? + +It's unsurprising for code written with 64 bit pointers ("64 bit +code") to be a little +slower than 32 bit code. The code and data structures are bigger, +more has to +be copied from main memory, fewer cache hits, all those bad things. + +On CPUs with a uniform instructions set in both 32 and 64 bit modes +you're +only likely to see improved performance in 64 bit mode if your code can +take advantage of the larger address space (postgresql doesn't). + +Some x86-esque architectures provide a somewhat different instruction +set in their 64 bit mode, with more programmer visible registers. The +increase in performance they can offer (with the right compiler) can +offset +the reduction due to pointer bloat, in some cases. + +Empirically... postgresql built for 64 bits is marginally slower than +that built +for a 32 bit api on sparc. None of my customers have found 64 bit x86 +systems to be suitable for production use, yet, so I've not tested on +any +of those architectures. + +Cheers, + Steve + +From pgsql-performance-owner@postgresql.org Mon Jun 12 20:35:32 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 1710C9FA4A8 + for ; + Mon, 12 Jun 2006 20:35:32 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 44542-07 for + ; + Mon, 12 Jun 2006 20:35:21 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id C6BBF9FA10A + for ; + Mon, 12 Jun 2006 20:35:17 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5CNZEJj013657; + Mon, 12 Jun 2006 19:35:14 -0400 (EDT) +To: Anthony Presley +cc: pgsql-performance@postgresql.org +Subject: Re: 64-bit vs 32-bit performance ... backwards? +In-reply-to: <1150151282.14661.42.camel@tigger> +References: <1150151282.14661.42.camel@tigger> +Comments: In-reply-to Anthony Presley + message dated "Mon, 12 Jun 2006 17:28:02 -0500" +Date: Mon, 12 Jun 2006 19:35:14 -0400 +Message-ID: <13656.1150155314@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/147 +X-Sequence-Number: 19504 + +Anthony Presley writes: +> I had an interesting discussion today w/ an Enterprise DB developer and +> sales person, and was told, twice, that the 64-bit linux version of +> Enterprise DB (which is based on the 64-bit version of PostgreSQL 8.1) +> is SIGNIFICANTLY SLOWER than the 32-bit version. Since the guys of EDB +> are PostgreSQL ..... has anyone seen that the 64-bit is slower than the +> 32-bit version? + +That is a content-free statement, since they didn't mention what +architectures they are comparing, what compilers (and compiler options) +they are using, or what test cases they are measuring on. + +Theoretically speaking, 64-bit *should* be slower than 32-bit (because +more data to transfer between memory and CPU to accomplish the same +work), except when considering workloads that can profit from having +direct access to more than 4Gb of memory. However the theoretical +advantage is probably completely swamped by implementation details, +ie, how tensely did the designers of your 64-bit chip optimize its +32-bit behavior. + +I believe that Red Hat generally recommends using 32-bit mode for +small-memory applications on PPC machines, because PPC32 is indeed +measurably faster than PPC64, but finds no such advantage on x86_64, +ia64 or s390x. I don't know what applications they tested to come +to that conclusion, though. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jun 12 21:26:40 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 919BF9FA4A8 + for ; + Mon, 12 Jun 2006 21:26:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 48337-10 for + ; + Mon, 12 Jun 2006 21:26:28 -0300 (ADT) +X-Greylist: delayed 00:21:44.467763 by SQLgrey- +Received: from kenobi.snowman.net (kenobi.snowman.net [70.84.9.186]) + by postgresql.org (Postfix) with ESMTP id 953F19FA10A + for ; + Mon, 12 Jun 2006 21:26:30 -0300 (ADT) +Received: by kenobi.snowman.net (Postfix, from userid 1000) + id 4E1C158007; Mon, 12 Jun 2006 19:04:42 -0500 (CDT) +Date: Mon, 12 Jun 2006 20:04:41 -0400 +From: Stephen Frost +To: Anthony Presley +Cc: pgsql-performance@postgresql.org +Subject: Re: 64-bit vs 32-bit performance ... backwards? +Message-ID: <20060613000441.GI8588@kenobi.snowman.net> +Mail-Followup-To: Anthony Presley , + pgsql-performance@postgresql.org +References: <1150151282.14661.42.camel@tigger> +MIME-Version: 1.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; boundary="3T9UM0G5oz8hnqz/" +Content-Disposition: inline +In-Reply-To: <1150151282.14661.42.camel@tigger> +X-Editor: Vim http://www.vim.org/ +X-Info: http://www.snowman.net +X-Operating-System: Linux/2.6.16-1-vserver-686 (i686) +X-Uptime: 19:13:58 up 35 days, 17:09, 20 users, load average: 1.28, 1.45, 1.35 +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/148 +X-Sequence-Number: 19505 + + +--3T9UM0G5oz8hnqz/ +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline + +* Anthony Presley (anthony@resolution.com) wrote: +> I had an interesting discussion today w/ an Enterprise DB developer and +> sales person, and was told, twice, that the 64-bit linux version of +> Enterprise DB (which is based on the 64-bit version of PostgreSQL 8.1) +> is SIGNIFICANTLY SLOWER than the 32-bit version. Since the guys of EDB +> are PostgreSQL ..... has anyone seen that the 64-bit is slower than the +> 32-bit version? + +Alot of it depends on what you're doing in the database, exactly, and +just which 32/64-bit platform is under discussion.. They're not all the +same (not even just amoung the ones Linux runs on :). + +> I was told that the added 32-bits puts a "strain" and extra "overhead" +> on the processor / etc.... which actually slows down the pointers and +> necessary back-end "stuff" on the database. + +That's so hand-wavy that I'd be disinclined to believe the speaker, so +I'll assume you're (poorly) paraphrasing... It's true that running +64bit means that you've got 64bit pointers, which are physically +larger than 32bit pointers. Larger pointers means more effort to keep +track of them, copy them around, etc. This is mitigated on some +platforms (ie: amd64) where there are extra registers available in +'64bit' mode (which is really more than just a 64bit mode of a 32bit +platform, unlike a platform like PPC or sparc). + +> I'm curious if anyone can back this up .... or debunk it. It's about +> the polar opposite of everything I've heard from every other database +> vendor for the past several years, and would be quite an eye-opener for +> me. + +PostgreSQL doesn't generally operate on >2G resident memory. I'm not +sure if it's possible for it to (I havn't really tried to find out, +though I have systems where it'd be possible to want to sort a >2G table +or similar, I don't have the work_mem set high enough for it to try, I +don't think). This is because Postgres lets the OS handle most of the +cacheing, so as long as your OS can see all the memory you have in the +box, that benefit of running 64bit isn't going to be seen on Postgres. +On many other database systems (notably the 800-pound gorillas...) the +database handle the cacheing and so wants to basically have control over +all the memory in the box, which means running 64bit if you have more +than 2G in your system. + +Just my 2c. + + Enjoy, + + Stephen + +--3T9UM0G5oz8hnqz/ +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: Digital signature +Content-Disposition: inline + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.3 (GNU/Linux) + +iD8DBQFEjgEZrzgMPqB3kigRAj/0AKCN36gIOKuIZk9QsiEbnwfglkWZpQCffa1n +UrLoBqE99ctMtKAmXawojwk= +=aik5 +-----END PGP SIGNATURE----- + +--3T9UM0G5oz8hnqz/-- + +From pgsql-performance-owner@postgresql.org Mon Jun 12 21:29:42 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6CC7C9FA5FB + for ; + Mon, 12 Jun 2006 21:29:42 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 85864-01 for + ; + Mon, 12 Jun 2006 21:29:36 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mx00.pub.collaborativefusion.com + (mx00.pub.collaborativefusion.com [206.210.89.199]) + by postgresql.org (Postfix) with ESMTP id B36089FA4A8 + for ; + Mon, 12 Jun 2006 21:29:37 -0300 (ADT) +Received: from localhost (monrovll-cuda1-24-53-251-44.pittpa.adelphia.net + [24.53.251.44]) + (AUTH: LOGIN wmoran, TLS: TLSv1/SSLv3,256bits,AES256-SHA) + by wingspan with esmtp; Mon, 12 Jun 2006 20:29:34 -0400 + id 00056405.448E06EE.00016D60 +Date: Mon, 12 Jun 2006 20:29:33 -0400 +From: Bill Moran +To: Anthony Presley +Cc: pgsql-performance@postgresql.org +Subject: Re: 64-bit vs 32-bit performance ... backwards? +Message-Id: <20060612202933.4d4221b0.wmoran@collaborativefusion.com> +In-Reply-To: <1150151282.14661.42.camel@tigger> +References: <1150151282.14661.42.camel@tigger> +Organization: Collaborative Fusion +X-Mailer: Sylpheed version 1.0.6 (GTK+ 1.2.10; i386-portbld-freebsd6.1) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/149 +X-Sequence-Number: 19506 + +Anthony Presley wrote: + +> Hi all! +> +> I had an interesting discussion today w/ an Enterprise DB developer and +> sales person, and was told, twice, that the 64-bit linux version of +> Enterprise DB (which is based on the 64-bit version of PostgreSQL 8.1) +> is SIGNIFICANTLY SLOWER than the 32-bit version. Since the guys of EDB +> are PostgreSQL ..... has anyone seen that the 64-bit is slower than the +> 32-bit version? +> +> I was told that the added 32-bits puts a "strain" and extra "overhead" +> on the processor / etc.... which actually slows down the pointers and +> necessary back-end "stuff" on the database. +> +> I'm curious if anyone can back this up .... or debunk it. It's about +> the polar opposite of everything I've heard from every other database +> vendor for the past several years, and would be quite an eye-opener for +> me. + +We did some tests on with identical hardware in both EMT64 and ia32 mode. +(Dell 2850, if you're curious) This was PostgreSQL 8.1 running on +FreeBSD 6. + +We found 64 bit to be ~5% slower than 32 bit mode in the (very) limited +tests that we did. We pulled the plug before doing any extensive +testing, because it just didn't seem as if it was going to be worth it. + +-- +Bill Moran + +I already know the ending it's the part that makes your face implode. +I don't know what makes your face implode, but that's the way the movie ends. + + TMBG + + +From pgsql-performance-owner@postgresql.org Mon Jun 12 22:14:49 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7FF269FA10A + for ; + Mon, 12 Jun 2006 22:14:49 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 72563-10 for + ; + Mon, 12 Jun 2006 22:14:43 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from projects.commandprompt.com (host-130.commandprompt.net + [207.173.203.130]) + by postgresql.org (Postfix) with ESMTP id 956249FA4A8 + for ; + Mon, 12 Jun 2006 22:14:44 -0300 (ADT) +Received: from [192.168.1.100] (or-67-76-146-141.sta.sprint-hsd.net + [67.76.146.141]) (authenticated bits=0) + by projects.commandprompt.com (8.13.6/8.13.6) with ESMTP id + k5D1Eaed023433; Mon, 12 Jun 2006 18:14:40 -0700 +Message-ID: <448E11B1.20309@commandprompt.com> +Date: Mon, 12 Jun 2006 18:15:29 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Thunderbird 1.5.0.2 (X11/20060522) +MIME-Version: 1.0 +To: Steve Atkins +CC: "Pgsql-Performance ((E-mail))" +Subject: Re: 64-bit vs 32-bit performance ... backwards? +References: <1150151282.14661.42.camel@tigger> + <54CA6A16-AB42-440D-B5DB-BC43AE283ED8@blighty.com> +In-Reply-To: <54CA6A16-AB42-440D-B5DB-BC43AE283ED8@blighty.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: ClamAV version 0.88.2, + clamav-milter version 0.88.2 on projects.commandprompt.com +X-Virus-Status: Clean +X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by + milter-greylist-1.6 (projects.commandprompt.com + [192.168.2.159]); Mon, 12 Jun 2006 18:14:40 -0700 (PDT) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/150 +X-Sequence-Number: 19507 + + +> Empirically... postgresql built for 64 bits is marginally slower than +> that built +> for a 32 bit api on sparc. None of my customers have found 64 bit x86 +> systems to be suitable for production use, yet, so I've not tested on any +> of those architectures. + +Really? All of our customers are migrating to Opteron and I have many +that have been using Opteron for over 12 months happily. + +Joshua D. Drake + +> +> Cheers, +> Steve +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 3: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq +> + + +-- + + === The PostgreSQL Company: Command Prompt, Inc. === + Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 + Providing the most comprehensive PostgreSQL solutions since 1997 + http://www.commandprompt.com/ + + + +From pgsql-performance-owner@postgresql.org Mon Jun 12 22:29:19 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A56FE9FA4A8 + for ; + Mon, 12 Jun 2006 22:29:19 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 99015-07 for + ; + Mon, 12 Jun 2006 22:29:08 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from m.wordtothewise.com (goliath.word-to-the-wise.com + [208.187.80.130]) + by postgresql.org (Postfix) with ESMTP id 3C9C89FA10A + for ; + Mon, 12 Jun 2006 22:29:10 -0300 (ADT) +Received: from [10.3.2.7] (184.word-to-the-wise.com [208.187.80.184]) + (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by m.wordtothewise.com (Postfix) with ESMTP id 960D5106BC + for ; + Mon, 12 Jun 2006 18:29:07 -0700 (PDT) +Mime-Version: 1.0 (Apple Message framework v750) +In-Reply-To: <448E11B1.20309@commandprompt.com> +References: <1150151282.14661.42.camel@tigger> + <54CA6A16-AB42-440D-B5DB-BC43AE283ED8@blighty.com> + <448E11B1.20309@commandprompt.com> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <1BAED8DB-01CE-4D10-A509-91FB4DF1F04D@blighty.com> +Content-Transfer-Encoding: 7bit +From: Steve Atkins +Subject: Re: 64-bit vs 32-bit performance ... backwards? +Date: Mon, 12 Jun 2006 18:29:05 -0700 +To: "Pgsql-Performance ((E-mail))" +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/151 +X-Sequence-Number: 19508 + + +On Jun 12, 2006, at 6:15 PM, Joshua D. Drake wrote: + +> +>> Empirically... postgresql built for 64 bits is marginally slower +>> than that built +>> for a 32 bit api on sparc. None of my customers have found 64 bit x86 +>> systems to be suitable for production use, yet, so I've not tested +>> on any +>> of those architectures. +> +> Really? All of our customers are migrating to Opteron and I have +> many that have been using Opteron for over 12 months happily. + +An Opteron is 64 bit capable; that doesn't mean you have to run 64 bit +code on it. + +Mine're mostly reasonably conservative users, with hundreds of machines +to support. Using 64 bit capable hardware, such as Opterons, is one +thing, +but using an entirely different linux installation and userspace +code, say, is +a much bigger change in support terms. In the extreme case it makes no +sense to double your OS support overheads to get a single digit +percentage +performance improvement on one database system. + +That's not to say that linux/x86-64 isn't production ready for some +users, just +that it's not necessarily a good operational decision for my +customers. Given +my internal workloads aren't really stressing the hardware they're on +I don't +have much incentive to benchmark x86-64 yet - by the time the numbers +might be useful to me we'll be on a different postgresql, likely a +different +gcc/icc and so on. + +Cheers, + Steve + + +From pgsql-performance-owner@postgresql.org Mon Jun 12 22:50:43 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 929619FA10A + for ; + Mon, 12 Jun 2006 22:50:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 01888-09 for + ; + Mon, 12 Jun 2006 22:50:37 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) + by postgresql.org (Postfix) with ESMTP id 589D59FA4A8 + for ; + Mon, 12 Jun 2006 22:50:39 -0300 (ADT) +Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D1)); Mon, 12 Jun 2006 21:50:31 -0400 +X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by + D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 12 Jun + 2006 21:50:31 -0400 +Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Tue, 13 Jun + 2006 01:50:30 +0000 +User-Agent: Microsoft-Entourage/11.2.3.060209 +Date: Mon, 12 Jun 2006 18:50:27 -0700 +Subject: Re: 64-bit vs 32-bit performance ... backwards? +From: "Luke Lonergan" +To: "Steve Atkins" , + "Pgsql-Performance ((E-mail))" +Message-ID: +Thread-Topic: [PERFORM] 64-bit vs 32-bit performance ... backwards? +Thread-Index: AcaOi74+/MS5Dvp+EdqF7QAWy4o9DA== +In-Reply-To: <1BAED8DB-01CE-4D10-A509-91FB4DF1F04D@blighty.com> +MIME-Version: 1.0 +X-OriginalArrivalTime: 13 Jun 2006 01:50:31.0282 (UTC) + FILETIME=[C0CBD520:01C68E8B] +X-WSS-ID: 6890C66D1N411290829-01-01 +Content-Type: multipart/alternative; + boundary=B_3232983027_1886387 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/152 +X-Sequence-Number: 19509 + +> This message is in MIME format. Since your mail reader does not understand +this format, some or all of this message may not be legible. + +--B_3232983027_1886387 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: 7bit + + +Opteron is ~20% faster at executing code in 64-bit mode than 32-bit because +of the extra registers made available with their 64-bit mode: + http://www.tomshardware.com/2003/04/22/duel_of_the_titans/page7.html + +Doubling the GPRs from 8 to 16 has generally made a 20%-30% difference in +CPU-bound work: + http://www.tomshardware.com/2003/04/22/duel_of_the_titans/page18.html + +If the task is memory bandwidth bound, there should be an advantage to using +less memory for the same task, but if the database is using types that are +the same width for either execution mode, you wouldn't expect a significant +difference just from wider pointer arithmetic. + +- Luke + +--B_3232983027_1886387 +Content-Type: text/html; + charset=us-ascii +Content-Transfer-Encoding: quoted-printable + + + +Re: [PERFORM] 64-bit vs 32-bit performance ... backwards? + + +
+Opteron is ~20% faster at executing code in 64-bit mode than 32-bit because= + of the extra registers made available with their 64-bit mode:
+  http://www.tomshardware.com/2003/04/22/duel_of_the_titans/pa= +ge7.html
+
+Doubling the GPRs from 8 to 16 has generally made a 20%-30% difference in C= +PU-bound work:
+  http://www.tomshardware.com/2003/04/22/duel_of_the_titans/p= +age18.html
+
+If the task is memory bandwidth bound, there should be an advantage to usin= +g less memory for the same task, but if the database is using types that are= + the same width for either execution mode, you wouldn't expect a significant= + difference just from wider pointer arithmetic.
+
+- Luke
+ + + + +--B_3232983027_1886387-- + + +From pgsql-performance-owner@postgresql.org Mon Jun 12 23:16:31 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id F1DC59FA4A8 + for ; + Mon, 12 Jun 2006 23:16:30 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 03698-03 for + ; + Mon, 12 Jun 2006 23:16:20 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.envysolutions.com (mark.mielke.cc [206.248.142.186]) + by postgresql.org (Postfix) with ESMTP id 4A0FB9FA10A + for ; + Mon, 12 Jun 2006 23:16:22 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mail.envysolutions.com (Postfix) with ESMTP id 5C1F31B69A; + Mon, 12 Jun 2006 22:16:27 -0400 (EDT) +Received: from mail.envysolutions.com ([127.0.0.1]) + by localhost (mark.mielke.cc [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 04379-08; Mon, 12 Jun 2006 22:16:27 -0400 (EDT) +Received: by mail.envysolutions.com (Postfix, from userid 500) + id 421F21B69B; Mon, 12 Jun 2006 22:16:27 -0400 (EDT) +Date: Mon, 12 Jun 2006 22:16:27 -0400 +From: mark@mark.mielke.cc +To: Anthony Presley , pgsql-performance@postgresql.org +Subject: Re: 64-bit vs 32-bit performance ... backwards? +Message-ID: <20060613021627.GA4682@mark.mielke.cc> +References: <1150151282.14661.42.camel@tigger> + <20060613000441.GI8588@kenobi.snowman.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20060613000441.GI8588@kenobi.snowman.net> +User-Agent: Mutt/1.4.2.1i +X-Virus-Scanned: amavisd-new at mail.envysolutions.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/153 +X-Sequence-Number: 19510 + +I've been trying to track this stuff - in fact, I'll likely be +switching from AMD32 to AMD64 in the next few weeks. + +I believe I have a handle on the + vs - of 64-bit. It makes sense that +full 64-bit would be slower. At an extreme it halfs the amount of +available memory or doubles the required memory bandwidth, depending +on the work load. + +Has anybody taken a look at PostgreSQL to ensure that it uses 32-bit +integers instead of 64-bit integers where only 32-bit is necessary? +32-bit offsets instead of 64-bit pointers? This sort of thing? + +I haven't. I'm meaning to take a look. Within registers, 64-bit should +be equal speed to 32-bit. Outside the registers, it would make sense +to only deal with the lower 32-bits where 32-bits is all that is +required. + +Cheers, +mark + +-- +mark@mielke.cc / markm@ncf.ca / markm@nortel.com __________________________ +. . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder +|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ | +| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada + + One ring to rule them all, one ring to find them, one ring to bring them all + and in the darkness bind them... + + http://mark.mielke.cc/ + + +From pgsql-performance-owner@postgresql.org Mon Jun 12 23:26:18 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C33AF9FA4A8 + for ; + Mon, 12 Jun 2006 23:26:16 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 06748-01 for + ; + Mon, 12 Jun 2006 23:26:06 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.202]) + by postgresql.org (Postfix) with ESMTP id 86F1D9FA10A + for ; + Mon, 12 Jun 2006 23:26:08 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id i28so1455018nzi + for ; + Mon, 12 Jun 2006 19:26:05 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=Ev3z/KpFZzzAVp3W0H9EZD8TtkSVhq5WBugG1WqpD+k2YTY2+DvZqbamdEYOl0fQFYfbjI8n6Ht5UMQdsa85PzGVuinsdz5weLoezezapXtodzYf0GlOpVwerVPBiQ+QgYu/8pozZu0ztCKxDX98Hh91C3alrJCThOmOv8D/W24= +Received: by 10.36.118.13 with SMTP id q13mr9879394nzc; + Mon, 12 Jun 2006 19:26:05 -0700 (PDT) +Received: by 10.37.18.19 with HTTP; Mon, 12 Jun 2006 19:26:05 -0700 (PDT) +Message-ID: <33c6269f0606121926p15107d2fq9d395460269e2e53@mail.gmail.com> +Date: Mon, 12 Jun 2006 22:26:05 -0400 +From: "Alex Turner" +To: "Steve Atkins" +Subject: Re: 64-bit vs 32-bit performance ... backwards? +Cc: "Pgsql-Performance ((E-mail))" +In-Reply-To: <1BAED8DB-01CE-4D10-A509-91FB4DF1F04D@blighty.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_5687_8014712.1150165565189" +References: <1150151282.14661.42.camel@tigger> + <54CA6A16-AB42-440D-B5DB-BC43AE283ED8@blighty.com> + <448E11B1.20309@commandprompt.com> + <1BAED8DB-01CE-4D10-A509-91FB4DF1F04D@blighty.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/154 +X-Sequence-Number: 19511 + +------=_Part_5687_8014712.1150165565189 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Anyone who has tried x86-64 linux knows what a royal pain in the ass it +is. They didn't do anything sensible, like just make the whole OS 64 bit, +no, they had to split it up, and put 64-bit libs in a new directory /lib64. +This means that a great many applications don't know to check in there for +libs, and don't compile pleasantly, php is one among them. I forget what +others, it's been awhile now. Of course if you actualy want to use more +than 4gig RAM in a pleasant way, it's pretty much essential. + +Alex. + +On 6/12/06, Steve Atkins wrote: +> +> +> On Jun 12, 2006, at 6:15 PM, Joshua D. Drake wrote: +> +> > +> >> Empirically... postgresql built for 64 bits is marginally slower +> >> than that built +> >> for a 32 bit api on sparc. None of my customers have found 64 bit x86 +> >> systems to be suitable for production use, yet, so I've not tested +> >> on any +> >> of those architectures. +> > +> > Really? All of our customers are migrating to Opteron and I have +> > many that have been using Opteron for over 12 months happily. +> +> An Opteron is 64 bit capable; that doesn't mean you have to run 64 bit +> code on it. +> +> Mine're mostly reasonably conservative users, with hundreds of machines +> to support. Using 64 bit capable hardware, such as Opterons, is one +> thing, +> but using an entirely different linux installation and userspace +> code, say, is +> a much bigger change in support terms. In the extreme case it makes no +> sense to double your OS support overheads to get a single digit +> percentage +> performance improvement on one database system. +> +> That's not to say that linux/x86-64 isn't production ready for some +> users, just +> that it's not necessarily a good operational decision for my +> customers. Given +> my internal workloads aren't really stressing the hardware they're on +> I don't +> have much incentive to benchmark x86-64 yet - by the time the numbers +> might be useful to me we'll be on a different postgresql, likely a +> different +> gcc/icc and so on. +> +> Cheers, +> Steve +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: Don't 'kill -9' the postmaster +> + +------=_Part_5687_8014712.1150165565189 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Anyone who has tried x86-64 linux knows what a royal pain in the ass it is.   They didn't do anything sensible, like just make the whole OS 64 bit, no, they had to split it up, and put 64-bit libs in a new directory /lib64.  This means that a great many applications don't know to check in there for libs, and don't compile pleasantly, php is one among them.  I forget what others, it's been awhile now.  Of course if you actualy want to use more than 4gig RAM in a pleasant way, it's pretty much essential. +

Alex.

On 6/12/06, Steve Atkins <steve@blighty.com> wrote:
+
On Jun 12, 2006, at 6:15 PM, Joshua D. Drake wrote:

>
>> Empirically... postgresql built for 64 bits is marginally slower
>> than that built
>> for a 32 bit api on sparc. None of my customers have found 64 bit x86 +
>> systems to be suitable for production use, yet, so I've not tested
>> on any
>> of those architectures.
>
> Really? All of our customers are migrating to Opteron and I have
> many that have been using Opteron for over 12 months happily. +

An Opteron is 64 bit capable; that doesn't mean you have to run 64 bit
code on it.

Mine're mostly reasonably conservative users, with hundreds of machines
to support. Using 64 bit capable hardware, such as Opterons, is one +
thing,
but using an entirely different linux installation and userspace
code, say, is
a much bigger change in support terms. In the extreme case it makes no
sense to double your OS support overheads to get a single digit +
percentage
performance improvement on one database system.

That's not to say that linux/x86-64 isn't production ready for some
users, just
that it's not necessarily a good operational decision for my
+customers. Given
my internal workloads aren't really stressing the hardware they're on
I don't
have much incentive to benchmark x86-64 yet - by the time the numbers
might be useful to me we'll be on a different postgresql, likely a +
different
gcc/icc and so on.

Cheers,
   Steve


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

+ +------=_Part_5687_8014712.1150165565189-- + +From pgsql-performance-owner@postgresql.org Mon Jun 12 23:38:37 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4789D9FA7BA + for ; + Mon, 12 Jun 2006 23:38:36 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 02737-06 for + ; + Mon, 12 Jun 2006 23:38:26 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id 8AB0F9FA4A8 + for ; + Mon, 12 Jun 2006 23:38:28 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id A69473093D; Tue, 13 Jun 2006 04:38:25 +0200 (MET DST) +From: Christopher Browne +X-Newsgroups: pgsql.performance +Subject: Re: 64-bit vs 32-bit performance ... backwards? +Date: Mon, 12 Jun 2006 22:31:57 -0400 +Organization: cbbrowne Computing Inc +Lines: 55 +Message-ID: <87bqsx23c2.fsf@wolfe.cbbrowne.com> +References: <1150151282.14661.42.camel@tigger> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@news.hub.org +X-message-flag: Outlook is rather hackable, isn't it? +X-Home-Page: http://www.cbbrowne.com/info/ +X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne +User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.19 (linux) +Cancel-Lock: sha1:ZAjcnosr1JhoAImpWLsgvHkK17Q= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/155 +X-Sequence-Number: 19512 + +anthony@resolution.com (Anthony Presley) wrote: +> Hi all! +> +> I had an interesting discussion today w/ an Enterprise DB developer and +> sales person, and was told, twice, that the 64-bit linux version of +> Enterprise DB (which is based on the 64-bit version of PostgreSQL 8.1) +> is SIGNIFICANTLY SLOWER than the 32-bit version. Since the guys of EDB +> are PostgreSQL ..... has anyone seen that the 64-bit is slower than the +> 32-bit version? +> +> I was told that the added 32-bits puts a "strain" and extra "overhead" +> on the processor / etc.... which actually slows down the pointers and +> necessary back-end "stuff" on the database. +> +> I'm curious if anyone can back this up .... or debunk it. It's about +> the polar opposite of everything I've heard from every other database +> vendor for the past several years, and would be quite an eye-opener for +> me. +> +> Anyone? + +Traditionally, there has been *some* truth to such assertions. + +Consider: + +1. 64 bit versions of things need to manipulate 64 bit address values +and such; this will bloat up the code somewhat as compared to 32 bit +versions that will be somewhat more compact. + +2. If you only have 2GB of memory, you get no particular advantage +out of 64 bittedness. + +In the days when people had 64 bit Alphas with 256MB of memory, there +was considerable debate about the actual merits of running in 64 bit +mode, and the answers were unobvious. + +On the other hand... + +3. Opterons tend to address memory quite a bit quicker than Intels of +pretty much any variety. + +4. 64 bit CPUs offer additional registers that can be expected to +make register-bound code quicker. + +5. If you have >>2GB of memory, a 64 bit system is needful to harness +that, and that will make a *big* difference to performance. + +The overall claim is somewhat content-free, in the absence of +information about the architecture of the database server. +-- +let name="cbbrowne" and tld="gmail.com" in name ^ "@" ^ tld;; +http://linuxfinances.info/info/ +"A program invented (sic) by a Finnish computer hacker and handed out free +in 1991 cost investors in Microsoft $11 billion (#6.75 billion) this week." +-- Andrew Butcher in the UK's Sunday Times, Feb 20th, 1999 + +From pgsql-performance-owner@postgresql.org Tue Jun 13 00:05:37 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 91BFF9FA5FB + for ; + Tue, 13 Jun 2006 00:05:37 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 15147-02 for + ; + Tue, 13 Jun 2006 00:05:31 -0300 (ADT) +X-Greylist: delayed 00:25:08.134943 by SQLgrey- +Received: from preston.office (mail.eclinic.com.au [203.202.134.251]) + by postgresql.org (Postfix) with ESMTP id 56B129FA10A + for ; + Tue, 13 Jun 2006 00:05:29 -0300 (ADT) +Received: from preston.office (preston [127.0.0.1]) + by preston.office (Postfix) with ESMTP id 6C59E10008A8; + Tue, 13 Jun 2006 12:40:32 +1000 (EST) +Received: from preston.office (preston [127.0.0.1]) + by preston.office (Postfix) with ESMTP id 085EC10008BD; + Tue, 13 Jun 2006 12:40:32 +1000 (EST) +Received: from [192.168.1.28] (shawn.office [192.168.1.28]) + by preston.office (Postfix) with ESMTP id AA7A510008A8; + Tue, 13 Jun 2006 12:40:31 +1000 (EST) +Message-ID: <448E25FB.1080902@eclinic.com.au> +Date: Tue, 13 Jun 2006 12:42:03 +1000 +From: Leigh Dyer +User-Agent: Thunderbird 1.5.0.2 (X11/20060521) +MIME-Version: 1.0 +To: Alex Turner +Cc: Steve Atkins , + "Pgsql-Performance ((E-mail))" +Subject: Re: 64-bit vs 32-bit performance ... backwards? +References: <1150151282.14661.42.camel@tigger> + <54CA6A16-AB42-440D-B5DB-BC43AE283ED8@blighty.com> + <448E11B1.20309@commandprompt.com> + <1BAED8DB-01CE-4D10-A509-91FB4DF1F04D@blighty.com> + <33c6269f0606121926p15107d2fq9d395460269e2e53@mail.gmail.com> +In-Reply-To: <33c6269f0606121926p15107d2fq9d395460269e2e53@mail.gmail.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-AV-Checked: ClamAV using ClamSMTP +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/160 +X-Sequence-Number: 19517 + +Alex Turner wrote: +> Anyone who has tried x86-64 linux knows what a royal pain in the ass it +> is. They didn't do anything sensible, like just make the whole OS 64 +> bit, no, they had to split it up, and put 64-bit libs in a new directory +> /lib64. This means that a great many applications don't know to check +> in there for libs, and don't compile pleasantly, php is one among them. +> I forget what others, it's been awhile now. Of course if you actualy +> want to use more than 4gig RAM in a pleasant way, it's pretty much +> essential. +> +That depends entirely on what AMD64 distribution you use -- on a Debian +or Ubuntu 64-bit system, the main system is pre 64-bit, with some +(optional) add-on libraries in separate directories to provide some +32-bit compatibility. + +On the performance stuff, my own testing of AMD64 on AMD's chips (not +with PostgreSQL, but with various other things) has shown it to be about +10% faster on average. As Luke mentioned, this isn't because of any +inherent advantage in 64-bit -- it's because AMD did some tweaking while +they had the hood open, adding extra registers among other things. + +I remember reading an article some time back comparing AMD's +implementation to Intel's that showed that EM64T Xeons ran 64-bit code +about 5-10% more slowly than they ran 32-bit code. I can't find the link +now, but it may explain why some people are getting better performance +with 64-bit (on Opterons), while others are finding it slower (on Xeons). + +Thanks +Leigh + +> Alex. +> +> On 6/12/06, *Steve Atkins* > wrote: +> +> +> On Jun 12, 2006, at 6:15 PM, Joshua D. Drake wrote: +> +> > +> >> Empirically... postgresql built for 64 bits is marginally slower +> >> than that built +> >> for a 32 bit api on sparc. None of my customers have found 64 +> bit x86 +> >> systems to be suitable for production use, yet, so I've not tested +> >> on any +> >> of those architectures. +> > +> > Really? All of our customers are migrating to Opteron and I have +> > many that have been using Opteron for over 12 months happily. +> +> An Opteron is 64 bit capable; that doesn't mean you have to run 64 bit +> code on it. +> +> Mine're mostly reasonably conservative users, with hundreds of machines +> to support. Using 64 bit capable hardware, such as Opterons, is one +> thing, +> but using an entirely different linux installation and userspace +> code, say, is +> a much bigger change in support terms. In the extreme case it makes no +> sense to double your OS support overheads to get a single digit +> percentage +> performance improvement on one database system. +> +> That's not to say that linux/x86-64 isn't production ready for some +> users, just +> that it's not necessarily a good operational decision for my +> customers. Given +> my internal workloads aren't really stressing the hardware they're on +> I don't +> have much incentive to benchmark x86-64 yet - by the time the numbers +> might be useful to me we'll be on a different postgresql, likely a +> different +> gcc/icc and so on. +> +> Cheers, +> Steve +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: Don't 'kill -9' the postmaster +> +> + + +From pgsql-performance-owner@postgresql.org Mon Jun 12 23:44:17 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 618D49FA4A8 + for ; + Mon, 12 Jun 2006 23:44:17 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 02772-09 for + ; + Mon, 12 Jun 2006 23:44:05 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 869BA9FA10A + for ; + Mon, 12 Jun 2006 23:44:07 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5D2i1YM015369; + Mon, 12 Jun 2006 22:44:02 -0400 (EDT) +To: "Alex Turner" +cc: "Steve Atkins" , + "Pgsql-Performance ((E-mail))" +Subject: Re: 64-bit vs 32-bit performance ... backwards? +In-reply-to: <33c6269f0606121926p15107d2fq9d395460269e2e53@mail.gmail.com> +References: <1150151282.14661.42.camel@tigger> + <54CA6A16-AB42-440D-B5DB-BC43AE283ED8@blighty.com> + <448E11B1.20309@commandprompt.com> + <1BAED8DB-01CE-4D10-A509-91FB4DF1F04D@blighty.com> + <33c6269f0606121926p15107d2fq9d395460269e2e53@mail.gmail.com> +Comments: In-reply-to "Alex Turner" + message dated "Mon, 12 Jun 2006 22:26:05 -0400" +Date: Mon, 12 Jun 2006 22:44:01 -0400 +Message-ID: <15368.1150166641@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/156 +X-Sequence-Number: 19513 + +"Alex Turner" writes: +> Anyone who has tried x86-64 linux knows what a royal pain in the ass it +> is. They didn't do anything sensible, like just make the whole OS 64 bit, +> no, they had to split it up, and put 64-bit libs in a new directory /lib64. + +Actually, there's nothing wrong with that. As this thread already made +clear, there are good reasons why you might want to run 32-bit apps as +well as 64-bit apps on your 64-bit hardware. So the 32-bit libraries +live in /usr/lib and the 64-bit ones in /usr/lib64. If you ask me, the +really serious mistake in this design is they didn't decree separate bin +directories /usr/bin and /usr/bin64 too. This makes it impossible to +install 32-bit and 64-bit versions of the same package at the same time, +something that curiously enough people are now demanding support for. + +(Personally, if I'd designed it, the libraries would actually live in +/usr/lib32 and /usr/lib64, and /usr/lib would be a symlink to whichever +you needed it to be at the moment. Likewise for /usr/bin.) + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jun 12 23:52:11 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DE0229FA5FB + for ; + Mon, 12 Jun 2006 23:52:10 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 09141-02 for + ; + Mon, 12 Jun 2006 23:52:05 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id 209169FA4A8 + for ; + Mon, 12 Jun 2006 23:52:06 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id EB1A13093C; Tue, 13 Jun 2006 04:52:03 +0200 (MET DST) +From: Christopher Browne +X-Newsgroups: pgsql.performance +Subject: Re: 64-bit vs 32-bit performance ... backwards? +Date: Mon, 12 Jun 2006 22:51:42 -0400 +Organization: cbbrowne Computing Inc +Lines: 27 +Message-ID: <87zmghzs1t.fsf@wolfe.cbbrowne.com> +References: <1150151282.14661.42.camel@tigger> + <54CA6A16-AB42-440D-B5DB-BC43AE283ED8@blighty.com> + <448E11B1.20309@commandprompt.com> + <1BAED8DB-01CE-4D10-A509-91FB4DF1F04D@blighty.com> + <33c6269f0606121926p15107d2fq9d395460269e2e53@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Complaints-To: usenet@news.hub.org +X-message-flag: Outlook is rather hackable, isn't it? +X-Home-Page: http://www.cbbrowne.com/info/ +X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne +User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.19 (linux) +Cancel-Lock: sha1:yCCfuKmze5uXiwilwgfLOfZkyQ8= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/157 +X-Sequence-Number: 19514 + +Martha Stewart called it a Good Thing when armtuk@gmail.com ("Alex Turner") wrote: +> Anyone who has tried x86-64 linux knows what a royal pain in the ass +> it is.�� They didn't do anything sensible, like just make the whole +> OS 64 bit, no, they had to split it up, and put 64-bit libs in a new +> directory /lib64.� This means that a great many applications don't +> know to check in there for libs, and don't compile pleasantly, php +> is one among them.� I forget what others, it's been awhile now.� Of +> course if you actualy want to use more than 4gig RAM in a pleasant +> way, it's pretty much essential. Alex. + +That's absolute nonsense. + +I have been running the Debian AMD64 port since I can't recall when. +I have experienced NO such issues. + +Packages simply install, in most cases. + +When I do need to compile things, they *do* compile pleasantly. + +I seem to recall hearing there being "significant issues" as to how +Red Hat's distributions of Linux coped with AMD64. That's not a +problem with Linux, of course... +-- +"cbbrowne","@","gmail.com" +http://linuxdatabases.info/info/spreadsheets.html +"Imagine a law so stupid that civil obedience becomes an efficient way +to fighting it" --Per Abrahamsen on the DMCA + +From pgsql-performance-owner@postgresql.org Mon Jun 12 23:57:53 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 885B99FAE4E + for ; + Mon, 12 Jun 2006 23:57:53 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 06116-05 for + ; + Mon, 12 Jun 2006 23:57:43 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) + by postgresql.org (Postfix) with ESMTP id 19C239FABE7 + for ; + Mon, 12 Jun 2006 23:57:44 -0300 (ADT) +Received: from 172.16.1.25 by mail.Mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D1)); Mon, 12 Jun 2006 22:57:36 -0400 +X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by + D01HOST03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 12 Jun + 2006 22:57:36 -0400 +Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Tue, 13 Jun + 2006 02:57:35 +0000 +User-Agent: Microsoft-Entourage/11.2.3.060209 +Date: Mon, 12 Jun 2006 19:57:32 -0700 +Subject: Re: 64-bit vs 32-bit performance ... backwards? +From: "Luke Lonergan" +To: mark@mark.mielke.cc, "Anthony Presley" , + pgsql-performance@postgresql.org +Message-ID: +Thread-Topic: [PERFORM] 64-bit vs 32-bit performance ... backwards? +Thread-Index: AcaOlR1UXBJCOPqIEdqqSwAWy4o9DA== +In-Reply-To: <20060613021627.GA4682@mark.mielke.cc> +MIME-Version: 1.0 +X-OriginalArrivalTime: 13 Jun 2006 02:57:36.0228 (UTC) + FILETIME=[1FD9DA40:01C68E95] +X-WSS-ID: 6890F62A1N411311116-01-01 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/158 +X-Sequence-Number: 19515 + +Mark, + +On 6/12/06 7:16 PM, "mark@mark.mielke.cc" wrote: + +> I haven't. I'm meaning to take a look. Within registers, 64-bit should +> be equal speed to 32-bit. Outside the registers, it would make sense +> to only deal with the lower 32-bits where 32-bits is all that is +> required. + +The short answer to all of this as shown in many lab tests by us and +elsewhere (see prior post): + +- 64-bit pgsql on Opteron is generally faster than 32-bit, often by a large +amount (20%-30%) on queries that perform sorting, aggregation, etc. It's +generally not slower. + +- 64-bit pgsql on Xeon is generally slower than 32-bit by about 5% + +So if you have Opterons and you want the best performance, run in 64-bit. +If you have Xeons, you would only run in 64-bit if you use more than 4GB of +memory. + +- Luke + + + +From pgsql-performance-owner@postgresql.org Tue Jun 13 00:00:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2CCB39FAD5A + for ; + Tue, 13 Jun 2006 00:00:55 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 07817-06 for + ; + Tue, 13 Jun 2006 00:00:46 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail6.sea5.speakeasy.net (mail6.sea5.speakeasy.net + [69.17.117.8]) by postgresql.org (Postfix) with ESMTP id 1080B9FACFE + for ; + Tue, 13 Jun 2006 00:00:43 -0300 (ADT) +Received: (qmail 31405 invoked from network); 13 Jun 2006 03:00:42 -0000 +Received: from dsl093-038-250.pdx1.dsl.speakeasy.net (HELO [192.168.1.21]) + (davidw@[66.93.38.250]) (envelope-sender ) + by mail6.sea5.speakeasy.net (qmail-ldap-1.03) with RC4-SHA encrypted + SMTP for ; 13 Jun 2006 03:00:42 -0000 +In-Reply-To: <15368.1150166641@sss.pgh.pa.us> +References: <1150151282.14661.42.camel@tigger> + <54CA6A16-AB42-440D-B5DB-BC43AE283ED8@blighty.com> + <448E11B1.20309@commandprompt.com> + <1BAED8DB-01CE-4D10-A509-91FB4DF1F04D@blighty.com> + <33c6269f0606121926p15107d2fq9d395460269e2e53@mail.gmail.com> + <15368.1150166641@sss.pgh.pa.us> +Mime-Version: 1.0 (Apple Message framework v750) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <6B4AA0AB-D851-4E60-B072-5B85C8EB4829@kineticode.com> +Cc: "Alex Turner" , "Steve Atkins" , + "Pgsql-Performance ((E-mail))" +Content-Transfer-Encoding: 7bit +From: David Wheeler +Subject: Re: 64-bit vs 32-bit performance ... backwards? +Date: Mon, 12 Jun 2006 20:00:37 -0700 +To: Tom Lane +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/159 +X-Sequence-Number: 19516 + +On Jun 12, 2006, at 19:44, Tom Lane wrote: + +> (Personally, if I'd designed it, the libraries would actually live in +> /usr/lib32 and /usr/lib64, and /usr/lib would be a symlink to +> whichever +> you needed it to be at the moment. Likewise for /usr/bin.) + +/me nominates Tom to create a Linux distribution. + +:-) + +David + +From pgsql-performance-owner@postgresql.org Tue Jun 13 01:34:11 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 441809F9CAA + for ; + Tue, 13 Jun 2006 01:34:10 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 23323-03 for + ; + Tue, 13 Jun 2006 01:34:05 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by postgresql.org (Postfix) with ESMTP id 8248C9F9316 + for ; + Tue, 13 Jun 2006 01:34:05 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO + spooky.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 9573546; Mon, 12 Jun 2006 21:37:16 -0700 +From: Josh Berkus +Organization: PostgreSQL @ Sun +To: pgsql-performance@postgresql.org +Subject: Re: 64-bit vs 32-bit performance ... backwards? +Date: Mon, 12 Jun 2006 21:34:07 -0700 +User-Agent: KMail/1.8.2 +Cc: Leigh Dyer , Alex Turner , + Steve Atkins +References: <1150151282.14661.42.camel@tigger> + <33c6269f0606121926p15107d2fq9d395460269e2e53@mail.gmail.com> + <448E25FB.1080902@eclinic.com.au> +In-Reply-To: <448E25FB.1080902@eclinic.com.au> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200606122134.07510.josh@agliodbs.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/162 +X-Sequence-Number: 19519 + +Folks, + +FWIW, the applications where I did direct 32 / 64 comparison were +a) several data warehouse tests, with databases > 100GB +b) computation-heavy applications (such as a complex calendaring app) + +And, as others have pointed out, I wasn't comparing generics; I was comparing +Athalon/Xeon to Opteron. So it's quite possible that the improvements had +nothing to do with going 64-bit and were because of other architecture +improvements. + +In which case, why was 64-bit such a big deal? + +-- +Josh Berkus +PostgreSQL @ Sun +San Francisco + +From pgsql-performance-owner@postgresql.org Tue Jun 13 04:00:46 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E52D39F9CAA + for ; + Tue, 13 Jun 2006 04:00:45 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 37971-08 for + ; + Tue, 13 Jun 2006 04:00:42 -0300 (ADT) +X-Greylist: delayed 00:59:57.97449 by SQLgrey- +Received: from mx1.neopolitan.us (mx1.neopolitan.us [65.87.16.224]) + by postgresql.org (Postfix) with ESMTP id 041839F9316 + for ; + Tue, 13 Jun 2006 04:00:40 -0300 (ADT) +Received: from [71.131.255.89] (account jrogers@neopolitan.com HELO + [192.168.2.87]) by mx1.neopolitan.us (CommuniGate Pro SMTP 4.2.10) + with ESMTP-TLS id 13191539 for pgsql-performance@postgresql.org; + Mon, 12 Jun 2006 23:00:40 -0700 +Mime-Version: 1.0 (Apple Message framework v750) +In-Reply-To: <448E11B1.20309@commandprompt.com> +References: <1150151282.14661.42.camel@tigger> + <54CA6A16-AB42-440D-B5DB-BC43AE283ED8@blighty.com> + <448E11B1.20309@commandprompt.com> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <31554317-AD3E-4D08-92DC-7958E46A0D47@neopolitan.com> +Content-Transfer-Encoding: 7bit +From: "J. Andrew Rogers" +Subject: Re: 64-bit vs 32-bit performance ... backwards? +Date: Mon, 12 Jun 2006 23:00:38 -0700 +To: "Pgsql-Performance ((E-mail))" +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/167 +X-Sequence-Number: 19524 + + +On Jun 12, 2006, at 6:15 PM, Joshua D. Drake wrote: +>> Empirically... postgresql built for 64 bits is marginally slower +>> than that built +>> for a 32 bit api on sparc. None of my customers have found 64 bit x86 +>> systems to be suitable for production use, yet, so I've not tested +>> on any +>> of those architectures. +> +> Really? All of our customers are migrating to Opteron and I have +> many that have been using Opteron for over 12 months happily. + + + +We have been using PostgreSQL on Opteron servers almost since the +Opteron was first released, running both 32-bit and 64-bit versions +of Linux. Both 32-bit and 64-bit versions have been bulletproof for +us, with the usual stability I've become accustomed to with both +PostgreSQL and Linux. We have been running nothing but 64-bit +versions on mission-critical systems for the last year with zero +problems. + +The short story is that for us 64-bit PostgreSQL on Opterons is +typically something like 20% faster than 32-bit on the same, and +*much* faster than P4 Xeon systems they nominally compete with. +AMD64 is a more efficient architecture than x86 in a number of ways, +and the Opteron has enviable memory latency and bandwidth that make +it an extremely efficient database workhorse. x86->AMD64 is not a +word-width migration, it is a different architecture cleverly +designed to be efficiently compatible with x86. In addition to +things like a more RISC-like register set, AMD64 uses a different +floating point architecture that is more efficient than the old x87. + +In terms of bang for the buck in a bulletproof database server, it is +really hard to argue with 64-bit Opterons. They are damn fast, and +in my experience problem free. We run databases on other +architectures, but they are all getting replaced with 64-bit Linux on +Opterons because the AMD64 systems tend to be both faster and +cheaper. Architectures like Sparc have never given us problems, but +they have not exactly thrilled us with their performance either. + + +Cheers, + +J. Andrew Rogers + + +From pgsql-performance-owner@postgresql.org Tue Jun 13 03:27:38 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 680039F9CAA + for ; + Tue, 13 Jun 2006 03:27:37 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 32238-10 for + ; + Tue, 13 Jun 2006 03:27:27 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moonunit2.moonview.localnet (wsip-70-167-125-69.sd.sd.cox.net + [70.167.125.69]) + by postgresql.org (Postfix) with ESMTP id ADC1F9F9316 + for ; + Tue, 13 Jun 2006 03:27:26 -0300 (ADT) +Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) + by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id + k5D6dI68032754 + for ; Mon, 12 Jun 2006 23:39:18 -0700 +Message-ID: <448E5A92.9050206@modgraph-usa.com> +Date: Mon, 12 Jun 2006 23:26:26 -0700 +From: "Craig A. James" +User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: function not called if part of aggregate +References: <448C505C.2080504@modgraph-usa.com> + <87ac8jfu7t.fsf@stark.xeocode.com> +In-Reply-To: <87ac8jfu7t.fsf@stark.xeocode.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/163 +X-Sequence-Number: 19520 + +Greg Stark wrote: +> However that's not enough to explain what you've shown. How about you show the +> actual query and actual plan you're working with? The plan you've shown can't +> result from the query you sent. + +Mea culpa, sort of. But ... in fact, the plan I sent *was* from query I sent, with the table/column names changed for clarity. This time I'll send the plan "raw". (This is PG 8.0.1.) + +chm=> explain select count(1) from (select normalize_add_salt(smiles) from +chm(> salt_smiles order by db_no) as foo; + QUERY PLAN +---------------------------------------------------------------------------------------------------- + Aggregate (cost=69.95..69.95 rows=1 width=0) + -> Subquery Scan foo (cost=0.00..67.93 rows=806 width=0) + -> Index Scan using salt_smiles_pkey on salt_smiles (cost=0.00..59.87 rows=806 width=30) +(3 rows) + +As pointed out by Tom and others, this query DOES in fact call the normalize_add_salt() function. + +Now here's the weird part. (And where my original posting went wrong -- sorry for the error! I got the two queries mixed up.) + +I originally had a more complex query, the purpose being to guarantee that the function was called on the strings in the order specified. (More on this below.) Here is the original query I used: + +chm=> explain select count(1) from (select normalize_add_salt(smiles) +chm(> from (select smiles from salt_smiles order by db_no) as foo) as bar; + QUERY PLAN +---------------------------------------------------------------------------------------------------- + Aggregate (cost=67.94..67.94 rows=1 width=0) + -> Subquery Scan foo (cost=0.00..65.92 rows=806 width=0) + -> Index Scan using salt_smiles_pkey on salt_smiles (cost=0.00..57.86 rows=806 width=30) +(3 rows) + +Notice that the plans are essentially identical, yet in this one the function does NOT get called. I proved this by brute force, inserting "char **p = NULL; *p = "foo";" into the C code to guarantee a segmentation violation if the function gets called. In the first case it does SIGSEGV, and in the second case it does not. + +Now the reason for this more-complex query with an additional subselect is that the SMILES (which, by the way, are a lexical way of representing chemical structures - see www.daylight.com), must be passed to the function in a particular order (hence the ORDER BY). In retrospect I realize the optimizer apparently flattens this query anyway (hence the identical plans, above). + +But the weird thing is that, in spite of flattening, which would appear to make the queries equivalent, the function gets called in one case, and not in the other. + +Steinar H. Gunderson asked: +>> select count(1) from (select foo_init(value) from foo_init_table order by +>> value_id) as foo; +> Why not just count(foo_init(value))? + +Because the SMILES must be processed in a specific order, hence the more complex queries. + +The simple answer to this whole problem is what Steinar wrote: +>>This works well, but it requires me to actually retrieve the function's +>>value 800 times. +> +> Is this actually a problem? + +No, it's just a nuisance. It occurs to me that in spite of the ORDER BY expression, Postgres is free to evaluate the function first, THEN sort the results, which means the SMILES would be processed in random order anyway. I.e. my ORDER BY clause is useless for the intended purpose. + +So the only way I can see to get this right is to pull the SMILES into my application with the ORDER BY to ensure I have them in the correct order, then send them back one at a time via a "select normalize_add_salt(smiles)", meaning I'll retrieve 800 strings and then send them back. + +I just thought there ought to be a way to do this all on the PG server instead of sending all these strings back and forth. I'd like to say to Postgres, "Just do it this way, OK?" But the optimizer can't be turned off, so I guess I have to do it the slow way. The good news is that this is just an initialization step, after which I typically process thousands of molecules, so the extra overhead won't kill me. + +Thanks to all for your help. + +Craig + +From pgsql-performance-owner@postgresql.org Tue Jun 13 03:31:12 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DE3E19F9CAA + for ; + Tue, 13 Jun 2006 03:31:11 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 35904-05 for + ; + Tue, 13 Jun 2006 03:31:07 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by postgresql.org (Postfix) with ESMTP id 443819F9316 + for ; + Tue, 13 Jun 2006 03:31:06 -0300 (ADT) +Received: from [2001:700:300:dc0f:216:3eff:fe40:5a47] (helo=trofast.sesse.net) + by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1Fq2Qa-00080d-ER + for pgsql-performance@postgresql.org; Tue, 13 Jun 2006 08:31:05 +0200 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1Fq2QV-0001g3-00 + for ; Tue, 13 Jun 2006 08:30:59 +0200 +Date: Tue, 13 Jun 2006 08:30:59 +0200 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Placement of 64-bit libraries (offtopic) +Message-ID: <20060613063059.GA6316@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <1150151282.14661.42.camel@tigger> + <54CA6A16-AB42-440D-B5DB-BC43AE283ED8@blighty.com> + <448E11B1.20309@commandprompt.com> + <1BAED8DB-01CE-4D10-A509-91FB4DF1F04D@blighty.com> + <33c6269f0606121926p15107d2fq9d395460269e2e53@mail.gmail.com> + <15368.1150166641@sss.pgh.pa.us> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +In-Reply-To: <15368.1150166641@sss.pgh.pa.us> +X-Operating-System: Linux 2.6.16trofastxen on a x86_64 +X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/164 +X-Sequence-Number: 19521 + +On Mon, Jun 12, 2006 at 10:44:01PM -0400, Tom Lane wrote: +> (Personally, if I'd designed it, the libraries would actually live in +> /usr/lib32 and /usr/lib64, and /usr/lib would be a symlink to whichever +> you needed it to be at the moment. Likewise for /usr/bin.) + +Actually, there have been plans for doing something like this in Debian for a +while: Let stuff live in /lib/i686-linux-gnu and /lib/x86_64-linux-gnu +(lib32 and lib64 doesn't really scale, once you start considering stuff like +"ia64 can emulate hppa"), and adjust paths and symlinks as fit. It's still a +long way to go, though. + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Tue Jun 13 03:37:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 90C809F9CAA + for ; + Tue, 13 Jun 2006 03:37:54 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 36304-06 for + ; + Tue, 13 Jun 2006 03:37:49 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.rentalia.net (mail.rentalia.com [213.192.209.8]) + by postgresql.org (Postfix) with ESMTP id CA65B9F9316 + for ; + Tue, 13 Jun 2006 03:37:48 -0300 (ADT) +Received: (qmail 15391 invoked by uid 514); 13 Jun 2006 08:37:46 +0200 +Received: from 62.37.216.115 by rigodon (envelope-from , + uid 512) with qmail-scanner-1.25-st-qms + (clamdscan: 0.88/1284. spamassassin: 3.0.2. perlscan: 1.25-st-qms. + Clear:RC:0(62.37.216.115):SA:0(-2.2/5.0):. + Processed in 4.731492 secs); 13 Jun 2006 06:37:46 -0000 +X-Antivirus-MYDOMAIN-Mail-From: ruben@rentalia.com via rigodon +X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:0(62.37.216.115):SA:0(-2.2/5.0):. + Processed in 4.731492 secs Process 15373) +Received: from 62-37-216-115.mad1.adsl.uni2.es (HELO ?192.168.2.28?) + (ruben@rentalia.com@62.37.216.115) + by mail.rentalia.net with SMTP; 13 Jun 2006 08:37:41 +0200 +Message-ID: <448E5D30.6010600@rentalia.com> +Date: Tue, 13 Jun 2006 08:37:36 +0200 +From: Ruben Rubio Rey +User-Agent: Mozilla Thunderbird 1.0.8 (X11/20060503) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Jim C. Nasby" , + pgsql-performance@postgresql.org +Subject: Re: Posrgres speed problem +References: <448D7C81.1000108@rentalia.com> + <20060612150506.GA50764@winnie.fuhr.org> + <20060612152354.GT34196@pervasive.com> +In-Reply-To: <20060612152354.GT34196@pervasive.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/165 +X-Sequence-Number: 19522 + +Jim C. Nasby wrote: + +>On Mon, Jun 12, 2006 at 09:05:06AM -0600, Michael Fuhr wrote: +> +> +>>On Mon, Jun 12, 2006 at 04:38:57PM +0200, Ruben Rubio Rey wrote: +>> +>> +>>>I have two similar servers, one in production and another for testing +>>>purposes. +>>>Databases are equal (with a difference of some hours) +>>> +>>>In the testing server, an sql sentence takes arround 1 sec. +>>>In production server (low server load) takes arround 50 secs, and uses +>>>too much resources. +>>> +>>>Explain analyze takes too much load, i had to cancel it! +>>> +>>> +>>The EXPLAIN ANALYZE output would be helpful, but if you don't want +>>to run it to completion then please post the output of EXPLAIN +>>ANALYZE for the fast system and EXPLAIN (without ANALYZE) for the +>>slow one. +>> +>>As someone else asked, are you running ANALYZE regularly? What +>>about VACUUM? +>> +>> +> +>For the next vacuum, can you add the -v (verbose) switch and email the +>last few lines of output? +> +>INFO: free space map contains 39 pages in 56 relations +>DETAIL: A total of 896 page slots are in use (including overhead). +>896 page slots are required to track all free space. +>Current limits are: 20000 page slots, 1000 relations, using 223 KB. +>VACUUM +> +> +INFO: free space map contains 1624 pages in 137 relations +DETAIL: A total of 3200 page slots are in use (including overhead). +3200 page slots are required to track all free space. +Current limits are: 20000 page slots, 1000 relations, using 182 KB. + + +From pgsql-performance-owner@postgresql.org Tue Jun 13 03:44:52 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4584A9F9CAA + for ; + Tue, 13 Jun 2006 03:44:52 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 35532-09 for + ; + Tue, 13 Jun 2006 03:44:44 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.rentalia.net (mail.rentalia.com [213.192.209.8]) + by postgresql.org (Postfix) with ESMTP id B65919F9316 + for ; + Tue, 13 Jun 2006 03:44:43 -0300 (ADT) +Received: (qmail 18862 invoked by uid 514); 13 Jun 2006 08:44:41 +0200 +Received: from 62.37.216.115 by rigodon (envelope-from , + uid 512) with qmail-scanner-1.25-st-qms + (clamdscan: 0.88/1284. spamassassin: 3.0.2. perlscan: 1.25-st-qms. + Clear:RC:0(62.37.216.115):SA:0(-2.2/5.0):. + Processed in 4.707879 secs); 13 Jun 2006 06:44:41 -0000 +X-Antivirus-MYDOMAIN-Mail-From: ruben@rentalia.com via rigodon +X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:0(62.37.216.115):SA:0(-2.2/5.0):. + Processed in 4.707879 secs Process 18848) +Received: from 62-37-216-115.mad1.adsl.uni2.es (HELO ?192.168.2.28?) + (ruben@rentalia.com@62.37.216.115) + by mail.rentalia.net with SMTP; 13 Jun 2006 08:44:37 +0200 +Message-ID: <448E5ECF.5090100@rentalia.com> +Date: Tue, 13 Jun 2006 08:44:31 +0200 +From: Ruben Rubio Rey +User-Agent: Mozilla Thunderbird 1.0.8 (X11/20060503) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Posrgres speed problem - solved? +References: <448D7C81.1000108@rentalia.com> <448D8940.4050209@aeccom.com> +In-Reply-To: <448D8940.4050209@aeccom.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/166 +X-Sequence-Number: 19523 + +Tonight database has been vacumm full and reindex (all nights database +do it) + +Now its working fine. Speed is as spected. I ll be watching that sql ... +Maybe the problem exists when database is busy, or maybe its solved ... + +From pgsql-performance-owner@postgresql.org Tue Jun 13 05:11:40 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 02BDA9F9CAA + for ; + Tue, 13 Jun 2006 05:11:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 43808-08 for + ; + Tue, 13 Jun 2006 05:11:31 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.pharmaline.de (mail.pharmaline.de [62.153.135.34]) + by postgresql.org (Postfix) with ESMTP id D2EA59F9316 + for ; + Tue, 13 Jun 2006 05:11:30 -0300 (ADT) +Received: from [192.168.2.20] (62.153.135.40) by mail.pharmaline.de with + ESMTP (Eudora Internet Mail Server 3.2.7); + Tue, 13 Jun 2006 10:11:24 +0200 +In-Reply-To: <448E5ECF.5090100@rentalia.com> +References: <448D7C81.1000108@rentalia.com> <448D8940.4050209@aeccom.com> + <448E5ECF.5090100@rentalia.com> +Mime-Version: 1.0 (Apple Message framework v750) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: +Cc: pgsql-performance@postgresql.org +Content-Transfer-Encoding: 7bit +From: Guido Neitzer +Subject: Re: Posrgres speed problem - solved? +Date: Tue, 13 Jun 2006 10:11:23 +0200 +To: Ruben Rubio Rey +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/168 +X-Sequence-Number: 19525 + +On 13.06.2006, at 8:44 Uhr, Ruben Rubio Rey wrote: + +> Tonight database has been vacumm full and reindex (all nights +> database do it) +> +> Now its working fine. Speed is as spected. I ll be watching that +> sql ... +> Maybe the problem exists when database is busy, or maybe its +> solved ... + +Depending on the usage pattern the nightly re-index / vacuum analyse +is suboptimal. If you have high insert/update traffic your +performance will decrease over the day and will only be good in the +morning hours and I hope this is not what you intend to have. + +Autovacuum is the way to go, if you have "changing content". Perhaps +combined with vacuum analyse in a nightly or weekly schedule. We do +this weekly. + +cug + +From pgsql-performance-owner@postgresql.org Tue Jun 13 05:17:27 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D15309F9CAA + for ; + Tue, 13 Jun 2006 05:17:26 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 41865-10 for + ; + Tue, 13 Jun 2006 05:17:22 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.rentalia.net (mail.rentalia.com [213.192.209.8]) + by postgresql.org (Postfix) with ESMTP id 1CB7F9F9316 + for ; + Tue, 13 Jun 2006 05:17:21 -0300 (ADT) +Received: (qmail 26176 invoked by uid 514); 13 Jun 2006 10:17:19 +0200 +Received: from 62.37.216.115 by rigodon (envelope-from , + uid 512) with qmail-scanner-1.25-st-qms + (clamdscan: 0.88/1284. spamassassin: 3.0.2. perlscan: 1.25-st-qms. + Clear:RC:0(62.37.216.115):SA:0(-2.2/5.0):. + Processed in 4.822127 secs); 13 Jun 2006 08:17:19 -0000 +X-Antivirus-MYDOMAIN-Mail-From: ruben@rentalia.com via rigodon +X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:0(62.37.216.115):SA:0(-2.2/5.0):. + Processed in 4.822127 secs Process 26083) +Received: from 62-37-216-115.mad1.adsl.uni2.es (HELO ?192.168.2.28?) + (ruben@rentalia.com@62.37.216.115) + by mail.rentalia.net with SMTP; 13 Jun 2006 10:17:14 +0200 +Message-ID: <448E7484.2020100@rentalia.com> +Date: Tue, 13 Jun 2006 10:17:08 +0200 +From: Ruben Rubio Rey +User-Agent: Mozilla Thunderbird 1.0.8 (X11/20060503) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Guido Neitzer +CC: pgsql-performance@postgresql.org +Subject: Re: Posrgres speed problem - solved? +References: <448D7C81.1000108@rentalia.com> <448D8940.4050209@aeccom.com> + <448E5ECF.5090100@rentalia.com> + +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/169 +X-Sequence-Number: 19526 + +Guido Neitzer wrote: + +> On 13.06.2006, at 8:44 Uhr, Ruben Rubio Rey wrote: +> +>> Tonight database has been vacumm full and reindex (all nights +>> database do it) +>> +>> Now its working fine. Speed is as spected. I ll be watching that sql +>> ... +>> Maybe the problem exists when database is busy, or maybe its solved ... +> +> +> Depending on the usage pattern the nightly re-index / vacuum analyse +> is suboptimal. If you have high insert/update traffic your +> performance will decrease over the day and will only be good in the +> morning hours and I hope this is not what you intend to have. +> +> Autovacuum is the way to go, if you have "changing content". Perhaps +> combined with vacuum analyse in a nightly or weekly schedule. We do +> this weekly. +> +> cug +> +> +I ll configure autovacum. I ll write if problem is solved. + + +From pgsql-performance-owner@postgresql.org Tue Jun 13 05:40:50 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8B48E9F9316 + for ; + Tue, 13 Jun 2006 05:40:50 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 49042-01 for + ; + Tue, 13 Jun 2006 05:40:41 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from fw.greenpeace.org (fw.greenpeace.org [212.19.215.77]) + by postgresql.org (Postfix) with ESMTP id 997039F9CAA + for ; + Tue, 13 Jun 2006 05:40:40 -0300 (ADT) +Received: (from root@localhost) by fw.greenpeace.org (8.9.3c/8.6.12) id + KAA54128 for ; + Tue, 13 Jun 2006 10:40:38 +0200 (CEST) +Received: by fw.greenpeace.org (TUNIX/Firewall SMTP Server) + for id sma052802; + Tue, 13 Jun 06 10:39:46 +0200 +Received: from bb.nli.gl3 (root@localhost) + by bb.nli.gl3 (8.12.8/8.12.5) with SMTP id k5D8dkZs010152 + for ; Tue, 13 Jun 2006 10:39:46 +0200 +Received: from maila.greenpeace.org (fw.nli.gl3 [192.168.31.7]) + by bb.nli.gl3 (8.12.8/8.13.3) with ESMTP id k5D8di7j010129; + Tue, 13 Jun 2006 10:39:45 +0200 +Received: from [192.168.200.143] (vpni.greenpeace.org [212.19.215.76]) + (authenticated (128 bits)) + by maila.greenpeace.org (8.13.4/8.11.6) with ESMTP id k5D8dejs015166 + (using TLSv1/SSLv3 with cipher RC4-MD5 (128 bits) verified NO); + Tue, 13 Jun 2006 10:39:44 +0200 +Message-ID: <448E79F4.1060303@superlativ.dk> +Date: Tue, 13 Jun 2006 10:40:20 +0200 +From: Nis Jorgensen +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: "J. Andrew Rogers" +CC: "Pgsql-Performance ((E-mail))" +Subject: Re: 64-bit vs 32-bit performance ... backwards? +References: <1150151282.14661.42.camel@tigger> + <54CA6A16-AB42-440D-B5DB-BC43AE283ED8@blighty.com> + <448E11B1.20309@commandprompt.com> + <31554317-AD3E-4D08-92DC-7958E46A0D47@neopolitan.com> +In-Reply-To: <31554317-AD3E-4D08-92DC-7958E46A0D47@neopolitan.com> +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Anti-Virus: Kaspersky Anti-Virus for MailServers 5.5.2/RELEASE, + bases: 25072005 #131892, status: clean +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/170 +X-Sequence-Number: 19527 + +J. Andrew Rogers wrote: + +> We have been using PostgreSQL on Opteron servers almost since the +> Opteron was first released, running both 32-bit and 64-bit versions of +> Linux. Both 32-bit and 64-bit versions have been bulletproof for us, +> with the usual stability I've become accustomed to with both PostgreSQL +> and Linux. We have been running nothing but 64-bit versions on +> mission-critical systems for the last year with zero problems. +> +> The short story is that for us 64-bit PostgreSQL on Opterons is +> typically something like 20% faster than 32-bit on the same, and *much* +> faster than P4 Xeon systems they nominally compete with. + +Since you sound like you have done extensive testing: + +Do you have any data regarding whether to enable hyperthreading or not? +I realize that this may be highly dependant on the OS, application and +number of CPUs, but I would be interested in hearing your +recommendations (or others'). + +/Nis + + + + + +From pgsql-performance-owner@postgresql.org Tue Jun 13 06:04:47 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 304ED9FA5E7 + for ; + Tue, 13 Jun 2006 06:04:47 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 48769-06 for + ; + Tue, 13 Jun 2006 06:04:37 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.aeccom.com (port-83-236-156-26.static.qsc.de + [83.236.156.26]) + by postgresql.org (Postfix) with ESMTP id 1C7ED9F9316 + for ; + Tue, 13 Jun 2006 06:04:36 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mail.aeccom.com (Postfix) with ESMTP id 6ADB01CFF0 + for ; + Tue, 13 Jun 2006 11:04:35 +0200 (CEST) +Received: from mail.aeccom.com ([127.0.0.1]) + by localhost (gate6.aeccom.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 28250-02-9 for ; + Tue, 13 Jun 2006 11:04:34 +0200 (CEST) +Received: from [192.168.2.14] (andes.core.aeccom.com [192.168.2.14]) + by mail.aeccom.com (Postfix) with ESMTP id 4812A1CFEA + for ; + Tue, 13 Jun 2006 11:04:34 +0200 (CEST) +Message-ID: <448E7FA0.5030006@aeccom.com> +Date: Tue, 13 Jun 2006 11:04:32 +0200 +From: Sven Geisler +Organization: AEC/communications GmbH +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: "Pgsql-Performance ((E-mail))" +Subject: Re: 64-bit vs 32-bit performance ... backwards? +References: <1150151282.14661.42.camel@tigger> + <54CA6A16-AB42-440D-B5DB-BC43AE283ED8@blighty.com> + <448E11B1.20309@commandprompt.com> + <31554317-AD3E-4D08-92DC-7958E46A0D47@neopolitan.com> +In-Reply-To: <31554317-AD3E-4D08-92DC-7958E46A0D47@neopolitan.com> +Content-Type: multipart/mixed; boundary="------------030908050406040306000605" +X-Virus-Scanned: amavisd-new at aeccom.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/171 +X-Sequence-Number: 19528 + +This is a multi-part message in MIME format. +--------------030908050406040306000605 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Installation of a 32-bit PostgreSQL on a 64-bit Linux like RHEL 4 is +very easy. Make sure that you have installed all needed 32-bit libs and +devel packages. + +Here is an example to call configure to get a 32-bit PostgreSQL: + +CXX="/usr/bin/g++ -m32" \ +CPP="/usr/bin/gcc -m32 -E" \ +LD="/usr/bin/ld -m elf_i386" \ +AS="/usr/bin/gcc -m32 -Wa,--32 -D__ASSEMBLY__ -traditional" \ +CC="/usr/bin/gcc -m32" \ +CFLAGS="-O3 -funroll-loops -fno-strict-aliasing -pipe -mcpu=opteron +-march=opteron -mfpmath=sse -msse2" \ +./configure --prefix= + + +J. Andrew Rogers schrieb: +> The short story is that for us 64-bit PostgreSQL on Opterons is +> typically something like 20% faster than 32-bit on the same, and *much* +> faster than P4 Xeon systems they nominally compete with. AMD64 is a +> more efficient architecture than x86 in a number of ways, and the +> Opteron has enviable memory latency and bandwidth that make it an +> extremely efficient database workhorse. x86->AMD64 is not a word-width +> migration, it is a different architecture cleverly designed to be +> efficiently compatible with x86. In addition to things like a more +> RISC-like register set, AMD64 uses a different floating point +> architecture that is more efficient than the old x87. +> + +I did a few test in the past with 64-bit PostgreSQL and 32-bit +PostgreSQL and the 32-bit version was always faster. +Please find attached a small patch with does apply a change to the +x86_64 part also to the i386 part of src/include/storage/s_lock.h. +Without this change the performance of PostgreSQL 8.0 was horrible on a +Opteron. The effect is smaller with PostgreSQL 8.1. + +Cheers +Sven. + + + + + +--------------030908050406040306000605 +Content-Type: text/plain; + name="postgresql-8.1.4.patch" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline; + filename="postgresql-8.1.4.patch" + +diff -Naur postgresql-8.1.4.orig/src/include/storage/s_lock.h postgresql-8.1.4/src/include/storage/s_lock.h +--- postgresql-8.1.4.orig/src/include/storage/s_lock.h 2005-10-11 22:41:32.000000000 +0200 ++++ postgresql-8.1.4/src/include/storage/s_lock.h 2006-05-31 09:19:04.000000000 +0200 +@@ -125,12 +125,9 @@ + * extra test appears to be a small loss on some x86 platforms and a small + * win on others; it's by no means clear that we should keep it. + */ ++ /* xchg implies a LOCK prefix, so no need to say LOCK explicitly */ + __asm__ __volatile__( +- " cmpb $0,%1 \n" +- " jne 1f \n" +- " lock \n" + " xchgb %0,%1 \n" +- "1: \n" + : "+q"(_res), "+m"(*lock) + : + : "memory", "cc"); +@@ -189,8 +186,8 @@ + * is a huge loss. On EM64T, it appears to be a wash or small loss, + * so we needn't bother to try to distinguish the sub-architectures. + */ ++ /* xchg implies a LOCK prefix, so no need to say LOCK explicitly */ + __asm__ __volatile__( +- " lock \n" + " xchgb %0,%1 \n" + : "+q"(_res), "+m"(*lock) + : + +--------------030908050406040306000605-- + +From pgsql-performance-owner@postgresql.org Tue Jun 13 07:34:17 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 594DD9FA4D8 + for ; + Tue, 13 Jun 2006 07:34:17 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 55311-09 for + ; + Tue, 13 Jun 2006 07:34:09 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.rentalia.net (mail.rentalia.com [213.192.209.8]) + by postgresql.org (Postfix) with ESMTP id 8783F9FA12F + for ; + Tue, 13 Jun 2006 07:34:08 -0300 (ADT) +Received: (qmail 31402 invoked by uid 514); 13 Jun 2006 12:34:06 +0200 +Received: from 62.37.216.115 by rigodon (envelope-from , + uid 512) with qmail-scanner-1.25-st-qms + (clamdscan: 0.88/1284. spamassassin: 3.0.2. perlscan: 1.25-st-qms. + Clear:RC:0(62.37.216.115):SA:0(-2.2/5.0):. + Processed in 4.692446 secs); 13 Jun 2006 10:34:06 -0000 +X-Antivirus-MYDOMAIN-Mail-From: ruben@rentalia.com via rigodon +X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:0(62.37.216.115):SA:0(-2.2/5.0):. + Processed in 4.692446 secs Process 31296) +Received: from 62-37-216-115.mad1.adsl.uni2.es (HELO ?192.168.2.28?) + (ruben@rentalia.com@62.37.216.115) + by mail.rentalia.net with SMTP; 13 Jun 2006 12:34:01 +0200 +Message-ID: <448E9494.9060109@rentalia.com> +Date: Tue, 13 Jun 2006 12:33:56 +0200 +From: Ruben Rubio Rey +User-Agent: Mozilla Thunderbird 1.0.8 (X11/20060503) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Posrgres speed problem - solved! +References: <448D7C81.1000108@rentalia.com> <448D8940.4050209@aeccom.com> + <448E5ECF.5090100@rentalia.com> + + <448E7484.2020100@rentalia.com> +In-Reply-To: <448E7484.2020100@rentalia.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/172 +X-Sequence-Number: 19529 + + +Seems autovacumm is working fine. Logs are reporting that is being useful. + +But server load is high. Is out there any way to stop "autovacumm" if +server load is very high? + +Thanks everyone!!! + +From pgsql-performance-owner@postgresql.org Tue Jun 13 07:47:00 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6C9929FA4D8 + for ; + Tue, 13 Jun 2006 07:47:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 63036-01 for + ; + Tue, 13 Jun 2006 07:46:55 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from peufeu.com (boutiquenumerique.com [82.67.9.10]) + by postgresql.org (Postfix) with ESMTP id B5E609FA12F + for ; + Tue, 13 Jun 2006 07:46:54 -0300 (ADT) +Received: (qmail 9556 invoked from network); 13 Jun 2006 12:47:55 +0200 +Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) + by boutiquenumerique.com with SMTP; 13 Jun 2006 12:47:55 +0200 +Date: Tue, 13 Jun 2006 12:47:54 +0200 +To: "Pgsql-Performance ((E-mail))" +Subject: Re: 64-bit vs 32-bit performance ... backwards? +References: <1150151282.14661.42.camel@tigger> + <54CA6A16-AB42-440D-B5DB-BC43AE283ED8@blighty.com> + <448E11B1.20309@commandprompt.com> + <1BAED8DB-01CE-4D10-A509-91FB4DF1F04D@blighty.com> + <33c6269f0606121926p15107d2fq9d395460269e2e53@mail.gmail.com> +From: PFC +Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-ID: +In-Reply-To: <33c6269f0606121926p15107d2fq9d395460269e2e53@mail.gmail.com> +User-Agent: Opera M2/8.54 (Linux, build 1745) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/173 +X-Sequence-Number: 19530 + +On Tue, 13 Jun 2006 04:26:05 +0200, Alex Turner wrote: + +> Anyone who has tried x86-64 linux knows what a royal pain in the ass it +> is. They didn't do anything sensible, like just make the whole OS 64 +> bit, +> no, they had to split it up, and put 64-bit libs in a new directory +> /lib64. +> This means that a great many applications don't know to check in there +> for +> libs, and don't compile pleasantly, php is one among them. I forget what +> others, it's been awhile now. Of course if you actualy want to use more +> than 4gig RAM in a pleasant way, it's pretty much essential. +> +> Alex. + + Decent distros do this for you : + +$ ll /usr | grep lib +lrwxrwxrwx 1 root root 5 jan 20 09:55 lib -> lib64 +drwxr-xr-x 10 root root 1,8K avr 19 16:16 lib32 +drwxr-xr-x 92 root root 77K jun 10 15:48 lib64 + + Also, on gentoo, everything "just works" in 64-bit mode and the packages +compile normally... I don't see a problem... + +From pgsql-performance-owner@postgresql.org Tue Jun 13 08:33:41 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E71F29FA5BE + for ; + Tue, 13 Jun 2006 08:33:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 66626-01 for + ; + Tue, 13 Jun 2006 08:33:31 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) + by postgresql.org (Postfix) with ESMTP id 6CFE39FA12F + for ; + Tue, 13 Jun 2006 08:33:31 -0300 (ADT) +Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D2)); Tue, 13 Jun 2006 07:33:23 -0400 +X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by + D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 13 Jun + 2006 07:33:23 -0400 +Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Tue, 13 Jun + 2006 11:33:22 +0000 +User-Agent: Microsoft-Entourage/11.2.3.060209 +Date: Tue, 13 Jun 2006 04:33:19 -0700 +Subject: Re: 64-bit vs 32-bit performance ... backwards? +From: "Luke Lonergan" +To: "Sven Geisler" , + "Pgsql-Performance ((E-mail))" +Message-ID: +Thread-Topic: [PERFORM] 64-bit vs 32-bit performance ... backwards? +Thread-Index: AcaO3Ssuad4tI/rQEdqT/wAWy4o9DA== +In-Reply-To: <448E7FA0.5030006@aeccom.com> +MIME-Version: 1.0 +X-OriginalArrivalTime: 13 Jun 2006 11:33:23.0394 (UTC) + FILETIME=[2DCCA220:01C68EDD] +X-WSS-ID: 68907D092DC9186341-01-01 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/174 +X-Sequence-Number: 19531 + +Sven, + +On 6/13/06 2:04 AM, "Sven Geisler" wrote: + +> Please find attached a small patch with does apply a change to the +> x86_64 part also to the i386 part of src/include/storage/s_lock.h. +> Without this change the performance of PostgreSQL 8.0 was horrible on a +> Opteron. The effect is smaller with PostgreSQL 8.1. + +Can you describe what kinds of tests you ran to check your speed? + +Since it's the TAS lock that you are patching, the potential impact is +diffuse and large: xlog.c, shmem.c, lwlock.c, proc.c, all do significant +work. + +- Luke + + + +From pgsql-performance-owner@postgresql.org Tue Jun 13 08:48:39 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 032D69FA5EA + for ; + Tue, 13 Jun 2006 08:48:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 65052-07 for + ; + Tue, 13 Jun 2006 08:48:29 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.pharmaline.de (mail.pharmaline.de [62.153.135.34]) + by postgresql.org (Postfix) with ESMTP id 561B09FA60C + for ; + Tue, 13 Jun 2006 08:48:29 -0300 (ADT) +Received: from [192.168.2.20] (62.153.135.40) by mail.pharmaline.de with + ESMTP (Eudora Internet Mail Server 3.2.7) for + ; Tue, 13 Jun 2006 13:48:26 +0200 +Mime-Version: 1.0 (Apple Message framework v750) +In-Reply-To: <448E9494.9060109@rentalia.com> +References: <448D7C81.1000108@rentalia.com> <448D8940.4050209@aeccom.com> + <448E5ECF.5090100@rentalia.com> + + <448E7484.2020100@rentalia.com> <448E9494.9060109@rentalia.com> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <14F7CD8C-D01B-4585-A909-604C4260B668@pharmaline.de> +Content-Transfer-Encoding: 7bit +From: Guido Neitzer +Subject: Re: Posrgres speed problem - solved! +Date: Tue, 13 Jun 2006 13:48:26 +0200 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/175 +X-Sequence-Number: 19532 + +On 13.06.2006, at 12:33 Uhr, Ruben Rubio Rey wrote: + +> Seems autovacumm is working fine. Logs are reporting that is being +> useful. +> +> But server load is high. Is out there any way to stop "autovacumm" +> if server load is very high? + +Look at the cost settings for vacuum and autovacuum. From the manual: + +"During the execution of VACUUM and ANALYZE commands, the system +maintains an internal +counter that keeps track of the estimated cost of the various I/O +operations that are performed. When +the accumulated cost reaches a limit (specified by +vacuum_cost_limit), the process performing +the operation will sleep for a while (specified by +vacuum_cost_delay). Then it will reset the +counter and continue execution. + +The intent of this feature is to allow administrators to reduce the I/ +O impact of these commands on +concurrent database activity. There are many situations in which it +is not very important that mainte- +nance commands like VACUUM and ANALYZE finish quickly; however, it is +usually very important that +these commands do not significantly interfere with the ability of the +system to perform other database +operations. Cost-based vacuum delay provides a way for administrators +to achieve this." + +cug + + + +From pgsql-performance-owner@postgresql.org Tue Jun 13 08:56:01 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A38B89FA5BE + for ; + Tue, 13 Jun 2006 08:56:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 65237-09 for + ; + Tue, 13 Jun 2006 08:55:48 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from peufeu.com (boutiquenumerique.com [82.67.9.10]) + by postgresql.org (Postfix) with ESMTP id A4B859FA12F + for ; + Tue, 13 Jun 2006 08:55:47 -0300 (ADT) +Received: (qmail 9999 invoked from network); 13 Jun 2006 13:56:48 +0200 +Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) + by boutiquenumerique.com with SMTP; 13 Jun 2006 13:56:48 +0200 +Date: Tue, 13 Jun 2006 13:56:47 +0200 +To: "Tom Lane" +Subject: Re: Interesting slow query +Cc: pgsql-performance@postgresql.org +References: <003601c687ce$7aee7b20$7f00a8c0@kicommunication.com> + <13392.1150152788@sss.pgh.pa.us> +From: PFC +Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-ID: +In-Reply-To: <13392.1150152788@sss.pgh.pa.us> +User-Agent: Opera M2/8.54 (Linux, build 1745) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/176 +X-Sequence-Number: 19533 + + +> Usually we get complaints the other way around (that the NOT EXISTS +> approach is a lot slower). + + Yes, I know ;) + (I rephrased the query this way to exploit the fact that the planner +would choose a nested loop) + +> You did not show any statistics, but I +> suspect the key point here is that the condition id > 1130306 excludes +> most or all of the A and D tables. + + Right. + + Actually : + - Table r (raw_annonces) contains raw data waiting to be processed + - Table a (annonces) contains processed data ready for display on the +website (active data) + - Table d (archive) contains old archived data which can be displayed on +request but is normally excluded from the searches, which normally only +hit recent records. This is to get speedy searches. + + So, records are added into the "raw" table, these have a SERIAL primary +key. + Then a script processes them and inserts the results into the active +table. 15 days of "raw" records are kept, then they are deleted. + Periodically old records from "annonces" are moved to the archive. + + The promary key stays the same in the 3 tables. + + The script knows at which id it stopped last time it was run, hence the +(id > x) condition. Normally this excludes the entire "annonces" table, +because we process only new records. + +> The planner is not smart about +> making transitive inequality deductions, but you could help it along +> by adding the implied clauses yourself: +> +EXPLAIN ANALYZE SELECT r.* FROM raw_annonces r LEFT JOIN annonces a ON +(a.id=r.id AND a.id > 1180726) LEFT JOIN archive_data d ON (d.id=r.id AND +d.id > 1180726) WHERE a.id IS NULL AND d.id IS NULL AND r.id > 1180726 +order by id limit 1; +> +> Whether this is worth doing in your app depends on how often you do +> searches at the end of the ID range ... + + Quite often actually, so I did the mod. + The interesting part is that, yesterday after ANALYZE the query plan was +horrible, and today, after adding new data I ANALYZED and retried the slow +query, and it was fast again : + +EXPLAIN ANALYZE SELECT r.* FROM raw_annonces r LEFT JOIN annonces a ON +(a.id=r.id) LEFT JOIN archive_data d ON (d.id=r.id) WHERE a.id IS NULL AND +d.id IS NULL AND r.id > 1180726 order by id limit 1; + QUERY +PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (cost=0.00..10.42 rows=1 width=631) (actual time=0.076..0.076 +rows=1 loops=1) + -> Nested Loop Left Join (cost=0.00..7129.11 rows=684 width=631) +(actual time=0.074..0.074 rows=1 loops=1) + Filter: ("inner".id IS NULL) + -> Nested Loop Left Join (cost=0.00..4608.71 rows=684 +width=631) (actual time=0.064..0.064 rows=1 loops=1) + Filter: ("inner".id IS NULL) + -> Index Scan using raw_annonces_pkey on raw_annonces r +(cost=0.00..667.56 rows=684 width=631) (actual time=0.013..0.013 rows=1 +loops=1) + Index Cond: (id > 1180726) + -> Index Scan using annonces_pkey on annonces a +(cost=0.00..5.75 rows=1 width=4) (actual time=0.046..0.046 rows=0 loops=1) + Index Cond: (a.id = "outer".id) + -> Index Scan using archive_data_pkey on archive_data d +(cost=0.00..3.67 rows=1 width=4) (actual time=0.008..0.008 rows=0 loops=1) + Index Cond: (d.id = "outer".id) + Total runtime: 0.197 ms + + So I did a few tests... + +CREATE TABLE test.raw (id INTEGER PRIMARY KEY); +CREATE TABLE test.active (id INTEGER PRIMARY KEY); +CREATE TABLE test.archive (id INTEGER PRIMARY KEY); +INSERT INTO test.archive SELECT * FROM generate_series( 1, 1000000 ); +INSERT INTO test.active SELECT * FROM generate_series( 1000001, 1100000 ); +INSERT INTO test.raw SELECT * FROM generate_series( 1050000, 1101000 ); +VACUUM ANALYZE; + +So we have 1M archived records, 100K active, 51K in the "raw" table of +which 1000 are new. + + Query 1: + +EXPLAIN ANALYZE SELECT * FROM test.raw AS raw LEFT JOIN test.active AS +active ON (active.id=raw.id) LEFT JOIN test.archive AS archive ON +(archive.id=raw.id) WHERE raw.id>1100000 AND active.id IS NULL AND +archive.id IS NULL LIMIT 1; + QUERY +PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (cost=0.00..5.29 rows=1 width=12) (actual time=94.478..94.478 +rows=1 loops=1) + -> Nested Loop Left Join (cost=0.00..5400.09 rows=1021 width=12) +(actual time=94.477..94.477 rows=1 loops=1) + Filter: ("inner".id IS NULL) + -> Merge Left Join (cost=0.00..2310.55 rows=1021 width=8) +(actual time=94.458..94.458 rows=1 loops=1) + Merge Cond: ("outer".id = "inner".id) + Filter: ("inner".id IS NULL) + -> Index Scan using raw_pkey on raw (cost=0.00..24.78 +rows=1021 width=4) (actual time=0.016..0.016 rows=1 loops=1) + Index Cond: (id > 1100000) + -> Index Scan using active_pkey on active +(cost=0.00..2023.00 rows=100000 width=4) (actual time=0.005..76.572 +rows=100000 loops=1) + -> Index Scan using archive_pkey on archive (cost=0.00..3.01 +rows=1 width=4) (actual time=0.013..0.013 rows=0 loops=1) + Index Cond: (archive.id = "outer".id) + Total runtime: 94.550 ms + + Query 2: + +EXPLAIN ANALYZE SELECT * FROM test.raw AS raw LEFT JOIN test.active AS +active ON (active.id=raw.id AND active.id>1100000) LEFT JOIN test.archive +AS archive ON (archive.id=raw.id AND archive.id > 1100000) WHERE +raw.id>1100000 AND active.id IS NULL AND archive.id IS NULL LIMIT 1; + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------- + Limit (cost=0.00..0.04 rows=1 width=12) (actual time=0.035..0.035 rows=1 +loops=1) + -> Merge Left Join (cost=0.00..37.67 rows=1021 width=12) (actual +time=0.034..0.034 rows=1 loops=1) + Merge Cond: ("outer".id = "inner".id) + Filter: ("inner".id IS NULL) + -> Merge Left Join (cost=0.00..30.51 rows=1021 width=8) (actual +time=0.026..0.026 rows=1 loops=1) + Merge Cond: ("outer".id = "inner".id) + Filter: ("inner".id IS NULL) + -> Index Scan using raw_pkey on raw (cost=0.00..24.78 +rows=1021 width=4) (actual time=0.016..0.016 rows=1 loops=1) + Index Cond: (id > 1100000) + -> Index Scan using active_pkey on active +(cost=0.00..3.14 rows=10 width=4) (actual time=0.006..0.006 rows=0 loops=1) + Index Cond: (id > 1100000) + -> Index Scan using archive_pkey on archive (cost=0.00..4.35 +rows=100 width=4) (actual time=0.007..0.007 rows=0 loops=1) + Index Cond: (id > 1100000) + Total runtime: 0.101 ms + + OK, you were right ;) + + Query 3: + +EXPLAIN ANALYZE SELECT * FROM test.raw AS raw WHERE raw.id > 1100000 AND +NOT EXISTS (SELECT 1 FROM test.active AS a WHERE a.id=raw.id) AND NOT +EXISTS (SELECT 1 FROM test.archive AS a WHERE a.id=raw.id) LIMIT 1; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------- + Limit (cost=0.00..24.23 rows=1 width=4) (actual time=0.036..0.036 rows=1 +loops=1) + -> Index Scan using raw_pkey on raw (cost=0.00..6178.35 rows=255 +width=4) (actual time=0.035..0.035 rows=1 loops=1) + Index Cond: (id > 1100000) + Filter: ((NOT (subplan)) AND (NOT (subplan))) + SubPlan + -> Index Scan using archive_pkey on archive a +(cost=0.00..3.01 rows=1 width=0) (actual time=0.007..0.007 rows=0 loops=1) + Index Cond: (id = $0) + -> Index Scan using active_pkey on active a (cost=0.00..3.01 +rows=1 width=0) (actual time=0.008..0.008 rows=0 loops=1) + Index Cond: (id = $0) + Total runtime: 0.086 ms + + I see a problem with Query 1: + The Merge Join goes through tables "raw" and "active" in sorted order. +"archive" contains values 1-1000000 +"active" contains values 1000001-1100000 +"raw" contains values 1050000-1101000 + + However it starts at the beginning of "active" ; it would be smarter to +start the index scan of "active" at the lowest value in "raw", ie. to seek +into the right position into the index before beginning to scan it. This +is achieved by your advice on manually adding the "id > x" conditions in +the query. + + However, if I want to join the full tables, dropping the id>x condition : + +EXPLAIN ANALYZE SELECT * FROM test.raw AS raw LEFT JOIN test.active AS +active ON (active.id=raw.id) LEFT JOIN test.archive AS archive ON +(archive.id=raw.id) WHERE active.id IS NULL AND archive.id IS NULL; + QUERY +PLAN +---------------------------------------------------------------------------------------------------------------------------------------------- + Merge Left Join (cost=0.00..27305.04 rows=51001 width=12) (actual +time=837.196..838.099 rows=1000 loops=1) + Merge Cond: ("outer".id = "inner".id) + Filter: ("inner".id IS NULL) + -> Merge Left Join (cost=0.00..3943.52 rows=51001 width=8) (actual +time=153.495..154.190 rows=1000 loops=1) + Merge Cond: ("outer".id = "inner".id) + Filter: ("inner".id IS NULL) + -> Index Scan using raw_pkey on raw (cost=0.00..1033.01 +rows=51001 width=4) (actual time=0.012..23.085 rows=51001 loops=1) + -> Index Scan using active_pkey on active (cost=0.00..2023.00 +rows=100000 width=4) (actual time=0.004..47.333 rows=100000 loops=1) + -> Index Scan using archive_pkey on archive (cost=0.00..20224.00 +rows=1000000 width=4) (actual time=0.043..501.953 rows=1000000 loops=1) + Total runtime: 838.272 ms + + This is very slow : the Index Scans on "active" and "archive" have to +skip a huge number of rows before getting to the first interesting row. We +know that rows in "active" and "archive" will be of no use if their id is +< (SELECT min(id) FROM test.raw) which is 1050000. Let's rephrase : + +EXPLAIN ANALYZE SELECT * FROM test.raw AS raw LEFT JOIN test.active AS +active ON (active.id=raw.id AND active.id >= 1050000) LEFT JOIN +test.archive AS archive ON (archive.id=raw.id AND archive.id >= 1050000) +WHERE active.id IS NULL AND archive.id IS NULL; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------- + Merge Left Join (cost=0.00..2837.93 rows=51001 width=12) (actual +time=114.590..115.451 rows=1000 loops=1) + Merge Cond: ("outer".id = "inner".id) + Filter: ("inner".id IS NULL) + -> Merge Left Join (cost=0.00..2705.78 rows=51001 width=8) (actual +time=114.576..115.239 rows=1000 loops=1) + Merge Cond: ("outer".id = "inner".id) + Filter: ("inner".id IS NULL) + -> Index Scan using raw_pkey on raw (cost=0.00..1033.01 +rows=51001 width=4) (actual time=0.012..51.505 rows=51001 loops=1) + -> Index Scan using active_pkey on active (cost=0.00..1158.32 +rows=50913 width=4) (actual time=0.009..22.312 rows=50001 loops=1) + Index Cond: (id >= 1050000) + -> Index Scan using archive_pkey on archive (cost=0.00..4.35 rows=100 +width=4) (actual time=0.012..0.012 rows=0 loops=1) + Index Cond: (id >= 1050000) + Total runtime: 115.601 ms + + So here's my point : the first operation in the Index Scan in a merge +join could be to seek to the right position in the index before scanning +it. This value is known : it is the first value yielded by the index scan +on "raw". + + This would remove the need for teaching the planner about transitivity, +and also optimize this case where transitivity is useless. + + + + + + + + + + + + +From pgsql-performance-owner@postgresql.org Tue Jun 13 09:03:32 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5EFB29FA5BE + for ; + Tue, 13 Jun 2006 09:03:31 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 67535-04 for + ; + Tue, 13 Jun 2006 09:03:26 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.aeccom.com (port-83-236-156-26.static.qsc.de + [83.236.156.26]) + by postgresql.org (Postfix) with ESMTP id 1D0999FA12F + for ; + Tue, 13 Jun 2006 09:03:26 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mail.aeccom.com (Postfix) with ESMTP id 6EF731D030; + Tue, 13 Jun 2006 14:03:23 +0200 (CEST) +Received: from mail.aeccom.com ([127.0.0.1]) + by localhost (gate6.aeccom.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 31780-01; Tue, 13 Jun 2006 14:03:22 +0200 (CEST) +Received: from [192.168.2.14] (andes.core.aeccom.com [192.168.2.14]) + by mail.aeccom.com (Postfix) with ESMTP id 56F3D1D02D; + Tue, 13 Jun 2006 14:03:22 +0200 (CEST) +Message-ID: <448EA989.5000408@aeccom.com> +Date: Tue, 13 Jun 2006 14:03:21 +0200 +From: Sven Geisler +Organization: AEC/communications GmbH +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: Luke Lonergan +CC: "Pgsql-Performance ((E-mail))" +Subject: Re: 64-bit vs 32-bit performance ... backwards? +References: +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: amavisd-new at aeccom.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/177 +X-Sequence-Number: 19534 + +Luke + +Luke Lonergan schrieb: +> On 6/13/06 2:04 AM, "Sven Geisler" wrote: +>> Please find attached a small patch with does apply a change to the +>> x86_64 part also to the i386 part of src/include/storage/s_lock.h. +>> Without this change the performance of PostgreSQL 8.0 was horrible on a +>> Opteron. The effect is smaller with PostgreSQL 8.1. +> +> Can you describe what kinds of tests you ran to check your speed? + +I has create a test scenario with parallel client which running mostly +SELECTs on the same tables. I used a sequence of 25 queries using 10 +tables. We use the total throughput (queries per second) as result. + +> +> Since it's the TAS lock that you are patching, the potential impact is +> diffuse and large: xlog.c, shmem.c, lwlock.c, proc.c, all do significant +> work. + +Yes, I know. We had a problem last year with the performance of the +Opteron. We have started the futex patch to resolve the issue. The futex +patch itself did have no effect, but there was a side effect because the +futex patch did use also another assembler sequence. This make a hole +difference on a Opteron. It turned out that removing the lines + +cmpb +jne +lock + +was the reason why the Opteron runs faster. +I have created a sequence of larger query with following result on +Opteron 875 and PostgreSQL 8.0.3 +orignal 8.0.3 => 289 query/time and 10% cpu usage +patched 8.0.3 => 1022 query/time and 45% cpu usage + +I has a smaller effect on a XEON MP with EM64T. But this effect wasn't +that huge. There was no effect on classic XEON's. + +Cheers +Sven. + +From pgsql-performance-owner@postgresql.org Tue Jun 13 09:38:32 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 1DA209FA5BE + for ; + Tue, 13 Jun 2006 09:38:32 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 72869-01 for + ; + Tue, 13 Jun 2006 09:38:28 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id D1E5C9FA12F + for ; + Tue, 13 Jun 2006 09:38:27 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 1CA773093C; Tue, 13 Jun 2006 14:38:26 +0200 (MET DST) +From: Christopher Browne +X-Newsgroups: pgsql.performance +Subject: Re: 64-bit vs 32-bit performance ... backwards? +Date: Tue, 13 Jun 2006 08:23:42 -0400 +Organization: cbbrowne Computing Inc +Lines: 33 +Message-ID: <87u06pz1kh.fsf@wolfe.cbbrowne.com> +References: <1150151282.14661.42.camel@tigger> + <54CA6A16-AB42-440D-B5DB-BC43AE283ED8@blighty.com> + <448E11B1.20309@commandprompt.com> + <31554317-AD3E-4D08-92DC-7958E46A0D47@neopolitan.com> + <448E79F4.1060303@superlativ.dk> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@news.hub.org +X-message-flag: Outlook is rather hackable, isn't it? +X-Home-Page: http://www.cbbrowne.com/info/ +X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne +User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.19 (linux) +Cancel-Lock: sha1:NrLQQMBPFmLtzn/QreodaLfS8Ls= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/178 +X-Sequence-Number: 19535 + +Martha Stewart called it a Good Thing when nis@superlativ.dk (Nis Jorgensen) wrote: +> J. Andrew Rogers wrote: +> +>> We have been using PostgreSQL on Opteron servers almost since the +>> Opteron was first released, running both 32-bit and 64-bit versions of +>> Linux. Both 32-bit and 64-bit versions have been bulletproof for us, +>> with the usual stability I've become accustomed to with both PostgreSQL +>> and Linux. We have been running nothing but 64-bit versions on +>> mission-critical systems for the last year with zero problems. +>> +>> The short story is that for us 64-bit PostgreSQL on Opterons is +>> typically something like 20% faster than 32-bit on the same, and *much* +>> faster than P4 Xeon systems they nominally compete with. +> +> Since you sound like you have done extensive testing: +> +> Do you have any data regarding whether to enable hyperthreading or not? +> I realize that this may be highly dependant on the OS, application and +> number of CPUs, but I would be interested in hearing your +> recommendations (or others'). + +Um, Hyper-Threading? On AMD? + +Hyper-Threading is a feature only offered by Intel, on some Pentium 4 +chips. + +It is not offered by AMD. For our purposes, this is no loss; database +benchmarks have widely shown it to be a performance loser across +various database systems. +-- +output = reverse("moc.enworbbc" "@" "enworbbc") +http://linuxdatabases.info/info/languages.html +Yes, for sparkling white chip prints, use low SUDSing DRAW.... + +From pgsql-performance-owner@postgresql.org Tue Jun 13 09:42:28 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6B8799FA5BE + for ; + Tue, 13 Jun 2006 09:42:28 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 71581-05 for + ; + Tue, 13 Jun 2006 09:42:25 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) + by postgresql.org (Postfix) with ESMTP id 4F1099FA12F + for ; + Tue, 13 Jun 2006 09:42:24 -0300 (ADT) +Received: from 172.16.1.112 by mail.Mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D1)); Tue, 13 Jun 2006 08:42:12 -0400 +X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by + D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 13 Jun + 2006 08:42:12 -0400 +Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Tue, 13 Jun + 2006 12:42:11 +0000 +User-Agent: Microsoft-Entourage/11.2.3.060209 +Date: Tue, 13 Jun 2006 05:42:08 -0700 +Subject: Re: 64-bit vs 32-bit performance ... backwards? +From: "Luke Lonergan" +To: "Sven Geisler" +cc: "Pgsql-Performance ((E-mail))" +Message-ID: +Thread-Topic: [PERFORM] 64-bit vs 32-bit performance ... backwards? +Thread-Index: AcaO5shBBuxX4PraEdqT/wAWy4o9DA== +In-Reply-To: <448EA989.5000408@aeccom.com> +MIME-Version: 1.0 +X-OriginalArrivalTime: 13 Jun 2006 12:42:12.0137 (UTC) + FILETIME=[CAB8D190:01C68EE6] +X-WSS-ID: 68906D2E1N411507765-01-01 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/179 +X-Sequence-Number: 19536 + +Sven, + +On 6/13/06 5:03 AM, "Sven Geisler" wrote: + +> Yes, I know. We had a problem last year with the performance of the +> Opteron. We have started the futex patch to resolve the issue. The futex +> patch itself did have no effect, but there was a side effect because the +> futex patch did use also another assembler sequence. This make a hole +> difference on a Opteron. It turned out that removing the lines +> +> cmpb +> jne +> lock +> +> was the reason why the Opteron runs faster. +> I have created a sequence of larger query with following result on +> Opteron 875 and PostgreSQL 8.0.3 +> orignal 8.0.3 => 289 query/time and 10% cpu usage +> patched 8.0.3 => 1022 query/time and 45% cpu usage + +This was in 64-bit mode on the Opteron? + +- Luke + + + +From pgsql-performance-owner@postgresql.org Tue Jun 13 09:43:51 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id EA2D49FA5BE + for ; + Tue, 13 Jun 2006 09:43:50 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 68841-09 for + ; + Tue, 13 Jun 2006 09:43:47 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.174]) + by postgresql.org (Postfix) with ESMTP id A8BB79FA12F + for ; + Tue, 13 Jun 2006 09:43:47 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so510023ugf + for ; + Tue, 13 Jun 2006 05:43:45 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; + b=n4MXOwr/f1E/qnOmewRIc/J8vNZyH2kriov4tdY/Ku0Hf+f6lYkRsAMumrH0tpRYDbjTyp+SADS+iCj7vcpw88y8jCpNeIlNNzH/cRXf/Mcjmx8vbWUeMaY2xDVm9FBzAxX8TTq2JsFJ08vx97j13Q2GN+bHX11j0tepnyZHSU0= +Received: by 10.78.67.20 with SMTP id p20mr190178hua; + Tue, 13 Jun 2006 05:43:45 -0700 (PDT) +Received: by 10.78.50.4 with HTTP; Tue, 13 Jun 2006 05:43:45 -0700 (PDT) +Message-ID: <92d3a4950606130543y2aab73d8sbbbf04aee328b41f@mail.gmail.com> +Date: Tue, 13 Jun 2006 14:43:45 +0200 +From: Antoine +To: pgsql-performance@postgresql.org +Subject: OT - select + must have from - sql standard syntax? +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/180 +X-Sequence-Number: 19537 + +Hi, +I don't have a copy of the standard on hand and a collegue is claiming +that there must be a from clause in a select query (he is an oracle +guy). This doesn't seem to be the case for postgres... does anyone +know? +Cheers +Antoine +ps. any one of them will do... +-- +This is where I should put some witty comment. + +From pgsql-performance-owner@postgresql.org Tue Jun 13 09:47:05 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B2FA59FA5BE + for ; + Tue, 13 Jun 2006 09:47:03 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 71135-10 for + ; + Tue, 13 Jun 2006 09:46:55 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.aeccom.com (port-83-236-156-26.static.qsc.de + [83.236.156.26]) + by postgresql.org (Postfix) with ESMTP id E7E7C9FA12F + for ; + Tue, 13 Jun 2006 09:46:54 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mail.aeccom.com (Postfix) with ESMTP id 5D7FD1D03A; + Tue, 13 Jun 2006 14:46:53 +0200 (CEST) +Received: from mail.aeccom.com ([127.0.0.1]) + by localhost (gate6.aeccom.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 32430-02-13; Tue, 13 Jun 2006 14:46:52 +0200 (CEST) +Received: from [192.168.2.14] (andes.core.aeccom.com [192.168.2.14]) + by mail.aeccom.com (Postfix) with ESMTP id 750A71D039; + Tue, 13 Jun 2006 14:46:52 +0200 (CEST) +Message-ID: <448EB3BB.9030504@aeccom.com> +Date: Tue, 13 Jun 2006 14:46:51 +0200 +From: Sven Geisler +Organization: AEC/communications GmbH +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: Luke Lonergan +CC: Postgresql Performance +Subject: Re: 64-bit vs 32-bit performance ... backwards? +References: +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: amavisd-new at aeccom.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/181 +X-Sequence-Number: 19538 + +Luke + +Luke Lonergan schrieb: +> Sven, +> On 6/13/06 5:03 AM, "Sven Geisler" wrote: +>> Yes, I know. We had a problem last year with the performance of the +>> Opteron. We have started the futex patch to resolve the issue. The futex +>> patch itself did have no effect, but there was a side effect because the +>> futex patch did use also another assembler sequence. This make a hole +>> difference on a Opteron. It turned out that removing the lines +>> +>> cmpb +>> jne +>> lock +>> +>> was the reason why the Opteron runs faster. +>> I have created a sequence of larger query with following result on +>> Opteron 875 and PostgreSQL 8.0.3 +>> orignal 8.0.3 => 289 query/time and 10% cpu usage +>> patched 8.0.3 => 1022 query/time and 45% cpu usage +> +> This was in 64-bit mode on the Opteron? +This was in 32-bit mode on the Opteron. But the effect was the same in +64-bit mode with PostgreSQL 8.0.3. + +You already get this change if you compile PostgreSQL 8.1.x in x86_64 +(64-bit mode). + +Cheers +Sven. + +From pgsql-performance-owner@postgresql.org Tue Jun 13 09:50:02 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 1DFC99FA5BE + for ; + Tue, 13 Jun 2006 09:50:02 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 74429-02 for + ; + Tue, 13 Jun 2006 09:49:54 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) + by postgresql.org (Postfix) with ESMTP id 8F2BC9FA12F + for ; + Tue, 13 Jun 2006 09:49:54 -0300 (ADT) +Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D2)); Tue, 13 Jun 2006 08:49:48 -0400 +X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by + D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 13 Jun + 2006 08:49:48 -0400 +Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Tue, 13 Jun + 2006 12:49:47 +0000 +User-Agent: Microsoft-Entourage/11.2.3.060209 +Date: Tue, 13 Jun 2006 05:49:44 -0700 +Subject: Re: 64-bit vs 32-bit performance ... backwards? +From: "Luke Lonergan" +To: "Sven Geisler" +cc: "Postgresql Performance" +Message-ID: +Thread-Topic: [PERFORM] 64-bit vs 32-bit performance ... backwards? +Thread-Index: AcaO59gNFr1i+PrbEdqT/wAWy4o9DA== +In-Reply-To: <448EB3BB.9030504@aeccom.com> +MIME-Version: 1.0 +X-OriginalArrivalTime: 13 Jun 2006 12:49:48.0328 (UTC) + FILETIME=[DAA20A80:01C68EE7] +X-WSS-ID: 68906BE62DC9223036-01-01 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/182 +X-Sequence-Number: 19539 + +Sven, + +On 6/13/06 5:46 AM, "Sven Geisler" wrote: + +> You already get this change if you compile PostgreSQL 8.1.x in x86_64 +> (64-bit mode). + +I see, so I think your point with the patch is to make the 32-bit compiled +version benefit as well. + +- Luke + + + +From pgsql-performance-owner@postgresql.org Tue Jun 13 09:52:15 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 964819FA5BE + for ; + Tue, 13 Jun 2006 09:52:15 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 73047-07 for + ; + Tue, 13 Jun 2006 09:52:06 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.aeccom.com (port-83-236-156-26.static.qsc.de + [83.236.156.26]) + by postgresql.org (Postfix) with ESMTP id 525F59FA12F + for ; + Tue, 13 Jun 2006 09:52:06 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mail.aeccom.com (Postfix) with ESMTP id 8ACAC1D03A; + Tue, 13 Jun 2006 14:52:04 +0200 (CEST) +Received: from mail.aeccom.com ([127.0.0.1]) + by localhost (gate6.aeccom.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 32430-02-20; Tue, 13 Jun 2006 14:52:03 +0200 (CEST) +Received: from [192.168.2.14] (andes.core.aeccom.com [192.168.2.14]) + by mail.aeccom.com (Postfix) with ESMTP id B2FA21D039; + Tue, 13 Jun 2006 14:52:03 +0200 (CEST) +Message-ID: <448EB4F2.2010105@aeccom.com> +Date: Tue, 13 Jun 2006 14:52:02 +0200 +From: Sven Geisler +Organization: AEC/communications GmbH +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: Luke Lonergan +CC: Postgresql Performance +Subject: Re: 64-bit vs 32-bit performance ... backwards? +References: +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: amavisd-new at aeccom.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/183 +X-Sequence-Number: 19540 + +Luke, + +Luke Lonergan schrieb: +> On 6/13/06 5:46 AM, "Sven Geisler" wrote: +>> You already get this change if you compile PostgreSQL 8.1.x in x86_64 +>> (64-bit mode). +> +> I see, so I think your point with the patch is to make the 32-bit compiled +> version benefit as well. +> + +Yup. I think you have to change this in the 32-bit compiled version too +if you want to compare 32-bit and 64-bit on a Opteron. + +Sven. + +From pgsql-performance-owner@postgresql.org Tue Jun 13 10:15:43 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 56E8B9FA5BE + for ; + Tue, 13 Jun 2006 10:15:42 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 75909-06 for + ; + Tue, 13 Jun 2006 10:15:32 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moutng.kundenserver.de (moutng.kundenserver.de + [212.227.126.171]) + by postgresql.org (Postfix) with ESMTP id 2D79D9FA12F + for ; + Tue, 13 Jun 2006 10:15:27 -0300 (ADT) +Received: from [84.143.14.54] (helo=pse.dyndns.org) + by mrelayeu.kundenserver.de (node=mrelayeu3) with ESMTP (Nemesis), + id 0MKxQS-1Fq8jg0Ouj-0001XH; Tue, 13 Jun 2006 15:15:13 +0200 +Received: from [192.168.0.103] (helo=[192.168.0.103]) + by pse.dyndns.org with esmtp (Exim 4.44) + id 1Fq8jc-0002rV-Lp; Tue, 13 Jun 2006 15:15:08 +0200 +Message-ID: <448EBA5A.8020503@pse-consulting.de> +Date: Tue, 13 Jun 2006 15:15:06 +0200 +From: Andreas Pflug +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: Josh Berkus +CC: pgsql-performance@postgresql.org, Leigh Dyer , + Alex Turner , Steve Atkins +Subject: Re: 64-bit vs 32-bit performance ... backwards? +References: <1150151282.14661.42.camel@tigger> + <33c6269f0606121926p15107d2fq9d395460269e2e53@mail.gmail.com> + <448E25FB.1080902@eclinic.com.au> + <200606122134.07510.josh@agliodbs.com> +In-Reply-To: <200606122134.07510.josh@agliodbs.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Provags-ID: kundenserver.de abuse@kundenserver.de + login:0ce7ee5c3478b8d72edd8e05ccd40b70 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/184 +X-Sequence-Number: 19541 + +Josh Berkus wrote: +> Folks, +> +> +> In which case, why was 64-bit such a big deal? +> + +We had this discussion with 16/32 bit too, back in those 286/386 times... +Not too many 16bit apps left now :-) + +Regards, +Andreas + + + + + +From pgsql-performance-owner@postgresql.org Tue Jun 13 10:46:19 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id EB6869FA5BE + for ; + Tue, 13 Jun 2006 10:46:18 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 79874-06 for + ; + Tue, 13 Jun 2006 10:46:14 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mx1.neopolitan.us (mx1.neopolitan.us [65.87.16.224]) + by postgresql.org (Postfix) with ESMTP id 838119FA12F + for ; + Tue, 13 Jun 2006 10:46:14 -0300 (ADT) +Received: from [71.131.255.89] (account jrogers@neopolitan.com HELO + [192.168.2.87]) by mx1.neopolitan.us (CommuniGate Pro SMTP 4.2.10) + with ESMTP-TLS id 13193542; Tue, 13 Jun 2006 06:46:12 -0700 +In-Reply-To: <448E79F4.1060303@superlativ.dk> +References: <1150151282.14661.42.camel@tigger> + <54CA6A16-AB42-440D-B5DB-BC43AE283ED8@blighty.com> + <448E11B1.20309@commandprompt.com> + <31554317-AD3E-4D08-92DC-7958E46A0D47@neopolitan.com> + <448E79F4.1060303@superlativ.dk> +Mime-Version: 1.0 (Apple Message framework v750) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <02FC7834-1B97-4612-9029-03B5E0127613@neopolitan.com> +Cc: "Pgsql-Performance ((E-mail))" +Content-Transfer-Encoding: 7bit +From: "J. Andrew Rogers" +Subject: Re: 64-bit vs 32-bit performance ... backwards? +Date: Tue, 13 Jun 2006 06:46:10 -0700 +To: Nis Jorgensen +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/185 +X-Sequence-Number: 19542 + + +On Jun 13, 2006, at 1:40 AM, Nis Jorgensen wrote: +> Since you sound like you have done extensive testing: +> +> Do you have any data regarding whether to enable hyperthreading or +> not? +> I realize that this may be highly dependant on the OS, application and +> number of CPUs, but I would be interested in hearing your +> recommendations (or others'). + + +Hyperthreading never made much of a difference for our database +loads. Since we've retired all non-dev P4 database servers, I am not +too worried about it. We will probably re-test the new "Core 2" CPUs +that are coming out, since those differ significantly from the P4 in +capability. + + +J. Andrew Rogers + + +From pgsql-performance-owner@postgresql.org Tue Jun 13 11:37:15 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id F1F859FA5BE + for ; + Tue, 13 Jun 2006 11:37:14 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 84860-06 for + ; + Tue, 13 Jun 2006 11:37:02 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 424809FA12F + for ; + Tue, 13 Jun 2006 11:37:02 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5DEax3o022610; + Tue, 13 Jun 2006 10:36:59 -0400 (EDT) +To: "Craig A. James" +cc: pgsql-performance@postgresql.org +Subject: Re: function not called if part of aggregate +In-reply-to: <448E5A92.9050206@modgraph-usa.com> +References: <448C505C.2080504@modgraph-usa.com> + <87ac8jfu7t.fsf@stark.xeocode.com> + <448E5A92.9050206@modgraph-usa.com> +Comments: In-reply-to "Craig A. James" + message dated "Mon, 12 Jun 2006 23:26:26 -0700" +Date: Tue, 13 Jun 2006 10:36:59 -0400 +Message-ID: <22609.1150209419@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/186 +X-Sequence-Number: 19543 + +"Craig A. James" writes: +> But the weird thing is that, in spite of flattening, which would appear to make the queries equivalent, the function gets called in one case, and not in the other. + +No, nothing particularly weird about it. ORDER BY in a subselect +acts as an "optimization fence" that prevents flattening. An +un-flattened subquery will evaluate all its output columns whether the +parent query reads them or not. (This is not set in stone mind you, +but in the current planner implementation it's hard to avoid, because +such a sub-query gets planned before we've figured out which columns +the parent wants to reference.) The cases in which you had the function +in a subquery without ORDER BY were flattenable, and in that case the +planner threw the function expression away as being unreferenced. + + regards, tom lane + +From pgsql-general-owner@postgresql.org Fri Jun 16 00:12:51 2006 +X-Original-To: pgsql-general-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B11529FA13E; + Tue, 13 Jun 2006 13:04:25 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 93919-08; Tue, 13 Jun 2006 13:04:16 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from server10.araisoft.com (server10.araisoft.com [72.9.228.195]) + by postgresql.org (Postfix) with ESMTP id CAE279F9316; + Tue, 13 Jun 2006 13:04:15 -0300 (ADT) +Received: from uni (adsl-69-235-160-36.dsl.irvnca.pacbell.net [69.235.160.36]) + by server10.araisoft.com (Postfix) with ESMTP + id 262E23D62034; Tue, 13 Jun 2006 09:04:14 -0700 (PDT) +Reply-To: +From: "Benjamin Arai" +To: , + +Subject: Question about clustering multiple columns +Date: Tue, 13 Jun 2006 09:04:15 -0700 +Organization: Araisoft +Message-ID: <002e01c68f03$05f00e10$6501a8c0@uni> +MIME-Version: 1.0 +Content-Type: multipart/mixed; + boundary="----=_NextPart_000_002F_01C68EC8.59913610" +X-Mailer: Microsoft Office Outlook 11 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +thread-index: AcaPAa1hG8/KtusrTQGYSpnCQ9zr5w== +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/636 +X-Sequence-Number: 97008 + +This is a multi-part message in MIME format. + +------=_NextPart_000_002F_01C68EC8.59913610 +Content-Type: multipart/alternative; + boundary="----=_NextPart_001_0030_01C68EC8.59913610" + + +------=_NextPart_001_0030_01C68EC8.59913610 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit + +Hi, + +I have a database where there are three columns (name,date,data). The +queries are almost always something like SELECT date,data FROM table WHERE +name=blah AND date > 1/1/2005 AND date < 1/1/2006;. I currently have three +B-tree indexes, one for each of the columns. Is clustering on date index +going to be what I want, or do I need a index that contains both name and +date? + +Benjamin Arai +barai@cs.ucr.edu +http://www.benjaminarai.com + + + +------=_NextPart_001_0030_01C68EC8.59913610 +Content-Type: text/html; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + + + + + + +
Hi,
+
 
+
I have = +a database=20 +where there are three columns (name,date,data).  The queries are = +almost=20 +always something like SELECT date,data FROM table WHERE name=3Dblah AND = +date >=20 +1/1/2005 AND date < 1/1/2006;.  I currently have three = +B-tree=20 +indexes, one for each of the columns.  Is clustering on date = +index=20 +going to be what I want, or do I need a index that contains both name = +and=20 +date?
+
 
+
+
+
Benjamin=20 +Arai
+
barai@cs.ucr.edu
+
http://www.benjaminarai.com
+
 
+
 
+ +------=_NextPart_001_0030_01C68EC8.59913610-- + +------=_NextPart_000_002F_01C68EC8.59913610 +Content-Type: text/x-vcard; + name="barai@cs.ucr.edu.vcf" +Content-Transfer-Encoding: quoted-printable +Content-Disposition: attachment; + filename="barai@cs.ucr.edu.vcf" + +BEGIN:VCARD +VERSION:2.1 +N:Arai;Benjamin +FN:barai@cs.ucr.edu +ORG:University of California, Riverside +TITLE:PhD Student +TEL;WORK;VOICE:(951) 827-2838 +TEL;HOME;VOICE:(951) 682-6816 +TEL;CELL;VOICE:(626) 378-2992 +ADR;WORK;ENCODING=3DQUOTED-PRINTABLE:;;Department of Computer Science = +and Engineering=3D0D=3D0AEngineering BU2, Room =3D +351=3D0D=3D0AUniversity of California;Riverside;CA;92521;United States = +of Americ=3D +a +LABEL;WORK;ENCODING=3DQUOTED-PRINTABLE:Department of Computer Science = +and Engineering=3D0D=3D0AEngineering BU2, Room 35=3D +1=3D0D=3D0AUniversity of California=3D0D=3D0ARiverside, CA = +92521=3D0D=3D0AUnited States =3D +of America +URL;WORK:http://www.benjaminarai.com +EMAIL;PREF;INTERNET:barai@cs.ucr.edu +REV:20060520T165426Z +END:VCARD + +------=_NextPart_000_002F_01C68EC8.59913610-- + + +From pgsql-performance-owner@postgresql.org Tue Jun 13 13:12:01 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2A0239FA13E + for ; + Tue, 13 Jun 2006 13:12:01 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 93175-10 for + ; + Tue, 13 Jun 2006 13:11:52 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from kenobi.snowman.net (kenobi.snowman.net [70.84.9.186]) + by postgresql.org (Postfix) with ESMTP id 04CFA9F9316 + for ; + Tue, 13 Jun 2006 13:11:51 -0300 (ADT) +Received: by kenobi.snowman.net (Postfix, from userid 1000) + id E839A58005; Tue, 13 Jun 2006 11:11:50 -0500 (CDT) +Date: Tue, 13 Jun 2006 12:11:50 -0400 +From: Stephen Frost +To: pgsql-performance@postgresql.org +Subject: Re: Placement of 64-bit libraries (offtopic) +Message-ID: <20060613161150.GJ8588@kenobi.snowman.net> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <1150151282.14661.42.camel@tigger> + <54CA6A16-AB42-440D-B5DB-BC43AE283ED8@blighty.com> + <448E11B1.20309@commandprompt.com> + <1BAED8DB-01CE-4D10-A509-91FB4DF1F04D@blighty.com> + <33c6269f0606121926p15107d2fq9d395460269e2e53@mail.gmail.com> + <15368.1150166641@sss.pgh.pa.us> <20060613063059.GA6316@uio.no> +MIME-Version: 1.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; boundary="Qa+qcrCtlQ17sJ4A" +Content-Disposition: inline +In-Reply-To: <20060613063059.GA6316@uio.no> +X-Editor: Vim http://www.vim.org/ +X-Info: http://www.snowman.net +X-Operating-System: Linux/2.6.16-1-vserver-686 (i686) +X-Uptime: 12:08:22 up 36 days, 10:03, 21 users, load average: 1.31, 0.84, 1.14 +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/187 +X-Sequence-Number: 19544 + + +--Qa+qcrCtlQ17sJ4A +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable + +* Steinar H. Gunderson (sgunderson@bigfoot.com) wrote: +> On Mon, Jun 12, 2006 at 10:44:01PM -0400, Tom Lane wrote: +> > (Personally, if I'd designed it, the libraries would actually live in +> > /usr/lib32 and /usr/lib64, and /usr/lib would be a symlink to whichever +> > you needed it to be at the moment. Likewise for /usr/bin.) +>=20 +> Actually, there have been plans for doing something like this in Debian f= +or a +> while: Let stuff live in /lib/i686-linux-gnu and /lib/x86_64-linux-gnu +> (lib32 and lib64 doesn't really scale, once you start considering stuff l= +ike +> "ia64 can emulate hppa"), and adjust paths and symlinks as fit. It's stil= +l a +> long way to go, though. + +The general feeling is that there won't be support for multiple versions +of a given binary being installed at once though. The proposal Steinar +mentioned is called 'multiarch' and is being discussed with LSB and +other distros too, though I think it did mostly originated with Debian +folks. + +Just my 2c. + + Thanks, + + Stephen + +--Qa+qcrCtlQ17sJ4A +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: Digital signature +Content-Disposition: inline + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.3 (GNU/Linux) + +iD8DBQFEjuPGrzgMPqB3kigRAk2+AJ9w1MPOQh610hM1UdsetrPBl7yY9gCgl5c5 +5NqKcABX4ee+pVZbH5Yhwus= +=5MDP +-----END PGP SIGNATURE----- + +--Qa+qcrCtlQ17sJ4A-- + +From pgsql-performance-owner@postgresql.org Tue Jun 13 14:53:40 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2FC229FA13E + for ; + Tue, 13 Jun 2006 14:53:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 06135-06 for + ; + Tue, 13 Jun 2006 14:53:36 -0300 (ADT) +X-Greylist: delayed 00:20:31.251579 by SQLgrey- +Received: from mail.leapfrogonline.com (mail.leapfrogonline.com + [69.36.35.239]) + by postgresql.org (Postfix) with ESMTP id EFD659F9316 + for ; + Tue, 13 Jun 2006 14:53:35 -0300 (ADT) +Received: from leapfrogonlinecom-MTA by mail.leapfrogonline.com + with Novell_GroupWise; Tue, 13 Jun 2006 12:32:53 -0500 +Message-Id: <448EB053.8F27.00A9.0@leapfrogonline.com> +X-Mailer: Novell GroupWise Internet Agent 7.0.1 Beta +Date: Tue, 13 Jun 2006 12:32:19 -0500 +From: "Shaun Thomas" +To: +Subject: Confirmation of bad query plan generated by 7.4 tree +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/188 +X-Sequence-Number: 19545 + +Just so I don't think I'm insane: + +warehouse=# explain analyze select e.event_date::date +warehouse-# from l_event_log e +warehouse-# JOIN c_event_type t ON (t.id = e.event_type_id) +warehouse-# WHERE e.event_date > now() - interval '2 days' +warehouse-# AND t.event_name = 'activation'; + +QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------- + Hash Join (cost=9.22..2723869.56 rows=268505 width=8) (actual +time=107.324..408.466 rows=815 loops=1) + Hash Cond: ("outer".event_type_id = "inner".id) + -> Index Scan using idx_evt_dt on l_event_log e +(cost=0.00..2641742.75 rows=15752255 width=12) (actual +time=0.034..229.641 rows=38923 loops=1) + Index Cond: (event_date > (now() - '2 days'::interval)) + -> Hash (cost=9.21..9.21 rows=3 width=4) (actual time=0.392..0.392 +rows=0 loops=1) + -> Index Scan using pk_c_event_type on c_event_type t +(cost=0.00..9.21 rows=3 width=4) (actual time=0.071..0.353 rows=6 +loops=1) + Filter: ((event_name)::text = 'activation'::text) + Total runtime: 412.015 ms +(8 rows) + + +Am I correct in assuming this terrible plan is due to our ancient +version of Postgres? +This plan is so bad, the system prefers a sequence scan on our 27M row +table with dates +spanning 4 years. 2 days should come back instantly. Both tables are +freshly vacuumed +and analyzed, so I'll just chalk this up to 7.4 sucking unless someone +says otherwise. + + +-- + +Shaun Thomas +Database Administrator + +Leapfrog Online +807 Greenwood Street +Evanston, IL 60201 +Tel. 847-440-8253 +Fax. 847-570-5750 +www.leapfrogonline.com + + +Confidentiality Note: + +The document(s) accompanying this e-mail transmission, if any, and the +e-mail transmittal message contain information from Leapfrog Online +Customer Acquisition, LLC is confidential or privileged. The information +is intended to be for the use of the individual(s) or entity(ies) named +on this e-mail transmission message. If you are not the intended +recipient, be aware that any disclosure, copying, distribution or use of +the contents of this e-mail is prohibited. If you have received this +e-mail in error, please immediately delete this e-mail and notify us by +telephone of the error + +From pgsql-performance-owner@postgresql.org Tue Jun 13 15:02:49 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3B7D09FA13E + for ; + Tue, 13 Jun 2006 15:02:49 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 08506-06 for + ; + Tue, 13 Jun 2006 15:02:44 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.206]) + by postgresql.org (Postfix) with ESMTP id DDC939F9316 + for ; + Tue, 13 Jun 2006 15:02:43 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id s1so1516028nze + for ; + Tue, 13 Jun 2006 11:02:43 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:subject:from:reply-to:to:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding; + b=nEkk0hLGST3Fexv2ID1ZgcjbsEVYOF1ca65LVH8aCEO1qhx8Vw6Jpf/8fK/Qn0OyeEaHP3tOv7njLNuZqLZx4T7rPfw5yrmfOUUs6NHvM82CRJ827/y23v+UJt3qKh7vibg0uE+rzkkiZYklwdHQdbm+sTXAXhHbsIsWIOeojHQ= +Received: by 10.65.220.8 with SMTP id x8mr62840qbq; + Tue, 13 Jun 2006 11:02:43 -0700 (PDT) +Received: from ?10.0.0.174? ( [63.193.127.22]) + by mx.gmail.com with ESMTP id d12sm2551647qbc.2006.06.13.11.02.42; + Tue, 13 Jun 2006 11:02:42 -0700 (PDT) +Subject: Which processor runs better for Postgresql? +From: Steve Poe +Reply-To: steve.poe@gmail.com +To: pgsql-performance@postgresql.org +Content-Type: text/plain +Date: Tue, 13 Jun 2006 11:02:40 -0700 +Message-Id: <1150221760.12191.25.camel@amd64-gentoo-laptop> +Mime-Version: 1.0 +X-Mailer: Evolution 2.4.2.1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/189 +X-Sequence-Number: 19546 + +I have a client who is running Postgresql 7.4.x series database +(required to use 7.4.x). They are planning an upgrade to a new server. +They are insistent on Dell. + +I have personal experience with AMD dual Opteron, but I have not seen +any benchmarks on Intel's dual core Xeon. I've seen in the past Dell and +not performed well as well as Xeon's HT issues. + +Can anyone share what their experience has been with Intel's dual core +CPUs and/or Dell's new servers? + +I am hoping the client is willing to wait for Dell to ship a AMD +Opeteron-based server. + +Thanks. + +Steve Poe + + +From pgsql-performance-owner@postgresql.org Tue Jun 13 15:09:40 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8C8AF9FA13E + for ; + Tue, 13 Jun 2006 15:09:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 08110-05 for + ; + Tue, 13 Jun 2006 15:09:32 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id E73549F9316 + for ; + Tue, 13 Jun 2006 15:09:31 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5DI9Spu009120; + Tue, 13 Jun 2006 14:09:28 -0400 (EDT) +To: "Shaun Thomas" +cc: pgsql-performance@postgresql.org +Subject: Re: Confirmation of bad query plan generated by 7.4 tree +In-reply-to: <448EB053.8F27.00A9.0@leapfrogonline.com> +References: <448EB053.8F27.00A9.0@leapfrogonline.com> +Comments: In-reply-to "Shaun Thomas" + message dated "Tue, 13 Jun 2006 12:32:19 -0500" +Date: Tue, 13 Jun 2006 14:09:28 -0400 +Message-ID: <9119.1150222168@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/190 +X-Sequence-Number: 19547 + +"Shaun Thomas" writes: +> Am I correct in assuming this terrible plan is due to our ancient +> version of Postgres? + +I missed the part where you explain why you think this plan is terrible? +412ms for what seems a rather expensive query doesn't sound so awful. +Do you know an alternative that is better? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jun 13 15:17:40 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C86A49FA13E + for ; + Tue, 13 Jun 2006 15:17:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 06852-10 for + ; + Tue, 13 Jun 2006 15:17:33 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.168]) + by postgresql.org (Postfix) with ESMTP id 224769F9316 + for ; + Tue, 13 Jun 2006 15:17:31 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id m3so2373946ugc + for ; + Tue, 13 Jun 2006 11:17:30 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:from:to:references:subject:date:mime-version:content-type:content-transfer-encoding:x-priority:x-msmail-priority:x-mailer:x-mimeole; + b=Vw8S9XGONkju9/6Rujm+/8DcP+2Cz4ZVLIlMLsAiSAs/rabB3favsytf/uVGYUava1XmoOT+KJGD5gcZg+6JGJAWTigbCHt5icjxu2HyIN//lzIhPy7pX/uFgeTA2Qzijr0tvjU45NzaAxWrD8Qj7hZKrZK7uyWWSLwFhUudbTo= +Received: by 10.67.97.7 with SMTP id z7mr6509492ugl; + Tue, 13 Jun 2006 11:17:30 -0700 (PDT) +Received: from maniek ( [62.148.95.123]) + by mx.gmail.com with ESMTP id s1sm7876280uge.2006.06.13.11.17.29; + Tue, 13 Jun 2006 11:17:30 -0700 (PDT) +Message-ID: <00af01c68f15$acd6eed0$0c67a8c0@maniek> +From: "Marcin Mank" +To: "Shaun Thomas" , + +References: <448EB053.8F27.00A9.0@leapfrogonline.com> +Subject: Re: Confirmation of bad query plan generated by 7.4 tree +Date: Tue, 13 Jun 2006 20:17:46 +0200 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="ISO-8859-1" +Content-Transfer-Encoding: 7bit +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 6.00.2800.1506 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/191 +X-Sequence-Number: 19548 + +> warehouse-# WHERE e.event_date > now() - interval '2 days' + +Try explicitly querying: +WHERE e.event_date > '2006-06-11 20:15:00' + +In my understanding 7.4 does not precalculate this timestamp value for the +purpose of choosing a plan. + +Greetings +Marcin + + +From pgsql-performance-owner@postgresql.org Tue Jun 13 16:04:16 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5477E9FA13E + for ; + Tue, 13 Jun 2006 16:04:16 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 11677-08 for + ; + Tue, 13 Jun 2006 16:04:10 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id 5E3A49F9316 + for ; + Tue, 13 Jun 2006 16:04:10 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 0857830920; Tue, 13 Jun 2006 21:04:07 +0200 (MET DST) +From: Chris Browne +X-Newsgroups: pgsql.performance +Subject: Re: Which processor runs better for Postgresql? +Date: Tue, 13 Jun 2006 14:22:06 -0400 +Organization: cbbrowne Computing Inc +Lines: 36 +Message-ID: <60bqswvru9.fsf@dba2.int.libertyrms.com> +References: <1150221760.12191.25.camel@amd64-gentoo-laptop> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@news.hub.org +User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.19 (linux) +Cancel-Lock: sha1:FQV0QgZOeRV/c/CzGiljFJc4sUc= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/193 +X-Sequence-Number: 19550 + +steve.poe@gmail.com (Steve Poe) writes: +> I have a client who is running Postgresql 7.4.x series database +> (required to use 7.4.x). They are planning an upgrade to a new server. +> They are insistent on Dell. + +Then they're being insistent on poor performance. + +If you search for "dell postgresql performance" you'll find plenty of +examples of people who have been disappointed when they insisted on +Dell for PostgreSQL. + +Here is a *long* thread on the matter... + + +> I am hoping the client is willing to wait for Dell to ship a AMD +> Opeteron-based server. + +Based on Dell's history, I would neither: + + a) Hold my breath, nor + + b) Expect an Opteron-based Dell server to perform as well as + seemingly-equivalent servers provisioned by other vendors. + +We got burned by some Celestica-built Opterons that didn't turn out +quite as hoped. + +We have had somewhat better results with some HP Opterons; they appear +to be surviving less-than-ideal 3rd world data centre situations with +reasonable aplomb. (Based on the amount of dust in their diet, I'm +somewhat surprised the disk drives are still running...) +-- +let name="cbbrowne" and tld="acm.org" in name ^ "@" ^ tld;; +http://cbbrowne.com/info/nonrdbms.html +We are Pentium of Borg. Division is futile. You will be approximated. +(seen in someone's .signature) + +From pgsql-performance-owner@postgresql.org Tue Jun 13 16:00:11 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A87429FA13E + for ; + Tue, 13 Jun 2006 16:00:11 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 12173-10 for + ; + Tue, 13 Jun 2006 16:00:04 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 3340F9F9316 + for ; + Tue, 13 Jun 2006 16:00:03 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Tue, 13 Jun 2006 19:00:02 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 13 Jun 2006 14:00:02 -0500 +Subject: Re: Which processor runs better for Postgresql? +From: Scott Marlowe +To: steve.poe@gmail.com +Cc: pgsql-performance@postgresql.org +In-Reply-To: <1150221760.12191.25.camel@amd64-gentoo-laptop> +References: <1150221760.12191.25.camel@amd64-gentoo-laptop> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1150225202.29299.51.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Tue, 13 Jun 2006 14:00:02 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/192 +X-Sequence-Number: 19549 + +On Tue, 2006-06-13 at 13:02, Steve Poe wrote: +> I have a client who is running Postgresql 7.4.x series database +> (required to use 7.4.x). They are planning an upgrade to a new server. +> They are insistent on Dell. + +Do they have a logical reason for this, or is it mostly hand-waving? My +experience has been hand waving. Last company I was at, the CIO bragged +about having saved a million a year on server by going with Dell. His +numbers were made up, and, in fact, we spent a large portion of each +week babysitting those god awful 2600 series machines with adaptec cards +and the serverworks chipset. And they were slow compared to anything +else with similar specs. + +> I have personal experience with AMD dual Opteron, but I have not seen +> any benchmarks on Intel's dual core Xeon. I've seen in the past Dell and +> not performed well as well as Xeon's HT issues. + +Dells tend to perform poorly, period. They choose low end parts (the +2600's Serverworks chipset is widely regarded as one of the slowest +chipset for the P-IV there is.) and then mucking around with the BIOS of +the add in cards to make them somewhat stable with their dodgy hardware. + +> Can anyone share what their experience has been with Intel's dual core +> CPUs and/or Dell's new servers? + +Haven't used the dual core Dells. Latest ones I've used are the dual +Xeon 2850 machines, which are at least stable, if still pretty pokey. + +> I am hoping the client is willing to wait for Dell to ship a AMD +> Opeteron-based server. + +Let's just hope Dell hasn't spent all this time hamstringing a good chip +with low end, underperforming hardware, eh? + +My suggestion is to look at something like this: + +http://www.abmx.com/1u-supermicro-amd-opteron-rackmount-server-p-210.html + +1U rackmount opteron from Supermicro that can have two dual core +opterons and 4 drives and up to 16 gigs of ram. Supermicro server +motherboards have always treated me well and performed well too. + +From pgsql-performance-owner@postgresql.org Tue Jun 13 16:11:39 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E849D9FA13E + for ; + Tue, 13 Jun 2006 16:11:38 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 13935-10 for + ; + Tue, 13 Jun 2006 16:11:29 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from skunk.mtbrook.bozemanpass.com (unknown [69.145.82.195]) + by postgresql.org (Postfix) with ESMTP id 2C17C9F9316 + for ; + Tue, 13 Jun 2006 16:11:28 -0300 (ADT) +Received: from [69.145.82.218] (unknown [69.145.82.218]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by skunk.mtbrook.bozemanpass.com (Postfix) with ESMTP id E46FD5582B6 + for ; + Tue, 13 Jun 2006 12:11:24 -0700 (PDT) +Message-ID: <448F0DE0.50509@boreham.org> +Date: Tue, 13 Jun 2006 13:11:28 -0600 +From: David Boreham +Reply-To: david_list@boreham.org +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Which processor runs better for Postgresql? +References: <1150221760.12191.25.camel@amd64-gentoo-laptop> + <1150225202.29299.51.camel@state.g2switchworks.com> +In-Reply-To: <1150225202.29299.51.camel@state.g2switchworks.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/194 +X-Sequence-Number: 19551 + + +>My suggestion is to look at something like this: +> +>http://www.abmx.com/1u-supermicro-amd-opteron-rackmount-server-p-210.html +> +>1U rackmount opteron from Supermicro that can have two dual core +>opterons and 4 drives and up to 16 gigs of ram. Supermicro server +>motherboards have always treated me well and performed well too. +> +> +I've had good experience with similar machines from Tyan : +http://www.tyan.com/products/html/gt24b2891.html + + + + + +From pgsql-performance-owner@postgresql.org Tue Jun 13 16:15:27 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 997CD9FA5F8 + for ; + Tue, 13 Jun 2006 16:15:27 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 15078-06 for + ; + Tue, 13 Jun 2006 16:15:17 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from candle.pha.pa.us (candle.pha.pa.us [70.90.9.53]) + by postgresql.org (Postfix) with ESMTP id 479979F9316 + for ; + Tue, 13 Jun 2006 16:15:17 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id k5DJFDk06984; + Tue, 13 Jun 2006 15:15:13 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200606131915.k5DJFDk06984@candle.pha.pa.us> +Subject: Re: Which processor runs better for Postgresql? +In-Reply-To: <448F0DE0.50509@boreham.org> +To: david_list@boreham.org +Date: Tue, 13 Jun 2006 15:15:13 -0400 (EDT) +CC: pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/195 +X-Sequence-Number: 19552 + +David Boreham wrote: +> +> >My suggestion is to look at something like this: +> > +> >http://www.abmx.com/1u-supermicro-amd-opteron-rackmount-server-p-210.html +> > +> >1U rackmount opteron from Supermicro that can have two dual core +> >opterons and 4 drives and up to 16 gigs of ram. Supermicro server +> >motherboards have always treated me well and performed well too. +> > +> > +> I've had good experience with similar machines from Tyan : +> http://www.tyan.com/products/html/gt24b2891.html + +In fact I think Tyan makes the Supermicro motherboards. + +-- + Bruce Momjian http://candle.pha.pa.us + EnterpriseDB http://www.enterprisedb.com + + + If your life is a hard drive, Christ can be your backup. + + +From pgsql-performance-owner@postgresql.org Tue Jun 13 16:26:18 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 85DC89FA13E + for ; + Tue, 13 Jun 2006 16:26:17 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 15755-08 for + ; + Tue, 13 Jun 2006 16:26:11 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id E75689F9316 + for ; + Tue, 13 Jun 2006 16:26:10 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id CFC8B5643D; Tue, 13 Jun 2006 14:26:09 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Tue, 13 Jun 2006 14:26:09 -0500 +Date: Tue, 13 Jun 2006 14:26:09 -0500 +From: "Jim C. Nasby" +To: Zydoon +Cc: pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +Message-ID: <20060613192609.GX34196@pervasive.com> +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> + <20060603094355.GA23297@uio.no> + <1150062140.23423.0.camel@localhost.localdomain> + <448D3B65.7090709@aeccom.com> <448DE0DB.1020107@planet.tn> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <448DE0DB.1020107@planet.tn> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: 1:20:060613:fzied@planet.tn::aX7MDfhCx0DljWf/:001FRE +X-Hashcash: + 1:20:060613:pgsql-performance@postgresql.org::BV1KpzrHAO2r2HkJ:00000 + 0000000000000000000000001sYg +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/196 +X-Sequence-Number: 19553 + +On Mon, Jun 12, 2006 at 11:47:07PM +0200, Zydoon wrote: +> Thank you for sharing this. +> Coming back to my problem :) A very faithful partner accepted to +> gracefully borrow us 3 Pseries (bi-ppc + 2G RAM not more). with linux on +> them. +> Now I'm trying to make my tests, and I'm not that sure I will make the +> switch to the PSeries, since my dual xeon with 4 G RAM can handle 3500 +> concurrent postmasters consuming 3.7 G of the RAM. I cannot reach this +> number on the PSeries with 2 G. +> +> can someone give me advice ? + +Uhm... stick with commodity CPUs? + +Seriously, unless you're going to run on some seriously big hardware +you'll be hard-pressed to find better performance/dollar than going with +a server running Opterons. + +If you're trying to decide how much hardware you need to meet a specific +performance target there's a company here in Austin I can put you in +touch with; if I'm not mistaken on the cost of pSeries hardware their +fee would be well worth it to make sure you don't end up with too much +(or worse, too little) hardware for your load. + +> BTW, I promise, at the end of my tests, I'll publish my report. + +Great. More performance data is always good to have. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Tue Jun 13 16:28:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4257F9FA13E + for ; + Tue, 13 Jun 2006 16:28:55 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 14834-09 for + ; + Tue, 13 Jun 2006 16:28:51 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 322D09F9316 + for ; + Tue, 13 Jun 2006 16:28:51 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Tue, 13 Jun 2006 19:28:50 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 13 Jun 2006 14:28:49 -0500 +Subject: Re: scaling up postgres +From: Scott Marlowe +To: Zydoon +Cc: pgsql-performance@postgresql.org +In-Reply-To: <448DE0DB.1020107@planet.tn> +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> + <20060603094355.GA23297@uio.no> + <1150062140.23423.0.camel@localhost.localdomain> + <448D3B65.7090709@aeccom.com> <448DE0DB.1020107@planet.tn> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1150226929.29299.54.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Tue, 13 Jun 2006 14:28:49 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/197 +X-Sequence-Number: 19554 + +On Mon, 2006-06-12 at 16:47, Zydoon wrote: +> -----BEGIN PGP SIGNED MESSAGE----- +> Thank you for sharing this. +> Coming back to my problem :) A very faithful partner accepted to +> gracefully borrow us 3 Pseries (bi-ppc + 2G RAM not more). with linux on +> them. +> Now I'm trying to make my tests, and I'm not that sure I will make the +> switch to the PSeries, since my dual xeon with 4 G RAM can handle 3500 +> concurrent postmasters consuming 3.7 G of the RAM. I cannot reach this +> number on the PSeries with 2 G. +> +> can someone give me advice ? +> BTW, I promise, at the end of my tests, I'll publish my report. + +Search the performance archives for the last 4 or 5 months for PPC / +pseries machines. + +You'll find a very long thread about the disappointing performance the +tester got with a rather expensive P Series machine. And his happy +ending of testing on an Opteron machine. + +From pgsql-performance-owner@postgresql.org Tue Jun 13 16:38:38 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id ED6C29FA13E + for ; + Tue, 13 Jun 2006 16:38:37 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 20137-02 for + ; + Tue, 13 Jun 2006 16:38:31 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from pat.laterooms.com (fon.nation-net.com [194.24.251.1]) + by postgresql.org (Postfix) with ESMTP id D33FA9F9316 + for ; + Tue, 13 Jun 2006 16:38:30 -0300 (ADT) +Received: from pat.laterooms.com (localhost.localdomain [127.0.0.1]) + by pat.laterooms.com (Postfix) with ESMTP id 60486C1BD + for ; + Tue, 13 Jun 2006 20:38:28 +0100 (BST) +Received: from eddie.acentral.co.uk + (80-192-144-33.cable.ubr04.pres.blueyonder.co.uk [80.192.144.33]) + by pat.laterooms.com (Postfix) with ESMTP id 401B4C1BB + for ; + Tue, 13 Jun 2006 20:38:28 +0100 (BST) +Received: from eddie.acentral.co.uk (eddie.acentral.co.uk [127.0.0.1]) + by eddie.acentral.co.uk (Postfix) with ESMTP id B819175DEE + for ; + Tue, 13 Jun 2006 20:38:33 +0100 (BST) +Received: from localhost.localdomain (unknown [10.0.0.29]) + by eddie.acentral.co.uk (Postfix) with SMTP id 9ECD675D82 + for ; + Tue, 13 Jun 2006 20:38:33 +0100 (BST) +Date: Tue, 13 Jun 2006 20:38:24 +0100 +From: Gavin Hamill +To: pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +Message-Id: <20060613203824.7bca92bf.gdh@laterooms.com> +In-Reply-To: <1150226929.29299.54.camel@state.g2switchworks.com> +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> + <20060603094355.GA23297@uio.no> + <1150062140.23423.0.camel@localhost.localdomain> + <448D3B65.7090709@aeccom.com> <448DE0DB.1020107@planet.tn> + <1150226929.29299.54.camel@state.g2switchworks.com> +X-Mailer: Sylpheed version 2.2.4 (GTK+ 2.8.17; i486-pc-linux-gnu) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: ClamAV using ClamSMTP +X-AV-Checked: ClamAV using ClamSMTP +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/198 +X-Sequence-Number: 19555 + +On Tue, 13 Jun 2006 14:28:49 -0500 +Scott Marlowe wrote: + +> Search the performance archives for the last 4 or 5 months for PPC / +> pseries machines. +> +> You'll find a very long thread about the disappointing performance the +> tester got with a rather expensive P Series machine. And his happy +> ending of testing on an Opteron machine. + +Amen, brother :) + +We hoped throwing a silly pSeries 650 would solve all our problems. Boy +were we wrong... a world of pain... + +Don't go there - just buy an Opteron system - if you're talking about +IBM big iron, a decent Opteron will cost you about as much as a couple +of compilers and an on-site visit from IBM... + +Cheers, +Gavin. + +From pgsql-performance-owner@postgresql.org Tue Jun 13 16:43:54 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 51B099FA13E + for ; + Tue, 13 Jun 2006 16:43:54 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 18364-08 for + ; + Tue, 13 Jun 2006 16:43:42 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id D47CA9F9316 + for ; + Tue, 13 Jun 2006 16:43:41 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id E997356437; Tue, 13 Jun 2006 14:43:39 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Tue, 13 Jun 2006 14:43:38 -0500 +Date: Tue, 13 Jun 2006 14:43:38 -0500 +From: "Jim C. Nasby" +To: David Boreham +Cc: pgsql-performance@postgresql.org +Subject: Re: 64-bit vs 32-bit performance ... backwards? +Message-ID: <20060613194337.GY34196@pervasive.com> +References: <1150151282.14661.42.camel@tigger> <448DF692.3070906@boreham.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <448DF692.3070906@boreham.org> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060613:david_list@boreham.org::D64LRArXOz1eDf5/:000000000000000 + 0000000000000000000000007S18 +X-Hashcash: + 1:20:060613:pgsql-performance@postgresql.org::c8BSOaX43LXcO52F:00000 + 000000000000000000000000HGNB +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/199 +X-Sequence-Number: 19556 + +On Mon, Jun 12, 2006 at 05:19:46PM -0600, David Boreham wrote: +> What they are saying is strictly true : 64-bit pointers tend to increase +> the working set size +> of an application vs. 32-bit pointers. This means that any caches will +> have somewhat lower +> hit ratio. Also the bytes/s between the CPU and memory will be higher +> due to moving those larger pointers. + +While bytes/s will go up what really matters is words/s, where a word is +the size of a memory transfer to the CPU. Taking a simplistic view, 8 +bit CPUs move data into the CPU one byte at a time; 16 bit CPUs, 2 +bytes; 32 bit, 4 bytes, and 64 bit, 8 bytes. The reality is a bit more +complicated, but I'm 99.9% certain that you won't see a modern 64 bit CPU +tranfering data in less than 64 bit increments. + +> However, an application that needs to work on > around 2G of data will +> in the end be +> much faster 64-bit due to reduced I/O (it can keep more of the data in +> memory). + +There's not an automatic correlation between word size and address +space, just look at the 8088, so this depends entirely on the CPU. + +> I worked on porting a large database application from 32-bit to 64-bit. One +> of our customers required us to retain the 32-bit version because of +> this phenomenon. +> +> In measurements I conducted on that application, the performance +> difference wasn't +> great (10% or so), but it was measurable. This was with Sun Sparc hardware. +> It is possible that more modern CPU designs have more efficient 64-bit +> implementation than 32-bit, so the opposite might be seen too. +> +> Whether or not PG would show the same thing I can't say for sure. +> Probably it would though. + +It's going to depend entirely on the CPU and the compiler. I can say +that in the 32 vs 64 bit benchmarking I've done using dbt2, I wasn't +able to find a difference at all on Sunfire Opteron machines. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Tue Jun 13 16:44:28 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 411109FA13E + for ; + Tue, 13 Jun 2006 16:44:28 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 17777-09 for + ; + Tue, 13 Jun 2006 16:44:23 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from projects.commandprompt.com (host-130.commandprompt.net + [207.173.203.130]) + by postgresql.org (Postfix) with ESMTP id 1407C9F9316 + for ; + Tue, 13 Jun 2006 16:44:22 -0300 (ADT) +Received: from [192.168.1.50] (or-67-76-146-141.sta.sprint-hsd.net + [67.76.146.141]) (authenticated bits=0) + by projects.commandprompt.com (8.13.6/8.13.6) with ESMTP id + k5DJiKIt012207; Tue, 13 Jun 2006 12:44:21 -0700 +Message-ID: <448F1591.4000404@commandprompt.com> +Date: Tue, 13 Jun 2006 12:44:17 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Thunderbird 1.5.0.2 (X11/20060521) +MIME-Version: 1.0 +To: Scott Marlowe +CC: steve.poe@gmail.com, pgsql-performance@postgresql.org +Subject: Re: Which processor runs better for Postgresql? +References: <1150221760.12191.25.camel@amd64-gentoo-laptop> + <1150225202.29299.51.camel@state.g2switchworks.com> +In-Reply-To: <1150225202.29299.51.camel@state.g2switchworks.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: ClamAV version 0.88.2, + clamav-milter version 0.88.2 on projects.commandprompt.com +X-Virus-Status: Clean +X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by + milter-greylist-1.6 (projects.commandprompt.com + [192.168.2.159]); Tue, 13 Jun 2006 12:44:21 -0700 (PDT) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/200 +X-Sequence-Number: 19557 + +Scott Marlowe wrote: +> On Tue, 2006-06-13 at 13:02, Steve Poe wrote: +>> I have a client who is running Postgresql 7.4.x series database +>> (required to use 7.4.x). They are planning an upgrade to a new server. +>> They are insistent on Dell. +> +> Do they have a logical reason for this, or is it mostly hand-waving? + +They probably do. They have probably standardized on Dell hardware. It +is technically a dumb reason, but from a business standpoint it makes sense. + + My +> experience has been hand waving. Last company I was at, the CIO bragged +> about having saved a million a year on server by going with Dell. His +> numbers were made up, and, in fact, we spent a large portion of each +> week babysitting those god awful 2600 series machines with adaptec cards +> and the serverworks chipset. And they were slow compared to anything +> else with similar specs. + +You can get extremely competitive quotes from IBM or HP as long as you +say, "You are competing against Dell". + +> Dells tend to perform poorly, period. They choose low end parts (the +> 2600's Serverworks chipset is widely regarded as one of the slowest +> chipset for the P-IV there is.) and then mucking around with the BIOS of +> the add in cards to make them somewhat stable with their dodgy hardware. + +I can confirm this. + +>> I am hoping the client is willing to wait for Dell to ship a AMD +>> Opeteron-based server. + +Tell them to go with an HP DL 385. They will be much happier. + +Sincerely, + +Joshua D. Drake + + +-- + + === The PostgreSQL Company: Command Prompt, Inc. === +Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 + Providing the most comprehensive PostgreSQL solutions since 1997 + http://www.commandprompt.com/ + + + +From pgsql-performance-owner@postgresql.org Tue Jun 13 17:08:25 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 915849FA13E + for ; + Tue, 13 Jun 2006 17:08:24 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 20509-07 for + ; + Tue, 13 Jun 2006 17:08:15 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 768249F9316 + for ; + Tue, 13 Jun 2006 17:08:14 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 0429756437; Tue, 13 Jun 2006 15:08:11 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Tue, 13 Jun 2006 15:08:10 -0500 +Date: Tue, 13 Jun 2006 15:08:10 -0500 +From: "Jim C. Nasby" +To: Anthony Presley , pgsql-performance@postgresql.org +Subject: Re: 64-bit vs 32-bit performance ... backwards? +Message-ID: <20060613200810.GZ34196@pervasive.com> +References: <1150151282.14661.42.camel@tigger> + <20060613000441.GI8588@kenobi.snowman.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20060613000441.GI8588@kenobi.snowman.net> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060613:anthony@resolution.com::RpOs7MJqoYomZxEI:000000000000000 + 0000000000000000000000000LL0 +X-Hashcash: + 1:20:060613:pgsql-performance@postgresql.org::dzHARTiACHBSTyPs:00000 + 0000000000000000000000000azo +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/201 +X-Sequence-Number: 19558 + +On Mon, Jun 12, 2006 at 08:04:41PM -0400, Stephen Frost wrote: +> don't think). This is because Postgres lets the OS handle most of the +> cacheing, so as long as your OS can see all the memory you have in the + +Actually, in 8.1.x I've seen some big wins from greatly increasing the +amount of shared_buffers, even as high as 50% of memory, thanks to the +changes made to the buffer management code. I'd strongly advice users to +benchmark their applications with higher shared_buffers and see what +impact it has, especially if your application can't make use of really +big work_mem settings. If there's additional changes to the shared +buffer code in 8.2 (I know Tom's been looking at doing multiple buffer +pools to reduce contention on the BufMgr lock), it'd be worth +re-benchmarking when it comes out. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Tue Jun 13 17:11:33 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 52F269FA13E + for ; + Tue, 13 Jun 2006 17:11:33 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 21178-05 for + ; + Tue, 13 Jun 2006 17:11:26 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net + [194.217.242.89]) + by postgresql.org (Postfix) with ESMTP id D05EE9F9316 + for ; + Tue, 13 Jun 2006 17:11:26 -0300 (ADT) +Received: from mailgate.vale-housing.co.uk ([194.217.48.34] + helo=vale-housing.co.uk) + by anchor-post-31.mail.demon.net with esmtp (Exim 4.42) + id 1FqFET-000NRR-3T + for pgsql-performance@postgresql.org; Tue, 13 Jun 2006 20:11:25 +0000 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Subject: Re: Which processor runs better for Postgresql? +Date: Tue, 13 Jun 2006 21:11:24 +0100 +Message-ID: + +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Which processor runs better for Postgresql? +thread-index: AcaPIeMWar9gA/xCSu6GG5LfINVeegAAoF9w +From: "Dave Page" +To: "Joshua D. Drake" , + "Scott Marlowe" +Cc: , + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/202 +X-Sequence-Number: 19559 + +=20 + +> -----Original Message----- +> From: pgsql-performance-owner@postgresql.org=20 +> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of=20 +> Joshua D. Drake +> Sent: 13 June 2006 20:44 +> To: Scott Marlowe +> Cc: steve.poe@gmail.com; pgsql-performance@postgresql.org +> Subject: Re: [PERFORM] Which processor runs better for Postgresql? +>=20 +> They probably do. They have probably standardized on Dell=20 +> hardware. It=20 +> is technically a dumb reason, but from a business standpoint=20 +> it makes sense. + +We use Dell here for those reasons these days, but thankfully are able +to suitably overspec everything to allow for significant growth and any +minor performance issues that they may have (we've never seen any +though). In Dell's defence we've never had a single problem with the +2850's or 1850's we're running which have all been rock solid. They also +have excellent OOB management in their DRAC cards - far better than that +in the slightly older Intel boxes we also run. That is a big selling +point for us. + +> You can get extremely competitive quotes from IBM or HP as=20 +> long as you=20 +> say, "You are competing against Dell". + +Dell beat them hands down in our experience - and yes, we have had +numerous quotes for HP and IBM kit, each of them knowing they are +competing against Dell. + +> > Dells tend to perform poorly, period. They choose low end=20 +> parts (the +> > 2600's Serverworks chipset is widely regarded as one of the slowest +> > chipset for the P-IV there is.) and then mucking around=20 +> with the BIOS of +> > the add in cards to make them somewhat stable with their=20 +> dodgy hardware. +>=20 +> I can confirm this. + +And how old are the 2600's now? + +Anyhoo, I'm not saying the current machines are excellent performers or +anything, but there are good business reasons to run them if you don't +need to squeeze out every last pony. + +Regards, Dave. + +From pgsql-performance-owner@postgresql.org Tue Jun 13 17:13:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0454E9FA13E + for ; + Tue, 13 Jun 2006 17:13:55 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 22576-06 for + ; + Tue, 13 Jun 2006 17:13:46 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from peufeu.com (boutiquenumerique.com [82.67.9.10]) + by postgresql.org (Postfix) with ESMTP id 34E889F9316 + for ; + Tue, 13 Jun 2006 17:13:45 -0300 (ADT) +Received: (qmail 14698 invoked from network); 13 Jun 2006 22:14:45 +0200 +Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) + by boutiquenumerique.com with SMTP; 13 Jun 2006 22:14:45 +0200 +To: pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> + <20060603094355.GA23297@uio.no> + <1150062140.23423.0.camel@localhost.localdomain> + <448D3B65.7090709@aeccom.com> <448DE0DB.1020107@planet.tn> + <20060613192609.GX34196@pervasive.com> +Message-ID: +Date: Tue, 13 Jun 2006 22:14:44 +0200 +From: PFC +Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <20060613192609.GX34196@pervasive.com> +User-Agent: Opera M2/8.54 (Linux, build 1745) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/203 +X-Sequence-Number: 19560 + + +> Uhm... stick with commodity CPUs? + + Hehe, does this include Opterons ? + + Still, I looked on the "customize your server" link someone posted and +it's amazing ; these things have become cheaper while I wasn't looking... + You can buy 10 of these boxes with raptors and 4 opteron cores and 8 gigs +of RAM for the price of your average marketing boss's car... definitely +makes you think doesn't it. + + Juts wait until someone equates the price in man-hours to fix/run a +borken Dell box... + + + + + +From pgsql-performance-owner@postgresql.org Tue Jun 13 17:55:31 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C1F8F9FA13E + for ; + Tue, 13 Jun 2006 17:55:30 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 25439-09 for + ; + Tue, 13 Jun 2006 17:55:26 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.leapfrogonline.com (mail.leapfrogonline.com + [69.36.35.239]) + by postgresql.org (Postfix) with ESMTP id B7D039F9316 + for ; + Tue, 13 Jun 2006 17:55:26 -0300 (ADT) +Received: from leapfrogonlinecom-MTA by mail.leapfrogonline.com + with Novell_GroupWise; Tue, 13 Jun 2006 15:55:16 -0500 +Message-Id: <448EDFC4.8F27.00A9.0@leapfrogonline.com> +X-Mailer: Novell GroupWise Internet Agent 7.0.1 Beta +Date: Tue, 13 Jun 2006 15:54:44 -0500 +From: "Shaun Thomas" +To: "Tom Lane" +Cc: +Subject: Re: Confirmation of bad query plan generated by 7.4 +References: + <448EB053.8F27.00A9.0@leapfrogonline.com><448EB053.8F27.00A9.0@leapfrogonline.com> + <9119.1150222168@sss.pgh.pa.us> +In-Reply-To: <9119.1150222168@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/204 +X-Sequence-Number: 19561 + +>>> On 6/13/2006 at 1:09 PM, Tom Lane wrote: + +> I missed the part where you explain why you think this plan is +terrible? +> 412ms for what seems a rather expensive query doesn't sound so +awful. + +Sorry, I based that statement on the estimated/actual disparity. That +particular query plan is not terrible in its results, but look at the +estimates and how viciously the explain analyze corrects the values. + +Here's an example: + + -> Index Scan using idx_evt_dt on l_event_log e + (cost=0.00..2641742.75 rows=15752255 width=12) + (actual time=0.034..229.641 rows=38923 loops=1) + +rows=15752255 ? That's over half the 27M row table. As expected, the +*actual* match is much, much lower at 38923. As it turns out, Marcin +was right. Simply changing: + +now() - interval '2 days' + +to + +'2006-06-11 15:30:00' + +generated a much more accurate set of estimates. I have to assume +that +7.4 is incapable of that optimization step. Now that I know this, I +plan on modifying my stored proc to calculate the value before +inserting +it into the query. + +Thanks! + + +-- + +Shaun Thomas +Database Administrator + +Leapfrog Online +807 Greenwood Street +Evanston, IL 60201 +Tel. 847-440-8253 +Fax. 847-570-5750 +www.leapfrogonline.com + + +Confidentiality Note: + +The document(s) accompanying this e-mail transmission, if any, and the +e-mail transmittal message contain information from Leapfrog Online +Customer Acquisition, LLC is confidential or privileged. The information +is intended to be for the use of the individual(s) or entity(ies) named +on this e-mail transmission message. If you are not the intended +recipient, be aware that any disclosure, copying, distribution or use of +the contents of this e-mail is prohibited. If you have received this +e-mail in error, please immediately delete this e-mail and notify us by +telephone of the error + +From pgsql-performance-owner@postgresql.org Tue Jun 13 18:03:25 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id EE2779F9316 + for ; + Tue, 13 Jun 2006 18:03:24 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 29366-01 for + ; + Tue, 13 Jun 2006 18:03:12 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 460459FA5F8 + for ; + Tue, 13 Jun 2006 18:03:11 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id E73515648B; Tue, 13 Jun 2006 16:02:47 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Tue, 13 Jun 2006 16:02:47 -0500 +Date: Tue, 13 Jun 2006 16:02:47 -0500 +From: "Jim C. Nasby" +To: Antoine +Cc: pgsql-performance@postgresql.org +Subject: Re: OT - select + must have from - sql standard syntax? +Message-ID: <20060613210246.GA34196@pervasive.com> +References: <92d3a4950606130543y2aab73d8sbbbf04aee328b41f@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <92d3a4950606130543y2aab73d8sbbbf04aee328b41f@mail.gmail.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060613:melser.anton@gmail.com::cRhVOmf1RLmNc2eI:000000000000000 + 0000000000000000000000000xm2 +X-Hashcash: + 1:20:060613:pgsql-performance@postgresql.org::ax1w9e2kGb/cFbco:00000 + 00000000000000000000000021sL +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/205 +X-Sequence-Number: 19562 + +On Tue, Jun 13, 2006 at 02:43:45PM +0200, Antoine wrote: +> Hi, +> I don't have a copy of the standard on hand and a collegue is claiming +> that there must be a from clause in a select query (he is an oracle +> guy). This doesn't seem to be the case for postgres... does anyone +> know? + +Dunno, but I know that other databases (at least DB2) don't require FROM +either. In Oracle, if you want to do something like + +SELECT now(); + +you actually have to do + +SELECT now() FROM dual; + +where dual is a special, hard-coded table in Oracle that has only one +row. Personally, I find their approach to be pretty stupid. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Tue Jun 13 18:07:34 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 80C6F9FA13E + for ; + Tue, 13 Jun 2006 18:07:34 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 30044-01 for + ; + Tue, 13 Jun 2006 18:07:25 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id B55159F9316 + for ; + Tue, 13 Jun 2006 18:07:25 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5DL7Osq010558; + Tue, 13 Jun 2006 17:07:24 -0400 (EDT) +To: "Shaun Thomas" +cc: pgsql-performance@postgresql.org +Subject: Re: Confirmation of bad query plan generated by 7.4 tree +In-reply-to: <448EDFC4.8F27.00A9.0@leapfrogonline.com> +References: + <448EB053.8F27.00A9.0@leapfrogonline.com><448EB053.8F27.00A9.0@leapfrogonline.com> + <9119.1150222168@sss.pgh.pa.us> + <448EDFC4.8F27.00A9.0@leapfrogonline.com> +Comments: In-reply-to "Shaun Thomas" + message dated "Tue, 13 Jun 2006 15:54:44 -0500" +Date: Tue, 13 Jun 2006 17:07:24 -0400 +Message-ID: <10557.1150232844@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/206 +X-Sequence-Number: 19563 + +"Shaun Thomas" writes: +> Simply changing: +> now() - interval '2 days' +> to +> '2006-06-11 15:30:00' +> generated a much more accurate set of estimates. + +Yeah, 7.4 won't risk basing estimates on the results of non-immutable +functions. We relaxed that in 8.0 I believe. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jun 13 18:31:23 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 57E299FA13E + for ; + Tue, 13 Jun 2006 18:31:23 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 28571-07 for + ; + Tue, 13 Jun 2006 18:31:18 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id E33229F9316 + for ; + Tue, 13 Jun 2006 18:31:17 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 4CA1F5648A; Tue, 13 Jun 2006 16:13:49 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Tue, 13 Jun 2006 16:13:47 -0500 +Date: Tue, 13 Jun 2006 16:13:47 -0500 +From: "Jim C. Nasby" +To: Shaun Thomas +Cc: Tom Lane , pgsql-performance@postgresql.org +Subject: Re: Confirmation of bad query plan generated by 7.4 +Message-ID: <20060613211347.GB34196@pervasive.com> +References: <9119.1150222168@sss.pgh.pa.us> + <448EDFC4.8F27.00A9.0@leapfrogonline.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <448EDFC4.8F27.00A9.0@leapfrogonline.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060613:sthomas@leapfrogonline.com::xU1rbYrnT8a1To6Y:00000000000 + 0000000000000000000000003FaM +X-Hashcash: + 1:20:060613:tgl@sss.pgh.pa.us::naJQaI1l3BJlTn3o:00000000000000000000 + 000000000000000000000000AeL7 +X-Hashcash: + 1:20:060613:pgsql-performance@postgresql.org::Z6vqqiKRu1eqMouT:00000 + 0000000000000000000000006gP4 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/209 +X-Sequence-Number: 19566 + +On Tue, Jun 13, 2006 at 03:54:44PM -0500, Shaun Thomas wrote: +> >>> On 6/13/2006 at 1:09 PM, Tom Lane wrote: +> +> > I missed the part where you explain why you think this plan is +> terrible? +> > 412ms for what seems a rather expensive query doesn't sound so +> awful. +> +> Sorry, I based that statement on the estimated/actual disparity. That +> particular query plan is not terrible in its results, but look at the +> estimates and how viciously the explain analyze corrects the values. +> +> Here's an example: +> +> -> Index Scan using idx_evt_dt on l_event_log e +> (cost=0.00..2641742.75 rows=15752255 width=12) +> (actual time=0.034..229.641 rows=38923 loops=1) +> +> rows=15752255 ? That's over half the 27M row table. As expected, the +> *actual* match is much, much lower at 38923. As it turns out, Marcin +> was right. Simply changing: +> +> now() - interval '2 days' +> +> to +> +> '2006-06-11 15:30:00' +> +> generated a much more accurate set of estimates. I have to assume +> that +> 7.4 is incapable of that optimization step. Now that I know this, I +> plan on modifying my stored proc to calculate the value before +> inserting +> it into the query. + +Is there some compelling reason to stick with 7.4? In my experience +you'll see around double (+100%) the performance going to 8.1... + +Also, I'm not sure that the behavior is entirely changed, either. On a +8.1.4 database I'm still seeing a difference between now() - interval +and a hard-coded date. + +What's your stats target set to for that table? + +> -- +> Shaun Thomas +> Database Administrator +> +> Leapfrog Online +> 807 Greenwood Street +> Evanston, IL 60201 + +Heh, I grew up 3 miles from there. In fact, IIRC my old dentist is/was +at 807 Davis. + +> Tel. 847-440-8253 +> Fax. 847-570-5750 +> www.leapfrogonline.com +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Tue Jun 13 18:17:59 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E56A69FA13E + for ; + Tue, 13 Jun 2006 18:17:58 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 31086-01 for + ; + Tue, 13 Jun 2006 18:17:54 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id B60109F9316 + for ; + Tue, 13 Jun 2006 18:17:54 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id D65715648C; Tue, 13 Jun 2006 16:17:52 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Tue, 13 Jun 2006 16:17:51 -0500 +Date: Tue, 13 Jun 2006 16:17:51 -0500 +From: "Jim C. Nasby" +To: "Joshua D. Drake" +Cc: Scott Marlowe , steve.poe@gmail.com, + pgsql-performance@postgresql.org +Subject: Re: Which processor runs better for Postgresql? +Message-ID: <20060613211751.GC34196@pervasive.com> +References: <1150221760.12191.25.camel@amd64-gentoo-laptop> + <1150225202.29299.51.camel@state.g2switchworks.com> + <448F1591.4000404@commandprompt.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <448F1591.4000404@commandprompt.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060613:jd@commandprompt.com::nR48qeqfLh5YQOl2:00000000000000000 + 0000000000000000000000007Kjx +X-Hashcash: + 1:20:060613:smarlowe@g2switchworks.com::EsKA7tcoJNh+HB0S:00000000000 + 00000000000000000000000014yO +X-Hashcash: + 1:20:060613:steve.poe@gmail.com::txm9eseGHkeiSUpi:000000000000000000 + 0000000000000000000000000q5W +X-Hashcash: + 1:20:060613:pgsql-performance@postgresql.org::VrRprQhxA/szofyk:00000 + 000000000000000000000000419K +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/207 +X-Sequence-Number: 19564 + +On Tue, Jun 13, 2006 at 12:44:17PM -0700, Joshua D. Drake wrote: +> You can get extremely competitive quotes from IBM or HP as long as you +> say, "You are competing against Dell". + +Possibly even more competitive from Sun... +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Tue Jun 13 18:21:30 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 76F8A9FA13E + for ; + Tue, 13 Jun 2006 18:21:30 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 29928-04 for + ; + Tue, 13 Jun 2006 18:21:25 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id BCCA49F9316 + for ; + Tue, 13 Jun 2006 18:21:25 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id C3C545648F; Tue, 13 Jun 2006 16:21:24 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Tue, 13 Jun 2006 16:21:24 -0500 +Date: Tue, 13 Jun 2006 16:21:24 -0500 +From: "Jim C. Nasby" +To: PFC +Cc: pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +Message-ID: <20060613212124.GD34196@pervasive.com> +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> + <20060603094355.GA23297@uio.no> + <1150062140.23423.0.camel@localhost.localdomain> + <448D3B65.7090709@aeccom.com> <448DE0DB.1020107@planet.tn> + <20060613192609.GX34196@pervasive.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: 1:20:060613:lists@peufeu.com::NrooejFExINqoMK0:005Wf +X-Hashcash: + 1:20:060613:pgsql-performance@postgresql.org::9j/UKjZGEALTEuhU:00000 + 0000000000000000000000000GmO +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/208 +X-Sequence-Number: 19565 + +On Tue, Jun 13, 2006 at 10:14:44PM +0200, PFC wrote: +> +> >Uhm... stick with commodity CPUs? +> +> Hehe, does this include Opterons ? + +Absolutely. Heck, it wouldn't surprise me if a single model # of Opteron +sold more than all Power CPUs put together... + +> Still, I looked on the "customize your server" link someone posted +> and it's amazing ; these things have become cheaper while I wasn't +> looking... +> You can buy 10 of these boxes with raptors and 4 opteron cores and 8 +> gigs of RAM for the price of your average marketing boss's car... +> definitely makes you think doesn't it. + +And if you spend that much on CPU for a database, you're likely to be +pretty sadly disappointed, depending on what you're doing. + +> Juts wait until someone equates the price in man-hours to fix/run a +> borken Dell box... + +Would probably sound like a Mastercard commercial... + +Not having to babysit your servers every day: Priceless +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Tue Jun 13 18:55:49 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4A9FB9FA13E + for ; + Tue, 13 Jun 2006 18:55:49 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 33691-03 for + ; + Tue, 13 Jun 2006 18:55:37 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from planetmail2.outgw.tn (planetmail2.outgw.tn [193.95.28.39]) + by postgresql.org (Postfix) with ESMTP id C68CF9F9316 + for ; + Tue, 13 Jun 2006 18:55:37 -0300 (ADT) +Received: from smtp2.planet.net.tn (smtp-in.planet.tn [193.95.123.26]) +Received: from MailGateway.planettunisie.com ([193.95.123.23]) + by smtp2.planet.net.tn (Switch-3.1.8/Switch-3.1.7) with ESMTP id + k5DLOjcn023697 for ; + Tue, 13 Jun 2006 23:24:45 +0200 (CEST) +Received: from [192.168.0.1] ([196.203.226.184]) (authenticated bits=0) + by MailGateway.planettunisie.com with ESMTP id k5DLPpaT016184 + for ; Tue, 13 Jun 2006 21:25:51 GMT +Message-ID: <448F2D1C.7090301@planet.tn> +Date: Tue, 13 Jun 2006 23:24:44 +0200 +From: Zydoon +User-Agent: Thunderbird 1.5.0.2 (X11/20060501) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> + <20060603094355.GA23297@uio.no> + <1150062140.23423.0.camel@localhost.localdomain> + <448D3B65.7090709@aeccom.com> <448DE0DB.1020107@planet.tn> + <1150226929.29299.54.camel@state.g2switchworks.com> + <20060613203824.7bca92bf.gdh@laterooms.com> +In-Reply-To: <20060613203824.7bca92bf.gdh@laterooms.com> +X-Enigmail-Version: 0.94.0.0 +OpenPGP: id=8BE92B3F; + url=hkp://subkeys.pgp.net +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/213 +X-Sequence-Number: 19570 + +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +Gavin Hamill wrote: +> On Tue, 13 Jun 2006 14:28:49 -0500 +> Scott Marlowe wrote: +> +>> Search the performance archives for the last 4 or 5 months for PPC / +>> pseries machines. +>> +>> You'll find a very long thread about the disappointing performance the +>> tester got with a rather expensive P Series machine. And his happy +>> ending of testing on an Opteron machine. +> +> Amen, brother :) +> +> We hoped throwing a silly pSeries 650 would solve all our problems. Boy +> were we wrong... a world of pain... +> +> Don't go there - just buy an Opteron system - if you're talking about +> IBM big iron, a decent Opteron will cost you about as much as a couple +> of compilers and an on-site visit from IBM... +> +> Cheers, +> Gavin. +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 3: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq +> +Things cannot be clearer :) +I really know that opterons are the best I can have. +But for now I have to publish the results Sunday 25th on either the +xeons or the PPCs. +Tomorrow I'll conduct a deeper test, and come back. +Cheers. + +- -- +Zied Fakhfakh +GPG Key : gpg --keyserver subkeys.pgp.net --recv-keys F06B55B5 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.3 (GNU/Linux) +Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org + +iD8DBQFEjy0cS1DO7ovpKz8RAklqAKDC75a8SQUoGwNHGxu4ysZhNt5eJwCgt0mP +YHfZbYVS44kxFyxxEzs9KE0= +=aLbn +-----END PGP SIGNATURE----- + +From pgsql-performance-owner@postgresql.org Tue Jun 13 18:36:09 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E3C279FA13E + for ; + Tue, 13 Jun 2006 18:36:08 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 32666-02 for + ; + Tue, 13 Jun 2006 18:36:01 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.leapfrogonline.com (mail.leapfrogonline.com + [69.36.35.239]) + by postgresql.org (Postfix) with ESMTP id 12FE59F9316 + for ; + Tue, 13 Jun 2006 18:36:00 -0300 (ADT) +Received: from leapfrogonlinecom-MTA by mail.leapfrogonline.com + with Novell_GroupWise; Tue, 13 Jun 2006 16:35:50 -0500 +Message-Id: <448EE95D.8F27.00A9.0@leapfrogonline.com> +X-Mailer: Novell GroupWise Internet Agent 7.0.1 Beta +Date: Tue, 13 Jun 2006 16:35:41 -0500 +From: "Shaun Thomas" +To: "Jim C. Nasby" +Cc: ,"Tom Lane" +Subject: Re: Confirmation of bad query plan generated by 7.4 +References: <9119.1150222168@sss.pgh.pa.us> + <448EDFC4.8F27.00A9.0@leapfrogonline.com> + <20060613211347.GB34196@pervasive.com> +In-Reply-To: <20060613211347.GB34196@pervasive.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/210 +X-Sequence-Number: 19567 + +>>> On 6/13/2006 at 4:13 PM, "Jim C. Nasby" +wrote: + + +> Is there some compelling reason to stick with 7.4? In my experience +> you'll see around double (+100%) the performance going to 8.1... + +Not really. We *really* want to upgrade, but we're in the middle of +buying the new machine right now. There's also the issue of migrating +37GB of data which I don't look forward to, considering we'll need to +set up a slony replication for the entire thing to avoid the hours +of downtime necessary for a full dump/restore. + +> What's your stats target set to for that table? + +Not sure what you mean by that. It's just that this table has 27M +rows +extending over 4 years, and I'm not quite sure how to hint to that. +An index scan for a few days would be a tiny fraction of the entire +table, so PG being insistent on the sequence scans was confusing the +hell +out of me. + + +-- + +Shaun Thomas +Database Administrator + +Leapfrog Online +807 Greenwood Street +Evanston, IL 60201 +Tel. 847-440-8253 +Fax. 847-570-5750 +www.leapfrogonline.com + + +Confidentiality Note: + +The document(s) accompanying this e-mail transmission, if any, and the +e-mail transmittal message contain information from Leapfrog Online +Customer Acquisition, LLC is confidential or privileged. The information +is intended to be for the use of the individual(s) or entity(ies) named +on this e-mail transmission message. If you are not the intended +recipient, be aware that any disclosure, copying, distribution or use of +the contents of this e-mail is prohibited. If you have received this +e-mail in error, please immediately delete this e-mail and notify us by +telephone of the error + +From pgsql-performance-owner@postgresql.org Tue Jun 13 18:41:15 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 429C09FA13E + for ; + Tue, 13 Jun 2006 18:41:15 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 32775-03 for + ; + Tue, 13 Jun 2006 18:41:02 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.171]) + by postgresql.org (Postfix) with ESMTP id 4735E9F9316 + for ; + Tue, 13 Jun 2006 18:41:02 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id m2so3129103ugc + for ; + Tue, 13 Jun 2006 14:40:59 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:references:x-google-sender-auth; + b=q8yo0sy2c5bz4IaI804YP5UD04HXfDnWmoDzzia3uXhorkXLBeOjXr49NvV8fH26CfVrCphzryk58LuHdrxgW8F67xgA4cMj+PwrwU6ZTjPtK9EILGxCrIWvEJpkNrQozu6+M48LqMSWtQLEq9RBp9tSVJ/YRHPDuszi0ujYqlQ= +Received: by 10.67.97.7 with SMTP id z7mr6673083ugl; + Tue, 13 Jun 2006 14:40:58 -0700 (PDT) +Received: by 10.66.216.11 with HTTP; Tue, 13 Jun 2006 14:40:58 -0700 (PDT) +Message-ID: +Date: Tue, 13 Jun 2006 17:40:58 -0400 +From: "John Vincent" +To: "Jim C. Nasby" , pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +In-Reply-To: <20060613212124.GD34196@pervasive.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_10744_31493193.1150234858802" +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> + <20060603094355.GA23297@uio.no> + <1150062140.23423.0.camel@localhost.localdomain> + <448D3B65.7090709@aeccom.com> <448DE0DB.1020107@planet.tn> + <20060613192609.GX34196@pervasive.com> + <20060613212124.GD34196@pervasive.com> +X-Google-Sender-Auth: c7e26a2c713a5785 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/211 +X-Sequence-Number: 19568 + +------=_Part_10744_31493193.1150234858802 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Maybe from a postgresql perspective the cpus may be useless but the memory +on the pSeries can't be beat. We've been looking at running our warehouse +(PGSQL) in a LoP lpar but I wasn't able to find a LoP build of 8.1. + +We've been thrilled with the performance of our DB2 systems that run on +AIX/Power 5 but since the DB2 instance memory is limited to 18GB, we've got +two 86GB p570s sitting there being under utilized. + + +FYI, + +I've not seen my posts showing up on the list or the archives so I'm hoping +this gets through. + +On 6/13/06, Jim C. Nasby wrote: +> +> On Tue, Jun 13, 2006 at 10:14:44PM +0200, PFC wrote: +> > +> > >Uhm... stick with commodity CPUs? +> > +> > Hehe, does this include Opterons ? +> +> Absolutely. Heck, it wouldn't surprise me if a single model # of Opteron +> sold more than all Power CPUs put together... +> +> > Still, I looked on the "customize your server" link someone posted +> > and it's amazing ; these things have become cheaper while I +> wasn't +> > looking... +> > You can buy 10 of these boxes with raptors and 4 opteron cores and +> 8 +> > gigs of RAM for the price of your average marketing boss's car... +> > definitely makes you think doesn't it. +> +> And if you spend that much on CPU for a database, you're likely to be +> pretty sadly disappointed, depending on what you're doing. +> +> > Juts wait until someone equates the price in man-hours to fix/run +> a +> > borken Dell box... +> +> Would probably sound like a Mastercard commercial... +> +> Not having to babysit your servers every day: Priceless +> -- +> Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +> Pervasive Software http://pervasive.com work: 512-231-6117 +> vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: In versions below 8.0, the planner will ignore your desire to +> choose an index scan if your joining column's datatypes do not +> match +> + + + +-- +John E. Vincent +lusis.org@gmail.com + +------=_Part_10744_31493193.1150234858802 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Maybe from a postgresql perspective the cpus may be useless but the memory on the pSeries can't be beat. We've been looking at running our warehouse (PGSQL) in a LoP lpar but I wasn't able to find a LoP build of 8.1.

+We've been thrilled with the performance of our DB2 systems that run on AIX/Power 5 but since the DB2 instance memory is limited to 18GB, we've got two 86GB p570s sitting there being under utilized.


FYI,

+I've not seen my posts showing up on the list or the archives so I'm hoping this gets through.

On 6/13/06, Jim C. Nasby < +jnasby@pervasive.com> wrote:
On Tue, Jun 13, 2006 at 10:14:44PM +0200, PFC wrote: +
>
> >Uhm... stick with commodity CPUs?
>
>       Hehe, does this include Opterons ?

Absolutely. Heck, it wouldn't surprise me if a single model # of Opteron
sold more than all Power CPUs put together... +

>       Still, I looked on the "customize your server" link someone posted
>       and  it's amazing ; these things have become cheaper while I wasn't
> looking...
>       You can buy 10 of these boxes with raptors and 4 opteron cores and 8 +
>       gigs  of RAM for the price of your average marketing boss's car...
> definitely  makes you think doesn't it.

And if you spend that much on CPU for a database, you're likely to be
pretty sadly disappointed, depending on what you're doing. +

>       Juts wait until someone equates the price in man-hours to fix/run a
> borken Dell box...

Would probably sound like a Mastercard commercial...

Not having to babysit your servers every day: Priceless +
--
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117 +
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below +8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match



--
John E. Vincent
+lusis.org@gmail.com + +------=_Part_10744_31493193.1150234858802-- + +From pgsql-performance-owner@postgresql.org Tue Jun 13 18:54:29 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id EEC5B9FA13E + for ; + Tue, 13 Jun 2006 18:54:28 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 35127-02 for + ; + Tue, 13 Jun 2006 18:54:21 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id BE6F89F9316 + for ; + Tue, 13 Jun 2006 18:54:21 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 0396F5643D; Tue, 13 Jun 2006 16:54:20 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Tue, 13 Jun 2006 16:54:19 -0500 +Date: Tue, 13 Jun 2006 16:54:19 -0500 +From: "Jim C. Nasby" +To: Shaun Thomas +Cc: pgsql-performance@postgresql.org, Tom Lane +Subject: Re: Confirmation of bad query plan generated by 7.4 +Message-ID: <20060613215418.GI34196@pervasive.com> +References: <9119.1150222168@sss.pgh.pa.us> + <448EDFC4.8F27.00A9.0@leapfrogonline.com> + <20060613211347.GB34196@pervasive.com> + <448EE95D.8F27.00A9.0@leapfrogonline.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <448EE95D.8F27.00A9.0@leapfrogonline.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060613:sthomas@leapfrogonline.com::P2HD1ldIRYtCzeIW:00000000000 + 0000000000000000000000000azQ +X-Hashcash: + 1:20:060613:pgsql-performance@postgresql.org::3mbz7lXq5B2WiIAN:00000 + 0000000000000000000000005vU3 +X-Hashcash: + 1:20:060613:tgl@sss.pgh.pa.us::40mLcxzndPblpqW7:00000000000000000000 + 0000000000000000000000000a+2 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/212 +X-Sequence-Number: 19569 + +On Tue, Jun 13, 2006 at 04:35:41PM -0500, Shaun Thomas wrote: +> >>> On 6/13/2006 at 4:13 PM, "Jim C. Nasby" +> wrote: +> +> +> > Is there some compelling reason to stick with 7.4? In my experience +> > you'll see around double (+100%) the performance going to 8.1... +> +> Not really. We *really* want to upgrade, but we're in the middle of +> buying the new machine right now. There's also the issue of migrating +> 37GB of data which I don't look forward to, considering we'll need to +> set up a slony replication for the entire thing to avoid the hours +> of downtime necessary for a full dump/restore. + +As long as the master isn't very heavily loaded it shouldn't be that big +a deal to do so... + +> > What's your stats target set to for that table? +> +> Not sure what you mean by that. It's just that this table has 27M +> rows +> extending over 4 years, and I'm not quite sure how to hint to that. +> An index scan for a few days would be a tiny fraction of the entire +> table, so PG being insistent on the sequence scans was confusing the +> hell +> out of me. + +What's the output of +SELECT attname, attstattarget + FROM pg_attribute + WHERE attrelid='table_name'::regclass AND attnum >= 0; +and +SHOW default_statistics_target; + +? +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Tue Jun 13 19:04:56 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 399B49FA692 + for ; + Tue, 13 Jun 2006 19:04:55 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 34717-05 for + ; + Tue, 13 Jun 2006 19:04:49 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 51B099FA68D + for ; + Tue, 13 Jun 2006 19:04:49 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5DM4gqk010919; + Tue, 13 Jun 2006 18:04:42 -0400 (EDT) +To: "Jim C. Nasby" +cc: Shaun Thomas , + pgsql-performance@postgresql.org +Subject: Re: Confirmation of bad query plan generated by 7.4 +In-reply-to: <20060613211347.GB34196@pervasive.com> +References: <9119.1150222168@sss.pgh.pa.us> + <448EDFC4.8F27.00A9.0@leapfrogonline.com> + <20060613211347.GB34196@pervasive.com> +Comments: In-reply-to "Jim C. Nasby" + message dated "Tue, 13 Jun 2006 16:13:47 -0500" +Date: Tue, 13 Jun 2006 18:04:42 -0400 +Message-ID: <10918.1150236282@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/214 +X-Sequence-Number: 19571 + +"Jim C. Nasby" writes: +> Also, I'm not sure that the behavior is entirely changed, either. On a +> 8.1.4 database I'm still seeing a difference between now() - interval +> and a hard-coded date. + +It'd depend on the context, possibly, but it's easy to show that the +current planner does fold "now() - interval_constant" when making +estimates. Simple example: + +-- create and populate 1000-row table: + +regression=# create table t1 (f1 timestamptz); +CREATE TABLE +regression=# insert into t1 select now() - x * interval '1 day' from generate_series(1,1000) x; +INSERT 0 1000 + +-- default estimate is pretty awful: + +regression=# explain select * from t1 where f1 > now(); + QUERY PLAN +----------------------------------------------------- + Seq Scan on t1 (cost=0.00..39.10 rows=647 width=8) + Filter: (f1 > now()) +(2 rows) + +regression=# vacuum t1; +VACUUM + +-- now the planner at least knows how many rows in the table with some +-- accuracy, but with no stats it's still falling back on a default +-- selectivity estimate: + +regression=# explain select * from t1 where f1 > now(); + QUERY PLAN +----------------------------------------------------- + Seq Scan on t1 (cost=0.00..21.00 rows=333 width=8) + Filter: (f1 > now()) +(2 rows) + +-- and the default doesn't really care what the comparison value is: + +regression=# explain select * from t1 where f1 > now() - interval '10 days'; + QUERY PLAN +----------------------------------------------------- + Seq Scan on t1 (cost=0.00..23.50 rows=333 width=8) + Filter: (f1 > (now() - '10 days'::interval)) +(2 rows) + +-- but let's give it some stats: + +regression=# vacuum analyze t1; +VACUUM + +-- and things get better: + +regression=# explain select * from t1 where f1 > now() - interval '10 days'; + QUERY PLAN +--------------------------------------------------- + Seq Scan on t1 (cost=0.00..23.50 rows=9 width=8) + Filter: (f1 > (now() - '10 days'::interval)) +(2 rows) + +7.4 would still be saying "rows=333" in the last case, because it's +falling back on DEFAULT_INEQ_SEL whenever the comparison value isn't +strictly constant. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jun 13 19:05:19 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id BDE479FA692 + for ; + Tue, 13 Jun 2006 19:05:17 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 38283-01 for + ; + Tue, 13 Jun 2006 19:05:11 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 74C199FA68D + for ; + Tue, 13 Jun 2006 19:05:11 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 1324056427; Tue, 13 Jun 2006 17:05:10 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Tue, 13 Jun 2006 17:05:09 -0500 +Date: Tue, 13 Jun 2006 17:05:09 -0500 +From: "Jim C. Nasby" +To: John Vincent +Cc: pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +Message-ID: <20060613220509.GJ34196@pervasive.com> +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> + <20060603094355.GA23297@uio.no> + <1150062140.23423.0.camel@localhost.localdomain> + <448D3B65.7090709@aeccom.com> <448DE0DB.1020107@planet.tn> + <20060613192609.GX34196@pervasive.com> + <20060613212124.GD34196@pervasive.com> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060613:pgsql-performance@lusis.org::9LklVb9G61Szj1G/:0000000000 + 0000000000000000000000002OaG +X-Hashcash: + 1:20:060613:pgsql-performance@postgresql.org::wrDSEXf5I70Mh6Cc:00000 + 0000000000000000000000000mGz +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/215 +X-Sequence-Number: 19572 + +On Tue, Jun 13, 2006 at 05:40:58PM -0400, John Vincent wrote: +> Maybe from a postgresql perspective the cpus may be useless but the memory +> on the pSeries can't be beat. We've been looking at running our warehouse +> (PGSQL) in a LoP lpar but I wasn't able to find a LoP build of 8.1. + +Probably just because not many people have access to that kind of +hardware. Have you tried building on Linux on Power? + +Also, I believe Opterons can do up to 4 DIMMs per memory controller, so +with 2G sticks an 8 way Opteron could hit 64GB, which isn't exactly +shabby, and I suspect it'd cost quite a bit less than a comperable +p570... + +> We've been thrilled with the performance of our DB2 systems that run on +> AIX/Power 5 but since the DB2 instance memory is limited to 18GB, we've got +> two 86GB p570s sitting there being under utilized. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Tue Jun 13 19:21:30 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 20CD19FA38F + for ; + Tue, 13 Jun 2006 19:21:30 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 35179-08 for + ; + Tue, 13 Jun 2006 19:21:23 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.171]) + by postgresql.org (Postfix) with ESMTP id 4908C9FA1A8 + for ; + Tue, 13 Jun 2006 19:21:22 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so16901ugf + for ; + Tue, 13 Jun 2006 15:21:21 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; + b=SxNnxb6+1FahB0GK0Spltf3KqaPN/v+LJlK5yCJ/dFLeMst5lb16nVCMepDmAoC0WIT/UWYEcP++OHY2J7HRJ1/c8viOEs2Ycksd5qdcqIaLtkrbPo7zPtabYOcJi01cyuWFt+R7g7YabViBPgzi4SSz/qqQyd+CmAHVyFLYDq0= +Received: by 10.66.250.17 with SMTP id x17mr28259ugh; + Tue, 13 Jun 2006 15:21:21 -0700 (PDT) +Received: by 10.66.216.11 with HTTP; Tue, 13 Jun 2006 15:21:21 -0700 (PDT) +Message-ID: +Date: Tue, 13 Jun 2006 18:21:21 -0400 +From: "John Vincent" +To: "Jim C. Nasby" +Subject: Re: scaling up postgres +Cc: pgsql-performance@postgresql.org +In-Reply-To: <20060613220509.GJ34196@pervasive.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_11424_6759269.1150237281333" +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> + <20060603094355.GA23297@uio.no> + <1150062140.23423.0.camel@localhost.localdomain> + <448D3B65.7090709@aeccom.com> <448DE0DB.1020107@planet.tn> + <20060613192609.GX34196@pervasive.com> + <20060613212124.GD34196@pervasive.com> + + <20060613220509.GJ34196@pervasive.com> +X-Google-Sender-Auth: 6b7d6a3d2bbb8f65 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/217 +X-Sequence-Number: 19574 + +------=_Part_11424_6759269.1150237281333 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +On 6/13/06, Jim C. Nasby wrote: +> +> On Tue, Jun 13, 2006 at 05:40:58PM -0400, John Vincent wrote: +> > Maybe from a postgresql perspective the cpus may be useless but the +> memory +> > on the pSeries can't be beat. We've been looking at running our +> warehouse +> > (PGSQL) in a LoP lpar but I wasn't able to find a LoP build of 8.1. +> +> Probably just because not many people have access to that kind of +> hardware. Have you tried building on Linux on Power? + + +Actually it's on my radar. I was looking for a precompiled build first (we +actually checked the Pervasive and Bizgres sites first since we're +considering a support contract) before going the self-compiled route. When I +didn't see a pre-compiled build available, I started looking at the +developer archives and got a little worried that I wouldn't want to base my +job on a self-built Postgres on a fairly new (I'd consider Power 5 fairly +new) platform. + +As it stands we're currently migrating to an IBM x445 (8 XPU Xeon, 16GB of +memory) that was our old DB2 production server. + +Also, I believe Opterons can do up to 4 DIMMs per memory controller, so +> with 2G sticks an 8 way Opteron could hit 64GB, which isn't exactly +> shabby, and I suspect it'd cost quite a bit less than a comperable +> p570... + + +This is true. In our case I couldn't get the approval for the new hardware +since we had two x445 boxes sitting there doing nothing (I wanted them for +our VMware environment personally). Another sticking point is finding a +vendor that will provide a hardware support contract similar to what we have +with our existing IBM hardware (24x7x4). Since IBM has f-all for Opteron +based systems and we've sworn off Dell, I was pretty limited. HP was able to +get in on a pilot program and we're considering them now for future hardware +purchases but beyond Dell/IBM/HP, there's not much else that can provide the +kind of hardware support turn-around we need. + +> We've been thrilled with the performance of our DB2 systems that run on +> > AIX/Power 5 but since the DB2 instance memory is limited to 18GB, we've +> got +> > two 86GB p570s sitting there being under utilized. +> -- +> Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +> Pervasive Software http://pervasive.com work: 512-231-6117 +> vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 +> + + + +-- +John E. Vincent + +------=_Part_11424_6759269.1150237281333 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +

On 6/13/06, Jim C. Nasby <jnasby@pervasive.com> wrote:
+On Tue, Jun 13, 2006 at 05:40:58PM -0400, John Vincent wrote:
> Maybe from a postgresql perspective the cpus may be useless but the memory
> on the pSeries can't be beat. We've been looking at running our warehouse +
> (PGSQL) in a LoP lpar but I wasn't able to find a LoP build of 8.1.

Probably just because not many people have access to that kind of
hardware. Have you tried building on Linux on Power?
+
Actually it's on my radar. I was looking for a precompiled build first (we actually checked the Pervasive and Bizgres sites first since we're considering a support contract) before going the self-compiled route. When I didn't see a pre-compiled build available, I started looking at the developer archives and got a little worried that I wouldn't want to base my job on a self-built Postgres on a fairly new (I'd consider Power 5 fairly new) platform. +

As it stands we're currently migrating to an IBM x445 (8 XPU Xeon, 16GB of memory) that was our old DB2 production server.

+Also, I believe Opterons can do up to 4 DIMMs per memory controller, so
with 2G sticks an 8 way Opteron could hit 64GB, which isn't exactly
shabby, and I suspect it'd cost quite a bit less than a comperable
p570... +

This is true. In our case I couldn't get the approval for the new hardware since we had two x445 boxes sitting there doing nothing (I wanted them for our VMware environment personally). Another sticking point is finding a vendor that will provide a hardware support contract similar to what we have with our existing IBM hardware (24x7x4). Since IBM has f-all for Opteron based systems and we've sworn off Dell, I was pretty limited. HP was able to get in on a pilot program and we're considering them now for future hardware purchases but beyond Dell/IBM/HP, there's not much else that can provide the kind of hardware support turn-around we need. +

> We've been thrilled with the performance of our DB2 systems that run on
+> AIX/Power 5 but since the DB2 instance memory is limited to 18GB, we've got
> two 86GB p570s sitting there being under utilized.
--
Jim C. Nasby, Sr. Engineering Consultant       +jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf +       cell: 512-569-9461



--
John E. Vincent
+ +------=_Part_11424_6759269.1150237281333-- + +From pgsql-performance-owner@postgresql.org Tue Jun 13 19:13:38 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id CFCD89FA38F + for ; + Tue, 13 Jun 2006 19:13:37 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 34283-07 for + ; + Tue, 13 Jun 2006 19:13:29 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from smtp1.ActiveState.com (gw.activestate.com [209.17.183.249]) + by postgresql.org (Postfix) with ESMTP id 7488A9FA1A8 + for ; + Tue, 13 Jun 2006 19:13:28 -0300 (ADT) +Received: from smtp3.activestate.com (smtp3.activestate.com [192.168.3.19]) + by smtp1.ActiveState.com (8.12.10/8.12.10) with ESMTP id k5DMDQWJ007871 + for ; Tue, 13 Jun 2006 15:13:26 -0700 + (envelope-from mischa@ca.sophos.com) +Received: from [192.168.99.210] (mallet.activestate.com [192.168.99.210]) + by smtp3.ActiveState.com (8.13.4/8.13.4) with ESMTP id k5DMDP0f008538 + for ; Tue, 13 Jun 2006 15:13:26 -0700 + (envelope-from mischa@ca.sophos.com) +Message-ID: <448F3A6E.6080908@ca.sophos.com> +Date: Tue, 13 Jun 2006 15:21:34 -0700 +From: Mischa Sandberg +Reply-To: mischa@ca.sophos.com +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Solaris shared_buffers anomaly? +References: <1150151282.14661.42.camel@tigger> + <20060613000441.GI8588@kenobi.snowman.net> + <20060613200810.GZ34196@pervasive.com> +In-Reply-To: <20060613200810.GZ34196@pervasive.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/216 +X-Sequence-Number: 19573 + +Jim C. Nasby wrote: +... +> Actually, in 8.1.x I've seen some big wins from greatly increasing the +> amount of shared_buffers, even as high as 50% of memory, thanks to the +> changes made to the buffer management code. ... + +Anyone else run into a gotcha that one of our customers ran into? +PG 7.4.8 running on Solaris 2.6, USparc w 4GB RAM. +Usually about 50 active backends. +(No reason to believe this wouldn't apply to 8.x). + +Initially shared_buffers were set to 1000 (8MB). +Then, we moved all apps but the database server off the box. + +Raised shared_buffers to 2000 (16MB). +Modest improvement in some frequent repeated queries. + +Raised shared_buffers to 16000 (128MB). +DB server dropped to a CRAWL. + +vmstat showed that it was swapping like crazy. +Dropped shared_buffers back down again. +Swapping stopped. + +Stared at "ps u" a lot, and realized that the shm seg appeared to +be counted as part of the resident set (RSS). +Theory was that the kernel was reading the numbers the same way, +and swapping out resident sets, since they obviously wouldn't +all fit in RAM :-) + +Anyone from Sun reading this list, willing to offer an opinion? + +From pgsql-performance-owner@postgresql.org Tue Jun 13 19:22:20 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0A4049FA38F + for ; + Tue, 13 Jun 2006 19:22:20 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 39199-03 for + ; + Tue, 13 Jun 2006 19:22:11 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 3C0019FA1A8 + for ; + Tue, 13 Jun 2006 19:22:10 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5DMM780011047; + Tue, 13 Jun 2006 18:22:08 -0400 (EDT) +To: mischa@ca.sophos.com +cc: pgsql-performance@postgresql.org +Subject: Re: Solaris shared_buffers anomaly? +In-reply-to: <448F3A6E.6080908@ca.sophos.com> +References: <1150151282.14661.42.camel@tigger> + <20060613000441.GI8588@kenobi.snowman.net> + <20060613200810.GZ34196@pervasive.com> + <448F3A6E.6080908@ca.sophos.com> +Comments: In-reply-to Mischa Sandberg + message dated "Tue, 13 Jun 2006 15:21:34 -0700" +Date: Tue, 13 Jun 2006 18:22:07 -0400 +Message-ID: <11046.1150237327@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/218 +X-Sequence-Number: 19575 + +Mischa Sandberg writes: +> vmstat showed that it was swapping like crazy. +> Dropped shared_buffers back down again. +> Swapping stopped. + +Does Solaris have any call that allows locking a shmem segment in RAM? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jun 13 19:34:17 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id F22189FA38F + for ; + Tue, 13 Jun 2006 19:34:16 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 40530-07 for + ; + Tue, 13 Jun 2006 19:34:12 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) + by postgresql.org (Postfix) with ESMTP id 867B89FA1A8 + for ; + Tue, 13 Jun 2006 19:34:12 -0300 (ADT) +Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) + by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id k5DMY1LP043211 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); + Tue, 13 Jun 2006 16:34:04 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: from winnie.fuhr.org (localhost [127.0.0.1]) + by winnie.fuhr.org (8.13.6/8.13.6) with ESMTP id k5DMY15X047590; + Tue, 13 Jun 2006 16:34:01 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: (from mfuhr@localhost) + by winnie.fuhr.org (8.13.6/8.13.6/Submit) id k5DMY1D5047589; + Tue, 13 Jun 2006 16:34:01 -0600 (MDT) (envelope-from mfuhr) +Date: Tue, 13 Jun 2006 16:34:01 -0600 +From: Michael Fuhr +To: Tom Lane +Cc: mischa@ca.sophos.com, pgsql-performance@postgresql.org +Subject: Re: Solaris shared_buffers anomaly? +Message-ID: <20060613223401.GA47540@winnie.fuhr.org> +References: <1150151282.14661.42.camel@tigger> + <20060613000441.GI8588@kenobi.snowman.net> + <20060613200810.GZ34196@pervasive.com> + <448F3A6E.6080908@ca.sophos.com> <11046.1150237327@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <11046.1150237327@sss.pgh.pa.us> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/219 +X-Sequence-Number: 19576 + +On Tue, Jun 13, 2006 at 06:22:07PM -0400, Tom Lane wrote: +> Mischa Sandberg writes: +> > vmstat showed that it was swapping like crazy. +> > Dropped shared_buffers back down again. +> > Swapping stopped. +> +> Does Solaris have any call that allows locking a shmem segment in RAM? + +The Solaris 9 shmctl manpage mentions this token: + + SHM_LOCK + Lock the shared memory segment specified by shmid in + memory. This command can be executed only by a process + that has an effective user ID equal to super-user. + +-- +Michael Fuhr + +From pgsql-performance-owner@postgresql.org Tue Jun 13 19:40:04 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D84AC9FA38F + for ; + Tue, 13 Jun 2006 19:40:03 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 38120-08 for + ; + Tue, 13 Jun 2006 19:39:56 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 0F5B19FA1A8 + for ; + Tue, 13 Jun 2006 19:39:53 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 4719856437; Tue, 13 Jun 2006 17:39:52 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Tue, 13 Jun 2006 17:39:51 -0500 +Date: Tue, 13 Jun 2006 17:39:51 -0500 +From: "Jim C. Nasby" +To: Tom Lane +Cc: Shaun Thomas , + pgsql-performance@postgresql.org +Subject: Re: Confirmation of bad query plan generated by 7.4 +Message-ID: <20060613223950.GK34196@pervasive.com> +References: <9119.1150222168@sss.pgh.pa.us> + <448EDFC4.8F27.00A9.0@leapfrogonline.com> + <20060613211347.GB34196@pervasive.com> + <10918.1150236282@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <10918.1150236282@sss.pgh.pa.us> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060613:tgl@sss.pgh.pa.us::7xc2NUo5WQ77bgbY:00000000000000000000 + 0000000000000000000000000nOH +X-Hashcash: + 1:20:060613:sthomas@leapfrogonline.com::334t4Du81jo/jRTC:00000000000 + 0000000000000000000000005jJ2 +X-Hashcash: + 1:20:060613:pgsql-performance@postgresql.org::HRQ0UHq5L6ZNc9yg:00000 + 0000000000000000000000007thY +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/220 +X-Sequence-Number: 19577 + +On Tue, Jun 13, 2006 at 06:04:42PM -0400, Tom Lane wrote: +> "Jim C. Nasby" writes: +> > Also, I'm not sure that the behavior is entirely changed, either. On a +> > 8.1.4 database I'm still seeing a difference between now() - interval +> > and a hard-coded date. +> +> It'd depend on the context, possibly, but it's easy to show that the +> current planner does fold "now() - interval_constant" when making +> estimates. Simple example: + +Turns out the difference is between feeding a date vs a timestamp into the +query... I would have thought that since date is a date that the WHERE clause +would be casted to a date if it was a timestamptz, but I guess not... + +stats=# explain select * from email_contrib where project_id=8 and date >= now()-'15 days'::interval; + QUERY PLAN +---------------------------------------------------------------------------------------------------------- + Index Scan using email_contrib__project_date on email_contrib (cost=0.01..45405.83 rows=14225 width=24) + Index Cond: ((project_id = 8) AND (date >= (now() - '15 days'::interval))) +(2 rows) + +stats=# explain select * from email_contrib where project_id=8 AND date >= '2006-05-29 22:09:56.814897+00'::date; + QUERY PLAN +---------------------------------------------------------------------------------------------------------- + Index Scan using email_contrib__project_date on email_contrib (cost=0.00..48951.74 rows=15336 width=24) + Index Cond: ((project_id = 8) AND (date >= '2006-05-29'::date)) +(2 rows) + +stats=# explain select * from email_contrib where project_id=8 AND date >= '2006-05-29 22:09:56.814897+00'::timestamp; + QUERY PLAN +---------------------------------------------------------------------------------------------------------- + Index Scan using email_contrib__project_date on email_contrib (cost=0.00..45472.76 rows=14246 width=24) + Index Cond: ((project_id = 8) AND (date >= '2006-05-29 22:09:56.814897'::timestamp without time zone)) +(2 rows) + +Actual row count is 109071; reason for the vast difference is querying on two columns. + +I know comming up with general-purpose multicolumn stats is extremely +difficult, but can't we at least add histograms for multi-column indexes?? In +this case that would most likely make the estimate dead-on, because there's an +index on project_id, date. + +Details below for the morbidly curious/bored... + +stats=# \d email_contrib + Table "public.email_contrib" + Column | Type | Modifiers +------------+---------+----------- + project_id | integer | not null + id | integer | not null + date | date | not null + team_id | integer | + work_units | bigint | not null +Indexes: + "email_contrib_pkey" PRIMARY KEY, btree (project_id, id, date), tablespace "raid10" + "email_contrib__pk24" btree (id, date) WHERE project_id = 24, tablespace "raid10" + "email_contrib__pk25" btree (id, date) WHERE project_id = 25, tablespace "raid10" + "email_contrib__pk8" btree (id, date) WHERE project_id = 8, tablespace "raid10" + "email_contrib__project_date" btree (project_id, date), tablespace "raid10" + "email_contrib__project_id" btree (project_id), tablespace "raid10" + "email_contrib__team_id" btree (team_id), tablespace "raid10" +Foreign-key constraints: + "fk_email_contrib__id" FOREIGN KEY (id) REFERENCES stats_participant(id) ON UPDATE CASCADE + "fk_email_contrib__team_id" FOREIGN KEY (team_id) REFERENCES stats_team(team) ON UPDATE CASCADE +Tablespace: "raid10" + +stats=# explain analyze select * from email_contrib where project_id=8 and date >= now()-'15 days'::interval; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------- + Index Scan using email_contrib__project_date on email_contrib (cost=0.01..45475.95 rows=14247 width=24) (actual time=0.294..264.345 rows=109071 loops=1) + Index Cond: ((project_id = 8) AND (date >= (now() - '15 days'::interval))) + Total runtime: 412.167 ms +(3 rows) + +stats=# select now()-'15 days'::interval; + ?column? +------------------------------- + 2006-05-29 22:09:56.814897+00 +(1 row) + +stats=# explain analyze select * from email_contrib where project_id=8 and date >= '2006-05-29 22:09:56.814897+00'; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------- + Index Scan using email_contrib__project_date on email_contrib (cost=0.00..48951.74 rows=15336 width=24) (actual time=0.124..229.800 rows=116828 loops=1) + Index Cond: ((project_id = 8) AND (date >= '2006-05-29'::date)) + Total runtime: 391.240 ms +(3 rows) + +stats=# explain select * from email_contrib where project_id=8 and date >= '2006-05-29 22:09:56.814897+00'::date; + QUERY PLAN +---------------------------------------------------------------------------------------------------------- + Index Scan using email_contrib__project_date on email_contrib (cost=0.00..48951.74 rows=15336 width=24) + Index Cond: ((project_id = 8) AND (date >= '2006-05-29'::date)) +(2 rows) + +So casting to date doesn't change anything, but dropping project_id from the +where clause certainly does... + +stats=# explain analyze select * from email_contrib where date >= now()-'15 days'::interval; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------- + Bitmap Heap Scan on email_contrib (cost=847355.98..1256538.96 rows=152552 width=24) (actual time=74886.028..75267.633 rows=148894 loops=1) + Recheck Cond: (date >= (now() - '15 days'::interval)) + -> Bitmap Index Scan on email_contrib__project_date (cost=0.00..847355.98 rows=152552 width=0) (actual time=74885.690..74885.690 rows=148894 loops=1) + Index Cond: (date >= (now() - '15 days'::interval)) + Total runtime: 75472.490 ms +(5 rows) + +That estimate is dead-on. So it appears it's yet another case of cross-column +stats. :( But there's still a difference between now()-interval and something hard-coded: + +stats=# explain analyze select * from email_contrib where date >= '2006-05-29 22:09:56.814897+00'::date; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------- + Bitmap Heap Scan on email_contrib (cost=847355.98..1278756.22 rows=164256 width=24) (actual time=19356.752..19623.450 rows=159348 loops=1) + Recheck Cond: (date >= '2006-05-29'::date) + -> Bitmap Index Scan on email_contrib__project_date (cost=0.00..847355.98 rows=164256 width=0) (actual time=19356.391..19356.391 rows=159348 loops=1) + Index Cond: (date >= '2006-05-29'::date) + Total runtime: 19841.614 ms +(5 rows) + +stats=# explain analyze select * from email_contrib where date >= (now()-'15 days'::interval)::date; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------- + Bitmap Heap Scan on email_contrib (cost=847355.98..1279988.15 rows=164256 width=24) (actual time=19099.417..19372.167 rows=159348 loops=1) + Recheck Cond: (date >= ((now() - '15 days'::interval))::date) + -> Bitmap Index Scan on email_contrib__project_date (cost=0.00..847355.98 rows=164256 width=0) (actual time=19099.057..19099.057 rows=159348 loops=1) + Index Cond: (date >= ((now() - '15 days'::interval))::date) + Total runtime: 19589.785 ms + +Aha! It's the casting to date that changes things. + +The stats target is 100... + +stats=# select attname, n_distinct from pg_stats where tablename='email_contrib'; + attname | n_distinct +------------+------------ + project_id | 6 + team_id | 4104 + work_units | 6795 + date | 3034 + id | 35301 +(5 rows) + +The n_distinct for project_id and date both look about right. + +stats=# select * from pg_stats where tablename='email_contrib' and attname='project_id'; +-[ RECORD 1 ]-----+------------------------------------------------------------ +schemaname | public +tablename | email_contrib +attname | project_id +null_frac | 0 +avg_width | 4 +n_distinct | 6 +most_common_vals | {205,5,8,25,24,3} +most_common_freqs | {0.4273,0.419833,0.0933667,0.0514667,0.00506667,0.00296667} +histogram_bounds | +correlation | 0.605662 + +stats=# select relpages,reltuples from pg_class where relname='email_contrib'; + relpages | reltuples +----------+------------- + 996524 | 1.35509e+08 + +If we look at how many rows would match project_id 8 and any 15 dates... + +stats=# SELECT 1.35509e+08 * 0.0933667 / 3034 * 15; + ?column? +------------------------ + 62551.2268472313777195 + +We come up with something much closer to reality (116828 rows). I guess the +problem is in the histogram for date; where the last 3 values are: + +2005-11-02,2006-03-05,2006-06-11 +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Tue Jun 13 19:42:19 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5C00D9FA38F + for ; + Tue, 13 Jun 2006 19:42:19 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 40746-03 for + ; + Tue, 13 Jun 2006 19:42:09 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.leapfrogonline.com (mail.leapfrogonline.com + [69.36.35.239]) + by postgresql.org (Postfix) with ESMTP id 8BEC49FA1A8 + for ; + Tue, 13 Jun 2006 19:42:09 -0300 (ADT) +Received: from leapfrogonlinecom-MTA by mail.leapfrogonline.com + with Novell_GroupWise; Tue, 13 Jun 2006 17:41:53 -0500 +Message-Id: <448EF8B2.8F27.00A9.0@leapfrogonline.com> +X-Mailer: Novell GroupWise Internet Agent 7.0.1 Beta +Date: Tue, 13 Jun 2006 17:41:06 -0500 +From: "Shaun Thomas" +To: "Jim C. Nasby" +Cc: ,"Tom Lane" +Subject: Re: Confirmation of bad query plan generated by 7.4 +References: <9119.1150222168@sss.pgh.pa.us> + <448EDFC4.8F27.00A9.0@leapfrogonline.com> + <20060613211347.GB34196@pervasive.com> + <448EE95D.8F27.00A9.0@leapfrogonline.com> + <20060613215418.GI34196@pervasive.com> +In-Reply-To: <20060613215418.GI34196@pervasive.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/221 +X-Sequence-Number: 19578 + +>>> On 6/13/2006 at 4:54 PM, "Jim C. Nasby" +wrote: + +> SELECT attname, attstattarget +> FROM pg_attribute +> WHERE attrelid='table_name'::regclass AND attnum >= 0; + +-1 for all values. + +> SHOW default_statistics_target; + +10. + +Here's something slightly annoying: I tried precalculating the value +in my stored proc, and it's still ignoring it. + +lastTime := now() - interval ''7 days''; + +UPDATE fact_credit_app + SET activated_date_id = ad.date_id + FROM l_event_log e + JOIN c_event_type t ON (t.id = e.event_type_id) + JOIN wf_date ad ON (e.event_date::date=ad.datestamp) + WHERE e.ext_id=fact_credit_app.unique_id + AND t.event_name = ''activation'' + AND e.event_date > lastTime + AND fact_credit_app.activated_date_id IS NULL; + +Instead of taking a handful of seconds (like when I replace +lastTime with the text equivalent), it takes 10 minutes... +I can see the planner not liking the results of a function, +but a variable? That's a static value! ::cry:: + + +-- + +Shaun Thomas +Database Administrator + +Leapfrog Online +807 Greenwood Street +Evanston, IL 60201 +Tel. 847-440-8253 +Fax. 847-570-5750 +www.leapfrogonline.com + + +Confidentiality Note: + +The document(s) accompanying this e-mail transmission, if any, and the +e-mail transmittal message contain information from Leapfrog Online +Customer Acquisition, LLC is confidential or privileged. The information +is intended to be for the use of the individual(s) or entity(ies) named +on this e-mail transmission message. If you are not the intended +recipient, be aware that any disclosure, copying, distribution or use of +the contents of this e-mail is prohibited. If you have received this +e-mail in error, please immediately delete this e-mail and notify us by +telephone of the error + +From pgsql-performance-owner@postgresql.org Tue Jun 13 19:45:37 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id F28DD9FA38F + for ; + Tue, 13 Jun 2006 19:45:36 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 39857-08 for + ; + Tue, 13 Jun 2006 19:45:26 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 210F89FA1A8 + for ; + Tue, 13 Jun 2006 19:45:25 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 6D9AD5643D; Tue, 13 Jun 2006 17:45:24 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Tue, 13 Jun 2006 17:45:23 -0500 +Date: Tue, 13 Jun 2006 17:45:23 -0500 +From: "Jim C. Nasby" +To: John Vincent +Cc: pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +Message-ID: <20060613224523.GL34196@pervasive.com> +References: <20060603094355.GA23297@uio.no> + <1150062140.23423.0.camel@localhost.localdomain> + <448D3B65.7090709@aeccom.com> <448DE0DB.1020107@planet.tn> + <20060613192609.GX34196@pervasive.com> + <20060613212124.GD34196@pervasive.com> + + <20060613220509.GJ34196@pervasive.com> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060613:pgsql-performance@lusis.org::J42qZIsV/SFVgImj:0000000000 + 0000000000000000000000006rc5 +X-Hashcash: + 1:20:060613:pgsql-performance@postgresql.org::psUDHH6sjRCQaaEc:00000 + 0000000000000000000000004Emv +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/222 +X-Sequence-Number: 19579 + +On Tue, Jun 13, 2006 at 06:21:21PM -0400, John Vincent wrote: +> On 6/13/06, Jim C. Nasby wrote: +> > +> >On Tue, Jun 13, 2006 at 05:40:58PM -0400, John Vincent wrote: +> >> Maybe from a postgresql perspective the cpus may be useless but the +> >memory +> >> on the pSeries can't be beat. We've been looking at running our +> >warehouse +> >> (PGSQL) in a LoP lpar but I wasn't able to find a LoP build of 8.1. +> > +> >Probably just because not many people have access to that kind of +> >hardware. Have you tried building on Linux on Power? +> +> +> Actually it's on my radar. I was looking for a precompiled build first (we +> actually checked the Pervasive and Bizgres sites first since we're +> considering a support contract) before going the self-compiled route. When I +> didn't see a pre-compiled build available, I started looking at the +> developer archives and got a little worried that I wouldn't want to base my +> job on a self-built Postgres on a fairly new (I'd consider Power 5 fairly +> new) platform. + +Well, pre-compiled isn't going to make much of a difference +stability-wise. What you will run into is that very few people are +running PostgreSQL on your hardware, so it's possible you'd run into +some odd corner cases. I think it's pretty unlikely you'd lose data, but +you could end up with performance-related issues. + +If you can, it'd be great to do some testing on that hardware to see if +you can break PostgreSQL. + +> This is true. In our case I couldn't get the approval for the new hardware +> since we had two x445 boxes sitting there doing nothing (I wanted them for +> our VMware environment personally). Another sticking point is finding a +> vendor that will provide a hardware support contract similar to what we have +> with our existing IBM hardware (24x7x4). Since IBM has f-all for Opteron +> based systems and we've sworn off Dell, I was pretty limited. HP was able to +> get in on a pilot program and we're considering them now for future hardware +> purchases but beyond Dell/IBM/HP, there's not much else that can provide the +> kind of hardware support turn-around we need. + +What about Sun? + +> >We've been thrilled with the performance of our DB2 systems that run on +> >> AIX/Power 5 but since the DB2 instance memory is limited to 18GB, we've +> >got +> >> two 86GB p570s sitting there being under utilized. + +BTW, in a past life we moved a DB2 database off of Xeons and onto +RS/6000s with Power4. The difference was astounding. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Tue Jun 13 19:48:06 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 9DC9F9FA38F + for ; + Tue, 13 Jun 2006 19:48:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 42177-02 for + ; + Tue, 13 Jun 2006 19:48:01 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 19A909FA1A8 + for ; + Tue, 13 Jun 2006 19:48:01 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id F285F56435; Tue, 13 Jun 2006 17:47:59 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Tue, 13 Jun 2006 17:47:59 -0500 +Date: Tue, 13 Jun 2006 17:47:59 -0500 +From: "Jim C. Nasby" +To: Mischa Sandberg +Cc: pgsql-performance@postgresql.org +Subject: Re: Solaris shared_buffers anomaly? +Message-ID: <20060613224759.GM34196@pervasive.com> +References: <1150151282.14661.42.camel@tigger> + <20060613000441.GI8588@kenobi.snowman.net> + <20060613200810.GZ34196@pervasive.com> + <448F3A6E.6080908@ca.sophos.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <448F3A6E.6080908@ca.sophos.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060613:mischa@ca.sophos.com::S4r5wCO148Xhn44D:00000000000000000 + 00000000000000000000000002Nm +X-Hashcash: + 1:20:060613:pgsql-performance@postgresql.org::OfD+EIMce0fiTd7o:00000 + 0000000000000000000000006QYe +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/223 +X-Sequence-Number: 19580 + +On Tue, Jun 13, 2006 at 03:21:34PM -0700, Mischa Sandberg wrote: +> Jim C. Nasby wrote: +> ... +> >Actually, in 8.1.x I've seen some big wins from greatly increasing the +> >amount of shared_buffers, even as high as 50% of memory, thanks to the +> >changes made to the buffer management code. ... +> +> Anyone else run into a gotcha that one of our customers ran into? +> PG 7.4.8 running on Solaris 2.6, USparc w 4GB RAM. +> Usually about 50 active backends. +> (No reason to believe this wouldn't apply to 8.x). +> +> Initially shared_buffers were set to 1000 (8MB). +> Then, we moved all apps but the database server off the box. +> +> Raised shared_buffers to 2000 (16MB). +> Modest improvement in some frequent repeated queries. +> +> Raised shared_buffers to 16000 (128MB). +> DB server dropped to a CRAWL. +> +> vmstat showed that it was swapping like crazy. +> Dropped shared_buffers back down again. +> Swapping stopped. + +What's sort_mem set to? I suspect you simply ran the machine out of +memory. + +Also, Solaris by default will only use a portion of memory for +filesystem caching, which will kill PostgreSQL performance. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Tue Jun 13 19:54:40 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id AD1EA9FA38F + for ; + Tue, 13 Jun 2006 19:54:38 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 40517-06 for + ; + Tue, 13 Jun 2006 19:54:28 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id B4A1D9FA1A8 + for ; + Tue, 13 Jun 2006 19:54:28 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id DAF4956437; Tue, 13 Jun 2006 17:54:24 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Tue, 13 Jun 2006 17:54:24 -0500 +Date: Tue, 13 Jun 2006 17:54:23 -0500 +From: "Jim C. Nasby" +To: Shaun Thomas +Cc: pgsql-performance@postgresql.org, Tom Lane +Subject: Re: Confirmation of bad query plan generated by 7.4 +Message-ID: <20060613225423.GN34196@pervasive.com> +References: <9119.1150222168@sss.pgh.pa.us> + <448EDFC4.8F27.00A9.0@leapfrogonline.com> + <20060613211347.GB34196@pervasive.com> + <448EE95D.8F27.00A9.0@leapfrogonline.com> + <20060613215418.GI34196@pervasive.com> + <448EF8B2.8F27.00A9.0@leapfrogonline.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <448EF8B2.8F27.00A9.0@leapfrogonline.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060613:sthomas@leapfrogonline.com::0qwTB5jnagPeY9Hf:00000000000 + 00000000000000000000000009Et +X-Hashcash: + 1:20:060613:pgsql-performance@postgresql.org::NBiqzauZjhOJjmBl:00000 + 0000000000000000000000007OV5 +X-Hashcash: + 1:20:060613:tgl@sss.pgh.pa.us::bjjjry4cIdB9eRTM:00000000000000000000 + 0000000000000000000000001Iyx +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/224 +X-Sequence-Number: 19581 + +On Tue, Jun 13, 2006 at 05:41:06PM -0500, Shaun Thomas wrote: +> >>> On 6/13/2006 at 4:54 PM, "Jim C. Nasby" +> wrote: +> +> > SELECT attname, attstattarget +> > FROM pg_attribute +> > WHERE attrelid='table_name'::regclass AND attnum >= 0; +> +> -1 for all values. +> +> > SHOW default_statistics_target; +> +> 10. + +Increasing the statistics target for that table (or +default_statistics_target) might help. I'd try between 50 and 100. + +> Here's something slightly annoying: I tried precalculating the value +> in my stored proc, and it's still ignoring it. +> +> lastTime := now() - interval ''7 days''; +> +> UPDATE fact_credit_app +> SET activated_date_id = ad.date_id +> FROM l_event_log e +> JOIN c_event_type t ON (t.id = e.event_type_id) +> JOIN wf_date ad ON (e.event_date::date=ad.datestamp) +> WHERE e.ext_id=fact_credit_app.unique_id +> AND t.event_name = ''activation'' +> AND e.event_date > lastTime +> AND fact_credit_app.activated_date_id IS NULL; +> +> Instead of taking a handful of seconds (like when I replace +> lastTime with the text equivalent), it takes 10 minutes... +> I can see the planner not liking the results of a function, +> but a variable? That's a static value! ::cry:: + +If you're using plpgsql, it should be turning that update into a +prepared statement and then binding the variable to it. That means that +if you pass in different values in the same session, you could end up +with bad plans depending on the valuse, since it will cache the query +plan. + +Actually, come to think of it... I'm not sure if bound parameters are +used in query planning... +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Tue Jun 13 19:55:45 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id CF0659FA5CE + for ; + Tue, 13 Jun 2006 19:55:44 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 42379-03 for + ; + Tue, 13 Jun 2006 19:55:40 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from projects.commandprompt.com (host-130.commandprompt.net + [207.173.203.130]) + by postgresql.org (Postfix) with ESMTP id 0F9D89FA38F + for ; + Tue, 13 Jun 2006 19:55:39 -0300 (ADT) +Received: from [192.168.1.50] (or-67-76-146-141.sta.sprint-hsd.net + [67.76.146.141]) (authenticated bits=0) + by projects.commandprompt.com (8.13.6/8.13.6) with ESMTP id + k5DMta8w015560; Tue, 13 Jun 2006 15:55:37 -0700 +Message-ID: <448F4264.5030109@commandprompt.com> +Date: Tue, 13 Jun 2006 15:55:32 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Thunderbird 1.5.0.2 (X11/20060521) +MIME-Version: 1.0 +To: mischa@ca.sophos.com +CC: pgsql-performance@postgresql.org +Subject: Re: Solaris shared_buffers anomaly? +References: <1150151282.14661.42.camel@tigger> + <20060613000441.GI8588@kenobi.snowman.net> + <20060613200810.GZ34196@pervasive.com> + <448F3A6E.6080908@ca.sophos.com> +In-Reply-To: <448F3A6E.6080908@ca.sophos.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: ClamAV version 0.88.2, + clamav-milter version 0.88.2 on projects.commandprompt.com +X-Virus-Status: Clean +X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by + milter-greylist-1.6 (projects.commandprompt.com + [192.168.2.159]); Tue, 13 Jun 2006 15:55:37 -0700 (PDT) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/225 +X-Sequence-Number: 19582 + +> Initially shared_buffers were set to 1000 (8MB). +> Then, we moved all apps but the database server off the box. +> +> Raised shared_buffers to 2000 (16MB). +> Modest improvement in some frequent repeated queries. +> +> Raised shared_buffers to 16000 (128MB). +> DB server dropped to a CRAWL. + +Versions below 8.1 normally don't do well with high shared_buffers. 8.1 +would do much better. If you dropped that to more like 6k you would +probably continue to see increase over 2k. + +Sincerely, + +Joshua D. Drake + + +-- + + === The PostgreSQL Company: Command Prompt, Inc. === +Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 + Providing the most comprehensive PostgreSQL solutions since 1997 + http://www.commandprompt.com/ + + + +From pgsql-performance-owner@postgresql.org Tue Jun 13 19:56:58 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D2CF19FA5CE + for ; + Tue, 13 Jun 2006 19:56:57 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 39857-10 for + ; + Tue, 13 Jun 2006 19:56:52 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from smtp1.ActiveState.com (gw.activestate.com [209.17.183.249]) + by postgresql.org (Postfix) with ESMTP id 67E369FA38F + for ; + Tue, 13 Jun 2006 19:56:52 -0300 (ADT) +Received: from smtp3.activestate.com (smtp3.activestate.com [192.168.3.19]) + by smtp1.ActiveState.com (8.12.10/8.12.10) with ESMTP id k5DMuoWJ010911 + for ; Tue, 13 Jun 2006 15:56:50 -0700 + (envelope-from mischa@ca.sophos.com) +Received: from [192.168.99.210] (mallet.activestate.com [192.168.99.210]) + by smtp3.ActiveState.com (8.13.4/8.13.4) with ESMTP id k5DMuoj3014942 + for ; Tue, 13 Jun 2006 15:56:50 -0700 + (envelope-from mischa@ca.sophos.com) +Message-ID: <448F449A.6030900@ca.sophos.com> +Date: Tue, 13 Jun 2006 16:04:58 -0700 +From: Mischa Sandberg +Reply-To: mischa@ca.sophos.com +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Solaris shared_buffers anomaly? +References: <1150151282.14661.42.camel@tigger> + <20060613000441.GI8588@kenobi.snowman.net> + <20060613200810.GZ34196@pervasive.com> + <448F3A6E.6080908@ca.sophos.com> <11046.1150237327@sss.pgh.pa.us> +In-Reply-To: <11046.1150237327@sss.pgh.pa.us> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/226 +X-Sequence-Number: 19583 + +Tom Lane wrote: +> Mischa Sandberg writes: +>> vmstat showed that it was swapping like crazy. +>> Dropped shared_buffers back down again. +>> Swapping stopped. +> +> Does Solaris have any call that allows locking a shmem segment in RAM? + +Yes, mlock(). But want to understand what's going on before patching. +No reason to believe that the multiply-attached shm seg was being swapped out +(which is frankly insane). Swapping out (and in) just the true resident set of +every backend would be enough to explain the vmstat io we saw. + +http://www.carumba.com/talk/random/swol-09-insidesolaris.html + +For a dedicated DB server machine, Solaris has a feature: +create "intimate" shared memory with shmat(..., SHM_SHARE_MMU). +All backends share the same TLB entries (!). + +Context switch rates on our in-house solaris boxes running PG +have been insane (4000/sec). Reloading the TLB map on every process +context switch might be one reason Solaris runs our db apps at less +than half the speed of our perftesters' Xeon beige-boxes. + +That's guesswork. Sun is making PG part of their distro ... +perhaps they've some knowledgeable input. + +-- +Engineers think that equations approximate reality. +Physicists think that reality approximates the equations. +Mathematicians never make the connection. + + +From pgsql-performance-owner@postgresql.org Tue Jun 13 20:17:38 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 717239FA38F + for ; + Tue, 13 Jun 2006 20:17:38 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 43857-05 for + ; + Tue, 13 Jun 2006 20:17:32 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 8078E9FA1A8 + for ; + Tue, 13 Jun 2006 20:17:32 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 3724D56435; Tue, 13 Jun 2006 18:17:31 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Tue, 13 Jun 2006 18:17:30 -0500 +Date: Tue, 13 Jun 2006 18:17:30 -0500 +From: "Jim C. Nasby" +To: Mischa Sandberg +Cc: pgsql-performance@postgresql.org +Subject: Re: Solaris shared_buffers anomaly? +Message-ID: <20060613231730.GS34196@pervasive.com> +References: <1150151282.14661.42.camel@tigger> + <20060613000441.GI8588@kenobi.snowman.net> + <20060613200810.GZ34196@pervasive.com> + <448F3A6E.6080908@ca.sophos.com> + <20060613224759.GM34196@pervasive.com> + <448F4842.4010305@ca.sophos.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <448F4842.4010305@ca.sophos.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060613:mischa@ca.sophos.com::iBC2bNytH6f5X5BF:00000000000000000 + 0000000000000000000000001qEt +X-Hashcash: + 1:20:060613:pgsql-performance@postgresql.org::Li8tRixyCTxUpK8F:00000 + 0000000000000000000000001Uq3 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/228 +X-Sequence-Number: 19585 + +On Tue, Jun 13, 2006 at 04:20:34PM -0700, Mischa Sandberg wrote: +> Jim C. Nasby wrote: +> >On Tue, Jun 13, 2006 at 03:21:34PM -0700, Mischa Sandberg wrote: +> >>Raised shared_buffers to 16000 (128MB). +> >>DB server dropped to a CRAWL. +> >> +> >>vmstat showed that it was swapping like crazy. +> >>Dropped shared_buffers back down again. +> >>Swapping stopped. +> > +> >What's sort_mem set to? I suspect you simply ran the machine out of +> >memory. +> +> 8192 (8MB). No issue when shared_buffers was 2000; same apps always. + +So if all 50 backends were running a sort, you'd use 400MB. The box has +4G, right? + +> >Also, Solaris by default will only use a portion of memory for +> >filesystem caching, which will kill PostgreSQL performance. +> +> Yep, tested /etc/system segmap_percent at 20,40,60. +> No significant difference between 20 and 60. + +That's pretty disturbing... how large is your database? +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Tue Jun 13 20:12:36 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C847C9FA38F + for ; + Tue, 13 Jun 2006 20:12:35 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 42379-07 for + ; + Tue, 13 Jun 2006 20:12:30 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from smtp1.ActiveState.com (gw.activestate.com [209.17.183.249]) + by postgresql.org (Postfix) with ESMTP id 949719FA1A8 + for ; + Tue, 13 Jun 2006 20:12:30 -0300 (ADT) +Received: from smtp3.activestate.com (smtp3.activestate.com [192.168.3.19]) + by smtp1.ActiveState.com (8.12.10/8.12.10) with ESMTP id k5DNCQQG012077; + Tue, 13 Jun 2006 16:12:26 -0700 (envelope-from mischa@ca.sophos.com) +Received: from [192.168.99.210] (mallet.activestate.com [192.168.99.210]) + by smtp3.ActiveState.com (8.13.4/8.13.4) with ESMTP id k5DNCQId017595; + Tue, 13 Jun 2006 16:12:26 -0700 (envelope-from mischa@ca.sophos.com) +Message-ID: <448F4842.4010305@ca.sophos.com> +Date: Tue, 13 Jun 2006 16:20:34 -0700 +From: Mischa Sandberg +Reply-To: mischa@ca.sophos.com +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: "Jim C. Nasby" +CC: pgsql-performance@postgresql.org +Subject: Re: Solaris shared_buffers anomaly? +References: <1150151282.14661.42.camel@tigger> + <20060613000441.GI8588@kenobi.snowman.net> + <20060613200810.GZ34196@pervasive.com> + <448F3A6E.6080908@ca.sophos.com> + <20060613224759.GM34196@pervasive.com> +In-Reply-To: <20060613224759.GM34196@pervasive.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/227 +X-Sequence-Number: 19584 + +Jim C. Nasby wrote: +> On Tue, Jun 13, 2006 at 03:21:34PM -0700, Mischa Sandberg wrote: +>> Raised shared_buffers to 16000 (128MB). +>> DB server dropped to a CRAWL. +>> +>> vmstat showed that it was swapping like crazy. +>> Dropped shared_buffers back down again. +>> Swapping stopped. +> +> What's sort_mem set to? I suspect you simply ran the machine out of +> memory. + +8192 (8MB). No issue when shared_buffers was 2000; same apps always. + +> Also, Solaris by default will only use a portion of memory for +> filesystem caching, which will kill PostgreSQL performance. + +Yep, tested /etc/system segmap_percent at 20,40,60. +No significant difference between 20 and 60. +Default is 10%? 12%? Can't recall. + +Was not changed from 20 during the shared_buffer test. +-- +Engineers think that equations approximate reality. +Physicists think that reality approximates the equations. +Mathematicians never make the connection. + +From pgsql-performance-owner@postgresql.org Tue Jun 13 20:53:38 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 602329FA38F + for ; + Tue, 13 Jun 2006 20:53:38 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 48096-02 for + ; + Tue, 13 Jun 2006 20:53:27 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from smtp1.ActiveState.com (gw.activestate.com [209.17.183.249]) + by postgresql.org (Postfix) with ESMTP id 9B45B9FA1A8 + for ; + Tue, 13 Jun 2006 20:53:27 -0300 (ADT) +Received: from smtp3.activestate.com (smtp3.activestate.com [192.168.3.19]) + by smtp1.ActiveState.com (8.12.10/8.12.10) with ESMTP id k5DNrPQG015399 + for ; Tue, 13 Jun 2006 16:53:25 -0700 + (envelope-from mischa@ca.sophos.com) +Received: from [192.168.99.210] (mallet.activestate.com [192.168.99.210]) + by smtp3.ActiveState.com (8.13.4/8.13.4) with ESMTP id k5DNrPgT023612 + for ; Tue, 13 Jun 2006 16:53:25 -0700 + (envelope-from mischa@ca.sophos.com) +Message-ID: <448F51DE.2070604@ca.sophos.com> +Date: Tue, 13 Jun 2006 17:01:34 -0700 +From: Mischa Sandberg +Reply-To: mischa@ca.sophos.com +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Solaris shared_buffers anomaly? +References: <1150151282.14661.42.camel@tigger> + <20060613000441.GI8588@kenobi.snowman.net> + <20060613200810.GZ34196@pervasive.com> + <448F3A6E.6080908@ca.sophos.com> + <20060613224759.GM34196@pervasive.com> + <448F4842.4010305@ca.sophos.com> + <20060613231730.GS34196@pervasive.com> +In-Reply-To: <20060613231730.GS34196@pervasive.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/229 +X-Sequence-Number: 19586 + +Jim C. Nasby wrote: +> On Tue, Jun 13, 2006 at 04:20:34PM -0700, Mischa Sandberg wrote: +>> Jim C. Nasby wrote: +>>> What's sort_mem set to? I suspect you simply ran the machine out of +>>> memory. +>> 8192 (8MB). No issue when shared_buffers was 2000; same apps always. +> +> So if all 50 backends were running a sort, you'd use 400MB. The box has +> 4G, right? + +Umm ... yes. "if". 35-40 of them are doing pure INSERTS. +Not following your train. + +>> Yep, tested /etc/system segmap_percent at 20,40,60. +>> No significant difference between 20 and 60. +> That's pretty disturbing... how large is your database? + +~10GB. Good locality. Where heading? + +-- +Engineers think that equations approximate reality. +Physicists think that reality approximates the equations. +Mathematicians never make the connection. + +From pgsql-performance-owner@postgresql.org Tue Jun 13 21:11:05 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 70EC19FA38F + for ; + Tue, 13 Jun 2006 21:11:05 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 47095-10 for + ; + Tue, 13 Jun 2006 21:10:54 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from linda-4.paradise.net.nz (bm-4a.paradise.net.nz + [203.96.152.183]) + by postgresql.org (Postfix) with ESMTP id D3B129FA1A8 + for ; + Tue, 13 Jun 2006 21:10:52 -0300 (ADT) +Received: from smtp-3.paradise.net.nz + (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by + linda-4.paradise.net.nz (Paradise.net.nz) with ESMTP id + <0J0T0033WPU34N@linda-4.paradise.net.nz> for + pgsql-performance@postgresql.org; Wed, 14 Jun 2006 12:10:51 +1200 (NZST) +Received: from [192.168.1.11] + (218-101-28-235.dsl.clear.net.nz [218.101.28.235]) by + smtp-3.paradise.net.nz (Postfix) with ESMTP id 934B9C2FD05; + Wed, 14 Jun 2006 12:10:50 +1200 (NZST) +Date: Wed, 14 Jun 2006 12:10:43 +1200 +From: Mark Kirkwood +Subject: Re: Solaris shared_buffers anomaly? +In-reply-to: <448F3A6E.6080908@ca.sophos.com> +To: mischa@ca.sophos.com +Cc: pgsql-performance@postgresql.org +Message-id: <448F5403.7030903@paradise.net.nz> +MIME-version: 1.0 +Content-type: text/plain; format=flowed; charset=ISO-8859-1 +Content-transfer-encoding: 7bit +User-Agent: Thunderbird 1.5 (X11/20060417) +References: <1150151282.14661.42.camel@tigger> + <20060613000441.GI8588@kenobi.snowman.net> + <20060613200810.GZ34196@pervasive.com> <448F3A6E.6080908@ca.sophos.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/230 +X-Sequence-Number: 19587 + +Mischa Sandberg wrote: +> Jim C. Nasby wrote: +> ... +>> Actually, in 8.1.x I've seen some big wins from greatly increasing the +>> amount of shared_buffers, even as high as 50% of memory, thanks to the +>> changes made to the buffer management code. ... +> +> Anyone else run into a gotcha that one of our customers ran into? +> PG 7.4.8 running on Solaris 2.6, USparc w 4GB RAM. +> Usually about 50 active backends. +> (No reason to believe this wouldn't apply to 8.x). +> +> Initially shared_buffers were set to 1000 (8MB). +> Then, we moved all apps but the database server off the box. +> +> Raised shared_buffers to 2000 (16MB). +> Modest improvement in some frequent repeated queries. +> +> Raised shared_buffers to 16000 (128MB). +> DB server dropped to a CRAWL. +> +> vmstat showed that it was swapping like crazy. +> Dropped shared_buffers back down again. Swapping stopped. +> +> Stared at "ps u" a lot, and realized that the shm seg appeared to +> be counted as part of the resident set (RSS). +> Theory was that the kernel was reading the numbers the same way, +> and swapping out resident sets, since they obviously wouldn't +> all fit in RAM :-) +> +> Anyone from Sun reading this list, willing to offer an opinion? +> + +A while ago I ran 7.4.? on a Solaris 2.8 box (E280 or E220 can't recall) +with 2G of ram - 40 users or so with shared_buffers = approx 12000 - +with no swapping I recall (in fact I pretty sure there was free memory!). + +I suspect something else is your culprit - what is work_mem (or +sort_mem) set to? I'm thinking that you have this high and didn't have +much memory headroom to begin with, so that upping shared_buffers from +16MB -> 128MB tipped things over the edge! + +Cheers + +Mark + +From pgsql-performance-owner@postgresql.org Tue Jun 13 22:19:36 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 285299FA5CE + for ; + Tue, 13 Jun 2006 22:19:35 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 62452-05 for + ; + Tue, 13 Jun 2006 22:19:28 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.172]) + by postgresql.org (Postfix) with ESMTP id 407BF9FA1A8 + for ; + Tue, 13 Jun 2006 22:19:27 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so69891ugf + for ; + Tue, 13 Jun 2006 18:19:26 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; + b=JepUhxEJi1SPQVBL/lK1gapr66Sv+4CzW+rBJaVSndLHKJB1Ic5Q/1at99kiD3Gb125gnSYfC45UIrkBYAZykUzwCbPcJTb4x/RK6PAY9tpSasCkDtwB88FqkOZDePcXLTAM5+bypdsfMf3w4bsTGgPVJdScuQaJLlvOHzs86C8= +Received: by 10.66.222.9 with SMTP id u9mr155627ugg; + Tue, 13 Jun 2006 18:19:26 -0700 (PDT) +Received: by 10.66.216.11 with HTTP; Tue, 13 Jun 2006 18:19:26 -0700 (PDT) +Message-ID: +Date: Tue, 13 Jun 2006 21:19:26 -0400 +From: "John Vincent" +To: "Jim C. Nasby" +Subject: Re: scaling up postgres +Cc: pgsql-performance@postgresql.org +In-Reply-To: <20060613224523.GL34196@pervasive.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_13847_28975422.1150247966407" +References: <20060603094355.GA23297@uio.no> <448D3B65.7090709@aeccom.com> + <448DE0DB.1020107@planet.tn> <20060613192609.GX34196@pervasive.com> + <20060613212124.GD34196@pervasive.com> + + <20060613220509.GJ34196@pervasive.com> + + <20060613224523.GL34196@pervasive.com> +X-Google-Sender-Auth: 3dad9f277b2d8383 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/231 +X-Sequence-Number: 19588 + +------=_Part_13847_28975422.1150247966407 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +> Well, pre-compiled isn't going to make much of a difference +> stability-wise. What you will run into is that very few people are +> running PostgreSQL on your hardware, so it's possible you'd run into +> some odd corner cases. I think it's pretty unlikely you'd lose data, but +> you could end up with performance-related issues. +> +> If you can, it'd be great to do some testing on that hardware to see if +> you can break PostgreSQL. + + +It shouldn't be too hard to snag resources for an LPAR. In fact since it was +one of the things I was looking at testing (postgres/LoP or Postgres/AIX). + +I'll see what I can work out. If I can't get a CPU on the 570, we have a 520 +that I should be able to use. + +> This is true. In our case I couldn't get the approval for the new hardware +> > since we had two x445 boxes sitting there doing nothing (I wanted them +> for +> > our VMware environment personally). Another sticking point is finding a +> > vendor that will provide a hardware support contract similar to what we +> have +> > with our existing IBM hardware (24x7x4). Since IBM has f-all for Opteron +> > based systems and we've sworn off Dell, I was pretty limited. HP was +> able to +> > get in on a pilot program and we're considering them now for future +> hardware +> > purchases but beyond Dell/IBM/HP, there's not much else that can provide +> the +> > kind of hardware support turn-around we need. +> +> What about Sun? + + +Good question. At the time, Sun was off again/on again with Linux. Quite +honestly I'm not sure where Sun is headed. I actually suggested the Sun +hardware for our last project (a Windows-platformed package we needed) but +cost-wise, they were just too much compared to the HP solution. HP has a +cluster-in-a-box solution that runs about 10K depending on your VAR (2 DL380 +with shared SCSI to an MSA500 - sounds like a perfect VMware solution). + + +> >We've been thrilled with the performance of our DB2 systems that run on +> > >> AIX/Power 5 but since the DB2 instance memory is limited to 18GB, +> we've +> > >got +> > >> two 86GB p570s sitting there being under utilized. +> +> BTW, in a past life we moved a DB2 database off of Xeons and onto +> RS/6000s with Power4. The difference was astounding. + + + I'm amazed myself. My last experience with AIX before this was pre Power4. +AIX 5.3 on Power 5 is a sight to behold. I'm still cursing our DBAs for not +realizing the 18GB instance memory thing though ;) + +-- +> Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +> Pervasive Software http://pervasive.com work: 512-231-6117 +> vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 +> + + + +-- +John E. Vincent +lusis.org@gmail.com + +------=_Part_13847_28975422.1150247966407 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +



Well, pre-compiled isn't going to make much of a difference +
stability-wise. What you will run into is that very few people are
running PostgreSQL on your hardware, so it's possible you'd run into
some odd corner cases. I think it's pretty unlikely you'd lose data, but
+you could end up with performance-related issues.

If you can, it'd be great to do some testing on that hardware to see if
you can break PostgreSQL.

It shouldn't be too hard to snag resources for an LPAR. In fact since it was one of the things I was looking at testing (postgres/LoP or Postgres/AIX). +

I'll see what I can work out. If I can't get a CPU on the 570, we have a 520 that I should be able to use.

+> This is true. In our case I couldn't get the approval for the new hardware
> since we had two x445 boxes sitting there doing nothing (I wanted them for
> our VMware environment personally). Another sticking point is finding a +
> vendor that will provide a hardware support contract similar to what we have
> with our existing IBM hardware (24x7x4). Since IBM has f-all for Opteron
> based systems and we've sworn off Dell, I was pretty limited. HP was able to +
> get in on a pilot program and we're considering them now for future hardware
> purchases but beyond Dell/IBM/HP, there's not much else that can provide the
> kind of hardware support turn-around we need. +

What about Sun?

Good question. At the time, Sun was off again/on again with Linux. Quite honestly I'm not sure where Sun is headed. I actually suggested the Sun hardware for our last project (a Windows-platformed package we needed) but cost-wise, they were just too much compared to the HP solution. HP has a cluster-in-a-box solution that runs about 10K depending on your VAR (2 DL380 with shared SCSI to an MSA500 - sounds like a perfect VMware solution). +


> >We've been thrilled with the performance of our DB2 systems that run on +
> >> AIX/Power 5 but since the DB2 instance memory is limited to 18GB, we've
> >got
> >> two 86GB p570s sitting there being under utilized.

BTW, in a past life we moved a DB2 database off of Xeons and onto +
RS/6000s with Power4. The difference was astounding.

 I'm amazed myself. My last experience with AIX before this was pre Power4. AIX 5.3 on Power 5 is a sight to behold. I'm still cursing our DBAs for not realizing the 18GB instance memory thing though ;) +

--
Jim C. Nasby, Sr. Engineering Consultant       +jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf +       cell: 512-569-9461



--
John E. Vincent
lusis.org@gmail.com + +------=_Part_13847_28975422.1150247966407-- + +From pgsql-performance-owner@postgresql.org Tue Jun 13 22:51:00 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DB32D9FA1A8 + for ; + Tue, 13 Jun 2006 22:50:58 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 65150-04 for + ; + Tue, 13 Jun 2006 22:50:54 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 6F79A9FA38F + for ; + Tue, 13 Jun 2006 22:50:54 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5E1on1X018668; + Tue, 13 Jun 2006 21:50:49 -0400 (EDT) +To: "Jim C. Nasby" +cc: Shaun Thomas , + pgsql-performance@postgresql.org +Subject: Re: Confirmation of bad query plan generated by 7.4 +In-reply-to: <20060613223950.GK34196@pervasive.com> +References: <9119.1150222168@sss.pgh.pa.us> + <448EDFC4.8F27.00A9.0@leapfrogonline.com> + <20060613211347.GB34196@pervasive.com> + <10918.1150236282@sss.pgh.pa.us> + <20060613223950.GK34196@pervasive.com> +Comments: In-reply-to "Jim C. Nasby" + message dated "Tue, 13 Jun 2006 17:39:51 -0500" +Date: Tue, 13 Jun 2006 21:50:49 -0400 +Message-ID: <18667.1150249849@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/232 +X-Sequence-Number: 19589 + +"Jim C. Nasby" writes: +> On Tue, Jun 13, 2006 at 06:04:42PM -0400, Tom Lane wrote: +>> It'd depend on the context, possibly, but it's easy to show that the +>> current planner does fold "now() - interval_constant" when making +>> estimates. Simple example: + +> Turns out the difference is between feeding a date vs a timestamp into the +> query... I would have thought that since date is a date that the WHERE clause +> would be casted to a date if it was a timestamptz, but I guess not... + +Hmm ... worksforme. Could you provide a complete test case? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jun 13 23:04:39 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8E1079FA1A8 + for ; + Tue, 13 Jun 2006 23:04:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 63623-10 for + ; + Tue, 13 Jun 2006 23:04:34 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id ECEC89FA38F + for ; + Tue, 13 Jun 2006 23:04:34 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5E24WGo018774; + Tue, 13 Jun 2006 22:04:32 -0400 (EDT) +To: mischa@ca.sophos.com +cc: pgsql-performance@postgresql.org +Subject: Re: Solaris shared_buffers anomaly? +In-reply-to: <448F449A.6030900@ca.sophos.com> +References: <1150151282.14661.42.camel@tigger> + <20060613000441.GI8588@kenobi.snowman.net> + <20060613200810.GZ34196@pervasive.com> + <448F3A6E.6080908@ca.sophos.com> <11046.1150237327@sss.pgh.pa.us> + <448F449A.6030900@ca.sophos.com> +Comments: In-reply-to Mischa Sandberg + message dated "Tue, 13 Jun 2006 16:04:58 -0700" +Date: Tue, 13 Jun 2006 22:04:32 -0400 +Message-ID: <18773.1150250672@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/233 +X-Sequence-Number: 19590 + +Mischa Sandberg writes: +> Tom Lane wrote: +>> Does Solaris have any call that allows locking a shmem segment in RAM? + +> Yes, mlock(). But want to understand what's going on before patching. + +Sure, but testing it with mlock() might help you understand what's going +on, by eliminating one variable: we don't really know if the shmem is +getting swapped, or something else. + +> For a dedicated DB server machine, Solaris has a feature: +> create "intimate" shared memory with shmat(..., SHM_SHARE_MMU). +> All backends share the same TLB entries (!). + +We use that already. (Hmm, might be interesting for you to turn it +*off* and see if anything changes. See src/backend/port/sysv_shmem.c.) + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jun 13 23:13:35 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 855B79FA38F + for ; + Tue, 13 Jun 2006 23:13:34 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 69865-02 for + ; + Tue, 13 Jun 2006 23:13:26 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id DB69A9FA1A8 + for ; + Tue, 13 Jun 2006 23:13:26 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5E2DOx6018844; + Tue, 13 Jun 2006 22:13:24 -0400 (EDT) +To: "Shaun Thomas" +cc: "Jim C. Nasby" , pgsql-performance@postgresql.org +Subject: Re: Confirmation of bad query plan generated by 7.4 +In-reply-to: <448EF8B2.8F27.00A9.0@leapfrogonline.com> +References: <9119.1150222168@sss.pgh.pa.us> + <448EDFC4.8F27.00A9.0@leapfrogonline.com> + <20060613211347.GB34196@pervasive.com> + <448EE95D.8F27.00A9.0@leapfrogonline.com> + <20060613215418.GI34196@pervasive.com> + <448EF8B2.8F27.00A9.0@leapfrogonline.com> +Comments: In-reply-to "Shaun Thomas" + message dated "Tue, 13 Jun 2006 17:41:06 -0500" +Date: Tue, 13 Jun 2006 22:13:24 -0400 +Message-ID: <18843.1150251204@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/234 +X-Sequence-Number: 19591 + +"Shaun Thomas" writes: +> I can see the planner not liking the results of a function, +> but a variable? That's a static value! + +Read what you wrote, and rethink... + +If you're desperate you can construct a query string with the variable +value embedded as a literal, and then EXECUTE that. This isn't a great +solution since it forces a re-plan on every execution. We've +occasionally debated ways to do it better, but no such improvement will +ever appear in 7.4 ;-) + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jun 13 23:24:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 986F89FA38F + for ; + Tue, 13 Jun 2006 23:24:53 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 66247-09 for + ; + Tue, 13 Jun 2006 23:24:44 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id A594E9FA1A8 + for ; + Tue, 13 Jun 2006 23:24:44 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5E2Of5h018927; + Tue, 13 Jun 2006 22:24:41 -0400 (EDT) +To: "Jim C. Nasby" +cc: John Vincent , + pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +In-reply-to: <20060613224523.GL34196@pervasive.com> +References: <20060603094355.GA23297@uio.no> + <1150062140.23423.0.camel@localhost.localdomain> + <448D3B65.7090709@aeccom.com> <448DE0DB.1020107@planet.tn> + <20060613192609.GX34196@pervasive.com> + <20060613212124.GD34196@pervasive.com> + + <20060613220509.GJ34196@pervasive.com> + + <20060613224523.GL34196@pervasive.com> +Comments: In-reply-to "Jim C. Nasby" + message dated "Tue, 13 Jun 2006 17:45:23 -0500" +Date: Tue, 13 Jun 2006 22:24:41 -0400 +Message-ID: <18926.1150251881@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/235 +X-Sequence-Number: 19592 + +"Jim C. Nasby" writes: +> On Tue, Jun 13, 2006 at 06:21:21PM -0400, John Vincent wrote: +>> Actually it's on my radar. I was looking for a precompiled build first (we +>> actually checked the Pervasive and Bizgres sites first since we're +>> considering a support contract) before going the self-compiled route. When I +>> didn't see a pre-compiled build available, I started looking at the +>> developer archives and got a little worried that I wouldn't want to base my +>> job on a self-built Postgres on a fairly new (I'd consider Power 5 fairly +>> new) platform. + +> Well, pre-compiled isn't going to make much of a difference +> stability-wise. What you will run into is that very few people are +> running PostgreSQL on your hardware, so it's possible you'd run into +> some odd corner cases. + +Power 5 is just a PPC64 platform isn't it? Red Hat's been building PG +for PPC64 for years, and I've not heard any problems reported. Now, +if you're using a non-gcc compiler then maybe that track record doesn't +carry over to whatever you are using ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jun 13 23:44:37 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B92979FA38F + for ; + Tue, 13 Jun 2006 23:44:36 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 71320-04 for + ; + Tue, 13 Jun 2006 23:44:32 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id AF7969FA1A8 + for ; + Tue, 13 Jun 2006 23:44:32 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5E2iT1s019097; + Tue, 13 Jun 2006 22:44:29 -0400 (EDT) +To: "Jim C. Nasby" +cc: Antoine , pgsql-performance@postgresql.org +Subject: Re: OT - select + must have from - sql standard syntax? +In-reply-to: <20060613210246.GA34196@pervasive.com> +References: <92d3a4950606130543y2aab73d8sbbbf04aee328b41f@mail.gmail.com> + <20060613210246.GA34196@pervasive.com> +Comments: In-reply-to "Jim C. Nasby" + message dated "Tue, 13 Jun 2006 16:02:47 -0500" +Date: Tue, 13 Jun 2006 22:44:29 -0400 +Message-ID: <19096.1150253069@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/236 +X-Sequence-Number: 19593 + +"Jim C. Nasby" writes: +> On Tue, Jun 13, 2006 at 02:43:45PM +0200, Antoine wrote: +>> I don't have a copy of the standard on hand and a collegue is claiming +>> that there must be a from clause in a select query (he is an oracle +>> guy). This doesn't seem to be the case for postgres... does anyone +>> know? + +> Dunno, but I know that other databases (at least DB2) don't require FROM +> either. + +The spec does require a FROM clause in SELECT (at least as of SQL99, did +not check SQL2003). However, it's clearly mighty useful to allow FROM +to be omitted for simple compute-this-scalar-result problems. You +should respond to the Oracle guy that "SELECT whatever FROM dual" is not +in the standard either (certainly the spec does not mention any such +table). And in any case an Oracle fanboy has got *no* leg to stand on +when griping about proprietary extensions to the spec. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Jun 14 00:35:51 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 841D49FA38F + for ; + Wed, 14 Jun 2006 00:35:50 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 81905-05 for + ; + Wed, 14 Jun 2006 00:35:42 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id C05419FA1A8 + for ; + Wed, 14 Jun 2006 00:35:41 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 8DBDC56440; Tue, 13 Jun 2006 22:35:40 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Tue, 13 Jun 2006 22:35:40 -0500 +Date: Tue, 13 Jun 2006 22:35:39 -0500 +From: "Jim C. Nasby" +To: Mischa Sandberg +Cc: pgsql-performance@postgresql.org +Subject: Re: Solaris shared_buffers anomaly? +Message-ID: <20060614033539.GY34196@pervasive.com> +References: <1150151282.14661.42.camel@tigger> + <20060613000441.GI8588@kenobi.snowman.net> + <20060613200810.GZ34196@pervasive.com> + <448F3A6E.6080908@ca.sophos.com> + <20060613224759.GM34196@pervasive.com> + <448F4842.4010305@ca.sophos.com> + <20060613231730.GS34196@pervasive.com> + <448F51DE.2070604@ca.sophos.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <448F51DE.2070604@ca.sophos.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060614:mischa@ca.sophos.com::nvqusgSV849RcH4V:00000000000000000 + 0000000000000000000000000wig +X-Hashcash: + 1:20:060614:pgsql-performance@postgresql.org::9kQ3Sk7h2PD9jsWS:00000 + 0000000000000000000000005ZfV +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/237 +X-Sequence-Number: 19594 + +On Tue, Jun 13, 2006 at 05:01:34PM -0700, Mischa Sandberg wrote: +> Jim C. Nasby wrote: +> >On Tue, Jun 13, 2006 at 04:20:34PM -0700, Mischa Sandberg wrote: +> >>Jim C. Nasby wrote: +> >>>What's sort_mem set to? I suspect you simply ran the machine out of +> >>>memory. +> >>8192 (8MB). No issue when shared_buffers was 2000; same apps always. +> > +> >So if all 50 backends were running a sort, you'd use 400MB. The box has +> >4G, right? +> +> Umm ... yes. "if". 35-40 of them are doing pure INSERTS. +> Not following your train. + +If sort_mem is set too high and a bunch of sorts fire off at once, +you'll run the box out of memory and it'll start swapping. Won't really +matter much whether it's swapping shared buffers or not; performance +will just completely tank. + +Actually, I think that Solaris can be pretty aggressive about swapping +stuff out to try and cache more data. Perhaps that's what's happening? + +> >>Yep, tested /etc/system segmap_percent at 20,40,60. +> >>No significant difference between 20 and 60. +> >That's pretty disturbing... how large is your database? +> +> ~10GB. Good locality. Where heading? + +I guess I should have asked what your working set size was... unless +that's very small, it doesn't make sense that changing the cache size +that much wouldn't help things. + +BTW, on some versions of Solaris, segmap_percent doesn't actually work; +you have to change something else that's measured in bytes. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Wed Jun 14 01:15:47 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 93BD99FA5C3 + for ; + Wed, 14 Jun 2006 01:15:46 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 01434-01 for + ; + Wed, 14 Jun 2006 01:15:42 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by postgresql.org (Postfix) with ESMTP id 764F69FA3C0 + for ; + Wed, 14 Jun 2006 01:15:41 -0300 (ADT) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1FqMmx-0002QS-00; Wed, 14 Jun 2006 00:15:31 -0400 +To: Tom Lane +Cc: "Jim C. Nasby" , Antoine , + pgsql-performance@postgresql.org +Subject: Re: OT - select + must have from - sql standard syntax? +References: <92d3a4950606130543y2aab73d8sbbbf04aee328b41f@mail.gmail.com> + <20060613210246.GA34196@pervasive.com> + <19096.1150253069@sss.pgh.pa.us> +In-Reply-To: <19096.1150253069@sss.pgh.pa.us> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 14 Jun 2006 00:15:30 -0400 +Message-ID: <87wtbkcqzh.fsf@stark.xeocode.com> +Lines: 20 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/238 +X-Sequence-Number: 19595 + + +Tom Lane writes: + +> The spec does require a FROM clause in SELECT (at least as of SQL99, did +> not check SQL2003). However, it's clearly mighty useful to allow FROM +> to be omitted for simple compute-this-scalar-result problems. You +> should respond to the Oracle guy that "SELECT whatever FROM dual" is not +> in the standard either (certainly the spec does not mention any such +> table). + +Well you could always create a "dual", it was always just a regular table. We +used to joke about what would happen to Oracle if you inserted an extra row in +it... + +Oracle used to always require FROM, if it has stopped requiring it then that's +new. I had heard it had special-cased dual in later versions to avoid the +table access overhead, I suspect these two changes are related. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Wed Jun 14 03:36:33 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C91489FA5C3 + for ; + Wed, 14 Jun 2006 03:36:32 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 11708-02 for + ; + Wed, 14 Jun 2006 03:36:24 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.175]) + by postgresql.org (Postfix) with ESMTP id E42119FA3C0 + for ; + Wed, 14 Jun 2006 03:36:23 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so157142ugf + for ; + Tue, 13 Jun 2006 23:36:22 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=M/ycFElnVH81XQByMVmiQ4euKJDAFrc1sSS4DMIm25cCXKhGR4+j/tfB5t6wnbe2GBoTcDubETi1b88tcB2CDD1AGEO/6yttPdeGwV1dscfUx5SDgBrVjhWovD3nIn0fhWw0Ao1E9y/yi5bF5pyyX61xmBG8Wzau0Wap4yR6ZbE= +Received: by 10.78.47.15 with SMTP id u15mr77026huu; + Tue, 13 Jun 2006 23:36:22 -0700 (PDT) +Received: by 10.78.50.4 with HTTP; Tue, 13 Jun 2006 23:36:22 -0700 (PDT) +Message-ID: <92d3a4950606132336j1220301en9e5d33c64ad2794a@mail.gmail.com> +Date: Wed, 14 Jun 2006 08:36:22 +0200 +From: Antoine +To: "Greg Stark" +Subject: Re: OT - select + must have from - sql standard syntax? +Cc: "Tom Lane" , "Jim C. Nasby" , + pgsql-performance@postgresql.org +In-Reply-To: <87wtbkcqzh.fsf@stark.xeocode.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <92d3a4950606130543y2aab73d8sbbbf04aee328b41f@mail.gmail.com> + <20060613210246.GA34196@pervasive.com> + <19096.1150253069@sss.pgh.pa.us> <87wtbkcqzh.fsf@stark.xeocode.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/239 +X-Sequence-Number: 19596 + +> > The spec does require a FROM clause in SELECT (at least as of SQL99, did +> > not check SQL2003). However, it's clearly mighty useful to allow FROM +> > to be omitted for simple compute-this-scalar-result problems. You +> > should respond to the Oracle guy that "SELECT whatever FROM dual" is not +> > in the standard either (certainly the spec does not mention any such +> > table). + +Thanks for your answers guys. I was pretty sure DUAL wasn't in the +standard (never seen it outside an oracle context) but wasn't at all +sure about the FROM. +Cheers +Antoine +ps. shame the standard isn't "freely" consultable to save you guys +silly OT questions! + + +-- +This is where I should put some witty comment. + +From pgsql-performance-owner@postgresql.org Wed Jun 14 04:52:33 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8858E9FA5C3 + for ; + Wed, 14 Jun 2006 04:52:32 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 17619-08 for + ; + Wed, 14 Jun 2006 04:52:28 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.193]) + by postgresql.org (Postfix) with ESMTP id EBC769FA3C0 + for ; + Wed, 14 Jun 2006 04:52:27 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id s1so76988nze + for ; + Wed, 14 Jun 2006 00:52:26 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:mime-version:content-type; + b=owtC/LNZJLDMDMKl6e/BBLchHyHmlhwHrxWRVjDdWeoKlLUfclEnUJBnUQrRJDEgbr9tOTK+DzfvwaJ1dAOut+d1RCNlWLxAUr23jc2WF+h5w8AbPhP7wSp556m1qEf5tUpk3EY0RlMcIqb3YIlH6Ga0WnJjMGcF4vPAkk7HnAY= +Received: by 10.64.156.3 with SMTP id d3mr247053qbe; + Wed, 14 Jun 2006 00:52:26 -0700 (PDT) +Received: by 10.65.75.17 with HTTP; Wed, 14 Jun 2006 00:52:26 -0700 (PDT) +Message-ID: <9e4684ce0606140052m62552d41xa9364b9d4e266c97@mail.gmail.com> +Date: Wed, 14 Jun 2006 09:52:26 +0200 +From: "hubert depesz lubaczewski" +To: Pgsql-Performance +Subject: how to partition disks +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_26035_5515386.1150271546893" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/240 +X-Sequence-Number: 19597 + +------=_Part_26035_5515386.1150271546893 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +hi +i'm waiting for new server to arrive. +for the server i will get hp msa1000, with 14 discs (72g, 15000 rpm). +what kind of partitioning you suggest, to get maximum performance? +for system things i will have separate discs, so whole array is only for +postgresql. + +data processing is oltp, but with large amounts of write operations. + +any hints? + +should i go with 3 partitions, or just 1? or 2? + +depesz + +-- +http://www.depesz.com/ - nowy, lepszy depesz + +------=_Part_26035_5515386.1150271546893 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +hi
i'm waiting for new server to arrive.
for the server i will get hp msa1000, with 14 discs (72g, 15000 rpm).
what kind of partitioning you suggest, to get maximum performance?
for system things i will have separate discs, so whole array is only for postgresql. +

data processing is oltp, but with large amounts of write operations.

any hints?

should i go with 3 partitions, or just 1? or 2?

depesz

--
+http://www.depesz.com/ - nowy, lepszy depesz + +------=_Part_26035_5515386.1150271546893-- + +From pgsql-performance-owner@postgresql.org Wed Jun 14 05:26:52 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 14FEF9FA5C3 + for ; + Wed, 14 Jun 2006 05:26:52 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 19081-10 for + ; + Wed, 14 Jun 2006 05:26:47 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.aeccom.com (port-83-236-156-26.static.qsc.de + [83.236.156.26]) + by postgresql.org (Postfix) with ESMTP id 914809FA3C0 + for ; + Wed, 14 Jun 2006 05:26:47 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mail.aeccom.com (Postfix) with ESMTP id 06B3C1D131; + Wed, 14 Jun 2006 10:26:46 +0200 (CEST) +Received: from mail.aeccom.com ([127.0.0.1]) + by localhost (gate6.aeccom.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 18927-01-2; Wed, 14 Jun 2006 10:26:45 +0200 (CEST) +Received: from [192.168.2.14] (andes.core.aeccom.com [192.168.2.14]) + by mail.aeccom.com (Postfix) with ESMTP id 212FF1D0AF; + Wed, 14 Jun 2006 10:26:45 +0200 (CEST) +Message-ID: <448FC843.1090205@aeccom.com> +Date: Wed, 14 Jun 2006 10:26:43 +0200 +From: Sven Geisler +Organization: AEC/communications GmbH +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: hubert depesz lubaczewski +CC: Pgsql-Performance +Subject: Re: how to partition disks +References: <9e4684ce0606140052m62552d41xa9364b9d4e266c97@mail.gmail.com> +In-Reply-To: <9e4684ce0606140052m62552d41xa9364b9d4e266c97@mail.gmail.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: amavisd-new at aeccom.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/241 +X-Sequence-Number: 19598 + +Hi Hubert, + +hubert depesz lubaczewski schrieb: +> hi +> i'm waiting for new server to arrive. +> for the server i will get hp msa1000, with 14 discs (72g, 15000 rpm). +> what kind of partitioning you suggest, to get maximum performance? +> for system things i will have separate discs, so whole array is only for +> postgresql. +> +> data processing is oltp, but with large amounts of write operations. +> +> any hints? +> +> should i go with 3 partitions, or just 1? or 2? +> + +You should configure your discs to RAID 10 volumes. +You should set up a separate volume for WAL. +A volume for an additional table space may also useful. + +In your case I would do 2 partitions: + +1. RAID 10 with 8 discs for general data +2. RAID 10 with 4 discs for WAL +(two disk as spare) + +You may split the first volume in two volumes for a second table space +if you Server doesn't have enough RAM and you have a high disk read I/O. + + +Cheers +Sven. + +From pgsql-performance-owner@postgresql.org Wed Jun 14 07:54:10 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 765D39FA5D8 + for ; + Wed, 14 Jun 2006 07:54:09 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 43380-04 for + ; + Wed, 14 Jun 2006 07:54:00 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from www.szamitogep.hu (szamitogep.hu [62.77.196.4]) + by postgresql.org (Postfix) with ESMTP id A51B59F9CAA + for ; + Wed, 14 Jun 2006 07:53:58 -0300 (ADT) +Received: by www.szamitogep.hu (Postfix, from userid 48) + id F3AA02B0098; Wed, 14 Jun 2006 12:53:54 +0200 (CEST) +Received: from 213.163.11.81 (SquirrelMail authenticated user zboszor) + by www.dunaweb.hu with HTTP; Wed, 14 Jun 2006 12:53:54 +0200 (CEST) +Message-ID: <3167.213.163.11.81.1150282434.squirrel@www.dunaweb.hu> +Date: Wed, 14 Jun 2006 12:53:54 +0200 (CEST) +Subject: Precomputed constants? +From: =?iso-8859-2?Q?B=F6sz=F6rm=E9nyi_Zolt=E1n?= +To: pgsql-performance@postgresql.org +User-Agent: SquirrelMail/1.4.5 +MIME-Version: 1.0 +Content-Type: text/plain;charset=iso-8859-2 +Content-Transfer-Encoding: 8bit +X-Priority: 3 (Normal) +Importance: Normal +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/242 +X-Sequence-Number: 19599 + +Hi, + +here's my problem: + +# explain analyze select * from mxstrpartsbg where szam = +round(800000*random())::integer; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------- + Seq Scan on mxstrpartsbg (cost=0.00..56875.04 rows=1 width=322) (actual +time=190.748..1271.664 rows=1 loops=1) + Filter: (szam = (round((800000::double precision * random())))::integer) + Total runtime: 1271.785 ms +(3 rows) + +# explain analyze select * from mxstrpartsbg where szam = 671478; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------ + Index Scan using mxstrpartsbg_pkey on mxstrpartsbg (cost=0.00..5.87 +rows=1 width=322) (actual time=71.642..71.644 rows=1 loops=1) + Index Cond: (szam = 671478) + Total runtime: 71.706 ms +(3 rows) + +Is there a way to have PostgreSQL to pre-compute all the constants in the +WHERE clause? It would be a huge performance gain. Thanks in advance. + +Best regards, +Zolt�n B�sz�rm�nyi + + +From pgsql-performance-owner@postgresql.org Wed Jun 14 08:09:45 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E6E7E9FA5D8 + for ; + Wed, 14 Jun 2006 08:09:44 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 44580-01 for + ; + Wed, 14 Jun 2006 08:09:39 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from fep05.ttnet.net.tr (mail.ttnet.net.tr [212.175.13.129]) + by postgresql.org (Postfix) with ESMTP id 2C31C9F9CAA + for ; + Wed, 14 Jun 2006 08:09:37 -0300 (ADT) +Received: from (192.168.8.105) by AVGW-I-1.ttnet.net.tr via smtp + id 2848_24850ad8_fb96_11da_9a6f_001422175f0e; + Wed, 14 Jun 2006 14:08:45 +0300 +Received: from alamut ([212.174.26.173]) by fep05.ttnet.net.tr with ESMTP + id <20060614110934.GEZM2298.fep05.ttnet.net.tr@alamut>; + Wed, 14 Jun 2006 14:09:34 +0300 +Received: from by AVGW-I-6.ttnet.net.tr via smtp + id 67db_1dafdfa8_fb96_11da_8ae9_0011433771ac; + Wed, 14 Jun 2006 14:08:32 +0300 +Date: Wed, 14 Jun 2006 14:07:13 +0300 +From: Volkan YAZICI +To: =?iso-8859-1?B?QvZzevZybelueWkgWm9sdOFu?= +Cc: pgsql-performance@postgresql.org +Subject: Re: Precomputed constants? +Message-ID: <20060614110713.GA2277@alamut.tdm.local> +References: <3167.213.163.11.81.1150282434.squirrel@www.dunaweb.hu> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +In-Reply-To: <3167.213.163.11.81.1150282434.squirrel@www.dunaweb.hu> +User-Agent: Mutt/1.4.2.1i +X-NAI-Spam-Rules: 0 Rules triggered +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/243 +X-Sequence-Number: 19600 + +On Jun 14 12:53, B�sz�rm�nyi Zolt�n wrote: +> # explain analyze select * from mxstrpartsbg where szam = +> round(800000*random())::integer; + +AFAIK, you can use sth like that: + +SELECT * FROM mxstrpartsbg + WHERE szam = (SELECT round(800000*random())::integer OFFSET 0); + +This will prevent calculation of round() for every row. + + +Regards. + +From pgsql-performance-owner@postgresql.org Wed Jun 14 08:21:33 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 996A29FA5E1 + for ; + Wed, 14 Jun 2006 08:21:33 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 43108-09 for + ; + Wed, 14 Jun 2006 08:21:29 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.198]) + by postgresql.org (Postfix) with ESMTP id 543B19FA5D8 + for ; + Wed, 14 Jun 2006 08:21:29 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id s1so112081nze + for ; + Wed, 14 Jun 2006 04:21:28 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=bfRnHf6xkRXjL73q8kvNNW+1M1x67N14RRKJRoREcEuEvAjOPNNMi+Lw0sdw/bUcHRmFKPXWDmMSLVK0L++wCMCJsrONsxXocCrvDTHYKajPx/GUr7NbtwE6xgrTQqgtRsGZT6vWe9olhKO9syrWmm1+ACdrW2GYdllonLxAYf8= +Received: by 10.65.192.19 with SMTP id u19mr331210qbp; + Wed, 14 Jun 2006 04:21:27 -0700 (PDT) +Received: by 10.65.75.17 with HTTP; Wed, 14 Jun 2006 04:21:25 -0700 (PDT) +Message-ID: <9e4684ce0606140421m1a71581dmaa7a9adb988aedc8@mail.gmail.com> +Date: Wed, 14 Jun 2006 13:21:25 +0200 +From: "hubert depesz lubaczewski" +To: "Sven Geisler" +Subject: Re: how to partition disks +Cc: Pgsql-Performance +In-Reply-To: <448FC843.1090205@aeccom.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_27298_25340412.1150284085539" +References: <9e4684ce0606140052m62552d41xa9364b9d4e266c97@mail.gmail.com> + <448FC843.1090205@aeccom.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/244 +X-Sequence-Number: 19601 + +------=_Part_27298_25340412.1150284085539 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +On 6/14/06, Sven Geisler wrote: +> +> You should configure your discs to RAID 10 volumes. +> You should set up a separate volume for WAL. +> A volume for an additional table space may also useful. +> In your case I would do 2 partitions: +> 1. RAID 10 with 8 discs for general data +> + +raid 10 is of course not questionable. but are you sure that it will work +faster than for example: +2 discs (raid 1) for xlog +6 discs (raid 10) for tables +6 discs (raid 10) for indices? + +depesz + +-- +http://www.depesz.com/ - nowy, lepszy depesz + +------=_Part_27298_25340412.1150284085539 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +On 6/14/06, Sven Geisler <sgeisler@aeccom.com> wrote:
+You should configure your discs to RAID 10 volumes.
You should set up a separate volume for WAL.
A volume for an additional table space may also useful.
In your case I would do 2 partitions:
1. RAID 10 with 8 discs for general data +

raid 10 is of course not questionable. but are you sure that it will work faster than for example:
2 discs (raid 1) for xlog
6 discs (raid 10) for tables
6 discs (raid 10) for indices?
+
depesz

--
http://www.depesz.com/ - nowy, lepszy depesz + +------=_Part_27298_25340412.1150284085539-- + +From pgsql-performance-owner@postgresql.org Wed Jun 14 08:30:16 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3BF0E9FA5D8 + for ; + Wed, 14 Jun 2006 08:30:16 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 43268-08 for + ; + Wed, 14 Jun 2006 08:30:11 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from www.szamitogep.hu (szamitogep.hu [62.77.196.4]) + by postgresql.org (Postfix) with ESMTP id 101F49F9CAA + for ; + Wed, 14 Jun 2006 08:30:11 -0300 (ADT) +Received: by www.szamitogep.hu (Postfix, from userid 48) + id 53A4B2B0098; Wed, 14 Jun 2006 13:30:10 +0200 (CEST) +Received: from 213.163.11.81 (SquirrelMail authenticated user zboszor) + by www.dunaweb.hu with HTTP; Wed, 14 Jun 2006 13:30:10 +0200 (CEST) +Message-ID: <3861.213.163.11.81.1150284610.squirrel@www.dunaweb.hu> +In-Reply-To: <20060614110713.GA2277@alamut.tdm.local> +References: <3167.213.163.11.81.1150282434.squirrel@www.dunaweb.hu> + <20060614110713.GA2277@alamut.tdm.local> +Date: Wed, 14 Jun 2006 13:30:10 +0200 (CEST) +Subject: Re: Precomputed constants? +From: =?iso-8859-2?Q?B=F6sz=F6rm=E9nyi_Zolt=E1n?= +To: "Volkan YAZICI" +Cc: pgsql-performance@postgresql.org +User-Agent: SquirrelMail/1.4.5 +MIME-Version: 1.0 +Content-Type: text/plain;charset=iso-8859-2 +Content-Transfer-Encoding: 8bit +X-Priority: 3 (Normal) +Importance: Normal +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/245 +X-Sequence-Number: 19602 + +> On Jun 14 12:53, B�sz�rm�nyi Zolt�n wrote: +>> # explain analyze select * from mxstrpartsbg where szam = +>> round(800000*random())::integer; +> +> AFAIK, you can use sth like that: +> +> SELECT * FROM mxstrpartsbg +> WHERE szam = (SELECT round(800000*random())::integer OFFSET 0); +> +> This will prevent calculation of round() for every row. +> +> Regards. + +Thanks, It worked. + +Oh, I see now. I makes sense, random() isn't a constant and +it was computed for every row. Actually running the query produces +different results sets with 0, 1 or 2 rows. + +Replacing random() with a true constant gives me index scan +even if it's hidden inside other function calls. E.g.: + +# explain analyze select * from mxstrpartsbg where szam = +round('800000.71'::decimal(10,2))::integer; + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------- + Index Scan using mxstrpartsbg_pkey on mxstrpartsbg (cost=0.00..5.87 +rows=1 width=322) (actual time=0.020..0.022 rows=1 loops=1) + Index Cond: (szam = 800001) + Total runtime: 0.082 ms +(3 rows) + +Best regards, +Zolt�n B�sz�rm�nyi + + +From pgsql-performance-owner@postgresql.org Wed Jun 14 08:41:46 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DD51F9FA5D8 + for ; + Wed, 14 Jun 2006 08:41:45 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 47352-02 for + ; + Wed, 14 Jun 2006 08:41:35 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.aeccom.com (port-83-236-156-26.static.qsc.de + [83.236.156.26]) + by postgresql.org (Postfix) with ESMTP id 755ED9F9CAA + for ; + Wed, 14 Jun 2006 08:41:35 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mail.aeccom.com (Postfix) with ESMTP id C940A1D018; + Wed, 14 Jun 2006 13:41:33 +0200 (CEST) +Received: from mail.aeccom.com ([127.0.0.1]) + by localhost (gate6.aeccom.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 22199-05-3; Wed, 14 Jun 2006 13:41:32 +0200 (CEST) +Received: from [192.168.2.14] (andes.core.aeccom.com [192.168.2.14]) + by mail.aeccom.com (Postfix) with ESMTP id DCCBB1D016; + Wed, 14 Jun 2006 13:41:32 +0200 (CEST) +Message-ID: <448FF5EB.8010808@aeccom.com> +Date: Wed, 14 Jun 2006 13:41:31 +0200 +From: Sven Geisler +Organization: AEC/communications GmbH +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: hubert depesz lubaczewski +CC: Pgsql-Performance +Subject: Re: how to partition disks +References: <9e4684ce0606140052m62552d41xa9364b9d4e266c97@mail.gmail.com> + <448FC843.1090205@aeccom.com> + <9e4684ce0606140421m1a71581dmaa7a9adb988aedc8@mail.gmail.com> +In-Reply-To: <9e4684ce0606140421m1a71581dmaa7a9adb988aedc8@mail.gmail.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: amavisd-new at aeccom.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/246 +X-Sequence-Number: 19603 + +Hi Hupert, + +hubert depesz lubaczewski schrieb: +> On 6/14/06, *Sven Geisler* > wrote: +> You should configure your discs to RAID 10 volumes. +> You should set up a separate volume for WAL. +> A volume for an additional table space may also useful. +> In your case I would do 2 partitions: +> 1. RAID 10 with 8 discs for general data +> +> +> raid 10 is of course not questionable. but are you sure that it will +> work faster than for example: +> 2 discs (raid 1) for xlog +> 6 discs (raid 10) for tables +> 6 discs (raid 10) for indices? +> + +This depends on your application. Do you have a lot of disc reads? +Anyhow, I would put the xlog always to a RAID 10 volume because most of +the I/O for update and inserts is going to the xlog. + +4 discs xlog +6 discs tables +4 discs tables2 + +This should be better. You should distribute indices on separate spindle +stacks to share the I/O. But again this depends on your application and +your server. How are the indices used? How large is your file system +cache. What does PostgreSQL effectively read from disc. + +Don't forget to tune your postgresql.conf: + + + +Cheers +Sven. + +From pgsql-performance-owner@postgresql.org Wed Jun 14 10:57:54 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4CE9D9FA5D8 + for ; + Wed, 14 Jun 2006 10:57:54 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 20543-01 for + ; + Wed, 14 Jun 2006 10:57:42 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 03BDA9F9CAA + for ; + Wed, 14 Jun 2006 10:57:42 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 521AE5643F; Wed, 14 Jun 2006 08:57:41 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Wed, 14 Jun 2006 08:57:40 -0500 +Date: Wed, 14 Jun 2006 08:57:40 -0500 +From: "Jim C. Nasby" +To: Tom Lane +Cc: Shaun Thomas , + pgsql-performance@postgresql.org +Subject: Re: Confirmation of bad query plan generated by 7.4 +Message-ID: <20060614135740.GZ34196@pervasive.com> +References: <9119.1150222168@sss.pgh.pa.us> + <448EDFC4.8F27.00A9.0@leapfrogonline.com> + <20060613211347.GB34196@pervasive.com> + <10918.1150236282@sss.pgh.pa.us> + <20060613223950.GK34196@pervasive.com> + <18667.1150249849@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <18667.1150249849@sss.pgh.pa.us> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060614:tgl@sss.pgh.pa.us::J+dOd7ipDqByX5wg:00000000000000000000 + 00000000000000000000000036zw +X-Hashcash: + 1:20:060614:sthomas@leapfrogonline.com::NO7CzU3ORfXjoJ+s:00000000000 + 0000000000000000000000002h0z +X-Hashcash: + 1:20:060614:pgsql-performance@postgresql.org::Tp2oFulSh7xs2xgE:00000 + 0000000000000000000000004EqG +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/247 +X-Sequence-Number: 19604 + +On Tue, Jun 13, 2006 at 09:50:49PM -0400, Tom Lane wrote: +> "Jim C. Nasby" writes: +> > On Tue, Jun 13, 2006 at 06:04:42PM -0400, Tom Lane wrote: +> >> It'd depend on the context, possibly, but it's easy to show that the +> >> current planner does fold "now() - interval_constant" when making +> >> estimates. Simple example: +> +> > Turns out the difference is between feeding a date vs a timestamp into the +> > query... I would have thought that since date is a date that the WHERE clause +> > would be casted to a date if it was a timestamptz, but I guess not... +> +> Hmm ... worksforme. Could you provide a complete test case? + +I can't provide the data I used for that, but I'll try and come up with +something else. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Wed Jun 14 10:58:56 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 14A049FA5E1 + for ; + Wed, 14 Jun 2006 10:58:56 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 16274-08 for + ; + Wed, 14 Jun 2006 10:58:51 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from globalrelay.com (mail1.globalrelay.com [216.18.71.77]) + by postgresql.org (Postfix) with ESMTP id D9E779F9CAA + for ; + Wed, 14 Jun 2006 10:58:51 -0300 (ADT) +X-Virus-Scanned: Scanned by GRC-AntiVirus Gateway +X-GR-Acctd: YES +Received: from [63.226.156.118] (HELO DaveEMachine) + by globalrelay.com (CommuniGate Pro SMTP 4.2.3) + with ESMTP id 93532778 for pgsql-performance@postgresql.org; + Wed, 14 Jun 2006 06:58:49 -0700 +From: "Dave Dutcher" +To: +Subject: Re: OT - select + must have from - sql standard syntax? +Date: Wed, 14 Jun 2006 08:58:48 -0500 +Message-ID: <030a01c68fba$a90f5080$8300a8c0@tridecap.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook, Build 10.0.2627 +In-Reply-To: <87wtbkcqzh.fsf@stark.xeocode.com> +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +Importance: Normal +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/248 +X-Sequence-Number: 19605 + +> -----Original Message----- +> From: pgsql-performance-owner@postgresql.org +> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of +> Greg Stark +> Sent: Tuesday, June 13, 2006 11:16 PM +> Subject: Re: [PERFORM] OT - select + must have from - sql +> standard syntax? +[SNIP] +> +> Well you could always create a "dual", it was always just a +> regular table. We +> used to joke about what would happen to Oracle if you +> inserted an extra row in +> it... + + +I've never used Oracle, so I don't understand why its called dual when +it only has one row? Shouldn't it be called single? :\ + + +Dave + + +From pgsql-performance-owner@postgresql.org Wed Jun 14 11:20:59 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A40E49FA5D8 + for ; + Wed, 14 Jun 2006 11:20:59 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 22382-06 for + ; + Wed, 14 Jun 2006 11:20:51 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 44C949F9CAA + for ; + Wed, 14 Jun 2006 11:20:51 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5EEKfdL023626; + Wed, 14 Jun 2006 10:20:42 -0400 (EDT) +To: Antoine +cc: "Greg Stark" , "Jim C. Nasby" , + pgsql-performance@postgresql.org +Subject: Re: OT - select + must have from - sql standard syntax? +In-reply-to: <92d3a4950606132336j1220301en9e5d33c64ad2794a@mail.gmail.com> +References: <92d3a4950606130543y2aab73d8sbbbf04aee328b41f@mail.gmail.com> + <20060613210246.GA34196@pervasive.com> + <19096.1150253069@sss.pgh.pa.us> <87wtbkcqzh.fsf@stark.xeocode.com> + <92d3a4950606132336j1220301en9e5d33c64ad2794a@mail.gmail.com> +Comments: In-reply-to Antoine + message dated "Wed, 14 Jun 2006 08:36:22 +0200" +Date: Wed, 14 Jun 2006 10:20:41 -0400 +Message-ID: <23625.1150294841@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/249 +X-Sequence-Number: 19606 + +Antoine writes: +> ps. shame the standard isn't "freely" consultable to save you guys +> silly OT questions! + +You can get free "draft" versions that are close-enough-to-final to be +perfectly usable. See our developers' FAQ for some links. I like the +drafts partly because they're plain ASCII, and so far easier to search +than PDFs ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Jun 14 11:23:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0368F9FA5E1 + for ; + Wed, 14 Jun 2006 11:23:55 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 22821-02 for + ; + Wed, 14 Jun 2006 11:23:46 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from web31804.mail.mud.yahoo.com (web31804.mail.mud.yahoo.com + [68.142.207.67]) by postgresql.org (Postfix) with SMTP id 7735C9F9CAA + for ; + Wed, 14 Jun 2006 11:23:46 -0300 (ADT) +Received: (qmail 13560 invoked by uid 60001); 14 Jun 2006 14:23:44 -0000 +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + h=Message-ID:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; + b=pf0tDemKYagn9wBe7XKXyhcaSXNtDxklUxjcF6dFPVX0Dh2dzV2Ad7wdUNk/cLuMnUSASr0+hSgeuh1eyZlCFYcc1sh0h8BNzaRpEMd31mI7g0F2uQP19L+QIDNS60waMUrH3Eyp2VtJpspkoMuwpLkv06QGKHBc/dgbOASGkVU= + ; +Message-ID: <20060614142344.13558.qmail@web31804.mail.mud.yahoo.com> +Received: from [63.203.180.122] by web31804.mail.mud.yahoo.com via HTTP; + Wed, 14 Jun 2006 07:23:44 PDT +Date: Wed, 14 Jun 2006 07:23:44 -0700 (PDT) +From: Richard Broersma Jr +Subject: Re: how to partition disks +To: Sven Geisler , + hubert depesz lubaczewski +Cc: Pgsql-Performance +In-Reply-To: <448FF5EB.8010808@aeccom.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/250 +X-Sequence-Number: 19607 + +> > raid 10 is of course not questionable. but are you sure that it will +> > work faster than for example: +> > 2 discs (raid 1) for xlog +> > 6 discs (raid 10) for tables +> > 6 discs (raid 10) for indices? +> > +> +> This depends on your application. Do you have a lot of disc reads? +> Anyhow, I would put the xlog always to a RAID 10 volume because most of +> the I/O for update and inserts is going to the xlog. +> +> 4 discs xlog +> 6 discs tables +> 4 discs tables2 + +I have a question in regards to I/O bandwidths of various raid configuration. Primary, does the +above suggested raid partitions imply that multiple (smaller) disk arrays have a potential for +more I/O bandwidth than a larger raid 10 array? + +Regards, + +Richard + + + +From pgsql-performance-owner@postgresql.org Wed Jun 14 11:32:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 9BC279FA5D8 + for ; + Wed, 14 Jun 2006 11:32:54 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 22601-07 for + ; + Wed, 14 Jun 2006 11:32:50 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.leapfrogonline.com (mail.leapfrogonline.com + [69.36.35.239]) + by postgresql.org (Postfix) with ESMTP id 680E89F9CAA + for ; + Wed, 14 Jun 2006 11:32:49 -0300 (ADT) +Received: from leapfrogonlinecom-MTA by mail.leapfrogonline.com + with Novell_GroupWise; Wed, 14 Jun 2006 09:32:33 -0500 +Message-Id: <448FD794.8F27.00A9.0@leapfrogonline.com> +X-Mailer: Novell GroupWise Internet Agent 7.0.1 Beta +Date: Wed, 14 Jun 2006 09:32:04 -0500 +From: "Shaun Thomas" +To: "Tom Lane" +Cc: "Jim C. Nasby" , +Subject: Re: Confirmation of bad query plan generated by 7.4 +References: <9119.1150222168@sss.pgh.pa.us> + <448EDFC4.8F27.00A9.0@leapfrogonline.com> + <20060613211347.GB34196@pervasive.com> + <448EE95D.8F27.00A9.0@leapfrogonline.com> + <20060613215418.GI34196@pervasive.com> + <448EF8B2.8F27.00A9.0@leapfrogonline.com><448EF8B2.8F27.00A9 +In-Reply-To: <448EF8B2.8F27.00A9.0@leapfrogonline.com><448EF8B2.8F27.00A9 +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/252 +X-Sequence-Number: 19609 + +>>> On 6/13/2006 at 9:13 PM, Tom Lane wrote: + +> Read what you wrote, and rethink... + +Hah. Yes, I understand the irony of that statement, but the point is +that the value of the variable won't change during query execution. + +> If you're desperate you can construct a query string with the +variable +> value embedded as a literal, and then EXECUTE that. This isn't a +great +> solution since it forces a re-plan on every execution. + +That's so gross... but it might work. I'm not really desperate, just +frustrated. I really can't wait until we can upgrade; 7.4 is driving +me nuts. I'm not really worried about a re-plan, since this SP just +updates a fact table, so it only gets called twice a day. Cutting the +execution time of the SP down to < 20 seconds from 15 minutes would be +nice, but not absolutely required. I was just surprised at the large +difference in manual execution as opposed to the SP with the same +query. + +> We've occasionally debated ways to do it better, but no such +> improvement will ever appear in 7.4 ;-) + +Agreed! When we finally upgrade, I fully plan on putting a symbolic +bullet into our old installation. ;) + +Thanks! + + +-- + +Shaun Thomas +Database Administrator + +Leapfrog Online +807 Greenwood Street +Evanston, IL 60201 +Tel. 847-440-8253 +Fax. 847-570-5750 +www.leapfrogonline.com + + +Confidentiality Note: + +The document(s) accompanying this e-mail transmission, if any, and the +e-mail transmittal message contain information from Leapfrog Online +Customer Acquisition, LLC is confidential or privileged. The information +is intended to be for the use of the individual(s) or entity(ies) named +on this e-mail transmission message. If you are not the intended +recipient, be aware that any disclosure, copying, distribution or use of +the contents of this e-mail is prohibited. If you have received this +e-mail in error, please immediately delete this e-mail and notify us by +telephone of the error + +From pgsql-performance-owner@postgresql.org Wed Jun 14 11:32:32 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 922719F9CAA + for ; + Wed, 14 Jun 2006 11:32:32 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 20397-09 for + ; + Wed, 14 Jun 2006 11:32:27 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.aeccom.com (port-83-236-156-26.static.qsc.de + [83.236.156.26]) + by postgresql.org (Postfix) with ESMTP id 0FC189FA5D8 + for ; + Wed, 14 Jun 2006 11:32:27 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mail.aeccom.com (Postfix) with ESMTP id 0B1451D1B2; + Wed, 14 Jun 2006 16:32:26 +0200 (CEST) +Received: from mail.aeccom.com ([127.0.0.1]) + by localhost (gate6.aeccom.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 25538-02-2; Wed, 14 Jun 2006 16:32:25 +0200 (CEST) +Received: from [192.168.2.14] (andes.core.aeccom.com [192.168.2.14]) + by mail.aeccom.com (Postfix) with ESMTP id 32EAD1D186; + Wed, 14 Jun 2006 16:32:25 +0200 (CEST) +Message-ID: <44901DF7.7010200@aeccom.com> +Date: Wed, 14 Jun 2006 16:32:23 +0200 +From: Sven Geisler +Organization: AEC/communications GmbH +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: Richard Broersma Jr +CC: Pgsql-Performance +Subject: Re: how to partition disks +References: <20060614142344.13558.qmail@web31804.mail.mud.yahoo.com> +In-Reply-To: <20060614142344.13558.qmail@web31804.mail.mud.yahoo.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: amavisd-new at aeccom.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/251 +X-Sequence-Number: 19608 + +Hi Richard, + +Richard Broersma Jr schrieb: +>> This depends on your application. Do you have a lot of disc reads? +>> Anyhow, I would put the xlog always to a RAID 10 volume because most of +>> the I/O for update and inserts is going to the xlog. +>> +>> 4 discs xlog +>> 6 discs tables +>> 4 discs tables2 +> +> I have a question in regards to I/O bandwidths of various raid configuration. Primary, does the +> above suggested raid partitions imply that multiple (smaller) disk arrays have a potential for +> more I/O bandwidth than a larger raid 10 array? + +Yes. +Because the disc arms didn't need to reposition that much as there would +o with one large volume. + +For example, You run two queries with two clients and each queries needs +to read some indices from disk. In this case it more efficient to read +from different volumes than to read from one large volume where the disc +arms has to jump. + +Sven. + +From pgsql-performance-owner@postgresql.org Wed Jun 14 12:14:06 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id BFF309FA621 + for ; + Wed, 14 Jun 2006 12:14:05 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 28615-03 for + ; + Wed, 14 Jun 2006 12:13:56 -0300 (ADT) +X-Greylist: delayed 00:25:56.033825 by SQLgrey- +Received: from mail.clacorp.com (mail.clacorp.com [129.41.227.169]) + by postgresql.org (Postfix) with ESMTP id DA8FA9FA5FC + for ; + Wed, 14 Jun 2006 12:13:55 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by mail.clacorp.com (Postfix) with ESMTP + id EB5445612049; Wed, 14 Jun 2006 10:50:28 -0400 (EDT) +Received: from mail.clacorp.com ([127.0.0.1]) + by localhost (mail [127.0.0.1]) (amavisd-new, port 10024) with LMTP + id 21833-03-3; Wed, 14 Jun 2006 10:50:28 -0400 (EDT) +Received: from [10.10.0.242] (dsl027-169-002.atl1.dsl.speakeasy.net + [216.27.169.2]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.clacorp.com (Postfix) with ESMTP id 07FAA560C6F3 + for ; + Wed, 14 Jun 2006 10:50:28 -0400 (EDT) +Message-ID: <44902165.7020502@lusis.org> +Date: Wed, 14 Jun 2006 10:47:01 -0400 +From: "John E. Vincent" +Reply-To: pgsql-performance@lusis.org +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: "PGSQL Performance" +Subject: Performance of pg_dump on PGSQL 8.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at clacorp.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/254 +X-Sequence-Number: 19611 + +-- this is the third time I've tried sending this and I never saw it get +through to the list. Sorry if multiple copies show up. + +Hi all, + +I've been lurking using the web archives for a while and haven't found +an answer that seems to answer my questions about pg_dump. + +We have a 206GB data warehouse running on version 8.0.3. The server is +somewhat underpowered in terms of CPU: (1) 2.8 GHz Xeon 4GB Ram and a +single HBA to our SAN (IBM DS4300). We in the process of migrating to a +new server that we've repurposed from our production OLTP database (8) +2.0 GHz Xeon, 16GB Ram and dual HBAs to the same SAN running version 8.1. + +Independant of that move, we still need to get by on the old system and +I'm concerned that even on the new system, pg_dump will still perform +poorly. I can't do a full test because we're also taking advantage of +the table partitioning in 8.1 so we're not doing a dump and restore. + +We backup the database using: + +pg_dump -Fc -cv ${CURDB} > ${BACKDIR}/${CURDB}-${DATE}.bak + +There a three different LUNs allocated to the old warehouse on the SAN - +data, wal and a dump area for the backups. The SAN has two controllers +(only 128MB of cache per) and the data is on one controller while the +WAL and dump area are on the other. Still a single HBA though. + +Creating the compressed backup of this database takes 12 hours. We start +at 6PM and it's done a little after 1AM, just in time for the next day's +load. The load itself takes about 5 hours. + +I've watched the backup process and I/O is not a problem. Memory isn't a +problem either. It seems that we're CPU bound but NOT in I/O wait. The +server is a dedicated PGSQL box. + +Here are our settings from the conf file: + +maintenance_work_mem = 524288 +work_mem = 1048576 ( I know this is high but you should see some of our +sorts and aggregates) +shared_buffers = 50000 +effective_cache_size = 450000 +wal_buffers = 64 +checkpoint_segments = 256 +checkpoint_timeout = 3600 + +We're inserting around 3mil rows a night if you count staging, info, dim +and fact tables. The vacuum issue is a whole other problem but right now +I'm concerned about just the backup on the current hardware. + +I've got some space to burn so I could go to an uncompressed backup and +compress it later during the day. + +If there are any tips anyone can provide I would greatly appreciate it. +I know that the COPY performance was bumped up in 8.1 but I'm stuck on +this 8.0 box for a while longer. + +Thanks, +John E. Vincent + +From pgsql-performance-owner@postgresql.org Wed Jun 14 12:03:50 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id BE1969FA5E1 + for ; + Wed, 14 Jun 2006 12:03:49 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 24011-10 for + ; + Wed, 14 Jun 2006 12:03:39 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.199]) + by postgresql.org (Postfix) with ESMTP id A3F0E9FA5D8 + for ; + Wed, 14 Jun 2006 12:03:39 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id o1so154953nzf + for ; + Wed, 14 Jun 2006 08:03:37 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:subject:from:reply-to:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding; + b=pGq62zQhgH+Rhndg2xhuz/Mjh6eISxYwu+7yml/952lSaMtj1J0kO9QT2IoMD69XfQakOqdjGzNFnw+hNlN3jp8AKPex9ngQ8QCwIEnFqVj0i2yRZVeAYHCGJC0MdOIQoKR/s4wmnRvU3+ZItu1Onf+n7+M1LwV4f50U1W2tYIM= +Received: by 10.36.221.9 with SMTP id t9mr1226557nzg; + Wed, 14 Jun 2006 08:03:37 -0700 (PDT) +Received: from ?10.0.0.174? ( [63.193.127.22]) + by mx.gmail.com with ESMTP id 14sm1164230nzp.2006.06.14.08.03.36; + Wed, 14 Jun 2006 08:03:37 -0700 (PDT) +Subject: Re: Which processor runs better for Postgresql? +From: Steve Poe +Reply-To: steve.poe@gmail.com +To: Dave Page +Cc: "Joshua D. Drake" , + Scott Marlowe , + pgsql-performance@postgresql.org +In-Reply-To: + +References: + +Content-Type: text/plain +Date: Wed, 14 Jun 2006 08:03:25 -0700 +Message-Id: <1150297405.12280.15.camel@amd64-gentoo-laptop> +Mime-Version: 1.0 +X-Mailer: Evolution 2.4.2.1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/253 +X-Sequence-Number: 19610 + +Dave, Joshua, Scott (and all), + +Thanks for your feedback, while I do appreciate it, I did not intent on +making this discussion "buy this instead"...I whole-heartly agree with +you. Joshua, you made the best comment, it is a business decision for +the client. I don't agree with it, but I understand it. I've recommended +Sun or Penguin Computing which I've had no technical issues with. They +did not dispute my recommendation but they ignored it. I have not like +Dell, on the server side, since 1998 - 2000 time period. + +Excluding Dell's issues, has anyone seen performance differences between +AMD's Opteron and Intel's new Xeon's (dual or quad CPU or dual-core). If +anyone has done benchmark comparisons between them, any summary +information would be appreciated. + +For now, I am asking the client to hold-off and wait for the AMD Opteron +availability on the Dell servers. + +Thanks again. + +Steve + + + + +From pgsql-performance-owner@postgresql.org Wed Jun 14 12:16:54 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id BAFBF9F9CAA + for ; + Wed, 14 Jun 2006 12:16:53 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 28298-05 for + ; + Wed, 14 Jun 2006 12:16:42 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 14E059FA5D8 + for ; + Wed, 14 Jun 2006 12:16:42 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id C986A5643D; Wed, 14 Jun 2006 10:16:40 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Wed, 14 Jun 2006 10:16:39 -0500 +Date: Wed, 14 Jun 2006 10:16:39 -0500 +From: "Jim C. Nasby" +To: Sven Geisler +Cc: Richard Broersma Jr , + Pgsql-Performance +Subject: Re: how to partition disks +Message-ID: <20060614151639.GA34196@pervasive.com> +References: <20060614142344.13558.qmail@web31804.mail.mud.yahoo.com> + <44901DF7.7010200@aeccom.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <44901DF7.7010200@aeccom.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060614:sgeisler@aeccom.com::yJIeiEuN/YnfbnNa:000000000000000000 + 0000000000000000000000004t2v +X-Hashcash: + 1:20:060614:rabroersma@yahoo.com::A25l3n+iD+hCGWkB:00000000000000000 + 000000000000000000000000AGR5 +X-Hashcash: + 1:20:060614:pgsql-performance@postgresql.org::/7oD/NhQRoqPKuBT:00000 + 0000000000000000000000002UFS +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/255 +X-Sequence-Number: 19612 + +On Wed, Jun 14, 2006 at 04:32:23PM +0200, Sven Geisler wrote: +> Hi Richard, +> +> Richard Broersma Jr schrieb: +> >>This depends on your application. Do you have a lot of disc reads? +> >>Anyhow, I would put the xlog always to a RAID 10 volume because most of +> >>the I/O for update and inserts is going to the xlog. +> >> +> >>4 discs xlog +> >>6 discs tables +> >>4 discs tables2 +> > +> >I have a question in regards to I/O bandwidths of various raid +> >configuration. Primary, does the +> >above suggested raid partitions imply that multiple (smaller) disk arrays +> >have a potential for +> >more I/O bandwidth than a larger raid 10 array? +> +> Yes. +> Because the disc arms didn't need to reposition that much as there would +> o with one large volume. +> +> For example, You run two queries with two clients and each queries needs +> to read some indices from disk. In this case it more efficient to read +> from different volumes than to read from one large volume where the disc +> arms has to jump. + +But keep in mind that all of that is only true if you have very good +knowledge of how your data will be accessed. If you don't know that, +you'll almost certainly be better off just piling everything into one +RAID array and letting the controller deal with it. + +Also, if you have a good RAID controller that's batter-backed, +seperating pg_xlog onto it's own array is much less likely to be a win. +The reason you normally put pg_xlog on it's own partition is because the +database has to fsync pg_xlog *at every single commit*. This means you +absolutely want that fsync to be as fast as possible. But with a good, +battery-backed controller, this no longer matters. The fsync is only +going to push the data into the controller, and the controller will take +things from there. That means it's far less important to put pg_xlog on +it's own array. I actually asked about this recently and one person did +reply that they'd done testing and found it was better to just put all +their drives into one array so they weren't wasting bandwidth on the +pg_xlog drives. + +Even if you do decide to keep pg_xlog seperate, a 4 drive RAID10 for +that is overkill. It will be next to impossible for you to generate +enough WAL traffic to warrent it. + +Your best bet is to perform testing with your application. That's the +only way you'll truely find out what's going to work best. Short of +that, your best bet is to just pile all the drives together. If you do +testing, I'd start first with the effect of a seperate pg_xlog. Only +after you have those results would I consider trying to do things like +split indexes from tables, etc. + +BTW, you should consider reserving some of the drives in the array as +hot spares. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Wed Jun 14 12:18:15 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 568D19F9CAA + for ; + Wed, 14 Jun 2006 12:18:15 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 28061-07 for + ; + Wed, 14 Jun 2006 12:18:06 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id A32179FA60C + for ; + Wed, 14 Jun 2006 12:18:06 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 570515649C; Wed, 14 Jun 2006 10:18:05 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Wed, 14 Jun 2006 10:18:04 -0500 +Date: Wed, 14 Jun 2006 10:18:04 -0500 +From: "Jim C. Nasby" +To: B?sz?rm?nyi Zolt?n +Cc: Volkan YAZICI , pgsql-performance@postgresql.org +Subject: Re: Precomputed constants? +Message-ID: <20060614151804.GB34196@pervasive.com> +References: <3167.213.163.11.81.1150282434.squirrel@www.dunaweb.hu> + <20060614110713.GA2277@alamut.tdm.local> + <3861.213.163.11.81.1150284610.squirrel@www.dunaweb.hu> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <3861.213.163.11.81.1150284610.squirrel@www.dunaweb.hu> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060614:zboszor@dunaweb.hu::VtTZ6uvCZEmvcG+G:0000000000000000000 + 00000000000000000000000058kj +X-Hashcash: + 1:20:060614:yazicivo@ttnet.net.tr::GtdFVI9qEUEb0+sS:0000000000000000 + 0000000000000000000000001BY/ +X-Hashcash: + 1:20:060614:pgsql-performance@postgresql.org::QAMZj3YAAJFWkadJ:00000 + 0000000000000000000000001hI6 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/256 +X-Sequence-Number: 19613 + +On Wed, Jun 14, 2006 at 01:30:10PM +0200, B?sz?rm?nyi Zolt?n wrote: +> Replacing random() with a true constant gives me index scan +> even if it's hidden inside other function calls. E.g.: + +The database has no choice but to compute random() for every row; it's +marked VOLATILE. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Wed Jun 14 12:52:01 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E29E99FA5D8 + for ; + Wed, 14 Jun 2006 12:52:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 33615-02 for + ; + Wed, 14 Jun 2006 12:51:49 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 4575D9FA5FC + for ; + Wed, 14 Jun 2006 12:51:50 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5EFplJV026781; + Wed, 14 Jun 2006 11:51:47 -0400 (EDT) +To: pgsql-performance@lusis.org +cc: "PGSQL Performance" +Subject: Re: Performance of pg_dump on PGSQL 8.0 +In-reply-to: <44902165.7020502@lusis.org> +References: <44902165.7020502@lusis.org> +Comments: In-reply-to "John E. Vincent" + message dated "Wed, 14 Jun 2006 10:47:01 -0400" +Date: Wed, 14 Jun 2006 11:51:47 -0400 +Message-ID: <26780.1150300307@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/257 +X-Sequence-Number: 19614 + +"John E. Vincent" writes: +> I've watched the backup process and I/O is not a problem. Memory isn't a +> problem either. It seems that we're CPU bound but NOT in I/O wait. + +Is it the pg_dump process, or the connected backend, that's chewing the +bulk of the CPU time? (This should be pretty obvious in "top".) + +If it's the pg_dump process, the bulk of the CPU time is likely going +into compression --- you might consider backing off the compression +level, perhaps --compress=1 or even 0 if size of the dump file isn't +a big concern. + +Another possibility if your LAN is reasonably fast is to run pg_dump on +a different machine, so that you can put two CPUs to work. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Jun 14 13:44:28 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4EBC39F9FE3 + for ; + Wed, 14 Jun 2006 13:44:28 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 38389-03 for + ; + Wed, 14 Jun 2006 13:44:16 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 48F0B9F9CAA + for ; + Wed, 14 Jun 2006 13:44:16 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Wed, 14 Jun 2006 16:44:10 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 14 Jun 2006 11:44:10 -0500 +Subject: Re: Performance of pg_dump on PGSQL 8.0 +From: Scott Marlowe +To: pgsql-performance@lusis.org +Cc: PGSQL Performance +In-Reply-To: <44902165.7020502@lusis.org> +References: <44902165.7020502@lusis.org> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1150303450.26538.9.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Wed, 14 Jun 2006 11:44:10 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/258 +X-Sequence-Number: 19615 + +On Wed, 2006-06-14 at 09:47, John E. Vincent wrote: +> -- this is the third time I've tried sending this and I never saw it get +> through to the list. Sorry if multiple copies show up. +> +> Hi all, + +BUNCHES SNIPPED + +> work_mem = 1048576 ( I know this is high but you should see some of our +> sorts and aggregates) + +Ummm. That's REALLY high. You might want to consider lowering the +global value here, and then crank it up on a case by case basis, like +during nighttime report generation. Just one or two queries could +theoretically run your machine out of memory right now. Just put a "set +work_mem=1000000" in your script before the big query runs. + +> We're inserting around 3mil rows a night if you count staging, info, dim +> and fact tables. The vacuum issue is a whole other problem but right now +> I'm concerned about just the backup on the current hardware. +> +> I've got some space to burn so I could go to an uncompressed backup and +> compress it later during the day. + +That's exactly what we do. We just do a normal backup, and have a +script that gzips anything in the backup directory that doesn't end in +.gz... If you've got space to burn, as you say, then use it at least a +few days to see how it affects backup speeds. + +Seeing as how you're CPU bound, most likely the problem is just the +compressed backup. + +From pgsql-performance-owner@postgresql.org Wed Jun 14 14:04:25 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7D0C19F9FE3 + for ; + Wed, 14 Jun 2006 14:04:24 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 38400-07 for + ; + Wed, 14 Jun 2006 14:04:19 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 797969F9CAA + for ; + Wed, 14 Jun 2006 14:04:20 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Wed, 14 Jun 2006 17:04:18 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 14 Jun 2006 12:04:18 -0500 +Subject: Re: Which processor runs better for Postgresql? +From: Scott Marlowe +To: Dave Page +Cc: "Joshua D. Drake" , steve.poe@gmail.com, + pgsql-performance@postgresql.org +In-Reply-To: + +References: + +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1150304658.26538.12.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Wed, 14 Jun 2006 12:04:18 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/260 +X-Sequence-Number: 19617 + +On Tue, 2006-06-13 at 15:11, Dave Page wrote: +> +> > -----Original Message----- + +> And how old are the 2600's now? +> +> Anyhoo, I'm not saying the current machines are excellent performers or +> anything, but there are good business reasons to run them if you don't +> need to squeeze out every last pony. + +Just thought I'd point you to Dell's forums. + +http://forums.us.dell.com/supportforums/board?board.id=pes_linux&page=1 + +wherein you'll find plenty of folks who have problems with freezing RAID +controllers with 28xx and 18xx machines. + +From pgsql-performance-owner@postgresql.org Wed Jun 14 14:04:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 1581A9FA5C8 + for ; + Wed, 14 Jun 2006 14:04:44 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 39235-08 for + ; + Wed, 14 Jun 2006 14:04:33 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.175]) + by postgresql.org (Postfix) with ESMTP id 197A49F9FE3 + for ; + Wed, 14 Jun 2006 14:04:33 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so417330ugf + for ; + Wed, 14 Jun 2006 10:04:31 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; + b=guOtrmjtBq55rLt5jwZUx4DFlxBLva8UQ6NERqtqKNzqLw2kuH4aVaIkoVgeCI/i60pGzfa7jA+05kG9OZhOQKnoJ32Af4QdlJtOz/KN6yXKRQjqtgtu6HZ+vK58VU3vlDV/YwewlIF7Vy2PYyXiy9OFch9oF21eN1497alfxzQ= +Received: by 10.66.250.17 with SMTP id x17mr857052ugh; + Wed, 14 Jun 2006 10:04:31 -0700 (PDT) +Received: by 10.66.216.11 with HTTP; Wed, 14 Jun 2006 10:04:31 -0700 (PDT) +Message-ID: +Date: Wed, 14 Jun 2006 13:04:31 -0400 +From: "John Vincent" +To: "Scott Marlowe" +Subject: Re: Performance of pg_dump on PGSQL 8.0 +Cc: "PGSQL Performance" +In-Reply-To: <1150303450.26538.9.camel@state.g2switchworks.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_7780_8892426.1150304671808" +References: <44902165.7020502@lusis.org> + <1150303450.26538.9.camel@state.g2switchworks.com> +X-Google-Sender-Auth: 5c8f9fa2b394e391 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/261 +X-Sequence-Number: 19618 + +------=_Part_7780_8892426.1150304671808 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +On 6/14/06, Scott Marlowe wrote: +> +> On Wed, 2006-06-14 at 09:47, John E. Vincent wrote: +> > -- this is the third time I've tried sending this and I never saw it get +> > through to the list. Sorry if multiple copies show up. +> > +> > Hi all, +> +> BUNCHES SNIPPED +> +> > work_mem = 1048576 ( I know this is high but you should see some of our +> > sorts and aggregates) +> +> Ummm. That's REALLY high. You might want to consider lowering the +> global value here, and then crank it up on a case by case basis, like +> during nighttime report generation. Just one or two queries could +> theoretically run your machine out of memory right now. Just put a "set +> work_mem=1000000" in your script before the big query runs. + + + +I know it is but that's what we need for some of our queries. Our ETL tool +(informatica) and BI tool (actuate) won't let us set those things as part of +our jobs. We need it for those purposes. We have some really nasty queries +that will be fixed in our new server. + +E.G. we have a table called loan_account_agg_fact that has 200+ million rows +and it contains every possible combination of late status for a customer +account (i.e. 1 day late, 2 day late, 3 day late) so it gets inserted for +new customers but updated for existing records as part of our warehouse +load. Part of the new layout is combining late ranges so instead of number +of days we have a range of days (i.e. 1-15,16-30....). Even with work_mem +that large, the load of that loan_account_agg_fact table creates over 3GB of +temp tables! + + +> That's exactly what we do. We just do a normal backup, and have a +> script that gzips anything in the backup directory that doesn't end in +> .gz... If you've got space to burn, as you say, then use it at least a +> few days to see how it affects backup speeds. +> +> Seeing as how you're CPU bound, most likely the problem is just the +> compressed backup. +> + +I'm starting to think the same thing. I'll see how this COPY I'm doing of +the single largest table does right now and make some judgement based on +that. + +-- +John E. Vincent + +------=_Part_7780_8892426.1150304671808 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +

On 6/14/06, Scott Marlowe <smarlowe@g2switchworks.com> wrote:
+On Wed, 2006-06-14 at 09:47, John E. Vincent wrote:
> -- this is the third time I've tried sending this and I never saw it get
> through to the list. Sorry if multiple copies show up.
>
> Hi all,
+
BUNCHES SNIPPED

> work_mem = 1048576 ( I know this is high but you should see some of our
> sorts and aggregates)

Ummm.  That's REALLY high.  You might want to consider lowering the
global value here, and then crank it up on a case by case basis, like +
during nighttime report generation.  Just one or two queries could
theoretically run your machine out of memory right now.  Just put a "set
work_mem=1000000" in your script before the big query runs.
+


I know it is but that's what we need for some of our queries. Our ETL tool (informatica) and BI tool (actuate) won't let us set those things as part of our jobs. We need it for those purposes. We have some really nasty queries that will be fixed in our new server. +

E.G. we have a table called loan_account_agg_fact that has 200+ million rows and it contains every possible combination of late status for a customer account (i.e. 1 day late, 2 day late, 3 day late) so it gets inserted for new customers but updated for existing records as part of our warehouse load. Part of the new layout is combining late ranges so instead of number of days we have a range of days ( +i.e. 1-15,16-30....). Even with work_mem that large, the load of that loan_account_agg_fact table creates over 3GB of temp tables!

+
That's exactly what we do.  We just do a normal backup, and have a
script that gzips anything in the backup directory that doesn't end in
.gz...  If you've got space to burn, as you say, then use it at least a
+few days to see how it affects backup speeds.

Seeing as how you're CPU bound, most likely the problem is just the
compressed backup.

I'm starting to think the same thing. I'll see how this COPY I'm doing of the single largest table does right now and make some judgement based on that. +

--
John E. Vincent
+ +------=_Part_7780_8892426.1150304671808-- + +From pgsql-performance-owner@postgresql.org Wed Jun 14 13:58:56 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 635189F9CAA + for ; + Wed, 14 Jun 2006 13:58:56 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 40802-01 for + ; + Wed, 14 Jun 2006 13:58:43 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from smtp1.ActiveState.com (gw.activestate.com [209.17.183.249]) + by postgresql.org (Postfix) with ESMTP id 8E1979FA64B + for ; + Wed, 14 Jun 2006 13:58:14 -0300 (ADT) +Received: from smtp3.activestate.com (smtp3.activestate.com [192.168.3.19]) + by smtp1.ActiveState.com (8.12.10/8.12.10) with ESMTP id k5EGwB9h020891; + Wed, 14 Jun 2006 09:58:11 -0700 (envelope-from mischa@ca.sophos.com) +Received: from [192.168.99.210] (mallet.activestate.com [192.168.99.210]) + by smtp3.ActiveState.com (8.13.4/8.13.4) with ESMTP id k5EGwAqI030331; + Wed, 14 Jun 2006 09:58:11 -0700 (envelope-from mischa@ca.sophos.com) +Message-ID: <4490420C.1030609@ca.sophos.com> +Date: Wed, 14 Jun 2006 10:06:20 -0700 +From: Mischa Sandberg +Reply-To: mischa@ca.sophos.com +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: Tom Lane +CC: pgsql-performance@postgresql.org +Subject: Re: Solaris shared_buffers anomaly? +References: <1150151282.14661.42.camel@tigger> + <20060613000441.GI8588@kenobi.snowman.net> + <20060613200810.GZ34196@pervasive.com> + <448F3A6E.6080908@ca.sophos.com> <11046.1150237327@sss.pgh.pa.us> + <448F449A.6030900@ca.sophos.com> <18773.1150250672@sss.pgh.pa.us> +In-Reply-To: <18773.1150250672@sss.pgh.pa.us> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/259 +X-Sequence-Number: 19616 + +Tom Lane wrote: +> Mischa Sandberg writes: + +>> Tom Lane wrote: +>>> Does Solaris have any call that allows locking a shmem segment in RAM? +>> Yes, mlock(). But want to understand what's going on before patching. +> +> Sure, but testing it with mlock() might help you understand what's going +> on, by eliminating one variable: we don't really know if the shmem is +> getting swapped, or something else. + +>> For a dedicated DB server machine, Solaris has a feature: +>> create "intimate" shared memory with shmat(..., SHM_SHARE_MMU). +>> All backends share the same TLB entries (!). +> +> We use that already. (Hmm, might be interesting for you to turn it +> *off* and see if anything changes. See src/backend/port/sysv_shmem.c.) + +Gah. Always must remember to RTFSource. +And reproduce the problem on a machine I control :-) + +-- +Engineers think that equations approximate reality. +Physicists think that reality approximates the equations. +Mathematicians never make the connection. + +From pgsql-performance-owner@postgresql.org Wed Jun 14 14:29:41 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 416429F9FE3 + for ; + Wed, 14 Jun 2006 14:29:41 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 44350-01 for + ; + Wed, 14 Jun 2006 14:29:35 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from hs5.cfa.cmu.edu (HS5.CFA.cmu.edu [128.2.103.215]) + by postgresql.org (Postfix) with ESMTP id 1CE489F9CAA + for ; + Wed, 14 Jun 2006 14:29:33 -0300 (ADT) +Received: from webmail.webopticon.org (hs5.cfa.cmu.edu [127.0.0.1]) + by hs5.cfa.cmu.edu (8.12.11.20060308/8.12.11) with ESMTP id + k5EHTTRn031171; Wed, 14 Jun 2006 13:29:29 -0400 +Received: from 216.41.12.254 (SquirrelMail authenticated user agentm) + by webmail.webopticon.org with HTTP; + Wed, 14 Jun 2006 13:29:29 -0400 (EDT) +Message-ID: <43719.216.41.12.254.1150306169.squirrel@webmail.webopticon.org> +In-Reply-To: +References: <44902165.7020502@lusis.org> + <1150303450.26538.9.camel@state.g2switchworks.com> + +Date: Wed, 14 Jun 2006 13:29:29 -0400 (EDT) +Subject: Re: Performance of pg_dump on PGSQL 8.0 +From: "A.M." +To: "John Vincent" +Cc: "Scott Marlowe" , + "PGSQL Performance" +User-Agent: SquirrelMail/1.5.1 [CVS] +MIME-Version: 1.0 +Content-Type: text/plain;charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/262 +X-Sequence-Number: 19619 + +On Wed, June 14, 2006 1:04 pm, John Vincent wrote: + +> I know it is but that's what we need for some of our queries. Our ETL +> tool (informatica) and BI tool (actuate) won't let us set those things as +> part of our jobs. We need it for those purposes. We have some really nasty +> queries that will be fixed in our new server. + +You could modify pgpool to insert the necessary set commands and point the +tools at pgpool. + +-M + + +From pgsql-performance-owner@postgresql.org Wed Jun 14 15:11:27 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 1A5989FA5C8 + for ; + Wed, 14 Jun 2006 15:11:27 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 48093-03 for + ; + Wed, 14 Jun 2006 15:11:22 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.170]) + by postgresql.org (Postfix) with ESMTP id 6E72A9F9CAA + for ; + Wed, 14 Jun 2006 15:11:22 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so450904ugf + for ; + Wed, 14 Jun 2006 11:11:20 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; + b=cOqup07Y4WPMAPMi2ZFMJBYlPrVI/7dF50P8DYLfNdBQac+jW1sANK/Bmfrad1z2fnFX+gJ3ctiBuOOJ0pS4o0dsuX74RijicgkjmEcw9c0/z5rA7NVHB/nqEIkaB/H+1NNeCgceodkIqagNsrdCI4XgzGHWiYxHxyrulJY8K1c= +Received: by 10.67.101.10 with SMTP id d10mr922575ugm; + Wed, 14 Jun 2006 11:11:19 -0700 (PDT) +Received: by 10.66.216.11 with HTTP; Wed, 14 Jun 2006 11:11:19 -0700 (PDT) +Message-ID: +Date: Wed, 14 Jun 2006 14:11:19 -0400 +From: "John Vincent" +To: "Scott Marlowe" +Subject: Re: Performance of pg_dump on PGSQL 8.0 +Cc: "PGSQL Performance" +In-Reply-To: <1150303450.26538.9.camel@state.g2switchworks.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_8822_10722423.1150308679487" +References: <44902165.7020502@lusis.org> + <1150303450.26538.9.camel@state.g2switchworks.com> +X-Google-Sender-Auth: 6006274cd31faeef +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/263 +X-Sequence-Number: 19620 + +------=_Part_8822_10722423.1150308679487 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Out of curiosity, does anyone have any idea what the ratio of actual +datasize to backup size is if I use the custom format with -Z 0 compression +or the tar format? + +Thanks. + +On 6/14/06, Scott Marlowe wrote: +> +> On Wed, 2006-06-14 at 09:47, John E. Vincent wrote: +> > -- this is the third time I've tried sending this and I never saw it get +> > through to the list. Sorry if multiple copies show up. +> > +> > Hi all, +> +> BUNCHES SNIPPED +> +> > work_mem = 1048576 ( I know this is high but you should see some of our +> > sorts and aggregates) +> +> Ummm. That's REALLY high. You might want to consider lowering the +> global value here, and then crank it up on a case by case basis, like +> during nighttime report generation. Just one or two queries could +> theoretically run your machine out of memory right now. Just put a "set +> work_mem=1000000" in your script before the big query runs. +> +> > We're inserting around 3mil rows a night if you count staging, info, dim +> > and fact tables. The vacuum issue is a whole other problem but right now +> > I'm concerned about just the backup on the current hardware. +> > +> > I've got some space to burn so I could go to an uncompressed backup and +> > compress it later during the day. +> +> That's exactly what we do. We just do a normal backup, and have a +> script that gzips anything in the backup directory that doesn't end in +> .gz... If you've got space to burn, as you say, then use it at least a +> few days to see how it affects backup speeds. +> +> Seeing as how you're CPU bound, most likely the problem is just the +> compressed backup. +> + + + +-- +John E. Vincent +lusis.org@gmail.com + +------=_Part_8822_10722423.1150308679487 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Out of curiosity, does anyone have any idea what the ratio of actual datasize to backup size is if I use the custom format with -Z 0 compression or the tar format?

Thanks.

On 6/14/06, +Scott Marlowe <smarlowe@g2switchworks.com> wrote:
+On Wed, 2006-06-14 at 09:47, John E. Vincent wrote:
> -- this is the third time I've tried sending this and I never saw it get
> through to the list. Sorry if multiple copies show up.
>
> Hi all,
+
BUNCHES SNIPPED

> work_mem = 1048576 ( I know this is high but you should see some of our
> sorts and aggregates)

Ummm.  That's REALLY high.  You might want to consider lowering the
global value here, and then crank it up on a case by case basis, like +
during nighttime report generation.  Just one or two queries could
theoretically run your machine out of memory right now.  Just put a "set
work_mem=1000000" in your script before the big query runs.
+
> We're inserting around 3mil rows a night if you count staging, info, dim
> and fact tables. The vacuum issue is a whole other problem but right now
> I'm concerned about just the backup on the current hardware. +
>
> I've got some space to burn so I could go to an uncompressed backup and
> compress it later during the day.

That's exactly what we do.  We just do a normal backup, and have a
script that gzips anything in the backup directory that doesn't end in +
.gz...  If you've got space to burn, as you say, then use it at least a
few days to see how it affects backup speeds.

Seeing as how you're CPU bound, most likely the problem is just the
compressed backup. +



--
John E. Vincent
lusis.org@gmail.com + +------=_Part_8822_10722423.1150308679487-- + +From pgsql-performance-owner@postgresql.org Wed Jun 14 15:43:51 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 72ED49FA5C8 + for ; + Wed, 14 Jun 2006 15:43:51 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 53819-08 for + ; + Wed, 14 Jun 2006 15:43:44 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net + [194.217.242.85]) + by postgresql.org (Postfix) with ESMTP id C98A79FA3D7 + for ; + Wed, 14 Jun 2006 15:43:44 -0300 (ADT) +Received: from mailgate.vale-housing.co.uk ([194.217.48.34] + helo=vale-housing.co.uk) + by anchor-post-35.mail.demon.net with esmtp (Exim 4.42) + id 1FqaL8-0002lZ-IX + for pgsql-performance@postgresql.org; Wed, 14 Jun 2006 18:43:42 +0000 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----_=_NextPart_001_01C68FE2.75A31ED6" +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Subject: Re: Which processor runs better for Postgresql? +Date: Wed, 14 Jun 2006 19:43:41 +0100 +Message-ID: + +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Which processor runs better for Postgresql? +thread-index: AcaP1JLy3YPzPrRUSpKqToF/SBk6dwADUe8A +From: "Dave Page" +To: "Scott Marlowe" +Cc: "Joshua D. Drake" , , + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/264 +X-Sequence-Number: 19621 + +This is a multi-part message in MIME format. + +------_=_NextPart_001_01C68FE2.75A31ED6 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + +=20 + + +________________________________ + + From: Scott Marlowe [mailto:smarlowe@g2switchworks.com]=20 + Sent: 14 June 2006 18:04 + To: Dave Page + Cc: Joshua D. Drake; steve.poe@gmail.com; +pgsql-performance@postgresql.org + Subject: RE: [PERFORM] Which processor runs better for +Postgresql? +=09 +=09 + + On Tue, 2006-06-13 at 15:11, Dave Page wrote: + >=20 + > > -----Original Message----- +=09 + > And how old are the 2600's now? + > + > Anyhoo, I'm not saying the current machines are excellent +performers or + > anything, but there are good business reasons to run them if +you don't + > need to squeeze out every last pony. +=09 + Just thought I'd point you to Dell's forums. +=09 +=09 +http://forums.us.dell.com/supportforums/board?board.id=3Dpes_linux&page=3D= +1 +=20 +=09 + wherein you'll find plenty of folks who have problems with +freezing RAID + controllers with 28xx and 18xx machines.=20 + =20 + +Never had any such problems in the dozen or so machines we run +(about a 50-50 split of Linux to Windows).=20 + +Regards, Dave + + +------_=_NextPart_001_01C68FE2.75A31ED6 +Content-Type: text/html; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + + +RE: [PERFORM] Which processor runs better for = +Postgresql? + + + +
 

+
+
+
+ From: Scott Marlowe=20 + [mailto:smarlowe@g2switchworks.com]
Sent: 14 June 2006=20 + 18:04
To: Dave Page
Cc: Joshua D. Drake;=20 + steve.poe@gmail.com; = +pgsql-performance@postgresql.org
Subject: RE:=20 + [PERFORM] Which processor runs better for = +Postgresql?

+
+

On Tue, 2006-06-13 at 15:11, Dave Page=20 + wrote:

> > -----Original = +Message-----

> And=20 + how old are the 2600's now?
>
> Anyhoo, I'm not saying the = +current=20 + machines are excellent performers or
> anything, but there are = +good=20 + business reasons to run them if you don't
> need to squeeze out = +every=20 + last pony.

Just thought I'd point you to Dell's=20 + forums.

http://forums.us.dell.com/supportforums/board?board.id=3Dpes_lin= +ux&page=3D1


wherein you'll find plenty of folks who have problems with = +freezing=20 + RAID
controllers with 28xx and 18xx machines. 
 

+

<shrug>Never had any such problems in the = +dozen or so=20 +machines we run (about a 50-50 split of Linux to=20 +Windows). 

+

Regards, Dave

+ +------_=_NextPart_001_01C68FE2.75A31ED6-- + +From pgsql-performance-owner@postgresql.org Wed Jun 14 16:04:18 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 80E8C9FA5FB + for ; + Wed, 14 Jun 2006 16:04:17 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 58951-04 for + ; + Wed, 14 Jun 2006 16:04:12 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.172]) + by postgresql.org (Postfix) with ESMTP id ADB529FA3D7 + for ; + Wed, 14 Jun 2006 16:04:12 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so478813ugf + for ; + Wed, 14 Jun 2006 12:04:11 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=J5Emr/JMpnIYxm9vuwu7+NxlxUx7viIFSX1Dxb2lDtIq5zld28YxmKGEeTfXUylm0TriRmc4VMVz6bw3IE5hyDI9poObrbeImHfQRv6UxoCqH57o51YoObTVYTR2/VLXf5vZCxiD354PxNO6xrk9GF/VU0EpEsXS+HoDgamOx+o= +Received: by 10.78.72.20 with SMTP id u20mr221489hua; + Wed, 14 Jun 2006 12:04:11 -0700 (PDT) +Received: by 10.78.50.4 with HTTP; Wed, 14 Jun 2006 12:04:10 -0700 (PDT) +Message-ID: <92d3a4950606141204t3587aa85p8302890ac50cdaa6@mail.gmail.com> +Date: Wed, 14 Jun 2006 21:04:10 +0200 +From: Antoine +To: "Tom Lane" +Subject: Re: OT - select + must have from - sql standard syntax? +Cc: "Greg Stark" , "Jim C. Nasby" , + pgsql-performance@postgresql.org +In-Reply-To: <23625.1150294841@sss.pgh.pa.us> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <92d3a4950606130543y2aab73d8sbbbf04aee328b41f@mail.gmail.com> + <20060613210246.GA34196@pervasive.com> + <19096.1150253069@sss.pgh.pa.us> <87wtbkcqzh.fsf@stark.xeocode.com> + <92d3a4950606132336j1220301en9e5d33c64ad2794a@mail.gmail.com> + <23625.1150294841@sss.pgh.pa.us> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/265 +X-Sequence-Number: 19622 + +> You can get free "draft" versions that are close-enough-to-final to be +> perfectly usable. See our developers' FAQ for some links. I like the +> drafts partly because they're plain ASCII, and so far easier to search +> than PDFs ... + +Great to know - thanks! +Cheers +Antoine + +-- +This is where I should put some witty comment. + +From pgsql-performance-owner@postgresql.org Wed Jun 14 16:30:56 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 84E8A9FA5C8 + for ; + Wed, 14 Jun 2006 16:30:55 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 59061-08 for + ; + Wed, 14 Jun 2006 16:30:48 -0300 (ADT) +X-Greylist: delayed 00:12:05.243037 by SQLgrey- +Received: from q1exch01.Q1LABS.INC (Q1EXCH01.Q1Labs.com [205.174.165.4]) + by postgresql.org (Postfix) with ESMTP id 0C85F9FA3D7 + for ; + Wed, 14 Jun 2006 16:30:48 -0300 (ADT) +Received: from q1exch02.Q1LABS.INC ([10.100.50.8]) by q1exch01.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 14 Jun 2006 16:18:36 -0300 +X-PMWin-Version: 2.5.0e, Antispam-Engine: 2.3.0.1, Antivirus-Engine: 2.34.3 +Thread-Index: AcaP51Xn5fI0oDCiRkSzGbOUiWW19g== +Received: from [10.100.100.103] ([10.100.100.103]) by q1exch02.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 14 Jun 2006 16:18:36 -0300 +From: "jody brownell" +To: +Content-class: urn:content-classes:message +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2663 +Importance: normal +Subject: Postgres consuming way too much memory??? +Date: Wed, 14 Jun 2006 16:18:37 -0300 +User-Agent: KMail/1.8.3 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-ID: <200606141618.37849.jody.brownell@q1labs.com> +X-OriginalArrivalTime: 14 Jun 2006 19:18:36.0812 (UTC) + FILETIME=[55E7F4C0:01C68FE7] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/266 +X-Sequence-Number: 19623 + +I have a box with an app and postgresql on it. Hardware includes with 2 2.8 Ghz xeons 512KB cache, 4 GB of memory, 6 scsi disk in a software +raid 5 on a trustix 2.2 with a 2.6.15.3 kernel. The data and indexes are on the raid array while the tx log is on disk +with the OS. All is well. + +The one application executes one transaction every 60 seconds or so. The transaction can range from tiny +to relatively large. Maybe 30-70k inserts, 60-100k updates... nothing too heavy, take about 8-12 seconds +to finish the the entire update in the worst case. The application is using the latest jdbc.... I am using +preparedStatements with addBatch/executebatch/clearBatch to send statements in batches of 10 thousand... +(is that high?) + +The box itself is a little over subscribed for memory which is causing us to swap a bit... As the +application runs, I notice the postgres process which handles this particular app connection grows in memory seemingly +uncrontrollably until kaboom. Once the kernel kills off enough processes and the system settles, I see the postgres process is at 1.9GB +of res memory and 77MB of shared memory. This challenges a number of assumptions I have made in the last while and raises a +few questions... BTW, I am assuming this is not a memory leak b/c the same install of our software on a box +with 8GB of memory and no swap being used has no unexplained growth in the memory... it is perfectly healthy +and quite performant. + +Anyway, due to errors in the transaction, it is rolledback afterwhich the postgres process remains at 901MB of +resident memory and 91MB of of shared memory. + +27116 postgres 15 0 1515m 901m 91m S 0.0 22.9 18:33.96 postgres: qradar qradar ::ffff:x.x.x.x(51149) idle + +There are a few things I would like to understand. + +- What in the postgres will grow at an uncontrolled rate when the system is under heavy load or the transaction + is larger... there must be something not governed by the shared memory or other configuration in postgresql.conf. + It seems like, once we start hitting swap, postgres grows in memory resulting in more swapping... until applications + start getting killed. +- when the transaction was rolled back why did the process hold onto the 901MB of memory? +- when is a transaction too big? is this determined by the configuration and performance of wal_buffers and wal log or is there + house cleaning which MUST be done at commit/rollback to avoid siutations like this thus indicating there is an upper bound. + +I have been configuring postgres from tidbits I collected reading this list in the last few months.... +not sure if what I have is totally right for the work load, but when I have adequate memory and avoid swap, we are more than +happy with performance. Configuration which is not below is just the default. + +shared_buffers = 32767 +work_mem = 20480 +maintenance_work_mem = 32768 +max_fsm_pages = 4024000 +max_fsm_relations = 2000 +fsync = false +wal_sync_method = fsync +wal_buffers = 4096 +checkpoint_segments = 32 +checkpoint_timeout = 1200 +checkpoint_warning = 60 +commit_delay = 5000 +commit_siblings = 5 +effective_cache_size = 175000 +random_page_cost = 2 +autovacuum = true +autovacuum_naptime = 60 +autovacuum_vacuum_threshold = 500 +autovacuum_analyze_threshold = 250 +autovacuum_vacuum_scale_factor = 0.2 +autovacuum_analyze_scale_factor = 0.1 +autovacuum_vacuum_cost_delay=100 +autovacuum_vacuum_cost_limit=100 +default_statistics_target = 40 + +Is there anything here which looks weird or mis configured? I am just starting to play with the bg writer configuration so I did not include. +typically, there is little or no iowait... and no reason to think there is something miconfigured... from what I have seen. + +In one transaction i have seen as many as 5 checkpoint_segments be created/used so I was considering increasing wal_buffers to 8192 from 4096 +given as many as 4 segments in memory/cache at once... need to test this though .... + +Anyone have any thoughts on what could have caused the bloat? + +thanks + +From pgsql-performance-owner@postgresql.org Wed Jun 14 16:52:15 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4300B9FA5FB + for ; + Wed, 14 Jun 2006 16:52:14 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 64300-03 for + ; + Wed, 14 Jun 2006 16:52:08 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id C5C2A9FA3D7 + for ; + Wed, 14 Jun 2006 16:52:08 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Wed, 14 Jun 2006 19:52:06 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 14 Jun 2006 14:52:06 -0500 +Subject: Re: Which processor runs better for Postgresql? +From: Scott Marlowe +To: Dave Page +Cc: "Joshua D. Drake" , steve.poe@gmail.com, + pgsql-performance@postgresql.org +In-Reply-To: + +References: + +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1150314726.26538.17.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Wed, 14 Jun 2006 14:52:06 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/267 +X-Sequence-Number: 19624 + +On Wed, 2006-06-14 at 13:43, Dave Page wrote: +> + +> +> Just thought I'd point you to Dell's forums. +> +> http://forums.us.dell.com/supportforums/board?board.id=pes_linux&page=1 +> +> wherein you'll find plenty of folks who have problems with +> freezing RAID +> controllers with 28xx and 18xx machines. +> +> +> Never had any such problems in the dozen or so machines we run +> (about a 50-50 split of Linux to Windows). +> +> Regards, Dave +> + +Yeah, We've got a mix of 2650 and 2850s, and our 2850s have been rock +solid stable, unlike the 2650s. I was actually kinda surprised to see +how many people have problems with the 2850s. + +Apparently, the 2850 mobos have a built in RAID that's pretty stable +(it's got a PERC number I can't remembeR), but ordering them with an add +on Perc RAID controller appears to make them somewhat unstable as well. + +On recommendation I've seen repeatedly is to use the --noapic option at +boot time. + +Just FYI + +From pgsql-performance-owner@postgresql.org Wed Jun 14 17:01:07 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 409BF9FA5C8 + for ; + Wed, 14 Jun 2006 17:01:07 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 64176-06 for + ; + Wed, 14 Jun 2006 17:01:00 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from anchor-post-34.mail.demon.net (anchor-post-34.mail.demon.net + [194.217.242.92]) + by postgresql.org (Postfix) with ESMTP id 75E309FA3D7 + for ; + Wed, 14 Jun 2006 17:01:01 -0300 (ADT) +Received: from mailgate.vale-housing.co.uk ([194.217.48.34] + helo=vale-housing.co.uk) + by anchor-post-34.mail.demon.net with esmtp (Exim 4.42) + id 1FqbXu-000Ml9-Fx + for pgsql-performance@postgresql.org; Wed, 14 Jun 2006 20:00:58 +0000 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Subject: Re: Which processor runs better for Postgresql? +Date: Wed, 14 Jun 2006 21:00:57 +0100 +Message-ID: + +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Which processor runs better for Postgresql? +thread-index: AcaP7AX9JOspc9sNTemvwypQ6A09ngAAOiwQ +From: "Dave Page" +To: "Scott Marlowe" +Cc: "Joshua D. Drake" , , + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/268 +X-Sequence-Number: 19625 + +=20 + +> -----Original Message----- +> From: Scott Marlowe [mailto:smarlowe@g2switchworks.com]=20 +> Sent: 14 June 2006 20:52 +> To: Dave Page +> Cc: Joshua D. Drake; steve.poe@gmail.com;=20 +> pgsql-performance@postgresql.org +> Subject: RE: [PERFORM] Which processor runs better for Postgresql? +>=20 +>=20 +> Yeah, We've got a mix of 2650 and 2850s, and our 2850s have been rock +> solid stable, unlike the 2650s. I was actually kinda surprised to see +> how many people have problems with the 2850s. +>=20 +> Apparently, the 2850 mobos have a built in RAID that's pretty stable +> (it's got a PERC number I can't remembeR), but ordering them=20 +> with an add +> on Perc RAID controller appears to make them somewhat=20 +> unstable as well. + +That might be it - we always chose the onboard PERC because it has twice +the cache of the other options.=20 + +Regards, Dave. + +From pgsql-performance-owner@postgresql.org Wed Jun 14 17:03:09 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0CEFE9FA5C8 + for ; + Wed, 14 Jun 2006 17:03:09 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 65854-03 for + ; + Wed, 14 Jun 2006 17:03:02 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 0A9CA9FA3D7 + for ; + Wed, 14 Jun 2006 17:03:02 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5EK30MT003107; + Wed, 14 Jun 2006 16:03:00 -0400 (EDT) +To: "jody brownell" +cc: pgsql-performance@postgresql.org +Subject: Re: Postgres consuming way too much memory??? +In-reply-to: <200606141618.37849.jody.brownell@q1labs.com> +References: <200606141618.37849.jody.brownell@q1labs.com> +Comments: In-reply-to "jody brownell" + message dated "Wed, 14 Jun 2006 16:18:37 -0300" +Date: Wed, 14 Jun 2006 16:03:00 -0400 +Message-ID: <3106.1150315380@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/269 +X-Sequence-Number: 19626 + +"jody brownell" writes: +> 27116 postgres 15 0 1515m 901m 91m S 0.0 22.9 18:33.96 postgres: qradar qradar ::ffff:x.x.x.x(51149) idle + +This looks like a memory leak, but you haven't provided enough info to +let someone else reproduce it. Can you log what your application is +doing and extract a test case? What PG version is this, anyway? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Jun 14 17:11:49 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B205F9FA5C8 + for ; + Wed, 14 Jun 2006 17:11:48 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 67430-03 for + ; + Wed, 14 Jun 2006 17:11:40 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 80F469FA3D7 + for ; + Wed, 14 Jun 2006 17:11:40 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Wed, 14 Jun 2006 20:11:37 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 14 Jun 2006 15:11:37 -0500 +Subject: Re: Performance of pg_dump on PGSQL 8.0 +From: Scott Marlowe +To: John Vincent +Cc: PGSQL Performance +In-Reply-To: +References: <44902165.7020502@lusis.org> + <1150303450.26538.9.camel@state.g2switchworks.com> + +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1150315897.26538.33.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Wed, 14 Jun 2006 15:11:37 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/270 +X-Sequence-Number: 19627 + +On Wed, 2006-06-14 at 12:04, John Vincent wrote: +> +> On 6/14/06, Scott Marlowe wrote: +> On Wed, 2006-06-14 at 09:47, John E. Vincent wrote: +> > -- this is the third time I've tried sending this and I +> never saw it get +> > through to the list. Sorry if multiple copies show up. +> > +> > Hi all, +> +> BUNCHES SNIPPED +> +> > work_mem = 1048576 ( I know this is high but you should see +> some of our +> > sorts and aggregates) +> +> Ummm. That's REALLY high. You might want to consider +> lowering the +> global value here, and then crank it up on a case by case +> basis, like +> during nighttime report generation. Just one or two queries +> could +> theoretically run your machine out of memory right now. Just +> put a "set +> work_mem=1000000" in your script before the big query runs. +> +> +> I know it is but that's what we need for some of our queries. Our ETL +> tool (informatica) and BI tool (actuate) won't let us set those things +> as part of our jobs. We need it for those purposes. We have some +> really nasty queries that will be fixed in our new server. + +Description of "Queries gone wild" redacted. hehe. + +Yeah, I've seen those kinds of queries before too. you might be able to +limit your exposure by using alter user: + +alter user userwhoneedslotsofworkmem set work_mem=1000000; + +and then only that user will have that big of a default. You could even +make it so that only queries that need that much log in as that user, +and all other queries log in as other folks. Just a thought. I just +get REAL nervous seeing a production machine with a work_mem set that +high. + + +From pgsql-performance-owner@postgresql.org Wed Jun 14 17:55:15 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8F9E99FA5C8 + for ; + Wed, 14 Jun 2006 17:55:14 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 69233-08 for + ; + Wed, 14 Jun 2006 17:55:03 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.172]) + by postgresql.org (Postfix) with ESMTP id B16539FA5FB + for ; + Wed, 14 Jun 2006 17:55:03 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so533166ugf + for ; + Wed, 14 Jun 2006 13:55:01 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; + b=pLQ6szmCAh/8hvz3CslKbhPVp9vie7Bz6JR2MI1eHq4UJ72jXhllCmjDGpsRflDxrOQDwts9NDiwxcolhZufRqyny+jgDFbg5XDgn+XRFJZKSLg6kvgcsYjZBkQThq3HBlyLnssvcvnJSlghj5cSorl1TghMQrqIfiPP2t3Ivls= +Received: by 10.67.100.17 with SMTP id c17mr1041081ugm; + Wed, 14 Jun 2006 13:55:00 -0700 (PDT) +Received: by 10.66.216.11 with HTTP; Wed, 14 Jun 2006 13:55:00 -0700 (PDT) +Message-ID: +Date: Wed, 14 Jun 2006 16:55:00 -0400 +From: "John Vincent" +To: "Scott Marlowe" +Subject: Re: Performance of pg_dump on PGSQL 8.0 +Cc: "PGSQL Performance" +In-Reply-To: <1150315897.26538.33.camel@state.g2switchworks.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_12166_5466557.1150318500847" +References: <44902165.7020502@lusis.org> + <1150303450.26538.9.camel@state.g2switchworks.com> + + <1150315897.26538.33.camel@state.g2switchworks.com> +X-Google-Sender-Auth: 39232c34f3430f1e +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/271 +X-Sequence-Number: 19628 + +------=_Part_12166_5466557.1150318500847 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +On 6/14/06, Scott Marlowe wrote: +> +> +> Description of "Queries gone wild" redacted. hehe. +> +> Yeah, I've seen those kinds of queries before too. you might be able to +> limit your exposure by using alter user: +> +> alter user userwhoneedslotsofworkmem set work_mem=1000000; + + +Is this applicable on 8.0? We were actually LOOKING for a governor of some +sort for these queries. And something that is not explicitly stated, is +that allocated up front or is that just a ceiling? + +and then only that user will have that big of a default. You could even +> make it so that only queries that need that much log in as that user, +> and all other queries log in as other folks. Just a thought. I just +> get REAL nervous seeing a production machine with a work_mem set that +> high. + + +Which is actually how it's configured. We have a dedicated user connecting +from Actuate. The reports developers use thier own logins when developing +new reports. Only when they get published do they convert to the Actuate +user. + + + + +-- +John E. Vincent +lusis.org@gmail.com + +------=_Part_12166_5466557.1150318500847 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +

On 6/14/06, Scott Marlowe <smarlowe@g2switchworks.com> wrote:
+
Description of "Queries gone wild" redacted.  hehe.

Yeah, I've seen those kinds of queries before too.  you might be able to
limit your exposure by using alter user:

alter user userwhoneedslotsofworkmem set work_mem=1000000; +

Is this applicable on  8.0? We were actually LOOKING for a governor of some sort for these queries.  And something that is not explicitly stated, is that allocated up front or is that just a ceiling? +

and then only that user will have that big of a default.  You could even
make it so that only queries that need that much log in as that user, +
and all other queries log in as other folks.  Just a thought.  I just
get REAL nervous seeing a production machine with a work_mem set that
high.

Which is actually how it's configured. We have a dedicated user connecting from  Actuate. The reports developers use thier own logins when developing new reports. Only when they get published do they convert to the Actuate user. +




--
John E. Vincent
lusis.org@gmail.com + +------=_Part_12166_5466557.1150318500847-- + +From pgsql-performance-owner@postgresql.org Wed Jun 14 18:03:48 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DED5E9FA621 + for ; + Wed, 14 Jun 2006 18:03:47 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 71713-06-3 + for ; + Wed, 14 Jun 2006 18:03:37 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 5DA359FA5C8 + for ; + Wed, 14 Jun 2006 18:03:38 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Wed, 14 Jun 2006 21:03:35 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 14 Jun 2006 16:03:35 -0500 +Subject: Re: Performance of pg_dump on PGSQL 8.0 +From: Scott Marlowe +To: John Vincent +Cc: PGSQL Performance +In-Reply-To: +References: <44902165.7020502@lusis.org> + <1150303450.26538.9.camel@state.g2switchworks.com> + + + +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1150319015.26538.45.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Wed, 14 Jun 2006 16:03:35 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/272 +X-Sequence-Number: 19629 + +How long does gzip take to compress this backup? + +On Wed, 2006-06-14 at 15:59, John Vincent wrote: +> Okay I did another test dumping using the uncompressed backup on the +> system unloaded and the time dropped down to 8m for the backup. +> There's still the size issue to contend with but as I said, I've got a +> fair bit of space left on the SAN to work with. +> +> On 6/14/06, John Vincent wrote: +> Well I did a test to answer my own question: +> +> -rw-r--r-- 1 postgres postgres 167M Jun 14 01:43 +> claDW_PGSQL-20060613170001.bak +> -rw-r--r-- 1 root root 2.4G Jun 14 14:45 +> claDW_PGSQL.test.bak +> +> the claDW_PGSQL database is a subset of the data in the main +> schema that I'm dealing with. +> +> I did several tests using -Fc -Z0 and a straight pg_dump with +> no format option. +> +> The file size is about 1300% larger and takes just as long to +> dump even for that small database. +> +> Interestingly enough gzip compresses about 1M smaller with no +> gzip options. +> +> I don't know that the uncompressed is really helping much. I'm +> going to run another query when there's no other users on the +> system and see how it goes. +> +> +> +> -- +> John E. Vincent + +From pgsql-performance-owner@postgresql.org Wed Jun 14 18:13:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0B5859FA5C8 + for ; + Wed, 14 Jun 2006 18:13:55 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 73330-04 for + ; + Wed, 14 Jun 2006 18:13:48 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id DD7869FA3D7 + for ; + Wed, 14 Jun 2006 18:13:48 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 98B6656437; Wed, 14 Jun 2006 16:13:46 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Wed, 14 Jun 2006 16:13:44 -0500 +Date: Wed, 14 Jun 2006 16:13:44 -0500 +From: "Jim C. Nasby" +To: John Vincent +Cc: Scott Marlowe , + PGSQL Performance +Subject: Re: Performance of pg_dump on PGSQL 8.0 +Message-ID: <20060614211343.GP34196@pervasive.com> +References: <44902165.7020502@lusis.org> + <1150303450.26538.9.camel@state.g2switchworks.com> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060614:pgsql-performance@lusis.org::7FJVWxx+h6cCJsmX:0000000000 + 0000000000000000000000002xHW +X-Hashcash: + 1:20:060614:smarlowe@g2switchworks.com::D3DvzD1fGQ2wra7m:00000000000 + 0000000000000000000000008QUL +X-Hashcash: + 1:20:060614:pgsql-performance@postgresql.org::KhaUZhd4/ckvfAMs:00000 + 00000000000000000000000037+9 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/273 +X-Sequence-Number: 19630 + +On Wed, Jun 14, 2006 at 02:11:19PM -0400, John Vincent wrote: +> Out of curiosity, does anyone have any idea what the ratio of actual +> datasize to backup size is if I use the custom format with -Z 0 compression +> or the tar format? + +-Z 0 should mean no compression. + +Something you can try is piping the output of pg_dump to gzip/bzip2. On +some OSes, that will let you utilize 1 CPU for just the compression. If +you wanted to get even fancier, there is a parallelized version of bzip2 +out there, which should let you use all your CPUs. + +Or if you don't care about disk IO bandwidth, just compress after the +fact (though, that could just put you in a situation where pg_dump +becomes bandwidth constrained). +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Wed Jun 14 18:16:27 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C9DDC9FA5C8 + for ; + Wed, 14 Jun 2006 18:16:26 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 73520-03 for + ; + Wed, 14 Jun 2006 18:16:22 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.170]) + by postgresql.org (Postfix) with ESMTP id C44109FA3D7 + for ; + Wed, 14 Jun 2006 18:16:22 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so543522ugf + for ; + Wed, 14 Jun 2006 14:16:20 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; + b=Lq+UYRfb2HN57Jj/tAchq4Mz1wwPLCo854I0pj8KS1A/OGtoVsUoF5VrwWesyc9Uy2F4wBrlZMqrMZcA+K6wAS74EsLrqOpHwA6ziXahPUk55SPbDsLvOH8zi80kG8rpzXsoEtk36E+pGmR2OHyIT8vqsgcwksWacTHkaXKxmrU= +Received: by 10.66.216.6 with SMTP id o6mr1062230ugg; + Wed, 14 Jun 2006 14:16:20 -0700 (PDT) +Received: by 10.66.216.11 with HTTP; Wed, 14 Jun 2006 14:16:19 -0700 (PDT) +Message-ID: +Date: Wed, 14 Jun 2006 17:16:19 -0400 +From: "John Vincent" +Reply-To: pgsql-performance@lusis.org +To: "Scott Marlowe" +Subject: Re: Performance of pg_dump on PGSQL 8.0 +Cc: "PGSQL Performance" +In-Reply-To: <1150319015.26538.45.camel@state.g2switchworks.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_12490_12012128.1150319779973" +References: <44902165.7020502@lusis.org> + <1150303450.26538.9.camel@state.g2switchworks.com> + + + + <1150319015.26538.45.camel@state.g2switchworks.com> +X-Google-Sender-Auth: 899db6d545f6b27b +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/274 +X-Sequence-Number: 19631 + +------=_Part_12490_12012128.1150319779973 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +time gzip -6 claDW_PGSQL.test.bak + +real 3m4.360s +user 1m22.090s +sys 0m6.050s + +Which is still less time than it would take to do a compressed pg_dump. + +On 6/14/06, Scott Marlowe wrote: +> +> How long does gzip take to compress this backup? +> +> On Wed, 2006-06-14 at 15:59, John Vincent wrote: +> > Okay I did another test dumping using the uncompressed backup on the +> > system unloaded and the time dropped down to 8m for the backup. +> > There's still the size issue to contend with but as I said, I've got a +> > fair bit of space left on the SAN to work with. +> + +------=_Part_12490_12012128.1150319779973 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +time gzip -6 claDW_PGSQL.test.bak

real    3m4.360s
user    1m22.090s
sys     0m6.050s

Which is still less time than it would take to do a compressed pg_dump.

On 6/14/06, +Scott Marlowe <smarlowe@g2switchworks.com> wrote:
+How long does gzip take to compress this backup?

On Wed, 2006-06-14 at 15:59, John Vincent wrote:
> Okay I did another test dumping using the uncompressed backup on the
> system unloaded and the time dropped down to 8m for the backup. +
> There's still the size issue to contend with but as I said, I've got a
> fair bit of space left on the SAN to work with.

+ +------=_Part_12490_12012128.1150319779973-- + +From pgsql-performance-owner@postgresql.org Wed Jun 14 18:18:27 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 75A869FA3D7 + for ; + Wed, 14 Jun 2006 18:18:26 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 73619-04 for + ; + Wed, 14 Jun 2006 18:18:16 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.172]) + by postgresql.org (Postfix) with ESMTP id 01A139FA5C8 + for ; + Wed, 14 Jun 2006 18:18:16 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so544455ugf + for ; + Wed, 14 Jun 2006 14:18:14 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; + b=iyZrmVQsk3IwKXJnN8zBCHE27V1st9yrTpNFT8licKad5dzimYEBrwzu4oYcgWLRJHfyGTlXaREyfunES644bgneBl7zhlDWwXLTQFpcyIv2wYn6Z2p1YsDgY5bBmN3O9CcMaJbInCiJ0xfPKZysC18e8lsme88/lhvBf6Ib40w= +Received: by 10.67.97.7 with SMTP id z7mr1062360ugl; + Wed, 14 Jun 2006 14:18:14 -0700 (PDT) +Received: by 10.66.216.11 with HTTP; Wed, 14 Jun 2006 14:18:14 -0700 (PDT) +Message-ID: +Date: Wed, 14 Jun 2006 17:18:14 -0400 +From: "John Vincent" +Reply-To: pgsql-performance@lusis.org +To: "Jim C. Nasby" +Subject: Re: Performance of pg_dump on PGSQL 8.0 +Cc: "Scott Marlowe" , + "PGSQL Performance" +In-Reply-To: <20060614211343.GP34196@pervasive.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_12542_19336241.1150319894353" +References: <44902165.7020502@lusis.org> + <1150303450.26538.9.camel@state.g2switchworks.com> + + <20060614211343.GP34196@pervasive.com> +X-Google-Sender-Auth: 04b273d9f4f4f5ec +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/275 +X-Sequence-Number: 19632 + +------=_Part_12542_19336241.1150319894353 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +On 6/14/06, Jim C. Nasby wrote: +> +> On Wed, Jun 14, 2006 at 02:11:19PM -0400, John Vincent wrote: +> > Out of curiosity, does anyone have any idea what the ratio of actual +> > datasize to backup size is if I use the custom format with -Z 0 +> compression +> > or the tar format? +> +> -Z 0 should mean no compression. + + +But the custom format is still a binary backup, no? + +Something you can try is piping the output of pg_dump to gzip/bzip2. On +> some OSes, that will let you utilize 1 CPU for just the compression. If +> you wanted to get even fancier, there is a parallelized version of bzip2 +> out there, which should let you use all your CPUs. +> +> Or if you don't care about disk IO bandwidth, just compress after the +> fact (though, that could just put you in a situation where pg_dump +> becomes bandwidth constrained). + + +Unfortunately if we working with our current source box, the 1 CPU is +already the bottleneck in regards to compression. If I run the pg_dump from +the remote server though, I might be okay. + +-- +> Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +> Pervasive Software http://pervasive.com work: 512-231-6117 +> vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 +> + +------=_Part_12542_19336241.1150319894353 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +

On 6/14/06, Jim C. Nasby <jnasby@pervasive.com> wrote:
+On Wed, Jun 14, 2006 at 02:11:19PM -0400, John Vincent wrote:
> Out of curiosity, does anyone have any idea what the ratio of actual
> datasize to backup size is if I use the custom format with -Z 0 compression +
> or the tar format?

-Z 0 should mean no compression.

But the custom format is still a binary backup, no?

+Something you can try is piping the output of pg_dump to gzip/bzip2. On
some OSes, that will let you utilize 1 CPU for just the compression. If
you wanted to get even fancier, there is a parallelized version of bzip2 +
out there, which should let you use all your CPUs.

Or if you don't care about disk IO bandwidth, just compress after the
fact (though, that could just put you in a situation where pg_dump
becomes bandwidth constrained). +

Unfortunately if we working with our current source box, the 1 CPU is already the bottleneck in regards to compression. If I run the pg_dump from the remote server though, I might be okay.

+
--
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com +
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461 +

+ +------=_Part_12542_19336241.1150319894353-- + +From pgsql-performance-owner@postgresql.org Wed Jun 14 18:25:34 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C7A249FA5FB + for ; + Wed, 14 Jun 2006 18:25:33 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 74429-04 for + ; + Wed, 14 Jun 2006 18:25:23 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by postgresql.org (Postfix) with ESMTP id B77C49FA3D7 + for ; + Wed, 14 Jun 2006 18:25:24 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO [192.168.1.27]) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 9585510; Wed, 14 Jun 2006 14:28:36 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: Solaris shared_buffers anomaly? +Date: Wed, 14 Jun 2006 14:25:04 -0700 +User-Agent: KMail/1.8 +Cc: "Jim C. Nasby" , + Mischa Sandberg +References: <1150151282.14661.42.camel@tigger> + <448F51DE.2070604@ca.sophos.com> + <20060614033539.GY34196@pervasive.com> +In-Reply-To: <20060614033539.GY34196@pervasive.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200606141425.04600.josh@agliodbs.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/277 +X-Sequence-Number: 19634 + +Folks, + +First off, you'll be glad to know that I've persuaded two of the Sun +performance engineers to join this list soon. So you should be able to +get more difinitive answers to these questions. + +Second, 7.4 still did linear scanning of shared_buffers as part of LRU and +for other activities. I don't know how that would cause swapping, but it +certainly could cause dramatic slowdowns (like 2-5x) if you overallocated +shared_buffers. + +Possibly this is also triggering a bug in Solaris 2.6. 2.6 is pretty +darned old (1997); maybe you should upgrade? We're testing with s_b set +to 300,000 on Solaris 10 (Niagara) so this is obviously not a current +Solaris issue. + +-- +--Josh + +Josh Berkus +PostgreSQL @ Sun +San Francisco + +From pgsql-performance-owner@postgresql.org Wed Jun 14 18:25:17 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 911469FA5C8 + for ; + Wed, 14 Jun 2006 18:25:16 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 73287-09 for + ; + Wed, 14 Jun 2006 18:25:10 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 0F6B19FA3D7 + for ; + Wed, 14 Jun 2006 18:25:10 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id CF26756440; Wed, 14 Jun 2006 16:25:08 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Wed, 14 Jun 2006 16:25:08 -0500 +Date: Wed, 14 Jun 2006 16:25:08 -0500 +From: "Jim C. Nasby" +To: John Vincent +Cc: Scott Marlowe , + PGSQL Performance +Subject: Re: Performance of pg_dump on PGSQL 8.0 +Message-ID: <20060614212507.GR34196@pervasive.com> +References: <44902165.7020502@lusis.org> + <1150303450.26538.9.camel@state.g2switchworks.com> + + <20060614211343.GP34196@pervasive.com> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060614:pgsql-performance@lusis.org::AGsL0aMBpg8l5LQh:0000000000 + 0000000000000000000000000KJJ +X-Hashcash: + 1:20:060614:smarlowe@g2switchworks.com::g9uWbu/s0D/1MGpp:00000000000 + 0000000000000000000000002984 +X-Hashcash: + 1:20:060614:pgsql-performance@postgresql.org::Iad7pH4EnBEbstzW:00000 + 00000000000000000000000029ri +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/276 +X-Sequence-Number: 19633 + +On Wed, Jun 14, 2006 at 05:18:14PM -0400, John Vincent wrote: +> On 6/14/06, Jim C. Nasby wrote: +> > +> >On Wed, Jun 14, 2006 at 02:11:19PM -0400, John Vincent wrote: +> >> Out of curiosity, does anyone have any idea what the ratio of actual +> >> datasize to backup size is if I use the custom format with -Z 0 +> >compression +> >> or the tar format? +> > +> >-Z 0 should mean no compression. +> +> +> But the custom format is still a binary backup, no? + +I fail to see what that has to do with anything... + +> Something you can try is piping the output of pg_dump to gzip/bzip2. On +> >some OSes, that will let you utilize 1 CPU for just the compression. If +> >you wanted to get even fancier, there is a parallelized version of bzip2 +> >out there, which should let you use all your CPUs. +> > +> >Or if you don't care about disk IO bandwidth, just compress after the +> >fact (though, that could just put you in a situation where pg_dump +> >becomes bandwidth constrained). +> +> +> Unfortunately if we working with our current source box, the 1 CPU is +> already the bottleneck in regards to compression. If I run the pg_dump from +> the remote server though, I might be okay. + +Oh, right, forgot about that. Yeah, your best bet could be to use an +external machine for the dump. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Wed Jun 14 21:39:16 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B1CC39FA4A8 + for ; + Wed, 14 Jun 2006 21:39:14 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 11618-10 for + ; + Wed, 14 Jun 2006 21:39:09 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id E58CF9FA10A + for ; + Wed, 14 Jun 2006 21:39:09 -0300 (ADT) +Received: from [192.168.42.113] (natpool.bovine.net [67.100.216.14]) + (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by noel.decibel.org (Postfix) with ESMTP id A360956445; + Wed, 14 Jun 2006 19:39:07 -0500 (CDT) +In-Reply-To: <18667.1150249849@sss.pgh.pa.us> +References: <9119.1150222168@sss.pgh.pa.us> + <448EDFC4.8F27.00A9.0@leapfrogonline.com> + <20060613211347.GB34196@pervasive.com> + <10918.1150236282@sss.pgh.pa.us> + <20060613223950.GK34196@pervasive.com> + <18667.1150249849@sss.pgh.pa.us> +Mime-Version: 1.0 (Apple Message framework v750) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: +Cc: Shaun Thomas , + pgsql-performance@postgresql.org +Content-Transfer-Encoding: 7bit +From: Jim Nasby +Subject: Re: Confirmation of bad query plan generated by 7.4 +Date: Wed, 14 Jun 2006 16:36:00 -0500 +To: Tom Lane +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/282 +X-Sequence-Number: 19639 + +On Jun 13, 2006, at 8:50 PM, Tom Lane wrote: + +> "Jim C. Nasby" writes: +>> On Tue, Jun 13, 2006 at 06:04:42PM -0400, Tom Lane wrote: +>>> It'd depend on the context, possibly, but it's easy to show that the +>>> current planner does fold "now() - interval_constant" when making +>>> estimates. Simple example: +> +>> Turns out the difference is between feeding a date vs a timestamp +>> into the +>> query... I would have thought that since date is a date that the +>> WHERE clause +>> would be casted to a date if it was a timestamptz, but I guess not... +> +> Hmm ... worksforme. Could you provide a complete test case? + +decibel=# create table date_test(d date not null, i int not null); +CREATE TABLE +decibel=# insert into date_test select now()-x*'1 day'::interval, i +from generate_series(0,3000) x, generate_series(1,100000) i; +INSERT 0 300100000 +decibel=# analyze verbose date_test; +INFO: analyzing "decibel.date_test" +INFO: "date_test": scanned 30000 of 1622163 pages, containing +5550000 live rows and 0 dead rows; 30000 rows in sample, 300100155 +estimated total rows +ANALYZE +decibel=# explain select * from date_test where d >= now()-'15 +days'::interval; + QUERY PLAN +--------------------------------------------------------------------- +Seq Scan on date_test (cost=0.00..6873915.80 rows=1228164 width=8) + Filter: (d >= (now() - '15 days'::interval)) +(2 rows) + +decibel=# explain select * from date_test where d >= (now()-'15 +days'::interval)::date; + QUERY PLAN +--------------------------------------------------------------------- +Seq Scan on date_test (cost=0.00..7624166.20 rows=1306467 width=8) + Filter: (d >= ((now() - '15 days'::interval))::date) +(2 rows) + +decibel=# select version(); + version +------------------------------------------------------------------------ +------------------------- +PostgreSQL 8.1.4 on amd64-portbld-freebsd6.0, compiled by GCC cc +(GCC) 3.4.4 [FreeBSD] 20050518 +(1 row) + +decibel=# + +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + + + +From pgsql-performance-owner@postgresql.org Wed Jun 14 18:48:42 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8AB749FA621 + for ; + Wed, 14 Jun 2006 18:48:42 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 75760-06 for + ; + Wed, 14 Jun 2006 18:48:33 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from corpmail.hi5.com (corpmail.hi5.com [204.13.49.5]) + by postgresql.org (Postfix) with ESMTP id 84B679FA3D7 + for ; + Wed, 14 Jun 2006 18:48:34 -0300 (ADT) +Received: from [192.168.1.133] by hi5.com (MDaemon PRO v9.0.1) + with ESMTP id md50009625875.msg + for ; Wed, 14 Jun 2006 14:50:15 -0700 +Mime-Version: 1.0 (Apple Message framework v750) +Content-Transfer-Encoding: 7bit +Message-Id: <9A377C54-361D-4F01-BF7A-7632FBA3453C@hi5.com> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +To: pgsql-performance@postgresql.org +From: Dan Gorman +Subject: Postgres fsync off (not needed) with NetApp +Date: Wed, 14 Jun 2006 14:48:04 -0700 +X-Mailer: Apple Mail (2.750) +X-Authenticated-Sender: dgorman@hi5.com +X-Spam-Processed: corpmail, Wed, 14 Jun 2006 14:50:16 -0700 + (not processed: message from valid local sender) +X-MDRemoteIP: 66.237.43.131 +X-Return-Path: dgorman@hi5.com +X-MDaemon-Deliver-To: pgsql-performance@postgresql.org +X-MDAV-Processed: corpmail, Wed, 14 Jun 2006 14:50:16 -0700 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/278 +X-Sequence-Number: 19635 + +All, + So I thought I'd pose this question: + +If I have a pg database attached to a powervault (PV) with just an +off-the-shelf SCSI card I generally want fsync on to prevent data +corruption in case the PV should loose power. +However, if I have it attached to a NetApp that ensures data writes +to via the NVRAM can I safely turn fsync off to gain additional +performance? + +Best Regards, +Dan Gorman + + + +From pgsql-performance-owner@postgresql.org Wed Jun 14 18:53:30 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6CB4A9FA5C8 + for ; + Wed, 14 Jun 2006 18:53:30 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 76526-09 for + ; + Wed, 14 Jun 2006 18:53:24 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from druid.net (druid.net [66.96.28.249]) + by postgresql.org (Postfix) with ESMTP id 786609FA3D7 + for ; + Wed, 14 Jun 2006 18:53:25 -0300 (ADT) +Received: from dilbert (H245.C18.B96.tor.eicat.ca [66.96.18.245]) + by druid.net (Postfix) with SMTP id B5958B4B3; + Wed, 14 Jun 2006 17:53:25 -0400 (EDT) +Date: Wed, 14 Jun 2006 17:53:24 -0400 +From: "D'Arcy J.M. Cain" +To: Dan Gorman +Cc: pgsql-performance@postgresql.org +Subject: Re: Postgres fsync off (not needed) with NetApp +Message-Id: <20060614175324.a3f9ffb4.darcy@druid.net> +In-Reply-To: <9A377C54-361D-4F01-BF7A-7632FBA3453C@hi5.com> +References: <9A377C54-361D-4F01-BF7A-7632FBA3453C@hi5.com> +X-Mailer: Sylpheed version 2.2.4 (GTK+ 2.8.18; i386--netbsdelf) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/279 +X-Sequence-Number: 19636 + +On Wed, 14 Jun 2006 14:48:04 -0700 +Dan Gorman wrote: +> If I have a pg database attached to a powervault (PV) with just an +> off-the-shelf SCSI card I generally want fsync on to prevent data +> corruption in case the PV should loose power. +> However, if I have it attached to a NetApp that ensures data writes +> to via the NVRAM can I safely turn fsync off to gain additional +> performance? + +I wouldn't. Remember, you still have to get the data to the NetApp. +You don't want things sitting in the computer's buffers when it's power +goes down. + +-- +D'Arcy J.M. Cain | Democracy is three wolves +http://www.druid.net/darcy/ | and a sheep voting on ++1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner. + +From pgsql-performance-owner@postgresql.org Wed Jun 14 18:55:01 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6B7889FA5C8 + for ; + Wed, 14 Jun 2006 18:55:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 77797-04 for + ; + Wed, 14 Jun 2006 18:54:49 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) + by postgresql.org (Postfix) with ESMTP id 247849FA3D7 + for ; + Wed, 14 Jun 2006 18:54:49 -0300 (ADT) +Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP + with MS-WebStorage 6.0.6249 +Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; + 14 Jun 2006 14:54:45 -0700 +Subject: Re: Postgres fsync off (not needed) with NetApp +From: Mark Lewis +To: Dan Gorman +Cc: pgsql-performance@postgresql.org +In-Reply-To: <9A377C54-361D-4F01-BF7A-7632FBA3453C@hi5.com> +References: <9A377C54-361D-4F01-BF7A-7632FBA3453C@hi5.com> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Organization: MIR3, Inc. +Date: Wed, 14 Jun 2006 14:54:45 -0700 +Message-Id: <1150322085.31200.39.camel@archimedes> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-27) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/280 +X-Sequence-Number: 19637 + +No. You need fsync on in order to force the data to get TO the NetApp +at the right time. With fsync off, the data gets cached in the +operating system. + +-- Mark Lewis + +On Wed, 2006-06-14 at 14:48 -0700, Dan Gorman wrote: +> All, +> So I thought I'd pose this question: +> +> If I have a pg database attached to a powervault (PV) with just an +> off-the-shelf SCSI card I generally want fsync on to prevent data +> corruption in case the PV should loose power. +> However, if I have it attached to a NetApp that ensures data writes +> to via the NVRAM can I safely turn fsync off to gain additional +> performance? +> +> Best Regards, +> Dan Gorman +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: Don't 'kill -9' the postmaster + +From pgsql-performance-owner@postgresql.org Wed Jun 14 19:13:30 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 89AF59FA10A + for ; + Wed, 14 Jun 2006 19:13:29 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 79963-03 for + ; + Wed, 14 Jun 2006 19:13:22 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from candle.pha.pa.us (candle.pha.pa.us [70.90.9.53]) + by postgresql.org (Postfix) with ESMTP id B71EC9FA4A8 + for ; + Wed, 14 Jun 2006 19:13:22 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id k5EMCm204045; + Wed, 14 Jun 2006 18:12:48 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200606142212.k5EMCm204045@candle.pha.pa.us> +Subject: Re: Effects of cascading references in foreign keys +In-Reply-To: <12097.1130610925@sss.pgh.pa.us> +To: Tom Lane +Date: Wed, 14 Jun 2006 18:12:48 -0400 (EDT) +CC: Michael Fuhr , Bruno Wolff III , + Martin Lesser , + Stephan Szabo , + pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/281 +X-Sequence-Number: 19638 + + +Would someone please find the answer to Tom's last question? + +--------------------------------------------------------------------------- + +Tom Lane wrote: +> I wrote: +> > Looking at this, I wonder if there isn't a bug or at least an +> > inefficiency in 8.1. The KeysEqual short circuit tests are still there +> > in ri_triggers.c; aren't they now redundant with the test in triggers.c? +> > And don't they need to account for the special case mentioned in the +> > comment in triggers.c, that the RI check must still be done if we are +> > looking at a row updated by the same transaction that created it? +> +> OK, I take back the possible-bug comment: the special case only applies +> to the FK-side triggers, which is to say RI_FKey_check, and that routine +> doesn't attempt to skip the check on equal old/new keys. I'm still +> wondering though if the KeysEqual tests in the other RI triggers aren't +> now a waste of cycles. +> +> regards, tom lane +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 3: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq +> + +-- + Bruce Momjian http://candle.pha.pa.us + EnterpriseDB http://www.enterprisedb.com + + + If your life is a hard drive, Christ can be your backup. + + +From pgsql-performance-owner@postgresql.org Wed Jun 14 23:37:08 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E606F9FABE7 + for ; + Wed, 14 Jun 2006 23:37:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 21631-09 for + ; + Wed, 14 Jun 2006 23:37:01 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 728439FA10A + for ; + Wed, 14 Jun 2006 23:37:01 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5F2ated016555; + Wed, 14 Jun 2006 22:36:55 -0400 (EDT) +To: Jim Nasby +cc: Shaun Thomas , + pgsql-performance@postgresql.org +Subject: Re: Confirmation of bad query plan generated by 7.4 +In-reply-to: +References: <9119.1150222168@sss.pgh.pa.us> + <448EDFC4.8F27.00A9.0@leapfrogonline.com> + <20060613211347.GB34196@pervasive.com> + <10918.1150236282@sss.pgh.pa.us> + <20060613223950.GK34196@pervasive.com> + <18667.1150249849@sss.pgh.pa.us> + +Comments: In-reply-to Jim Nasby + message dated "Wed, 14 Jun 2006 16:36:00 -0500" +Date: Wed, 14 Jun 2006 22:36:55 -0400 +Message-ID: <16554.1150339015@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/283 +X-Sequence-Number: 19640 + +Jim Nasby writes: +> On Jun 13, 2006, at 8:50 PM, Tom Lane wrote: +>> Hmm ... worksforme. Could you provide a complete test case? + +> decibel=# create table date_test(d date not null, i int not null); +> [etc] + +Not sure what you are driving at. The estimates are clearly not +defaults (the default estimate would be 1/3rd of the table, or +about 100mil rows). Are you expecting them to be the same? If so why? +The comparison values are slightly different after all. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jun 15 00:34:09 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id EEA119FA4A8 + for ; + Thu, 15 Jun 2006 00:34:07 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 33794-05 for + ; + Thu, 15 Jun 2006 00:34:04 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by postgresql.org (Postfix) with ESMTP id 1F2889FA10A + for ; + Thu, 15 Jun 2006 00:34:03 -0300 (ADT) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1FqicE-0004ui-00; Wed, 14 Jun 2006 23:33:54 -0400 +To: Mark Lewis +Cc: Dan Gorman , pgsql-performance@postgresql.org +Subject: Re: Postgres fsync off (not needed) with NetApp +References: <9A377C54-361D-4F01-BF7A-7632FBA3453C@hi5.com> + <1150322085.31200.39.camel@archimedes> +In-Reply-To: <1150322085.31200.39.camel@archimedes> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 14 Jun 2006 23:33:53 -0400 +Message-ID: <873be7ay8u.fsf@stark.xeocode.com> +Lines: 18 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/284 +X-Sequence-Number: 19641 + + +Mark Lewis writes: + +> On Wed, 2006-06-14 at 14:48 -0700, Dan Gorman wrote: +> > +> > However, if I have it attached to a NetApp that ensures data writes +> > to via the NVRAM can I safely turn fsync off to gain additional +> > performance? +> +> No. You need fsync on in order to force the data to get TO the NetApp +> at the right time. With fsync off, the data gets cached in the +> operating system. + +In fact the benefit of the NVRAM is precisely that it makes sure you *don't* +have any reason to turn fsync off. It should make the fsync essentially free. + +-- +greg + + +From pgsql-hackers-owner@postgresql.org Thu Jun 15 01:05:49 2006 +X-Original-To: pgsql-hackers-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id F11719FA6A2 + for ; + Thu, 15 Jun 2006 01:05:48 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 41820-01 for + ; + Thu, 15 Jun 2006 01:05:38 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from candle.pha.pa.us (candle.pha.pa.us [70.90.9.53]) + by postgresql.org (Postfix) with ESMTP id A42449FA692 + for ; + Thu, 15 Jun 2006 01:05:37 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id k5F45cH11445; + Thu, 15 Jun 2006 00:05:38 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200606150405.k5F45cH11445@candle.pha.pa.us> +Subject: Test request for Stats collector performance improvement +In-Reply-To: <200601021840.k02Ieed21704@candle.pha.pa.us> +To: PostgreSQL-development +Date: Thu, 15 Jun 2006 00:05:38 -0400 (EDT) +CC: Tom Lane , Michael Fuhr , + Merlin Moncure , + Carlos Benkendorf +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/734 +X-Sequence-Number: 84967 + + +Would some people please run the attached test procedure and report back +the results? I basically need to know the patch is an improvement on +more platforms than just my own. Thanks + +--------------------------------------------------------------------------- + +Run this script and record the time reported: + + ftp://candle.pha.pa.us/pub/postgresql/mypatches/stat.script + +Modify postgresql.conf: + + stats_command_string = on + +and reload the server. Do "SELECT * FROM pg_stat_activity;" to verify +the command string is enabled. You should see your query in the +"current query" column. + +Rerun the stat.script again and record the time. + +Apply this patch to CVS HEAD: + + ftp://candle.pha.pa.us/pub/postgresql/mypatches/stat.nobuffer + +Run the stat.script again and record the time. + +Report via email your three times and your platform. + +If the patch worked, the first and third times will be similar, and +the second time will be high. + + +--------------------------------------------------------------------------- + +Bruce Momjian wrote: +> Tom Lane wrote: +> > Michael Fuhr writes: +> > > Further tests show that for this application +> > > the killer is stats_command_string, not stats_block_level or +> > > stats_row_level. +> > +> > I tried it with pgbench -c 10, and got these results: +> > 41% reduction in TPS rate for stats_command_string +> > 9% reduction in TPS rate for stats_block/row_level (any combination) +> > +> > strace'ing a backend confirms my belief that stats_block/row_level send +> > just one stats message per transaction (at least for the relatively +> > small number of tables touched per transaction by pgbench). However +> > stats_command_string sends 14(!) --- there are seven commands per +> > pgbench transaction and each results in sending a message and +> > later an message. +> > +> > Given the rather lackadaisical way in which the stats collector makes +> > the data available, it seems like the backends are being much too +> > enthusiastic about posting their stats_command_string status +> > immediately. Might be worth thinking about how to cut back the +> > overhead by suppressing some of these messages. +> +> I did some research on this because the numbers Tom quotes indicate there +> is something wrong in the way we process stats_command_string +> statistics. +> +> I made a small test script: +> +> if [ ! -f /tmp/pgstat.sql ] +> then i=0 +> while [ $i -lt 10000 ] +> do +> i=`expr $i + 1` +> echo "SELECT 1;" +> done > /tmp/pgstat.sql +> fi +> +> time psql test /dev/null +> +> This sends 10,000 "SELECT 1" queries to the backend, and reports the +> execution time. I found that without stats_command_string defined, it +> ran in 3.5 seconds. With stats_command_string defined, it took 5.5 +> seconds, meaning the command string is causing a 57% slowdown. That is +> way too much considering that the SELECT 1 has to be send from psql to +> the backend, parsed, optimized, and executed, and the result returned to +> the psql, while stats_command_string only has to send a string to a +> backend collector. There is _no_ way that collector should take 57% of +> the time it takes to run the actual query. +> +> With the test program, I tried various options. The basic code we have +> sends a UDP packet to a statistics buffer process, which recv()'s the +> packet, puts it into a memory queue buffer, and writes it to a pipe() +> that is read by the statistics collector process which processes the +> packet. +> +> I tried various ways of speeding up the buffer and collector processes. +> I found if I put a pg_usleep(100) in the buffer process the backend +> speed was good, but packets were lost. What I found worked well was to +> do multiple recv() calls in a loop. The previous code did a select(), +> then perhaps a recv() and pipe write() based on the results of the +> select(). This caused many small packets to be written to the pipe and +> the pipe write overhead seems fairly large. The best fix I found was to +> loop over the recv() call at most 25 times, collecting a group of +> packets that can then be sent to the collector in one pipe write. The +> recv() socket is non-blocking, so a zero return indicates there are no +> more packets available. Patch attached. +> +> This change reduced the stats_command_string time from 5.5 to 3.9, which +> is closer to the 3.5 seconds with stats_command_string off. +> +> A second improvement I discovered is that the statistics collector is +> calling gettimeofday() for every packet received, so it can determine +> the timeout for the select() call to write the flat file. I removed +> that behavior and instead used setitimer() to issue a SIGINT every +> 500ms, which was the original behavior. This eliminates the +> gettimeofday() call and makes the code cleaner. Second patch attached. + +-- + Bruce Momjian http://candle.pha.pa.us + EnterpriseDB http://www.enterprisedb.com + + + If your life is a hard drive, Christ can be your backup. + + +From pgsql-performance-owner@postgresql.org Thu Jun 15 01:31:28 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7562B9FA5E9 + for ; + Thu, 15 Jun 2006 01:31:26 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 44021-02 for + ; + Thu, 15 Jun 2006 01:31:17 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from linux.dunaweb.hu (linux.dunaweb.hu [62.77.196.1]) + by postgresql.org (Postfix) with ESMTP id DFCF19FA4A6 + for ; + Thu, 15 Jun 2006 01:31:16 -0300 (ADT) +Received: from localhost (linux.dunaweb.hu [127.0.0.1]) + by linux.dunaweb.hu (Postfix) with ESMTP + id 057D68E097A; Thu, 15 Jun 2006 06:31:15 +0200 (CEST) +Received: from linux.dunaweb.hu ([127.0.0.1]) + by localhost (linux.dunaweb.hu [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 28101-05; Thu, 15 Jun 2006 06:31:14 +0200 (CEST) +Received: from [81.17.177.202] (host-81-17-177-202.dunaweb.hu [81.17.177.202]) + by linux.dunaweb.hu (Postfix) with ESMTP + id F1EB18E0955; Thu, 15 Jun 2006 06:31:10 +0200 (CEST) +Message-ID: <4490E286.90004@dunaweb.hu> +Date: Thu, 15 Jun 2006 06:31:02 +0200 +From: Zoltan Boszormenyi +User-Agent: Thunderbird 1.5.0.2 (X11/20060501) +MIME-Version: 1.0 +To: "Jim C. Nasby" +Cc: Volkan YAZICI , + pgsql-performance@postgresql.org +Subject: Re: Precomputed constants? +References: <3167.213.163.11.81.1150282434.squirrel@www.dunaweb.hu> + <20060614110713.GA2277@alamut.tdm.local> + <3861.213.163.11.81.1150284610.squirrel@www.dunaweb.hu> + <20060614151804.GB34196@pervasive.com> +In-Reply-To: <20060614151804.GB34196@pervasive.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: amavisd-new at dunaweb.hu +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/285 +X-Sequence-Number: 19642 + +Jim C. Nasby �rta: +> On Wed, Jun 14, 2006 at 01:30:10PM +0200, B?sz?rm?nyi Zolt?n wrote: +> +>> Replacing random() with a true constant gives me index scan +>> even if it's hidden inside other function calls. E.g.: +>> +> +> The database has no choice but to compute random() for every row; it's +> marked VOLATILE. +> + +I see now, docs about CREATE FUNCTION mentions random(), +currval() and timeofday() as examples for VOLATILE. +But where in the documentation can I find this info about all +built-in functions? Thanks. + +Best regards, +Zolt�n B�sz�rm�nyi + + +From pgsql-performance-owner@postgresql.org Thu Jun 15 02:14:33 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 81FF79FA4C1 + for ; + Thu, 15 Jun 2006 02:14:32 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 45326-10 for + ; + Thu, 15 Jun 2006 02:14:29 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.168]) + by postgresql.org (Postfix) with ESMTP id CA2389FA4A6 + for ; + Thu, 15 Jun 2006 02:14:28 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so709018ugf + for ; + Wed, 14 Jun 2006 22:14:27 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=jqTr4bDhM/9ounZOulKVzQ2j8VDCMSUvijmkk9oNGout3PvjV5d6mtQd9TQHy/c+EyQS/17oBTGLB+xX/xf8IuEC5w4IqL9WrXjcqjEPvz/qZcLZEnLf/CpsMI6fmjXXZv4NHPmZSF+KCCrT60rmcjtH+B7QQJlozo60EAcoigY= +Received: by 10.67.30.6 with SMTP id h6mr1384738ugj; + Wed, 14 Jun 2006 22:14:26 -0700 (PDT) +Received: by 10.67.32.9 with HTTP; Wed, 14 Jun 2006 22:14:26 -0700 (PDT) +Message-ID: <36e682920606142214i6a6532f3k1a895a784f7b16dc@mail.gmail.com> +Date: Thu, 15 Jun 2006 01:14:26 -0400 +From: "Jonah H. Harris" +To: "Greg Stark" +Subject: Re: Postgres fsync off (not needed) with NetApp +Cc: "Mark Lewis" , "Dan Gorman" , + pgsql-performance@postgresql.org +In-Reply-To: <873be7ay8u.fsf@stark.xeocode.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <9A377C54-361D-4F01-BF7A-7632FBA3453C@hi5.com> + <1150322085.31200.39.camel@archimedes> + <873be7ay8u.fsf@stark.xeocode.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/286 +X-Sequence-Number: 19643 + +On 14 Jun 2006 23:33:53 -0400, Greg Stark wrote: +> In fact the benefit of the NVRAM is precisely that it makes sure you *don't* +> have any reason to turn fsync off. It should make the fsync essentially free. + +Having run PostgreSQL on a NetApp with input from NetApp, this is +correct. fsync should be turned on, but you will not incur the *real* +direct-to-disk cost of the sync, it will be direct-to-NVRAM. + +-- +Jonah H. Harris, Software Architect | phone: 732.331.1300 +EnterpriseDB Corporation | fax: 732.331.1301 +33 Wood Ave S, 2nd Floor | jharris@enterprisedb.com +Iselin, New Jersey 08830 | http://www.enterprisedb.com/ + +From pgsql-performance-owner@postgresql.org Thu Jun 15 02:21:12 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4CB0B9FA4C1 + for ; + Thu, 15 Jun 2006 02:21:12 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 49621-01 for + ; + Thu, 15 Jun 2006 02:21:04 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from corpmail.hi5.com (corpmail.hi5.com [204.13.49.5]) + by postgresql.org (Postfix) with ESMTP id 956D09FA4A6 + for ; + Thu, 15 Jun 2006 02:21:02 -0300 (ADT) +Received: from [192.168.15.101] by hi5.com (MDaemon PRO v9.0.1) + with ESMTP id md50009679822.msg + for ; Wed, 14 Jun 2006 22:22:35 -0700 +In-Reply-To: <36e682920606142214i6a6532f3k1a895a784f7b16dc@mail.gmail.com> +References: <9A377C54-361D-4F01-BF7A-7632FBA3453C@hi5.com> + <1150322085.31200.39.camel@archimedes> + <873be7ay8u.fsf@stark.xeocode.com> + <36e682920606142214i6a6532f3k1a895a784f7b16dc@mail.gmail.com> +Mime-Version: 1.0 (Apple Message framework v750) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <6A9B730A-425A-456E-9913-031B652E6227@hi5.com> +Cc: "Greg Stark" , "Mark Lewis" , + pgsql-performance@postgresql.org +Content-Transfer-Encoding: 7bit +From: Dan Gorman +Subject: Re: Postgres fsync off (not needed) with NetApp +Date: Wed, 14 Jun 2006 22:20:25 -0700 +To: "Jonah H. Harris" +X-Mailer: Apple Mail (2.750) +X-Authenticated-Sender: dgorman@hi5.com +X-Spam-Processed: corpmail, Wed, 14 Jun 2006 22:22:35 -0700 + (not processed: message from valid local sender) +X-Lookup-Warning: EHLO lookup on [192.168.15.101] does not match 65.254.152.26 +X-MDRemoteIP: 65.254.152.26 +X-Return-Path: dgorman@hi5.com +X-MDaemon-Deliver-To: pgsql-performance@postgresql.org +X-MDAV-Processed: corpmail, Wed, 14 Jun 2006 22:22:35 -0700 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/287 +X-Sequence-Number: 19644 + +That makes sense. Speaking of NetApp, we're using the 3050C with 4 FC +shelfs. Any generic advice other than the NetApp (their NFS oracle +tuning options) +that might be useful? (e.g. turning off snapshots) + +Regards, +Dan Gorman + +On Jun 14, 2006, at 10:14 PM, Jonah H. Harris wrote: + +> On 14 Jun 2006 23:33:53 -0400, Greg Stark wrote: +>> In fact the benefit of the NVRAM is precisely that it makes sure +>> you *don't* +>> have any reason to turn fsync off. It should make the fsync +>> essentially free. +> +> Having run PostgreSQL on a NetApp with input from NetApp, this is +> correct. fsync should be turned on, but you will not incur the *real* +> direct-to-disk cost of the sync, it will be direct-to-NVRAM. +> +> -- +> Jonah H. Harris, Software Architect | phone: 732.331.1300 +> EnterpriseDB Corporation | fax: 732.331.1301 +> 33 Wood Ave S, 2nd Floor | jharris@enterprisedb.com +> Iselin, New Jersey 08830 | http://www.enterprisedb.com/ + + + +From pgsql-performance-owner@postgresql.org Thu Jun 15 02:35:50 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B66279FA4C1 + for ; + Thu, 15 Jun 2006 02:35:48 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 49480-07 for + ; + Thu, 15 Jun 2006 02:35:45 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.175]) + by postgresql.org (Postfix) with ESMTP id 10AD49FA4A6 + for ; + Thu, 15 Jun 2006 02:35:44 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so3205ugf + for ; + Wed, 14 Jun 2006 22:35:43 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=rsz2GxENu47i9u46hYlmUXTtqoMZeUr9lxLhr0pM8JPKR7Fgn6MTIOnCiC3CYX3zIL0XXnBQpbDjZ1Yeck9NKtkWYsgwvAxysCb85B4j8tfe40CPT2quVievtmh6n/SyfoTn4bZQqsqgQHkzRNv9gzWcMry6fyh7agYkVMcoRJE= +Received: by 10.67.15.3 with SMTP id s3mr1391157ugi; + Wed, 14 Jun 2006 22:35:43 -0700 (PDT) +Received: by 10.67.32.9 with HTTP; Wed, 14 Jun 2006 22:35:43 -0700 (PDT) +Message-ID: <36e682920606142235t1a1b5092v1eb068ed6fcc46b8@mail.gmail.com> +Date: Thu, 15 Jun 2006 01:35:43 -0400 +From: "Jonah H. Harris" +To: "Dan Gorman" +Subject: Re: Postgres fsync off (not needed) with NetApp +Cc: "Greg Stark" , "Mark Lewis" , + pgsql-performance@postgresql.org +In-Reply-To: <6A9B730A-425A-456E-9913-031B652E6227@hi5.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <9A377C54-361D-4F01-BF7A-7632FBA3453C@hi5.com> + <1150322085.31200.39.camel@archimedes> + <873be7ay8u.fsf@stark.xeocode.com> + <36e682920606142214i6a6532f3k1a895a784f7b16dc@mail.gmail.com> + <6A9B730A-425A-456E-9913-031B652E6227@hi5.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/288 +X-Sequence-Number: 19645 + +On 6/15/06, Dan Gorman wrote: +> shelfs. Any generic advice other than the NetApp (their NFS oracle +> tuning options) that might be useful? (e.g. turning off snapshots) + +I was using PostgreSQL on a 980c, but feature-wise they're probably +pretty close. + +What type of application are you running? OLTP? If so, what type of +transaction volume? Are you planning to use any Flex* or Snap* +features? What type of volume layouts are you using? + +-- +Jonah H. Harris, Software Architect | phone: 732.331.1300 +EnterpriseDB Corporation | fax: 732.331.1301 +33 Wood Ave S, 2nd Floor | jharris@enterprisedb.com +Iselin, New Jersey 08830 | http://www.enterprisedb.com/ + +From pgsql-performance-owner@postgresql.org Thu Jun 15 02:38:23 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5C95F9FA4C1 + for ; + Thu, 15 Jun 2006 02:38:23 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 50161-06 for + ; + Thu, 15 Jun 2006 02:38:20 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.170]) + by postgresql.org (Postfix) with ESMTP id 28B8D9FA4A6 + for ; + Thu, 15 Jun 2006 02:38:19 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so4040ugf + for ; + Wed, 14 Jun 2006 22:38:18 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=PhgqkJt9mNWwg8/RL0vDG8WAtAv6+SjgDOsMX0p9M5LWfAWZHD5gRdUPhMS3nEE3X2KpkBPIP0IzhxhpL80hA8P+83DywT450x1WefXPqY338yt7q8Jhx4aqVuQQ+NUyOMXtEFAZASyQg5PtJVtfXGQhs4M/o5PizeiCKb9/2/g= +Received: by 10.66.222.9 with SMTP id u9mr1403162ugg; + Wed, 14 Jun 2006 22:38:18 -0700 (PDT) +Received: by 10.67.32.9 with HTTP; Wed, 14 Jun 2006 22:38:18 -0700 (PDT) +Message-ID: <36e682920606142238l6a86f998w25979e6284a250a8@mail.gmail.com> +Date: Thu, 15 Jun 2006 01:38:18 -0400 +From: "Jonah H. Harris" +To: "Dan Gorman" +Subject: Re: Postgres fsync off (not needed) with NetApp +Cc: "Greg Stark" , "Mark Lewis" , + pgsql-performance@postgresql.org +In-Reply-To: <36e682920606142235t1a1b5092v1eb068ed6fcc46b8@mail.gmail.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <9A377C54-361D-4F01-BF7A-7632FBA3453C@hi5.com> + <1150322085.31200.39.camel@archimedes> + <873be7ay8u.fsf@stark.xeocode.com> + <36e682920606142214i6a6532f3k1a895a784f7b16dc@mail.gmail.com> + <6A9B730A-425A-456E-9913-031B652E6227@hi5.com> + <36e682920606142235t1a1b5092v1eb068ed6fcc46b8@mail.gmail.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/289 +X-Sequence-Number: 19646 + +On 6/15/06, Jonah H. Harris wrote: +> On 6/15/06, Dan Gorman wrote: +> > shelfs. Any generic advice other than the NetApp (their NFS oracle +> > tuning options) that might be useful? (e.g. turning off snapshots) +> +> I was using PostgreSQL on a 980c, but feature-wise they're probably +> pretty close. +> +> What type of application are you running? OLTP? If so, what type of +> transaction volume? Are you planning to use any Flex* or Snap* +> features? What type of volume layouts are you using? + +Also, you mentioned NFS... is that what you were planning? If you +licensed iSCSI, it's a bit better for the database from a performance +angle. + +-- +Jonah H. Harris, Software Architect | phone: 732.331.1300 +EnterpriseDB Corporation | fax: 732.331.1301 +33 Wood Ave S, 2nd Floor | jharris@enterprisedb.com +Iselin, New Jersey 08830 | http://www.enterprisedb.com/ + +From pgsql-performance-owner@postgresql.org Thu Jun 15 02:51:41 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8D3299FA4C1 + for ; + Thu, 15 Jun 2006 02:51:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 53181-01 for + ; + Thu, 15 Jun 2006 02:51:35 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from joeconway.com (wsip-68-15-9-201.sd.sd.cox.net [68.15.9.201]) + by postgresql.org (Postfix) with ESMTP id 7230A9FA4A6 + for ; + Thu, 15 Jun 2006 02:51:35 -0300 (ADT) +Received: from [192.168.4.40] (account jconway [192.168.4.40] verified) + by joeconway.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP-TLS id 3970120; Wed, 14 Jun 2006 22:51:34 -0700 +Message-ID: <4490F566.5090706@joeconway.com> +Date: Wed, 14 Jun 2006 22:51:34 -0700 +From: Joe Conway +User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; + rv:1.7.13) Gecko/20060501 Fedora/1.7.13-1.1.fc5 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Dan Gorman +CC: "Jonah H. Harris" , Greg Stark , + Mark Lewis , pgsql-performance@postgresql.org +Subject: Re: Postgres fsync off (not needed) with NetApp +References: <9A377C54-361D-4F01-BF7A-7632FBA3453C@hi5.com> + <1150322085.31200.39.camel@archimedes> + <873be7ay8u.fsf@stark.xeocode.com> + <36e682920606142214i6a6532f3k1a895a784f7b16dc@mail.gmail.com> + <6A9B730A-425A-456E-9913-031B652E6227@hi5.com> +In-Reply-To: <6A9B730A-425A-456E-9913-031B652E6227@hi5.com> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/290 +X-Sequence-Number: 19647 + +Dan Gorman wrote: +> That makes sense. Speaking of NetApp, we're using the 3050C with 4 FC +> shelfs. Any generic advice other than the NetApp (their NFS oracle +> tuning options) +> that might be useful? (e.g. turning off snapshots) + +I'm not sure if this is in the tuning advice you already have, but we +use a dedicated gigabit interface to the NetApp, with jumbo (9K) frames, +and an 8K NFS blocksize. We use this for both Oracle and Postgres when +the database resides on NetApp. + +Joe + +From pgsql-performance-owner@postgresql.org Thu Jun 15 02:58:31 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8C60B9FA4C1 + for ; + Thu, 15 Jun 2006 02:58:31 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 53181-06 for + ; + Thu, 15 Jun 2006 02:58:23 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from grp-smtp.toray.com.my (grp-smtp.toray.com.my [202.186.44.7]) + by postgresql.org (Postfix) with ESMTP id 4FB909FAE4E + for ; + Thu, 15 Jun 2006 02:58:23 -0300 (ADT) +Received: from localhost (localhost.toray.com.my [127.0.0.1]) + by grp-smtp.toray.com.my (Postfix) with ESMTP id AF70E5085A + for ; + Thu, 15 Jun 2006 13:58:20 +0800 (MYT) +X-Virus-Scanned: amavisd-new at toray.com.my +Received: from grp-smtp.toray.com.my ([127.0.0.1]) + by localhost (grp-smtp.pengroup.com.my [127.0.0.1]) (amavisd-new, + port 10024) + with ESMTP id KEpezLakssS3 for ; + Thu, 15 Jun 2006 13:58:20 +0800 (MYT) +Received: from notes01.pengroup.com.my (notes01.toray.com.my [10.200.1.1]) + by grp-smtp.toray.com.my (Postfix) with ESMTP id 34B3F50846 + for ; + Thu, 15 Jun 2006 13:58:20 +0800 (MYT) +Subject: Is it possible to start two instances of postgresql? +To: pgsql-performance@postgresql.org +X-Mailer: Lotus Notes Release 5.0.5 September 22, 2000 +Message-ID: +From: kah_hang_ang@toray.com.my +Date: Thu, 15 Jun 2006 13:58:20 +0800 +X-MIMETrack: Serialize by Router on Notes01/Pen-Group(Release 6.5.1|January + 21, + 2004) at 06/15/2006 01:58:20 PM +MIME-Version: 1.0 +Content-type: text/plain; charset=US-ASCII +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/291 +X-Sequence-Number: 19648 + + + + + +Hi, + +Is it possible to start two instances of postgresql with different port and +directory which run simultaneously? +If can then will this cause any problem or performance drop down? + +Thanks. + + +From pgsql-performance-owner@postgresql.org Thu Jun 15 03:03:00 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 458179FA4C1 + for ; + Thu, 15 Jun 2006 03:03:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 54061-05 for + ; + Thu, 15 Jun 2006 03:02:52 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from corpmail.hi5.com (corpmail.hi5.com [204.13.49.5]) + by postgresql.org (Postfix) with ESMTP id C9AEE9FA4A6 + for ; + Thu, 15 Jun 2006 03:02:51 -0300 (ADT) +Received: from [192.168.15.101] by hi5.com (MDaemon PRO v9.0.1) + with ESMTP id md50009684069.msg + for ; Wed, 14 Jun 2006 23:03:38 -0700 +In-Reply-To: <4490F566.5090706@joeconway.com> +References: <9A377C54-361D-4F01-BF7A-7632FBA3453C@hi5.com> + <1150322085.31200.39.camel@archimedes> + <873be7ay8u.fsf@stark.xeocode.com> + <36e682920606142214i6a6532f3k1a895a784f7b16dc@mail.gmail.com> + <6A9B730A-425A-456E-9913-031B652E6227@hi5.com> + <4490F566.5090706@joeconway.com> +Mime-Version: 1.0 (Apple Message framework v750) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <19AF7337-3F84-4753-AB6F-7193276C6F76@hi5.com> +Cc: "Jonah H. Harris" , Greg Stark , + Mark Lewis , pgsql-performance@postgresql.org +Content-Transfer-Encoding: 7bit +From: Dan Gorman +Subject: Re: Postgres fsync off (not needed) with NetApp +Date: Wed, 14 Jun 2006 23:01:28 -0700 +To: Joe Conway +X-Mailer: Apple Mail (2.750) +X-Authenticated-Sender: dgorman@hi5.com +X-Spam-Processed: corpmail, Wed, 14 Jun 2006 23:03:38 -0700 + (not processed: message from valid local sender) +X-Lookup-Warning: EHLO lookup on [192.168.15.101] does not match 65.254.152.26 +X-MDRemoteIP: 65.254.152.26 +X-Return-Path: dgorman@hi5.com +X-MDaemon-Deliver-To: pgsql-performance@postgresql.org +X-MDAV-Processed: corpmail, Wed, 14 Jun 2006 23:03:39 -0700 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/292 +X-Sequence-Number: 19649 + +Currently I have jumbo frames enabled on the NA and the switches and +also are using a the 32K R/W NFS options. Everything is gigE. + +Regards, +Dan Gorman + + +On Jun 14, 2006, at 10:51 PM, Joe Conway wrote: + +> Dan Gorman wrote: +>> That makes sense. Speaking of NetApp, we're using the 3050C with 4 +>> FC shelfs. Any generic advice other than the NetApp (their NFS +>> oracle tuning options) +>> that might be useful? (e.g. turning off snapshots) +> +> I'm not sure if this is in the tuning advice you already have, but +> we use a dedicated gigabit interface to the NetApp, with jumbo (9K) +> frames, and an 8K NFS blocksize. We use this for both Oracle and +> Postgres when the database resides on NetApp. +> +> Joe + + + +From pgsql-performance-owner@postgresql.org Thu Jun 15 03:07:48 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 467B69FA5E9 + for ; + Thu, 15 Jun 2006 03:07:48 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 54131-05 for + ; + Thu, 15 Jun 2006 03:07:39 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moutng.kundenserver.de (moutng.kundenserver.de + [212.227.126.188]) + by postgresql.org (Postfix) with ESMTP id BBB899FA4A6 + for ; + Thu, 15 Jun 2006 03:07:38 -0300 (ADT) +Received: from [194.25.154.138] (helo=webserv.wug.de) + by mrelayeu.kundenserver.de (node=mrelayeu6) with ESMTP (Nemesis), + id 0ML29c-1Fql0y3P3k-0003On; Thu, 15 Jun 2006 08:07:37 +0200 +Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) + id 1Fql0y-000692-00 + for pgsql-performance@postgresql.org; Thu, 15 Jun 2006 08:07:36 +0200 +Date: Thu, 15 Jun 2006 08:07:36 +0200 +From: "A. Kretschmer" +To: pgsql-performance@postgresql.org +Subject: Re: Is it possible to start two instances of postgresql? +Message-ID: <20060615060736.GC22034@webserv.wug-glas.de> +References: +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +X-DEST: 208 +X-OS: Linux - weil ich es mir Wert bin! +X-Info: registrierter Linux-User 97922 http://counter.li.org +User-Agent: mutt-ng 1.5.9i (Linux) +X-Provags-ID: kundenserver.de abuse@kundenserver.de + login:51ea9561fc3f6d9539a2acd743e4748c +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/293 +X-Sequence-Number: 19650 + +am 15.06.2006, um 13:58:20 +0800 mailte kah_hang_ang@toray.com.my folgendes: +> +> +> +> +> Hi, +> +> Is it possible to start two instances of postgresql with different port and +> directory which run simultaneously? + +Yes, this is possible, and this is the Debian way for updates. + + +> If can then will this cause any problem or performance drop down? + +Of course, if you have high load in one database ... you have only one +machine. + + +HTH, Andreas +-- +Andreas Kretschmer (Kontakt: siehe Header) +Heynitz: 035242/47215, D1: 0160/7141639 +GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net + === Schollglas Unternehmensgruppe === + +From pgsql-hackers-owner@postgresql.org Thu Jun 15 03:10:21 2006 +X-Original-To: pgsql-hackers-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 18BFD9FA4C1 + for ; + Thu, 15 Jun 2006 03:10:21 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 55651-06 for + ; + Thu, 15 Jun 2006 03:10:10 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id 9FAF99FA4A6 + for ; + Thu, 15 Jun 2006 03:10:10 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id AF55A30920; Thu, 15 Jun 2006 08:10:09 +0200 (MET DST) +From: "Qingqing Zhou" +X-Newsgroups: pgsql.hackers +Subject: Re: Test request for Stats collector performance improvement +Date: Thu, 15 Jun 2006 14:09:43 +0800 +Organization: Hub.Org Networking Services +Lines: 43 +Message-ID: +References: <200601021840.k02Ieed21704@candle.pha.pa.us> + <200606150405.k5F45cH11445@candle.pha.pa.us> +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2800.1807 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 +To: pgsql-hackers@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/738 +X-Sequence-Number: 84971 + + +"Bruce Momjian" wrote +> +> Would some people please run the attached test procedure and report back +> the results? I basically need to know the patch is an improvement on +> more platforms than just my own. Thanks +> + +Obviously it matches your expectation. + +uname: Linux amd64 2.6.9-5.13smp #1 SMP Wed Aug 10 10:55:44 CST 2005 x86_64 +x86_64 x86_64 GNU/Linux +compiler: gcc (GCC) 3.4.3 20041212 +configure: '--prefix=/home/qqzhou/pginstall' + +--Before patch -- +real 0m1.149s +user 0m0.182s +sys 0m0.122s + +real 0m1.121s +user 0m0.173s +sys 0m0.103s + +real 0m1.128s +user 0m0.116s +sys 0m0.092s + +-- After patch -- + +real 0m1.275s +user 0m0.097s +sys 0m0.160s + +real 0m4.063s +user 0m0.663s +sys 0m0.377s + +real 0m1.259s +user 0m0.073s +sys 0m0.160s + + + +From pgsql-performance-owner@postgresql.org Thu Jun 15 03:35:06 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 679339FA4C1 + for ; + Thu, 15 Jun 2006 03:35:05 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 57710-03 for + ; + Thu, 15 Jun 2006 03:35:00 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from grp-smtp.toray.com.my (grp-smtp.toray.com.my [202.186.44.7]) + by postgresql.org (Postfix) with ESMTP id 9AF7C9FA4A6 + for ; + Thu, 15 Jun 2006 03:34:57 -0300 (ADT) +Received: from localhost (localhost.toray.com.my [127.0.0.1]) + by grp-smtp.toray.com.my (Postfix) with ESMTP id 8AAEA5085A; + Thu, 15 Jun 2006 14:34:53 +0800 (MYT) +X-Virus-Scanned: amavisd-new at toray.com.my +Received: from grp-smtp.toray.com.my ([127.0.0.1]) + by localhost (grp-smtp.pengroup.com.my [127.0.0.1]) (amavisd-new, + port 10024) + with ESMTP id RHmAk1kjhNs0; Thu, 15 Jun 2006 14:34:51 +0800 (MYT) +Received: from notes01.pengroup.com.my (notes01.toray.com.my [10.200.1.1]) + by grp-smtp.toray.com.my (Postfix) with ESMTP id 9D5915083A; + Thu, 15 Jun 2006 14:34:51 +0800 (MYT) +Subject: Re: Is it possible to start two instances of postgresql? +To: "A. Kretschmer" +Cc: pgsql-performance@postgresql.org +X-Mailer: Lotus Notes Release 5.0.5 September 22, 2000 +Message-ID: +From: kah_hang_ang@toray.com.my +Date: Thu, 15 Jun 2006 14:34:51 +0800 +X-MIMETrack: Serialize by Router on Notes01/Pen-Group(Release 6.5.1|January + 21, + 2004) at 06/15/2006 02:34:52 PM +MIME-Version: 1.0 +Content-type: text/plain; charset=US-ASCII +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.591 tagged_above=0 required=5 tests=AWL, BAYES_00, + FORGED_RCVD_HELO, NO_REAL_NAME, SPF_PASS, URIBL_JP_SURBL +X-Spam-Level: +X-Archive-Number: 200606/294 +X-Sequence-Number: 19651 + + + + + +so what is the best way to implement two databases in one machine? +implement with two postgresql instances with separate directory or +implement under one instance? + +if I implement two database in one instance, if one of the database crash +will it affect the other? + + + + + "A. Kretschmer" + cc: + Sent by: Subject: Re: [PERFORM]Is it possible to start two instances of postgresql? + pgsql-performance-owner@pos + tgresql.org + + + 06/15/2006 02:07 PM + + + + + + +am 15.06.2006, um 13:58:20 +0800 mailte kah_hang_ang@toray.com.my +folgendes: +> +> +> +> +> Hi, +> +> Is it possible to start two instances of postgresql with different port +and +> directory which run simultaneously? + +Yes, this is possible, and this is the Debian way for updates. + + +> If can then will this cause any problem or performance drop down? + +Of course, if you have high load in one database ... you have only one +machine. + + +HTH, Andreas +-- +Andreas Kretschmer (Kontakt: siehe Header) +Heynitz: 035242/47215, D1: 0160/7141639 +GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net + === Schollglas Unternehmensgruppe === + +---------------------------(end of broadcast)--------------------------- +TIP 1: if posting/reading through Usenet, please send an appropriate + subscribe-nomail command to majordomo@postgresql.org so that your + message can get through to the mailing list cleanly + + + + +From pgsql-performance-owner@postgresql.org Thu Jun 15 04:07:04 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 211369FA4C1 + for ; + Thu, 15 Jun 2006 04:07:04 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 61124-02 for + ; + Thu, 15 Jun 2006 04:06:55 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moutng.kundenserver.de (moutng.kundenserver.de + [212.227.126.187]) + by postgresql.org (Postfix) with ESMTP id 36EBF9FA5E9 + for ; + Thu, 15 Jun 2006 04:06:54 -0300 (ADT) +Received: from [194.25.154.138] (helo=webserv.wug.de) + by mrelayeu.kundenserver.de (node=mrelayeu2) with ESMTP (Nemesis), + id 0MKwtQ-1FqlwL1Qxz-0001zx; Thu, 15 Jun 2006 09:06:53 +0200 +Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) + id 1FqlwK-0006bk-00 + for pgsql-performance@postgresql.org; Thu, 15 Jun 2006 09:06:52 +0200 +Date: Thu, 15 Jun 2006 09:06:52 +0200 +From: "A. Kretschmer" +To: pgsql-performance@postgresql.org +Subject: Re: Is it possible to start two instances of postgresql? +Message-ID: <20060615070652.GE22034@webserv.wug-glas.de> +References: +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +X-DEST: 208 +X-OS: Linux - weil ich es mir Wert bin! +X-Info: registrierter Linux-User 97922 http://counter.li.org +User-Agent: mutt-ng 1.5.9i (Linux) +X-Provags-ID: kundenserver.de abuse@kundenserver.de + login:51ea9561fc3f6d9539a2acd743e4748c +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/295 +X-Sequence-Number: 19652 + +am 15.06.2006, um 14:34:51 +0800 mailte kah_hang_ang@toray.com.my folgendes: +> +> +> +> +> so what is the best way to implement two databases in one machine? +> implement with two postgresql instances with separate directory or +> implement under one instance? + +What do you want to do? +Do you need 2 separate pg-versions? Or do you need, for instance, a +live-db and a test-db? + + +> if I implement two database in one instance, if one of the database crash +> will it affect the other? + +Yes, but on the other side, if you have 2 instances on the same machine +and this machine chrash, then you lost all. +What do you want to do? Perhaps, you need slony? (replication solution) + + + +Btw.: please, no silly fullquote. + + +Andreas +-- +Andreas Kretschmer (Kontakt: siehe Header) +Heynitz: 035242/47215, D1: 0160/7141639 +GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net + === Schollglas Unternehmensgruppe === + +From pgsql-performance-owner@postgresql.org Thu Jun 15 04:25:07 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 761809FA4C1 + for ; + Thu, 15 Jun 2006 04:25:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 61373-08 for + ; + Thu, 15 Jun 2006 04:24:57 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from grp-smtp.toray.com.my (grp-smtp.toray.com.my [202.186.44.7]) + by postgresql.org (Postfix) with ESMTP id A97879FA4A6 + for ; + Thu, 15 Jun 2006 04:24:56 -0300 (ADT) +Received: from localhost (localhost.toray.com.my [127.0.0.1]) + by grp-smtp.toray.com.my (Postfix) with ESMTP id 877C550893; + Thu, 15 Jun 2006 15:24:48 +0800 (MYT) +X-Virus-Scanned: amavisd-new at toray.com.my +Received: from grp-smtp.toray.com.my ([127.0.0.1]) + by localhost (grp-smtp.pengroup.com.my [127.0.0.1]) (amavisd-new, + port 10024) + with ESMTP id Gmmojtyj6h+u; Thu, 15 Jun 2006 15:24:44 +0800 (MYT) +Received: from notes01.pengroup.com.my (notes01.toray.com.my [10.200.1.1]) + by grp-smtp.toray.com.my (Postfix) with ESMTP id 022E350869; + Thu, 15 Jun 2006 15:24:35 +0800 (MYT) +Subject: Re: Is it possible to start two instances of postgresql? +To: "A. Kretschmer" +Cc: pgsql-performance@postgresql.org +X-Mailer: Lotus Notes Release 5.0.5 September 22, 2000 +Message-ID: +From: kah_hang_ang@toray.com.my +Date: Thu, 15 Jun 2006 15:24:35 +0800 +X-MIMETrack: Serialize by Router on Notes01/Pen-Group(Release 6.5.1|January + 21, + 2004) at 06/15/2006 03:24:35 PM +MIME-Version: 1.0 +Content-type: text/plain; charset=US-ASCII +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.806 tagged_above=0 required=5 tests=AWL, BAYES_00, + FORGED_RCVD_HELO, NO_REAL_NAME, SPF_PASS, URIBL_JP_SURBL +X-Spam-Level: +X-Archive-Number: 200606/296 +X-Sequence-Number: 19653 + + + + + + +both of the two database are live but use for two different web app. +my company don't want to spend more to buy a new server, so then I think of +to implement both under the same server and one instance.. +but then my superior don't want to do that way. + they want to implement two databases in one server but if one of the +database down it will not affect the other, so that's why I need to have +two instances. + + + + + + "A. Kretschmer" + cc: + Sent by: Subject: Re: [PERFORM]Is it possible to start two instances of postgresql? + pgsql-performance-owner@pos + tgresql.org + + + 06/15/2006 03:06 PM + + + + + + +am 15.06.2006, um 14:34:51 +0800 mailte kah_hang_ang@toray.com.my +folgendes: +> +> +> +> +> so what is the best way to implement two databases in one machine? +> implement with two postgresql instances with separate directory or +> implement under one instance? + +What do you want to do? +Do you need 2 separate pg-versions? Or do you need, for instance, a +live-db and a test-db? + + +> if I implement two database in one instance, if one of the database crash +> will it affect the other? + +Yes, but on the other side, if you have 2 instances on the same machine +and this machine chrash, then you lost all. +What do you want to do? Perhaps, you need slony? (replication solution) + + + +Btw.: please, no silly fullquote. + + +Andreas +-- +Andreas Kretschmer (Kontakt: siehe Header) +Heynitz: 035242/47215, D1: 0160/7141639 +GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net + === Schollglas Unternehmensgruppe === + +---------------------------(end of broadcast)--------------------------- +TIP 6: explain analyze is your friend + + + + +From pgsql-hackers-owner@postgresql.org Thu Jun 15 05:01:13 2006 +X-Original-To: pgsql-hackers-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0B48C9FA5E9 + for ; + Thu, 15 Jun 2006 05:01:13 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 66449-02 for + ; + Thu, 15 Jun 2006 05:00:51 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from thebighonker.lerctr.org (thebighonker.lerctr.org + [192.147.25.65]) + by postgresql.org (Postfix) with ESMTP id D9B249FA4C1 + for ; + Thu, 15 Jun 2006 05:00:51 -0300 (ADT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=lerami; d=lerctr.org; + b=K3L9/xysnC8lLeEBAx02ew2lQ/pV1xqn28VpQy5w3f+6rWoxJRMO+g0W8zy4/WBeDJe8Cho0o8TkJZqUuvc9skx02s5SWiUgQJ7GjX+egy9xwSP5dXHiEOhtvTi2bX3+9Ozv1ASQLE5WtEdidrwpBYDqivFOD8mZqGj+NyCE28c=; +Received: from adsl-70-240-13-227.dsl.austtx.swbell.net ([70.240.13.227]:2158 + helo=lerlaptop) + by thebighonker.lerctr.org with esmtpsa (TLSv1:RC4-MD5:128) + (Exim 4.62 (FreeBSD)) (envelope-from ) + id 1FqmmP-000I7v-7e; Thu, 15 Jun 2006 03:00:43 -0500 +From: "Larry Rosenman" +To: "'Bruce Momjian'" , + "'PostgreSQL-development'" +Cc: "'Tom Lane'" , "'Michael Fuhr'" , + "'Merlin Moncure'" , + "'Carlos Benkendorf'" +Subject: Re: Test request for Stats collector performance improvement +Date: Thu, 15 Jun 2006 03:00:27 -0500 +Message-ID: <002101c69051$ca9ff870$68c8a8c0@lerctr.org> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +X-Mailer: Microsoft Office Outlook 11 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +Thread-Index: AcaQMQ/UnRHTIphJTZuUDXcYgJRXdgAIF0cA +In-Reply-To: <200606150405.k5F45cH11445@candle.pha.pa.us> +X-LERCTR-Spam-Score: -4.4 (----) +X-LERCTR-Spam-Report: (-4.4 points, 5.0 required) + ALL_TRUSTED=-1.8 BAYES_00=-2.599 +DomainKey-Status: no signature +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/740 +X-Sequence-Number: 84973 + +Bruce Momjian wrote: +> Would some people please run the attached test procedure and report +> back the results? I basically need to know the patch is an +> improvement on more platforms than just my own. Thanks +> +> +--------------------------------------------------------------------------- +> +[snip] + FreeBSD thebighonker.lerctr.org 6.1-STABLE FreeBSD 6.1-STABLE #60: Mon Jun +12 16:55:31 CDT 2006 +root@thebighonker.lerctr.org:/usr/obj/usr/src/sys/THEBIGHONKER amd64 +$ +with all stats on, except command string, cvs HEAD, no other patch: + +$ sh stat.script + 1.92 real 0.35 user 0.42 sys +$ +# same as above, with command_string on. + +$ sh stat.script + 2.51 real 0.34 user 0.45 sys +$ +#with patch and command_string ON. +$ sh stat.script + 2.37 real 0.35 user 0.34 sys +$ +The above uname is for a very current RELENG_6 FreeBSD. This was done + on a dual-xeon in 64-bit mode. HTT *IS* enabled. + +LER + +-- +Larry Rosenman http://www.lerctr.org/~ler +Phone: +1 512-248-2683 E-Mail: ler@lerctr.org +US Mail: 430 Valona Loop, Round Rock, TX 78681-3683 US + + +From pgsql-performance-owner@postgresql.org Thu Jun 15 05:16:11 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A19BE9FA4C1 + for ; + Thu, 15 Jun 2006 05:16:09 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 65507-04 for + ; + Thu, 15 Jun 2006 05:15:58 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from fw.greenpeace.org (fw.greenpeace.org [212.19.215.77]) + by postgresql.org (Postfix) with ESMTP id CC6879FA4A6 + for ; + Thu, 15 Jun 2006 05:15:55 -0300 (ADT) +Received: (from root@localhost) by fw.greenpeace.org (8.9.3c/8.6.12) id + KAA91604 for ; + Thu, 15 Jun 2006 10:15:53 +0200 (CEST) +Received: by fw.greenpeace.org (TUNIX/Firewall SMTP Server) + for id sma090309; + Thu, 15 Jun 06 10:14:32 +0200 +Received: from bb.nli.gl3 (root@localhost) + by bb.nli.gl3 (8.12.8/8.12.5) with SMTP id k5F8EWoH028077 + for ; Thu, 15 Jun 2006 10:14:32 +0200 +Received: from maila.greenpeace.org (fw.nli.gl3 [192.168.31.7]) + by bb.nli.gl3 (8.12.8/8.13.3) with ESMTP id k5F8EU7j028064; + Thu, 15 Jun 2006 10:14:30 +0200 +Received: from [192.168.200.143] (vpni.greenpeace.org [212.19.215.76]) + (authenticated (128 bits)) + by maila.greenpeace.org (8.13.4/8.11.6) with ESMTP id k5F8ENmW007804 + (using TLSv1/SSLv3 with cipher RC4-MD5 (128 bits) verified NO); + Thu, 15 Jun 2006 10:14:27 +0200 +Message-ID: <44911706.60204@superlativ.dk> +Date: Thu, 15 Jun 2006 10:15:02 +0200 +From: Nis Jorgensen +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: kah_hang_ang@toray.com.my +CC: "A. Kretschmer" , + pgsql-performance@postgresql.org +Subject: Re: Is it possible to start two instances of postgresql? +References: +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Anti-Virus: Kaspersky Anti-Virus for MailServers 5.5.2/RELEASE, + bases: 25072005 #131892, status: clean +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/297 +X-Sequence-Number: 19654 + +kah_hang_ang@toray.com.my wrote: + +> both of the two database are live but use for two different web app. +> my company don't want to spend more to buy a new server, so then I think of +> to implement both under the same server and one instance.. +> but then my superior don't want to do that way. +> they want to implement two databases in one server but if one of the +> database down it will not affect the other, so that's why I need to have +> two instances. + +We are currently running your suggestion (two instances of PG) in a +production server, with no obvious problems attributable to the setup +(we have seen some performance problems with one system, but those are +likely caused by bad db/application design). + +In our case the two systems are running different minor versions +(although we are planning to migrate them both to the latest 7.4.x). + +/Nis + + +From pgsql-performance-owner@postgresql.org Thu Jun 15 09:01:34 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B00F29FA5EA + for ; + Thu, 15 Jun 2006 09:01:33 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 90652-01 for + ; + Thu, 15 Jun 2006 09:01:27 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from q1exch01.Q1LABS.INC (Q1EXCH01.Q1Labs.com [205.174.165.4]) + by postgresql.org (Postfix) with ESMTP id 440519F9CAA + for ; + Thu, 15 Jun 2006 09:01:26 -0300 (ADT) +Received: from q1exch02.Q1LABS.INC ([10.100.50.8]) by q1exch01.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Thu, 15 Jun 2006 09:01:18 -0300 +Thread-Index: AcaQc2is59Ty4p6BRp+qgfkJJIpG3Q== +X-PMWin-Version: 2.5.0e, Antispam-Engine: 2.3.0.1, Antivirus-Engine: 2.34.3 +Received: from remedy ([10.100.100.123]) by q1exch02.Q1LABS.INC with Microsoft + SMTPSVC(6.0.3790.1830); Thu, 15 Jun 2006 09:01:17 -0300 +From: "jody brownell" +To: "Tom Lane" , + +Subject: Re: Postgres consuming way too much memory??? +Date: Thu, 15 Jun 2006 09:01:18 -0300 +User-Agent: KMail/1.8.3 +References: <200606141618.37849.jody.brownell@q1labs.com> + <3106.1150315380@sss.pgh.pa.us> +In-Reply-To: <3106.1150315380@sss.pgh.pa.us> +Content-class: urn:content-classes:message +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2663 +Importance: normal +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-ID: <200606150901.19201.jody.brownell@q1labs.com> +X-OriginalArrivalTime: 15 Jun 2006 12:01:17.0609 (UTC) + FILETIME=[68891190:01C69073] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/298 +X-Sequence-Number: 19655 + +Sorry about that, I was in a slight panic :) + +I am using postgresql 8.1.4. I will install 8.1.3 and see if the same behavior exists.. we +may have started seeing this in 8.1.3, but I dont think before. I will check some stability +machines for similar bloating. + +The query (calling a store proc) which is always running when the spiral begins is below. It simply performs +bulk linking of two objects. Depending on what the application is detecting, it could be called to insert +40 - 50k records, 500 at a time. When the box is healthy, this is a 200 - 500 ms op, but this starts to become +a 20000+ ms op. I guess this makes sense considering the paging..... + +Jun 14 12:50:18 xxx postgres[5649]: [3-1] LOG: duration: 20117.984 ms statement: EXECUTE [PREPARE: select * from link_attacker_targets($1, $2, $3) as + +CREATE OR REPLACE FUNCTION link_attacker_targets (p_attacker bigint, p_targets varchar, p_targets_size integer) + returns bigint[] as +$body$ +DECLARE + v_targets bigint[]; + v_target bigint; + v_returns bigint[]; + v_returns_size integer := 0; +BEGIN + v_targets := convert_string2bigint_array (p_targets, p_targets_size); + + FOR i IN 1..p_targets_size LOOP + v_target := v_targets[i]; + + BEGIN + INSERT into attacker_target_link (attacker_id, target_id) values (p_attacker, v_target); + v_returns_size := v_returns_size + 1; + v_returns[v_returns_size] := v_target; + + EXCEPTION WHEN unique_violation THEN + -- do nothing... app cache may be out of date. + END; + END LOOP; + RETURN v_returns; +END; +$body$ +LANGUAGE plpgsql VOLATILE CALLED ON NULL INPUT SECURITY INVOKER; + +On Wednesday 14 June 2006 17:03, you wrote: +> "jody brownell" writes: +> > 27116 postgres 15 0 1515m 901m 91m S 0.0 22.9 18:33.96 postgres: qradar qradar ::ffff:x.x.x.x(51149) idle +> +> This looks like a memory leak, but you haven't provided enough info to +> let someone else reproduce it. Can you log what your application is +> doing and extract a test case? What PG version is this, anyway? +> +> regards, tom lane +> +> +> + +From pgsql-performance-owner@postgresql.org Thu Jun 15 09:15:21 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 883D09F9CAA + for ; + Thu, 15 Jun 2006 09:15:21 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 90514-07 for + ; + Thu, 15 Jun 2006 09:15:11 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from q1exch01.Q1LABS.INC (Q1EXCH01.Q1Labs.com [205.174.165.4]) + by postgresql.org (Postfix) with ESMTP id 317AA9FA5BA + for ; + Thu, 15 Jun 2006 09:15:09 -0300 (ADT) +Received: from q1exch02.Q1LABS.INC ([10.100.50.8]) by q1exch01.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Thu, 15 Jun 2006 09:15:08 -0300 +Thread-Index: AcaQdVfH7ygW5TSCT4evw5j6qhV5Uw== +X-PMWin-Version: 2.5.0e, Antispam-Engine: 2.3.0.1, Antivirus-Engine: 2.34.3 +Received: from remedy ([10.100.100.123]) by q1exch02.Q1LABS.INC with Microsoft + SMTPSVC(6.0.3790.1830); Thu, 15 Jun 2006 09:15:08 -0300 +From: "jody brownell" +To: +Subject: Re: Postgres consuming way too much memory??? +Date: Thu, 15 Jun 2006 09:15:10 -0300 +User-Agent: KMail/1.8.3 +Cc: "Tom Lane" +References: <200606141618.37849.jody.brownell@q1labs.com> + <3106.1150315380@sss.pgh.pa.us> + <200606150901.19201.jody.brownell@q1labs.com> +Content-class: urn:content-classes:message +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2663 +Importance: normal +In-Reply-To: <200606150901.19201.jody.brownell@q1labs.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-ID: <200606150915.10306.jody.brownell@q1labs.com> +X-OriginalArrivalTime: 15 Jun 2006 12:15:08.0474 (UTC) + FILETIME=[57C501A0:01C69075] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/299 +X-Sequence-Number: 19656 + +The last version of postgres we had in production was 8.1.1 actually, not 8.1.3. + +So far, on my stability box and older production stability boxes I dont see the same behavior. + +I will install 8.1.1 on these boxes and see what I see. + +On Thursday 15 June 2006 09:01, jody brownell wrote: +> Sorry about that, I was in a slight panic :) +> +> I am using postgresql 8.1.4. I will install 8.1.3 and see if the same behavior exists.. we +> may have started seeing this in 8.1.3, but I dont think before. I will check some stability +> machines for similar bloating. +> +> The query (calling a store proc) which is always running when the spiral begins is below. It simply performs +> bulk linking of two objects. Depending on what the application is detecting, it could be called to insert +> 40 - 50k records, 500 at a time. When the box is healthy, this is a 200 - 500 ms op, but this starts to become +> a 20000+ ms op. I guess this makes sense considering the paging..... +> +> Jun 14 12:50:18 xxx postgres[5649]: [3-1] LOG: duration: 20117.984 ms statement: EXECUTE [PREPARE: select * from link_attacker_targets($1, $2, $3) as +> +> CREATE OR REPLACE FUNCTION link_attacker_targets (p_attacker bigint, p_targets varchar, p_targets_size integer) +> returns bigint[] as +> $body$ +> DECLARE +> v_targets bigint[]; +> v_target bigint; +> v_returns bigint[]; +> v_returns_size integer := 0; +> BEGIN +> v_targets := convert_string2bigint_array (p_targets, p_targets_size); +> +> FOR i IN 1..p_targets_size LOOP +> v_target := v_targets[i]; +> +> BEGIN +> INSERT into attacker_target_link (attacker_id, target_id) values (p_attacker, v_target); +> v_returns_size := v_returns_size + 1; +> v_returns[v_returns_size] := v_target; +> +> EXCEPTION WHEN unique_violation THEN +> -- do nothing... app cache may be out of date. +> END; +> END LOOP; +> RETURN v_returns; +> END; +> $body$ +> LANGUAGE plpgsql VOLATILE CALLED ON NULL INPUT SECURITY INVOKER; +> +> On Wednesday 14 June 2006 17:03, you wrote: +> > "jody brownell" writes: +> > > 27116 postgres 15 0 1515m 901m 91m S 0.0 22.9 18:33.96 postgres: qradar qradar ::ffff:x.x.x.x(51149) idle +> > +> > This looks like a memory leak, but you haven't provided enough info to +> > let someone else reproduce it. Can you log what your application is +> > doing and extract a test case? What PG version is this, anyway? +> > +> > regards, tom lane +> > +> > +> > +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: explain analyze is your friend +> + +From pgsql-performance-owner@postgresql.org Thu Jun 15 09:43:30 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D13249FA5BA + for ; + Thu, 15 Jun 2006 09:43:29 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 92926-07 for + ; + Thu, 15 Jun 2006 09:43:25 -0300 (ADT) +X-Greylist: delayed 00:26:50.033067 by SQLgrey- +Received: from calypso.bi.lt (calypso.bi.lt [213.226.153.10]) + by postgresql.org (Postfix) with ESMTP id EAD309F9CAA + for ; + Thu, 15 Jun 2006 09:43:25 -0300 (ADT) +Received: from calypso.bi.lt (localhost [127.0.0.1]) + by calypso.bi.lt (Postfix) with ESMTP id 355EF480B84 + for ; + Thu, 15 Jun 2006 15:16:33 +0300 (EEST) +Received: from B027543 (inet.bee.lt [213.226.131.30]) + by calypso.bi.lt (Postfix) with SMTP id 1DF63480A74 + for ; + Thu, 15 Jun 2006 15:16:33 +0300 (EEST) +Message-ID: <016401c69075$8a35e8c0$f20214ac@bite.lt> +From: "Mindaugas" +To: +Subject: How to analyze function performance +Date: Thu, 15 Jun 2006 15:16:32 +0300 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="windows-1257" +Content-Transfer-Encoding: 7bit +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 6.00.2800.1506 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/300 +X-Sequence-Number: 19657 + + + Hello, + + Is it possible to somehow analyze function performance? E.g. +we are using function cleanup() which takes obviously too much time +to execute but I have problems trying to figure what is slowing things +down. + + When I explain analyze function lines step by step it show quite +acceptable performance. + + PostgreSQL 8.0 is running on two dual core Opterons. + + Thanks, + + Mindaugas + + +From pgsql-performance-owner@postgresql.org Thu Jun 15 10:03:42 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0340A9FA5BA + for ; + Thu, 15 Jun 2006 10:03:42 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 96043-03 for + ; + Thu, 15 Jun 2006 10:03:32 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from zeus.gigaweb.cz (zeus.gigaweb.cz [81.0.236.19]) + by postgresql.org (Postfix) with SMTP id 0B5219F9CAA + for ; + Thu, 15 Jun 2006 10:03:31 -0300 (ADT) +Received: (qmail 16212 invoked from network); 15 Jun 2006 13:03:28 -0000 +Received: from unknown (HELO ?192.168.1.101?) (89.102.195.181) + by 0 with SMTP; 15 Jun 2006 13:03:28 -0000 +Message-ID: <44915A9D.6090407@fuzzy.cz> +Date: Thu, 15 Jun 2006 15:03:25 +0200 +From: Tomas Vondra +User-Agent: Mail/News 1.5 (X11/20060424) +MIME-Version: 1.0 +To: Mindaugas +CC: pgsql-performance@postgresql.org +Subject: Re: How to analyze function performance +References: <016401c69075$8a35e8c0$f20214ac@bite.lt> +In-Reply-To: <016401c69075$8a35e8c0$f20214ac@bite.lt> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=windows-1257 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/301 +X-Sequence-Number: 19658 + +It depends what is the purpose of the function. If it's mainly a +container for a heap of SQL queries along with some simple IF, ELSE +etc. then I use two simple ways to analyze the performance (or lack +of performance): + +1) I use a lot of debug messages + +2) I print out all SQL and the execute EXPLAIN / EXPLAIN ANALYZE on them + +If the function is mainly a computation of something, it's usually nice +to try to use for example C language, as it's much faster than PL/pgSQL +for this type of functions. + +But it depends on what you are trying to do in that function ... + +Tomas + +> Hello, +> +> Is it possible to somehow analyze function performance? E.g. +> we are using function cleanup() which takes obviously too much time +> to execute but I have problems trying to figure what is slowing things +> down. +> +> When I explain analyze function lines step by step it show quite +> acceptable performance. +> +> PostgreSQL 8.0 is running on two dual core Opterons. +> +> Thanks, +> +> Mindaugas + +From pgsql-performance-owner@postgresql.org Thu Jun 15 11:24:14 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B79019FA5BA + for ; + Thu, 15 Jun 2006 11:24:13 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 01178-08 for + ; + Thu, 15 Jun 2006 11:24:08 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 5436C9F9CAA + for ; + Thu, 15 Jun 2006 11:24:08 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5FEO4UF027706; + Thu, 15 Jun 2006 10:24:04 -0400 (EDT) +To: "Mindaugas" +cc: pgsql-performance@postgresql.org +Subject: Re: How to analyze function performance +In-reply-to: <016401c69075$8a35e8c0$f20214ac@bite.lt> +References: <016401c69075$8a35e8c0$f20214ac@bite.lt> +Comments: In-reply-to "Mindaugas" + message dated "Thu, 15 Jun 2006 15:16:32 +0300" +Date: Thu, 15 Jun 2006 10:24:04 -0400 +Message-ID: <27705.1150381444@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/302 +X-Sequence-Number: 19659 + +"Mindaugas" writes: +> Is it possible to somehow analyze function performance? E.g. +> we are using function cleanup() which takes obviously too much time +> to execute but I have problems trying to figure what is slowing things +> down. + +> When I explain analyze function lines step by step it show quite +> acceptable performance. + +Are you sure you are "explain analyze"ing the same queries the function +is really doing? You have to account for the fact that what plpgsql is +issuing is parameterized queries, and sometimes that limits the +planner's ability to pick a good plan. For instance, if you have + + declare x int; + begin + ... + for r in select * from foo where key = x loop ... + +then what is really getting planned and executed is "select * from foo +where key = $1" --- every plpgsql variable gets replaced by a parameter +symbol "$n". You can model this for EXPLAIN purposes with a prepared +statement: + + prepare p1(int) as select * from foo where key = $1; + explain analyze execute p1(42); + +If you find out that a particular query really sucks when parameterized, +you can work around this by using EXECUTE to force the query to be +planned afresh on each use with literal constants instead of parameters: + + for r in execute 'select * from foo where key = ' || x loop ... + +The replanning takes extra time, though, so don't do this except where +you've specifically proved there's a need. + +BTW, be careful to use quote_literal() when needed in queries built as +strings, else you'll have bugs and maybe even security problems. + + regards, tom lane + +From pgsql-hackers-owner@postgresql.org Thu Jun 15 11:27:40 2006 +X-Original-To: pgsql-hackers-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 80FB79FA5EA + for ; + Thu, 15 Jun 2006 11:27:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 02354-09 for + ; + Thu, 15 Jun 2006 11:27:36 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 358839FA5BA + for ; + Thu, 15 Jun 2006 11:27:36 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5FERXJQ027746; + Thu, 15 Jun 2006 10:27:33 -0400 (EDT) +To: "Qingqing Zhou" +cc: pgsql-hackers@postgresql.org +Subject: Re: Test request for Stats collector performance improvement +In-reply-to: +References: <200601021840.k02Ieed21704@candle.pha.pa.us> + <200606150405.k5F45cH11445@candle.pha.pa.us> + +Comments: In-reply-to "Qingqing Zhou" + message dated "Thu, 15 Jun 2006 14:09:43 +0800" +Date: Thu, 15 Jun 2006 10:27:33 -0400 +Message-ID: <27745.1150381653@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/746 +X-Sequence-Number: 84979 + +"Qingqing Zhou" writes: +> Obviously it matches your expectation. + +Hm? I don't see any improvement there: + +> --Before patch -- +> real 0m1.149s +> real 0m1.121s +> real 0m1.128s + +> -- After patch -- +> real 0m1.275s +> real 0m4.063s +> real 0m1.259s + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jun 15 12:04:15 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 34F1E9F9CAA + for ; + Thu, 15 Jun 2006 12:04:14 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 09631-01 for + ; + Thu, 15 Jun 2006 12:04:05 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id 7209C9FA5BA + for ; + Thu, 15 Jun 2006 12:04:04 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id A26EC3093C; Thu, 15 Jun 2006 17:04:03 +0200 (MET DST) +From: Chris Browne +X-Newsgroups: pgsql.performance +Subject: Re: Is it possible to start two instances of postgresql? +Date: Thu, 15 Jun 2006 11:01:51 -0400 +Organization: cbbrowne Computing Inc +Lines: 26 +Message-ID: <60mzcetqcg.fsf@dba2.int.libertyrms.com> +References: +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@news.hub.org +User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.19 (linux) +Cancel-Lock: sha1:9wyS6gkrhlOfvtWG1jSRVuuoRbE= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/304 +X-Sequence-Number: 19661 + +kah_hang_ang@toray.com.my writes: +> Is it possible to start two instances of postgresql with different port and +> directory which run simultaneously? + +Certainly. We have one HACMP cluster which hosts 14 PostgreSQL +instances across two physical boxes. (If one went down, they'd all +migrate to the survivor...) + +> If can then will this cause any problem or performance drop down? + +There certainly can be; the databases will be sharing disks, memory, +and CPUs, so if they are avidly competing for resources, the +competition is sure to have some impact on performance. + +Flip side: That 14 database cluster has several databases that are +known to be very lightly used; they *aren't* competing, and aren't a +problem. + +Consider it obvious that if you haven't enough memory or I/O bandwidth +to cover your two PG instances, you'll find performance sucks... If +you have enough, then it can work fine... +-- +select 'cbbrowne' || '@' || 'acm.org'; +http://cbbrowne.com/info/linuxxian.html +"At Microsoft, it doesn't matter which file you're compiling, only +which flags you #define." -- Colin Plumb + +From pgsql-performance-owner@postgresql.org Thu Jun 15 12:03:01 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 361DE9FA646 + for ; + Thu, 15 Jun 2006 12:03:01 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 08323-05 for + ; + Thu, 15 Jun 2006 12:02:52 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from q1exch01.Q1LABS.INC (Q1EXCH01.Q1Labs.com [205.174.165.4]) + by postgresql.org (Postfix) with ESMTP id 85FEF9FA5EA + for ; + Thu, 15 Jun 2006 12:02:51 -0300 (ADT) +Received: from q1exch02.Q1LABS.INC ([10.100.50.8]) by q1exch01.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Thu, 15 Jun 2006 12:02:49 -0300 +X-PMWin-Version: 2.5.0e, Antispam-Engine: 2.3.0.1, Antivirus-Engine: 2.34.3 +Thread-Index: AcaQjMRbQ2Z5RgguQ667w5rdZSgw6g== +Received: from remedy ([10.100.100.123]) by q1exch02.Q1LABS.INC with Microsoft + SMTPSVC(6.0.3790.1830); Thu, 15 Jun 2006 12:02:48 -0300 +From: "jody brownell" +To: +Subject: Re: Postgres consuming way too much memory??? +Date: Thu, 15 Jun 2006 12:02:50 -0300 +Content-class: urn:content-classes:message +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2663 +Importance: normal +User-Agent: KMail/1.8.3 +Cc: "Tom Lane" +References: <200606141618.37849.jody.brownell@q1labs.com> + <200606150901.19201.jody.brownell@q1labs.com> + <200606150915.10306.jody.brownell@q1labs.com> +In-Reply-To: <200606150915.10306.jody.brownell@q1labs.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-ID: <200606151202.50939.jody.brownell@q1labs.com> +X-OriginalArrivalTime: 15 Jun 2006 15:02:48.0983 (UTC) + FILETIME=[C44CDA70:01C6908C] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/303 +X-Sequence-Number: 19660 + +Some more information... + +When postgresql starts to go into this bloating state, I can only make it happen from my java app. +If I simultaneously perform insert of 10million rows into another table, it behaves as expected, but +the postgresql process handling the java connection slows down and bloats. + +This leads me to think it has something to do with either the long lived connection. I am using +dbcp jdbc pool from jakarta OR I am trigger this behavior with something I am doing in the link +routine I sent earlier. + +I am going to try closing the connection after each TX to see if this resolves it for now. If not, I will write +a java app, stored procedure (table etc) reproduce it without our application. + +Oh yeah, it is when I use about have of my swap, dstat starts reporting heavy paging, memory climbs very quickly. + + + +On Thursday 15 June 2006 09:15, jody brownell wrote: +> The last version of postgres we had in production was 8.1.1 actually, not 8.1.3. +> +> So far, on my stability box and older production stability boxes I dont see the same behavior. +> +> I will install 8.1.1 on these boxes and see what I see. +> +> On Thursday 15 June 2006 09:01, jody brownell wrote: +> > Sorry about that, I was in a slight panic :) +> > +> > I am using postgresql 8.1.4. I will install 8.1.3 and see if the same behavior exists.. we +> > may have started seeing this in 8.1.3, but I dont think before. I will check some stability +> > machines for similar bloating. +> > +> > The query (calling a store proc) which is always running when the spiral begins is below. It simply performs +> > bulk linking of two objects. Depending on what the application is detecting, it could be called to insert +> > 40 - 50k records, 500 at a time. When the box is healthy, this is a 200 - 500 ms op, but this starts to become +> > a 20000+ ms op. I guess this makes sense considering the paging..... +> > +> > Jun 14 12:50:18 xxx postgres[5649]: [3-1] LOG: duration: 20117.984 ms statement: EXECUTE [PREPARE: select * from link_attacker_targets($1, $2, $3) as +> > +> > CREATE OR REPLACE FUNCTION link_attacker_targets (p_attacker bigint, p_targets varchar, p_targets_size integer) +> > returns bigint[] as +> > $body$ +> > DECLARE +> > v_targets bigint[]; +> > v_target bigint; +> > v_returns bigint[]; +> > v_returns_size integer := 0; +> > BEGIN +> > v_targets := convert_string2bigint_array (p_targets, p_targets_size); +> > +> > FOR i IN 1..p_targets_size LOOP +> > v_target := v_targets[i]; +> > +> > BEGIN +> > INSERT into attacker_target_link (attacker_id, target_id) values (p_attacker, v_target); +> > v_returns_size := v_returns_size + 1; +> > v_returns[v_returns_size] := v_target; +> > +> > EXCEPTION WHEN unique_violation THEN +> > -- do nothing... app cache may be out of date. +> > END; +> > END LOOP; +> > RETURN v_returns; +> > END; +> > $body$ +> > LANGUAGE plpgsql VOLATILE CALLED ON NULL INPUT SECURITY INVOKER; +> > +> > On Wednesday 14 June 2006 17:03, you wrote: +> > > "jody brownell" writes: +> > > > 27116 postgres 15 0 1515m 901m 91m S 0.0 22.9 18:33.96 postgres: qradar qradar ::ffff:x.x.x.x(51149) idle +> > > +> > > This looks like a memory leak, but you haven't provided enough info to +> > > let someone else reproduce it. Can you log what your application is +> > > doing and extract a test case? What PG version is this, anyway? +> > > +> > > regards, tom lane +> > > +> > > +> > > +> > +> > ---------------------------(end of broadcast)--------------------------- +> > TIP 6: explain analyze is your friend +> > +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 3: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq +> + +From pgsql-performance-owner@postgresql.org Thu Jun 15 12:34:52 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 068349FA5BA + for ; + Thu, 15 Jun 2006 12:34:52 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 09509-07 for + ; + Thu, 15 Jun 2006 12:34:42 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 20AFE9F9CAA + for ; + Thu, 15 Jun 2006 12:34:41 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5FFYdLO028322; + Thu, 15 Jun 2006 11:34:39 -0400 (EDT) +To: "jody brownell" +cc: pgsql-performance@postgresql.org +Subject: Re: Postgres consuming way too much memory??? +In-reply-to: <200606151202.50939.jody.brownell@q1labs.com> +References: <200606141618.37849.jody.brownell@q1labs.com> + <200606150901.19201.jody.brownell@q1labs.com> + <200606150915.10306.jody.brownell@q1labs.com> + <200606151202.50939.jody.brownell@q1labs.com> +Comments: In-reply-to "jody brownell" + message dated "Thu, 15 Jun 2006 12:02:50 -0300" +Date: Thu, 15 Jun 2006 11:34:39 -0400 +Message-ID: <28321.1150385679@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/305 +X-Sequence-Number: 19662 + +"jody brownell" writes: +> When postgresql starts to go into this bloating state, I can only make it happen from my java app. + +That's interesting. The JDBC driver uses protocol features that aren't +used by psql, so it's possible that the leak is triggered by one of +those features. I wouldn't worry too much about duplicating the problem +from psql anyway --- a Java test case will do fine. + +> I am going to try closing the connection after each TX to see if this +> resolves it for now. If not, I will write a java app, stored procedure +> (table etc) reproduce it without our application. + +Even if that works around it for you, please pursue getting a test case +together so we can find and fix the underlying problem. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jun 15 12:44:20 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 29DB99FA5BA + for ; + Thu, 15 Jun 2006 12:44:20 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 11388-09 for + ; + Thu, 15 Jun 2006 12:44:10 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 88FAF9F9CAA + for ; + Thu, 15 Jun 2006 12:44:09 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5FFi8Bo028420; + Thu, 15 Jun 2006 11:44:08 -0400 (EDT) +To: "jody brownell" +cc: pgsql-performance@postgresql.org +Subject: Re: Postgres consuming way too much memory??? +In-reply-to: <200606150901.19201.jody.brownell@q1labs.com> +References: <200606141618.37849.jody.brownell@q1labs.com> + <3106.1150315380@sss.pgh.pa.us> + <200606150901.19201.jody.brownell@q1labs.com> +Comments: In-reply-to "jody brownell" + message dated "Thu, 15 Jun 2006 09:01:18 -0300" +Date: Thu, 15 Jun 2006 11:44:08 -0400 +Message-ID: <28419.1150386248@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/306 +X-Sequence-Number: 19663 + +"jody brownell" writes: +> BEGIN +> INSERT into attacker_target_link (attacker_id, target_id) values (p_attacker, v_target); +> v_returns_size := v_returns_size + 1; +> v_returns[v_returns_size] := v_target; + +> EXCEPTION WHEN unique_violation THEN +> -- do nothing... app cache may be out of date. +> END; + +Hmm. There is a known problem that plpgsql leaks some memory when +catching an exception: +http://archives.postgresql.org/pgsql-hackers/2006-02/msg00885.php + +So if your problem case involves a whole lot of duplicates then that +could explain the initial bloat. However, AFAIK that leakage is in +a transaction-local memory context, so the space ought to be freed at +transaction end. And Linux's malloc does know about giving space back +to the kernel (unlike some platforms). So I'm not sure why you're +seeing persistent bloat. + +Can you rewrite the function to not use an EXCEPTION block (perhaps +a separate SELECT probe for each row --- note this won't be reliable +if there are concurrent processes making insertions)? If so, does +that fix the problem? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jun 15 12:50:18 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5F7099FA5BA + for ; + Thu, 15 Jun 2006 12:50:18 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 14396-01 for + ; + Thu, 15 Jun 2006 12:50:08 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 009F69F9CAA + for ; + Thu, 15 Jun 2006 12:50:07 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id E5E0456457; Thu, 15 Jun 2006 10:50:01 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Thu, 15 Jun 2006 10:50:00 -0500 +Date: Thu, 15 Jun 2006 10:50:00 -0500 +From: "Jim C. Nasby" +To: Tom Lane +Cc: Shaun Thomas , + pgsql-performance@postgresql.org +Subject: Re: Confirmation of bad query plan generated by 7.4 +Message-ID: <20060615155000.GJ34196@pervasive.com> +References: <9119.1150222168@sss.pgh.pa.us> + <448EDFC4.8F27.00A9.0@leapfrogonline.com> + <20060613211347.GB34196@pervasive.com> + <10918.1150236282@sss.pgh.pa.us> + <20060613223950.GK34196@pervasive.com> + <18667.1150249849@sss.pgh.pa.us> + + <16554.1150339015@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <16554.1150339015@sss.pgh.pa.us> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060615:tgl@sss.pgh.pa.us::tL1/3iGfzHCTNyBX:00000000000000000000 + 0000000000000000000000003Rkq +X-Hashcash: + 1:20:060615:sthomas@leapfrogonline.com::3aceqIZlepcP6lsl:00000000000 + 0000000000000000000000001aXn +X-Hashcash: + 1:20:060615:pgsql-performance@postgresql.org::ac/GbZvL/Cfpi9F+:00000 + 000000000000000000000000DLKB +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/307 +X-Sequence-Number: 19664 + +On Wed, Jun 14, 2006 at 10:36:55PM -0400, Tom Lane wrote: +> Jim Nasby writes: +> > On Jun 13, 2006, at 8:50 PM, Tom Lane wrote: +> >> Hmm ... worksforme. Could you provide a complete test case? +> +> > decibel=# create table date_test(d date not null, i int not null); +> > [etc] +> +> Not sure what you are driving at. The estimates are clearly not +> defaults (the default estimate would be 1/3rd of the table, or +> about 100mil rows). Are you expecting them to be the same? If so why? +> The comparison values are slightly different after all. + +Yes... I was expecting that since we're looking at a date field that the +timestamp would get cast to a date. Sorry I wasn't clear on that... +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Thu Jun 15 12:54:33 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D4DEA9FA5BA + for ; + Thu, 15 Jun 2006 12:54:32 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 15314-02 for + ; + Thu, 15 Jun 2006 12:54:23 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 1E8DB9F9CAA + for ; + Thu, 15 Jun 2006 12:54:22 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 9A2A256475; Thu, 15 Jun 2006 10:54:21 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Thu, 15 Jun 2006 10:54:20 -0500 +Date: Thu, 15 Jun 2006 10:54:20 -0500 +From: "Jim C. Nasby" +To: "Jonah H. Harris" +Cc: Greg Stark , Mark Lewis , + Dan Gorman , pgsql-performance@postgresql.org +Subject: Re: Postgres fsync off (not needed) with NetApp +Message-ID: <20060615155420.GK34196@pervasive.com> +References: <9A377C54-361D-4F01-BF7A-7632FBA3453C@hi5.com> + <1150322085.31200.39.camel@archimedes> + <873be7ay8u.fsf@stark.xeocode.com> + <36e682920606142214i6a6532f3k1a895a784f7b16dc@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <36e682920606142214i6a6532f3k1a895a784f7b16dc@mail.gmail.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060615:jonah.harris@gmail.com::wtcCzDPceckKqhjb:000000000000000 + 00000000000000000000000041Kv +X-Hashcash: 1:20:060615:gsstark@mit.edu::2n8kW7z1OmRymRJV:001NWB +X-Hashcash: + 1:20:060615:mark.lewis@mir3.com::THeZxH9LHu6zJ/+2:000000000000000000 + 00000000000000000000000042I1 +X-Hashcash: 1:20:060615:dgorman@hi5.com::x8zjZvWoXQ27GChe:005xA5 +X-Hashcash: + 1:20:060615:pgsql-performance@postgresql.org::QouyWI9dyU16Fyu6:00000 + 00000000000000000000000002yG +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/308 +X-Sequence-Number: 19665 + +On Thu, Jun 15, 2006 at 01:14:26AM -0400, Jonah H. Harris wrote: +> On 14 Jun 2006 23:33:53 -0400, Greg Stark wrote: +> >In fact the benefit of the NVRAM is precisely that it makes sure you +> >*don't* +> >have any reason to turn fsync off. It should make the fsync essentially +> >free. +> +> Having run PostgreSQL on a NetApp with input from NetApp, this is +> correct. fsync should be turned on, but you will not incur the *real* +> direct-to-disk cost of the sync, it will be direct-to-NVRAM. + +Just so there's no confusion... this applies to any caching RAID +controller as well. You just need to ensure that the cache in the +controller absolutely will not be lost in the event of a power failure +or what-have-you. On most controllers this is accomplished with a simple +battery backup; I don't know if the higher-end stuff takes further steps +(such as flashing the cache contents to flash memory on a power +failure). +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-hackers-owner@postgresql.org Thu Jun 15 12:57:51 2006 +X-Original-To: pgsql-hackers-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B962C9FA5BA + for ; + Thu, 15 Jun 2006 12:57:50 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 16056-01 for + ; + Thu, 15 Jun 2006 12:57:40 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from candle.pha.pa.us (candle.pha.pa.us [70.90.9.53]) + by postgresql.org (Postfix) with ESMTP id 5C7C79F9CAA + for ; + Thu, 15 Jun 2006 12:57:40 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id k5FFva918328; + Thu, 15 Jun 2006 11:57:36 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200606151557.k5FFva918328@candle.pha.pa.us> +Subject: Re: Test request for Stats collector performance improvement +In-Reply-To: <27745.1150381653@sss.pgh.pa.us> +To: Tom Lane +Date: Thu, 15 Jun 2006 11:57:36 -0400 (EDT) +CC: Qingqing Zhou , pgsql-hackers@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/749 +X-Sequence-Number: 84982 + +Tom Lane wrote: +> "Qingqing Zhou" writes: +> > Obviously it matches your expectation. +> +> Hm? I don't see any improvement there: +> +> > --Before patch -- +> > real 0m1.149s +> > real 0m1.121s +> > real 0m1.128s +> +> > -- After patch -- +> > real 0m1.275s +> > real 0m4.063s +> > real 0m1.259s + +The report is incomplete. I need three outputs: + + stats off + stats on + stats on, patched + +He only reported two sets of results. + +-- + Bruce Momjian http://candle.pha.pa.us + EnterpriseDB http://www.enterprisedb.com + + + If your life is a hard drive, Christ can be your backup. + + +From pgsql-performance-owner@postgresql.org Thu Jun 15 12:59:41 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DF5259F9CAA + for ; + Thu, 15 Jun 2006 12:59:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 15993-02 for + ; + Thu, 15 Jun 2006 12:59:31 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id B0F829FA160 + for ; + Thu, 15 Jun 2006 12:59:31 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id CA4915647A; Thu, 15 Jun 2006 10:59:30 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Thu, 15 Jun 2006 10:59:29 -0500 +Date: Thu, 15 Jun 2006 10:59:29 -0500 +From: "Jim C. Nasby" +To: Zoltan Boszormenyi +Cc: Volkan YAZICI , pgsql-performance@postgresql.org +Subject: Re: Precomputed constants? +Message-ID: <20060615155929.GL34196@pervasive.com> +References: <3167.213.163.11.81.1150282434.squirrel@www.dunaweb.hu> + <20060614110713.GA2277@alamut.tdm.local> + <3861.213.163.11.81.1150284610.squirrel@www.dunaweb.hu> + <20060614151804.GB34196@pervasive.com> <4490E286.90004@dunaweb.hu> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <4490E286.90004@dunaweb.hu> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060615:zboszor@dunaweb.hu::sl6sib0Tto5qFgf8:0000000000000000000 + 0000000000000000000000004Z+R +X-Hashcash: + 1:20:060615:yazicivo@ttnet.net.tr::9tMy5O751ZtoAoT/:0000000000000000 + 0000000000000000000000001KzZ +X-Hashcash: + 1:20:060615:pgsql-performance@postgresql.org::27X7pg5EEE3Cob6f:00000 + 0000000000000000000000004KrU +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/309 +X-Sequence-Number: 19666 + +On Thu, Jun 15, 2006 at 06:31:02AM +0200, Zoltan Boszormenyi wrote: +> Jim C. Nasby ?rta: +> >On Wed, Jun 14, 2006 at 01:30:10PM +0200, B?sz?rm?nyi Zolt?n wrote: +> > +> >>Replacing random() with a true constant gives me index scan +> >>even if it's hidden inside other function calls. E.g.: +> >> +> > +> >The database has no choice but to compute random() for every row; it's +> >marked VOLATILE. +> > +> +> I see now, docs about CREATE FUNCTION mentions random(), +> currval() and timeofday() as examples for VOLATILE. +> But where in the documentation can I find this info about all +> built-in functions? Thanks. + +No, but you can query pg_proc for that info. The docs should have info +about that table. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Thu Jun 15 13:12:46 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 110259FA5BE + for ; + Thu, 15 Jun 2006 13:12:46 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 17782-02 for + ; + Thu, 15 Jun 2006 13:12:41 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from q1exch01.Q1LABS.INC (Q1EXCH01.Q1Labs.com [205.174.165.4]) + by postgresql.org (Postfix) with ESMTP id 481D89FA13E + for ; + Thu, 15 Jun 2006 13:12:40 -0300 (ADT) +Received: from q1exch02.Q1LABS.INC ([10.100.50.8]) by q1exch01.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Thu, 15 Jun 2006 13:12:40 -0300 +X-PMWin-Version: 2.5.0e, Antispam-Engine: 2.3.0.1, Antivirus-Engine: 2.34.3 +Thread-Index: AcaQloYrzViJVVDlTGSZr1Pf6S7x3g== +Received: from q1corp034.q1labs.inc ([10.100.45.52]) by q1exch02.Q1LABS.INC + with Microsoft SMTPSVC(6.0.3790.1830); + Thu, 15 Jun 2006 13:12:39 -0300 +From: "jody brownell" +To: "Tom Lane" +Subject: Re: Postgres consuming way too much memory??? +Date: Thu, 15 Jun 2006 13:12:37 -0300 +Content-class: urn:content-classes:message +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2663 +Importance: normal +User-Agent: KMail/1.8.3 +Cc: +References: <200606141618.37849.jody.brownell@q1labs.com> + <200606150901.19201.jody.brownell@q1labs.com> + <28419.1150386248@sss.pgh.pa.us> +In-Reply-To: <28419.1150386248@sss.pgh.pa.us> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-ID: <200606151312.37853.jody.brownell@q1labs.com> +X-OriginalArrivalTime: 15 Jun 2006 16:12:39.0617 (UTC) + FILETIME=[861CDB10:01C69096] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/310 +X-Sequence-Number: 19667 + +Tom - that make sense... and fits the timeline of when the instability may have been introduced. + +I use soft references in java to track these relationships. When the GC needs memory it will collect +objects referenced by soft references so I need to have this exception caught where my caches may get cleaned. + +When the system is under load as it would be in this case, there references would be cleaned causing a large +number of exceptions in the pgplsql, subsequently causing the leak... hence the swift downward spiral. + +The previous version of these routines used selects but due to volume of selects, performance suffered quite +a bit. I dont think I could revert now for production use... closing the connection maybe the workaround for +us for this release IF this is in fact what the problem is. Unfortunatly, I use the catch in about 20 similar +routines to reset sequences etc.... this may be painful :( + +I will modify the routine to help isolate the problem. stay tuned. + +BTW - the fix you mentioned .... is that targeted for 8.2? Is there a timeline for 8.2? + +On Thursday 15 June 2006 12:44, Tom Lane wrote: +> "jody brownell" writes: +> > BEGIN +> > INSERT into attacker_target_link (attacker_id, target_id) values (p_attacker, v_target); +> > v_returns_size := v_returns_size + 1; +> > v_returns[v_returns_size] := v_target; +> +> > EXCEPTION WHEN unique_violation THEN +> > -- do nothing... app cache may be out of date. +> > END; +> +> Hmm. There is a known problem that plpgsql leaks some memory when +> catching an exception: +> http://archives.postgresql.org/pgsql-hackers/2006-02/msg00885.php +> +> So if your problem case involves a whole lot of duplicates then that +> could explain the initial bloat. However, AFAIK that leakage is in +> a transaction-local memory context, so the space ought to be freed at +> transaction end. And Linux's malloc does know about giving space back +> to the kernel (unlike some platforms). So I'm not sure why you're +> seeing persistent bloat. +> +> Can you rewrite the function to not use an EXCEPTION block (perhaps +> a separate SELECT probe for each row --- note this won't be reliable +> if there are concurrent processes making insertions)? If so, does +> that fix the problem? +> +> regards, tom lane +> +> +> + +From pgsql-performance-owner@postgresql.org Thu Jun 15 13:18:43 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 114089FA5BE + for ; + Thu, 15 Jun 2006 13:18:42 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 17398-02 for + ; + Thu, 15 Jun 2006 13:18:29 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id B9B4D9FA13E + for ; + Thu, 15 Jun 2006 13:18:28 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5FGIQLj028744; + Thu, 15 Jun 2006 12:18:26 -0400 (EDT) +To: "jody brownell" +cc: pgsql-performance@postgresql.org +Subject: Re: Postgres consuming way too much memory??? +In-reply-to: <200606151312.37853.jody.brownell@q1labs.com> +References: <200606141618.37849.jody.brownell@q1labs.com> + <200606150901.19201.jody.brownell@q1labs.com> + <28419.1150386248@sss.pgh.pa.us> + <200606151312.37853.jody.brownell@q1labs.com> +Comments: In-reply-to "jody brownell" + message dated "Thu, 15 Jun 2006 13:12:37 -0300" +Date: Thu, 15 Jun 2006 12:18:26 -0400 +Message-ID: <28743.1150388306@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/311 +X-Sequence-Number: 19668 + +"jody brownell" writes: +> BTW - the fix you mentioned .... is that targeted for 8.2? Is there a timeline for 8.2? + +There is no fix as yet, but it's on the radar screen to fix for 8.2. + +We expect 8.2 will go beta towards the end of summer (I forget whether +Aug 1 or Sep 1 is the target). + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jun 15 13:22:53 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 282649FA5BE + for ; + Thu, 15 Jun 2006 13:22:52 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 17900-07 for + ; + Thu, 15 Jun 2006 13:22:37 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) + by postgresql.org (Postfix) with ESMTP id 221479FA13E + for ; + Thu, 15 Jun 2006 13:22:36 -0300 (ADT) +Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) + by yertle.kcilink.com (Postfix) with ESMTP id BE376B80D + for ; + Thu, 15 Jun 2006 12:22:32 -0400 (EDT) +Mime-Version: 1.0 (Apple Message framework v750) +In-Reply-To: <1150221760.12191.25.camel@amd64-gentoo-laptop> +References: <1150221760.12191.25.camel@amd64-gentoo-laptop> +Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-4-282660335; + protocol="application/pkcs7-signature" +Message-Id: <83797745-D8D0-4748-BD9C-A87105B0754E@khera.org> +From: Vivek Khera +Subject: Re: Which processor runs better for Postgresql? +Date: Thu, 15 Jun 2006 12:22:31 -0400 +To: "Pgsql-Performance ((E-mail))" +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/312 +X-Sequence-Number: 19669 + + +--Apple-Mail-4-282660335 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=US-ASCII; + delsp=yes; + format=flowed + + +On Jun 13, 2006, at 2:02 PM, Steve Poe wrote: + +> +> Can anyone share what their experience has been with Intel's dual core +> CPUs and/or Dell's new servers? + +I'm one of the few Dell fans around here... but I must say that I +don't buy them for my big DB servers specifically since they don't +currently ship Opteron based systems. (I did call and thank my sales +rep for pushing my case for them to do Opterons, though, since I'm +sure they are doing it as a personal favor to me :-) ) + +I just put up a pentium-D dual-core based system and it is pretty +wickedly fast. it only has a pair of SATA drives on it and is used +for pre-production testing. + +> +> I am hoping the client is willing to wait for Dell to ship a AMD +> Opeteron-based server. + +Don't wait. It will be *months* before that happens. Go get a Sun +X4100 and an external RAID array and be happy. These boxes are an +amazing work of engineering. + + +--Apple-Mail-4-282660335 +Content-Transfer-Encoding: base64 +Content-Type: application/pkcs7-signature; + name=smime.p7s +Content-Disposition: attachment; + filename=smime.p7s + +MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGlDCCAz8w +ggKooAMCAQICAQ0wDQYJKoZIhvcNAQEFBQAwgdExCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0 +ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEaMBgGA1UEChMRVGhhd3RlIENvbnN1bHRpbmcx +KDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2aXNpb24xJDAiBgNVBAMTG1RoYXd0 +ZSBQZXJzb25hbCBGcmVlbWFpbCBDQTErMCkGCSqGSIb3DQEJARYccGVyc29uYWwtZnJlZW1haWxA +dGhhd3RlLmNvbTAeFw0wMzA3MTcwMDAwMDBaFw0xMzA3MTYyMzU5NTlaMGIxCzAJBgNVBAYTAlpB +MSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUg +UGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA +xKY8VXNV+065yplaHmjAdQRwnd/p/6Me7L3N9VvyGna9fww6YfK/Uc4B1OVQCjDXAmNaLIkVcI7d +yfArhVqqP3FWy688Cwfn8R+RNiQqE88r1fOCdz0Dviv+uxg+B79AgAJk16emu59l0cUqVIUPSAR/ +p7bRPGEEQB5kGXJgt/sCAwEAAaOBlDCBkTASBgNVHRMBAf8ECDAGAQH/AgEAMEMGA1UdHwQ8MDow +OKA2oDSGMmh0dHA6Ly9jcmwudGhhd3RlLmNvbS9UaGF3dGVQZXJzb25hbEZyZWVtYWlsQ0EuY3Js +MAsGA1UdDwQEAwIBBjApBgNVHREEIjAgpB4wHDEaMBgGA1UEAxMRUHJpdmF0ZUxhYmVsMi0xMzgw +DQYJKoZIhvcNAQEFBQADgYEASIzRUIPqCy7MDaNmrGcPf6+svsIXoUOWlJ1/TCG4+DYfqi2fNi/A +9BxQIJNwPP2t4WFiw9k6GX6EsZkbAMUaC4J0niVQlGLH2ydxVyWN3amcOY6MIE9lX5Xa9/eH1sYI +Tq726jTlEBpbNU1341YheILcIRk13iSx0x1G/11fZU8wggNNMIICtqADAgECAhA6sDoA4m3lcimf +yUtGSQgmMA0GCSqGSIb3DQEBBAUAMGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQKExxUaGF3dGUgQ29u +c3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVyc29uYWwgRnJlZW1haWwgSXNz +dWluZyBDQTAeFw0wNjA1MDIxNDEyNDdaFw0wNzA1MDIxNDEyNDdaMIGKMR8wHQYDVQQDExZUaGF3 +dGUgRnJlZW1haWwgTWVtYmVyMR4wHAYJKoZIhvcNAQkBFg92aXZla0BraGVyYS5vcmcxIDAeBgkq +hkiG9w0BCQEWEWtoZXJhQGtjaWxpbmsuY29tMSUwIwYJKoZIhvcNAQkBFhZ2aXZla0BtYWlsZXJt +YWlsZXIuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAq+zHKYq9vZ4Dq1itNqT/ +OeJvWDvQ5JdQlRzwsJlvtJBknXsnOaJNabmjnu2s6XFMcP2srBZQ/WPvhsClajLQOcxnarrfB66N +DpMzXTxfYzX6m9TA/fEn64sNn+YnBZL6Dvid9kiAgP9LmqcTOIFdWUya3ZmQS5YTuLB+tkFSL8/h ++inDPN6dcsna8TcM1SAk+3upxOR7kyFM9T3vy25w62Nh1zK7Stp0vUZLU6GzzC1VvHGZHKGticD6 +o3uHaMr2LCFjptoIcfZL75LO/UaR9o7smgboW4yJyW5g9ZasyYQUXyvkitfyZuVWATb8ZSHOkjWJ +872Pyf5+HOevVUI0aQIDAQABo1cwVTBFBgNVHREEPjA8gQ92aXZla0BraGVyYS5vcmeBEWtoZXJh +QGtjaWxpbmsuY29tgRZ2aXZla0BtYWlsZXJtYWlsZXIuY29tMAwGA1UdEwEB/wQCMAAwDQYJKoZI +hvcNAQEEBQADgYEAYpaFKDj47pTQIUQi28MgtjKophopv4QJjvspXmy0qxd8t/M/zc7HuBy3i/9a +PrXDgKyNBzzlFTasTazAY53ntVpqw9k1NOeHmH6o3j/DBVa49bC6bbWfp9UGOwYChlDR0tngQZyC +MDMZEdYv4zpGfBTku5m1jb8Yz/qYqV4FWB4xggMQMIIDDAIBATB2MGIxCzAJBgNVBAYTAlpBMSUw +IwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVy +c29uYWwgRnJlZW1haWwgSXNzdWluZyBDQQIQOrA6AOJt5XIpn8lLRkkIJjAJBgUrDgMCGgUAoIIB +bzAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wNjA2MTUxNjIyMzJa +MCMGCSqGSIb3DQEJBDEWBBSzCe8hvB8Na98vYyvlnMgNZnB4gDCBhQYJKwYBBAGCNxAEMXgwdjBi +MQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoG +A1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECEDqwOgDibeVyKZ/JS0ZJ +CCYwgYcGCyqGSIb3DQEJEAILMXigdjBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENv +bnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElz +c3VpbmcgQ0ECEDqwOgDibeVyKZ/JS0ZJCCYwDQYJKoZIhvcNAQEBBQAEggEAMNYaLMponlN0lRCO +CWHFlRQe8ZEPYd44uoZco+vvOAn4JPnamj8R5Wwl8/MEVejJdMRcYTiE7NuQlqWDh73zsOJhstNe +Sg2glUkrpEIGKEYHacTbsfwrAV2G8BqaqdUh+p0chU5wzlyIPg6KnRtFbLcUd6pRW2zJGZTfoKAg +5n0cK8Yy53hgWMwzWGLaLcoY1Mp0KsnmW1nBO7ZmPcJmpGKsnldE7p5J8i6rAgcLooDVMuxvxu4k +r6wOmtdT2wIrGbBV87tDEoY4toYi7H9GNlabVtTPCUTVRNBK0WtgESSgJi7mVzVMfdQ0nbROAWJ8 +g3DixcR6JzF5ks5YNIwDPwAAAAAAAA== + +--Apple-Mail-4-282660335-- + +From pgsql-performance-owner@postgresql.org Thu Jun 15 13:57:42 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E6E4E9FA5BE + for ; + Thu, 15 Jun 2006 13:57:41 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 19503-09 for + ; + Thu, 15 Jun 2006 13:57:35 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) + by postgresql.org (Postfix) with ESMTP id EF1249FA13E + for ; + Thu, 15 Jun 2006 13:57:32 -0300 (ADT) +Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP + with MS-WebStorage 6.0.6249 +Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; + 15 Jun 2006 09:57:25 -0700 +Subject: Re: Postgres consuming way too much memory??? +From: Mark Lewis +To: Tom Lane +Cc: jody brownell , pgsql-performance@postgresql.org +In-Reply-To: <28321.1150385679@sss.pgh.pa.us> +References: <200606141618.37849.jody.brownell@q1labs.com> + <200606150901.19201.jody.brownell@q1labs.com> + <200606150915.10306.jody.brownell@q1labs.com> + <200606151202.50939.jody.brownell@q1labs.com> + <28321.1150385679@sss.pgh.pa.us> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Organization: MIR3, Inc. +Date: Thu, 15 Jun 2006 09:57:25 -0700 +Message-Id: <1150390645.31200.53.camel@archimedes> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-27) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/313 +X-Sequence-Number: 19670 + +On Thu, 2006-06-15 at 11:34 -0400, Tom Lane wrote: +> "jody brownell" writes: +> > When postgresql starts to go into this bloating state, I can only make it happen from my java app. +> +> That's interesting. The JDBC driver uses protocol features that aren't +> used by psql, so it's possible that the leak is triggered by one of +> those features. I wouldn't worry too much about duplicating the problem +> from psql anyway --- a Java test case will do fine. +> +> > I am going to try closing the connection after each TX to see if this +> > resolves it for now. If not, I will write a java app, stored procedure +> > (table etc) reproduce it without our application. + + +Just to mention another possible culprit; this one doesn't seem all that +likely to me, but at least it's easy to investigate. + +With DBCP and non-ancient versions of the JDBC driver that use v3 +protocol and real prepared statements, it is possible to (mis)configure +the system to create an unbounded number of cached prepared statements +on any particular connection. Older versions of DBCP were also known to +have bugs which aggravated this issue when prepared statement caching +was enabled, IIRC. + +-- Mark Lewis + +From pgsql-performance-owner@postgresql.org Thu Jun 15 14:11:03 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0BDA09FA5BE + for ; + Thu, 15 Jun 2006 14:11:03 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 18819-10 for + ; + Thu, 15 Jun 2006 14:10:49 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from py-out-1112.google.com (py-out-1112.google.com + [64.233.166.181]) + by postgresql.org (Postfix) with ESMTP id BCBB59FA13E + for ; + Thu, 15 Jun 2006 14:10:49 -0300 (ADT) +Received: by py-out-1112.google.com with SMTP id b29so328776pya + for ; + Thu, 15 Jun 2006 10:10:48 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:subject:from:reply-to:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding; + b=I3s3YNqss2zQzseCZuNNzr9qSiBn9sl2KU6Y0rEtKWIDSpiNv/1jY4GauLMODPq3qDEH7gEwVi1EmjwvGUS7et/QHkBOGO9b5BV10qnwylXHtpMndB2Ap9exrro83W+zMY35YvllO9GHi+O14dlD4NJosGcCYOQFLDAZh0nYzmA= +Received: by 10.35.90.20 with SMTP id s20mr3314520pyl; + Thu, 15 Jun 2006 10:10:48 -0700 (PDT) +Received: from ?10.0.0.174? ( [63.193.127.22]) + by mx.gmail.com with ESMTP id m78sm1056572pye.2006.06.15.10.10.47; + Thu, 15 Jun 2006 10:10:48 -0700 (PDT) +Subject: Re: Which processor runs better for Postgresql? +From: Steve Poe +Reply-To: steve.poe@gmail.com +To: Vivek Khera +Cc: "Pgsql-Performance ((E-mail))" +In-Reply-To: <83797745-D8D0-4748-BD9C-A87105B0754E@khera.org> +References: <1150221760.12191.25.camel@amd64-gentoo-laptop> + <83797745-D8D0-4748-BD9C-A87105B0754E@khera.org> +Content-Type: text/plain +Date: Thu, 15 Jun 2006 10:10:46 -0700 +Message-Id: <1150391446.12275.15.camel@amd64-gentoo-laptop> +Mime-Version: 1.0 +X-Mailer: Evolution 2.4.2.1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/314 +X-Sequence-Number: 19671 + +Vivek, + +Thanks for your feedback. Which Dell server did you purchase? + +The client has a PowerEdge 2600 and they STILL want Dell. Again, if it +were my pocketbook, Dell would not be there. + +The client has a 30GB DB. This is large for me, but probably not with +you. Also, I am advising the client to go to a 10+ disc array (from 3) +and enough RAM to load half the DB into memory. + +Steve + + + + +On Thu, 2006-06-15 at 12:22 -0400, Vivek Khera wrote: +> On Jun 13, 2006, at 2:02 PM, Steve Poe wrote: +> +> > +> > Can anyone share what their experience has been with Intel's dual core +> > CPUs and/or Dell's new servers? +> +> I'm one of the few Dell fans around here... but I must say that I +> don't buy them for my big DB servers specifically since they don't +> currently ship Opteron based systems. (I did call and thank my sales +> rep for pushing my case for them to do Opterons, though, since I'm +> sure they are doing it as a personal favor to me :-) ) +> +> I just put up a pentium-D dual-core based system and it is pretty +> wickedly fast. it only has a pair of SATA drives on it and is used +> for pre-production testing. +> +> > +> > I am hoping the client is willing to wait for Dell to ship a AMD +> > Opeteron-based server. +> +> Don't wait. It will be *months* before that happens. Go get a Sun +> X4100 and an external RAID array and be happy. These boxes are an +> amazing work of engineering. +> + + +From pgsql-performance-owner@postgresql.org Thu Jun 15 14:36:13 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4655A9FA5BE + for ; + Thu, 15 Jun 2006 14:36:13 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 22035-10 for + ; + Thu, 15 Jun 2006 14:36:03 -0300 (ADT) +X-Greylist: delayed 00:18:21.449211 by SQLgrey- +Received: from crestone.coronasolutions.com (crestone.coronasolutions.com + [66.45.104.24]) by postgresql.org (Postfix) with ESMTP id 288219FA13E + for ; + Thu, 15 Jun 2006 14:36:01 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by crestone.coronasolutions.com (Postfix) with ESMTP id 79A866440F3; + Thu, 15 Jun 2006 11:17:37 -0600 (MDT) +Received: from crestone.coronasolutions.com ([127.0.0.1]) + by localhost (crestone.coronasolutions.com [127.0.0.1]) (amavisd-new, + port 10024) + with ESMTP id 17381-08; Thu, 15 Jun 2006 11:17:35 -0600 (MDT) +Received: from [192.168.1.100] (c-67-165-220-189.hsd1.co.comcast.net + [67.165.220.189]) + by crestone.coronasolutions.com (Postfix) with ESMTP id B229F6440E4 + for ; + Thu, 15 Jun 2006 11:17:35 -0600 (MDT) +Message-ID: <44919625.8040200@drivefaster.net> +Date: Thu, 15 Jun 2006 11:17:25 -0600 +From: Dan Harris +User-Agent: Thunderbird 1.5.0.4 (Macintosh/20060516) +MIME-Version: 1.0 +To: PostgreSQL Performance +Subject: Re: Is it possible to start two instances of postgresql? +References: + <44911706.60204@superlativ.dk> +In-Reply-To: <44911706.60204@superlativ.dk> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at drivefaster.net +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/316 +X-Sequence-Number: 19673 + + +> kah_hang_ang@toray.com.my wrote: +> +> +>> both of the two database are live but use for two different web app. +>> my company don't want to spend more to buy a new server, so then I think of +>> to implement both under the same server and one instance.. + +Just as an anecdote, I am running 30 databases on a single instance and +it's working quite well. There may be reasons to run multiple +instances but it seems like tuning them to cooperate for memory would +pose some problems - e.g. effective_cache_size. + +-Dan + + +From pgsql-performance-owner@postgresql.org Thu Jun 15 14:18:18 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 9DE359FA5BE + for ; + Thu, 15 Jun 2006 14:18:18 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 23319-02 for + ; + Thu, 15 Jun 2006 14:18:08 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from candle.pha.pa.us (candle.pha.pa.us [70.90.9.53]) + by postgresql.org (Postfix) with ESMTP id 6F9409FA13E + for ; + Thu, 15 Jun 2006 14:18:07 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id k5FHHk901846; + Thu, 15 Jun 2006 13:17:46 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200606151717.k5FHHk901846@candle.pha.pa.us> +Subject: Re: Postgres consuming way too much memory??? +In-Reply-To: <28419.1150386248@sss.pgh.pa.us> +To: Tom Lane +Date: Thu, 15 Jun 2006 13:17:46 -0400 (EDT) +CC: jody brownell , pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/315 +X-Sequence-Number: 19672 + + +Added to TODO: + +> o Fix memory leak from exceptions +> +> http://archives.postgresql.org/pgsql-performance/2006-06/msg0$ + + +--------------------------------------------------------------------------- + +Tom Lane wrote: +> "jody brownell" writes: +> > BEGIN +> > INSERT into attacker_target_link (attacker_id, target_id) values (p_attacker, v_target); +> > v_returns_size := v_returns_size + 1; +> > v_returns[v_returns_size] := v_target; +> +> > EXCEPTION WHEN unique_violation THEN +> > -- do nothing... app cache may be out of date. +> > END; +> +> Hmm. There is a known problem that plpgsql leaks some memory when +> catching an exception: +> http://archives.postgresql.org/pgsql-hackers/2006-02/msg00885.php +> +> So if your problem case involves a whole lot of duplicates then that +> could explain the initial bloat. However, AFAIK that leakage is in +> a transaction-local memory context, so the space ought to be freed at +> transaction end. And Linux's malloc does know about giving space back +> to the kernel (unlike some platforms). So I'm not sure why you're +> seeing persistent bloat. +> +> Can you rewrite the function to not use an EXCEPTION block (perhaps +> a separate SELECT probe for each row --- note this won't be reliable +> if there are concurrent processes making insertions)? If so, does +> that fix the problem? +> +> regards, tom lane +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 3: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq +> + +-- + Bruce Momjian http://candle.pha.pa.us + EnterpriseDB http://www.enterprisedb.com + + + If your life is a hard drive, Christ can be your backup. + + +From pgsql-performance-owner@postgresql.org Thu Jun 15 14:47:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2B8909FA5BE + for ; + Thu, 15 Jun 2006 14:47:44 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 26204-05 for + ; + Thu, 15 Jun 2006 14:47:37 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) + by postgresql.org (Postfix) with ESMTP id 91FEA9FA13E + for ; + Thu, 15 Jun 2006 14:47:37 -0300 (ADT) +Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) + by yertle.kcilink.com (Postfix) with ESMTP id AA936B80D + for ; + Thu, 15 Jun 2006 13:47:36 -0400 (EDT) +Mime-Version: 1.0 (Apple Message framework v750) +In-Reply-To: <1150391446.12275.15.camel@amd64-gentoo-laptop> +References: <1150221760.12191.25.camel@amd64-gentoo-laptop> + <83797745-D8D0-4748-BD9C-A87105B0754E@khera.org> + <1150391446.12275.15.camel@amd64-gentoo-laptop> +Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-5-287764297; + protocol="application/pkcs7-signature" +Message-Id: +From: Vivek Khera +Subject: Re: Which processor runs better for Postgresql? +Date: Thu, 15 Jun 2006 13:47:35 -0400 +To: "Pgsql-Performance ((E-mail))" +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/317 +X-Sequence-Number: 19674 + + +--Apple-Mail-5-287764297 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=US-ASCII; + delsp=yes; + format=flowed + + +On Jun 15, 2006, at 1:10 PM, Steve Poe wrote: + +> Vivek, +> +> Thanks for your feedback. Which Dell server did you purchase? + +I have many many dell rackmounts: 1550, 1650, 1750, 1850, and SC1425 +and throw in a couple of 2450. + +I *really* like the 1850 with built-in SCSI RAID. It is fast enough +to be a replica of my primary bread and butter database running on a +beefy opteron system (using Slony-1 replication). + +The SC1425 boxes make for good, cheap web front end servers. We buy +'em in pairs and load balance them at the network layer using CARP. + +At the office we have mostly SC400 series (400, 420, and 430) for our +servers. The latest box is an SC430 with dual core pentium D and +dual SATA drives running software mirror. It pushes over 20MB/s on +the disks, which is pretty impressive for the hardware. + + +> +> The client has a PowerEdge 2600 and they STILL want Dell. Again, if it +> were my pocketbook, Dell would not be there. + +I lucked out and skipped the 2650 line, apparently :-) + +I used the 2450's as my DB servers and they were barely adequate once +we got beyond our startup phase, and moving them over to Opteron was +a godsend. I tried some small opteron systems vendor but had QC +issues (1 of 5 systems stable), so went with Sun and have not looked +back. I still buy Dell's for all other server purposes mainly +because it is convenient in terms of purchasing and getting support +(ie, business reasons). + +And I don't spend all my time babysitting these boxes, like others +imply. + + +> +> The client has a 30GB DB. This is large for me, but probably not with +> you. Also, I am advising the client to go to a 10+ disc array (from 3) +> and enough RAM to load half the DB into memory. + +30GB DB on a 10 disk array seems overkill, considering that the +smallest disks you're going to get will be 36GB (or perhaps 72Gb by +now). + + + +--Apple-Mail-5-287764297 +Content-Transfer-Encoding: base64 +Content-Type: application/pkcs7-signature; + name=smime.p7s +Content-Disposition: attachment; + filename=smime.p7s + +MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGlDCCAz8w +ggKooAMCAQICAQ0wDQYJKoZIhvcNAQEFBQAwgdExCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0 +ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEaMBgGA1UEChMRVGhhd3RlIENvbnN1bHRpbmcx +KDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2aXNpb24xJDAiBgNVBAMTG1RoYXd0 +ZSBQZXJzb25hbCBGcmVlbWFpbCBDQTErMCkGCSqGSIb3DQEJARYccGVyc29uYWwtZnJlZW1haWxA +dGhhd3RlLmNvbTAeFw0wMzA3MTcwMDAwMDBaFw0xMzA3MTYyMzU5NTlaMGIxCzAJBgNVBAYTAlpB +MSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUg +UGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA +xKY8VXNV+065yplaHmjAdQRwnd/p/6Me7L3N9VvyGna9fww6YfK/Uc4B1OVQCjDXAmNaLIkVcI7d +yfArhVqqP3FWy688Cwfn8R+RNiQqE88r1fOCdz0Dviv+uxg+B79AgAJk16emu59l0cUqVIUPSAR/ +p7bRPGEEQB5kGXJgt/sCAwEAAaOBlDCBkTASBgNVHRMBAf8ECDAGAQH/AgEAMEMGA1UdHwQ8MDow +OKA2oDSGMmh0dHA6Ly9jcmwudGhhd3RlLmNvbS9UaGF3dGVQZXJzb25hbEZyZWVtYWlsQ0EuY3Js +MAsGA1UdDwQEAwIBBjApBgNVHREEIjAgpB4wHDEaMBgGA1UEAxMRUHJpdmF0ZUxhYmVsMi0xMzgw +DQYJKoZIhvcNAQEFBQADgYEASIzRUIPqCy7MDaNmrGcPf6+svsIXoUOWlJ1/TCG4+DYfqi2fNi/A +9BxQIJNwPP2t4WFiw9k6GX6EsZkbAMUaC4J0niVQlGLH2ydxVyWN3amcOY6MIE9lX5Xa9/eH1sYI +Tq726jTlEBpbNU1341YheILcIRk13iSx0x1G/11fZU8wggNNMIICtqADAgECAhA6sDoA4m3lcimf +yUtGSQgmMA0GCSqGSIb3DQEBBAUAMGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQKExxUaGF3dGUgQ29u +c3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVyc29uYWwgRnJlZW1haWwgSXNz +dWluZyBDQTAeFw0wNjA1MDIxNDEyNDdaFw0wNzA1MDIxNDEyNDdaMIGKMR8wHQYDVQQDExZUaGF3 +dGUgRnJlZW1haWwgTWVtYmVyMR4wHAYJKoZIhvcNAQkBFg92aXZla0BraGVyYS5vcmcxIDAeBgkq +hkiG9w0BCQEWEWtoZXJhQGtjaWxpbmsuY29tMSUwIwYJKoZIhvcNAQkBFhZ2aXZla0BtYWlsZXJt +YWlsZXIuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAq+zHKYq9vZ4Dq1itNqT/ +OeJvWDvQ5JdQlRzwsJlvtJBknXsnOaJNabmjnu2s6XFMcP2srBZQ/WPvhsClajLQOcxnarrfB66N +DpMzXTxfYzX6m9TA/fEn64sNn+YnBZL6Dvid9kiAgP9LmqcTOIFdWUya3ZmQS5YTuLB+tkFSL8/h ++inDPN6dcsna8TcM1SAk+3upxOR7kyFM9T3vy25w62Nh1zK7Stp0vUZLU6GzzC1VvHGZHKGticD6 +o3uHaMr2LCFjptoIcfZL75LO/UaR9o7smgboW4yJyW5g9ZasyYQUXyvkitfyZuVWATb8ZSHOkjWJ +872Pyf5+HOevVUI0aQIDAQABo1cwVTBFBgNVHREEPjA8gQ92aXZla0BraGVyYS5vcmeBEWtoZXJh +QGtjaWxpbmsuY29tgRZ2aXZla0BtYWlsZXJtYWlsZXIuY29tMAwGA1UdEwEB/wQCMAAwDQYJKoZI +hvcNAQEEBQADgYEAYpaFKDj47pTQIUQi28MgtjKophopv4QJjvspXmy0qxd8t/M/zc7HuBy3i/9a +PrXDgKyNBzzlFTasTazAY53ntVpqw9k1NOeHmH6o3j/DBVa49bC6bbWfp9UGOwYChlDR0tngQZyC +MDMZEdYv4zpGfBTku5m1jb8Yz/qYqV4FWB4xggMQMIIDDAIBATB2MGIxCzAJBgNVBAYTAlpBMSUw +IwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVy +c29uYWwgRnJlZW1haWwgSXNzdWluZyBDQQIQOrA6AOJt5XIpn8lLRkkIJjAJBgUrDgMCGgUAoIIB +bzAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wNjA2MTUxNzQ3MzZa +MCMGCSqGSIb3DQEJBDEWBBRgQmG5/8Xb9MuTBurtx/0QvJvfAzCBhQYJKwYBBAGCNxAEMXgwdjBi +MQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoG +A1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECEDqwOgDibeVyKZ/JS0ZJ +CCYwgYcGCyqGSIb3DQEJEAILMXigdjBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENv +bnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElz +c3VpbmcgQ0ECEDqwOgDibeVyKZ/JS0ZJCCYwDQYJKoZIhvcNAQEBBQAEggEAQjUdK6jyZDoHBiug +niOaQd2DL5drcMG3jdI7w3RNoclVY7Z1rUrKZ9uETOfFnGL+tsJ5EYvZ/i2xNHhgFQoxiOTNrfSa +98+2H/KwoOYTD7AFvH5IItSZ0jiQlh8dLw6qYQJmmjR00/voO3hfIlSfHRWrzVIgSag8UjF0Yz/w +U62vdFCV8IKjSokVwp2IfSvORxh3+44/M22pAZ8zrVtLQbTuukA4RnEfSoaHxhRUURvQYKnYdl0u +fC8KfxRoxHXSMAEnQtASnlz3Ctlj8Sdpb86zFL5ELqIHWC4IRk8kzQojBrQZqSrBpnPZUmamk02J +RJ4Cag/21jhGQvZ7bpcRywAAAAAAAA== + +--Apple-Mail-5-287764297-- + +From pgsql-performance-owner@postgresql.org Thu Jun 15 14:53:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7B9929FA5BE + for ; + Thu, 15 Jun 2006 14:53:44 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 27397-02 for + ; + Thu, 15 Jun 2006 14:53:35 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mx00.pub.collaborativefusion.com + (mx00.pub.collaborativefusion.com [206.210.89.199]) + by postgresql.org (Postfix) with ESMTP id 426D29FA13E + for ; + Thu, 15 Jun 2006 14:53:35 -0300 (ADT) +Received: from collaborativefusion.com (mx01.pub.collaborativefusion.com + [206.210.89.201]) (TLS: TLSv1/SSLv3,256bits,AES256-SHA) + by wingspan with esmtp; Thu, 15 Jun 2006 13:53:34 -0400 + id 0005641D.44919E9E.000119E8 +Received: from Internal Mail-Server by mx01 (envelope-from + wmoran@collaborativefusion.com) + with AES256-SHA encrypted SMTP; 15 Jun 2006 13:45:54 -0400 +Date: Thu, 15 Jun 2006 13:53:33 -0400 +From: Bill Moran +To: Dan Harris +Cc: pgsql-performance@postgresql.org +Subject: Re: Is it possible to start two instances of postgresql? +Message-Id: <20060615135333.1997750e.wmoran@collaborativefusion.com> +In-Reply-To: <44919625.8040200@drivefaster.net> +References: + <44911706.60204@superlativ.dk> <44919625.8040200@drivefaster.net> +Organization: Collaborative Fusion +X-Mailer: Sylpheed version 2.2.6 (GTK+ 2.8.19; i386-portbld-freebsd6.1) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/318 +X-Sequence-Number: 19675 + +In response to Dan Harris : +> +> > kah_hang_ang@toray.com.my wrote: +> > +> >> both of the two database are live but use for two different web app. +> >> my company don't want to spend more to buy a new server, so then I think of +> >> to implement both under the same server and one instance.. +> +> Just as an anecdote, I am running 30 databases on a single instance and +> it's working quite well. There may be reasons to run multiple +> instances but it seems like tuning them to cooperate for memory would +> pose some problems - e.g. effective_cache_size. + +The only reason I can see for doing this is when you need to run two +different versions of PostgreSQL. Which is what I've been forced to +do on one of our servers. + +It works, but it's a pain to admin. If you can just put all the databases +in one db cluster (is that terminology still correct?) it'll be much +easier. + +-- +Bill Moran +Collaborative Fusion Inc. + +From pgsql-performance-owner@postgresql.org Thu Jun 15 15:05:59 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C6EFD9FA5BE + for ; + Thu, 15 Jun 2006 15:05:58 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 26967-10 for + ; + Thu, 15 Jun 2006 15:05:49 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.173]) + by postgresql.org (Postfix) with ESMTP id 86F4D9FA13E + for ; + Thu, 15 Jun 2006 15:05:48 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so333109ugf + for ; + Thu, 15 Jun 2006 11:05:47 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:sender:to:subject:mime-version:content-type:x-google-sender-auth; + b=SORyc3ZEwHwR6YC/xHS92+w+Az8OaO9EyyclJON4JgOj8dJ8IAAETL7kE8juYweyGrP3GOtoNXbHM5yf68Ut61/EiGHgNdJ9Bkbk1n0OsvgIzXVEKSNpG5QsOiYiuxjauJ6jeKk4pZkn1oK9V3vGFqflGQpxjFfaMw49swdvjy8= +Received: by 10.67.97.7 with SMTP id z7mr1960556ugl; + Thu, 15 Jun 2006 11:05:46 -0700 (PDT) +Received: by 10.66.216.11 with HTTP; Thu, 15 Jun 2006 11:05:46 -0700 (PDT) +Message-ID: +Date: Thu, 15 Jun 2006 14:05:46 -0400 +From: "John Vincent" +Reply-To: pgsql-performance@lusis.org +To: "PGSQL Performance" +Subject: Optimizer internals +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_8773_21943576.1150394746846" +X-Google-Sender-Auth: cbb44d720f9099ee +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/319 +X-Sequence-Number: 19676 + +------=_Part_8773_21943576.1150394746846 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +I'm not a programmer so understanding the optimizer code is WAY beyond my +limits. + +My question, that I haven't seen answered elsewhere, is WHAT things can +affect the choice of an index scan over a sequence scan. I understand that +sometimes a sequence scan is faster and that you still have to get the data +from the disk but my question relates to an issue we had pop up today. + +We have 2 tables, which we'll refer to as laaf and laaf_new. The first table +has 220M rows and the second table has 4M rows. What were basically doing is +aggregating the records from the first table into the second one at which +point we're going to drop the first one. This is the same table I mentioned +previously in my post about pg_dump. + +laaf_new has one less column than laaf and both were freshly vacuum analyzed +after having an index added on a single column (other than the primary key). + + +The query we were doing was as follows: + +select main_account_status_dim_id, count(*) +from cla_dw.loan_account_agg_fact_new +group by main_account_status_dim_id +order by main_account_status_dim_id; + +One of our problems is that we don't have any PGSQL dbas here. All of our +guys are DB2 (we're still looking though). + +Now I've been told by our DBA that we should have been able to wholy satisfy +that query via the indexes. + +We did regular EXPLAINS on the query with seqscan enabled and disabled and +even in our own tests actually running the queries, the results WERE faster +with a seq scan than an index scan but the question we were discussing is +WHY did it choose the index scan and why is the index scan slower than the +sequence scan? He's telling me that DB2 would have been able to do the whole +thing with indexes. + +EXPLAINS: + +(the reason for the random_page_cost was that we had the default of 4 in the +.conf file and were planning on changing it to 2 anyway to match our other +server) + +set random_page_cost=2; +set enable_seqscan=on; +explain select main_account_status_dim_id, count(*) +from cla_dw.loan_account_agg_fact +group by main_account_status_dim_id +order by main_account_status_dim_id; + +"Sort (cost=8774054.54..8774054.66 rows=48 width=4)" +" Sort Key: main_account_status_dim_id" +" -> HashAggregate (cost=8774052.60..8774053.20 rows=48 width=4)" +" -> Seq Scan on loan_account_agg_fact +(cost=0.00..7609745.40rows=232861440 width=4)" + + +set random_page_cost=2; +set enable_seqscan=off; +explain select main_account_status_dim_id, count(*) +from cla_dw.loan_account_agg_fact +group by main_account_status_dim_id +order by main_account_status_dim_id; + +"Sort (cost=108774054.54..108774054.66 rows=48 width=4)" +" Sort Key: main_account_status_dim_id" +" -> HashAggregate (cost=108774052.60..108774053.20 rows=48 width=4)" +" -> Seq Scan on loan_account_agg_fact (cost= +100000000.00..107609745.40 rows=232861440 width=4)" +Here's the DDL for the table laaf: + + +When the system is not busy again, I'll run a verbose version. The query was +run against each of the tables to compare the results of aggregation change +with the new table. + +CREATE TABLE cla_dw.loan_account_agg_fact +( + loan_account_agg_fact_id int8 NOT NULL DEFAULT +nextval('loan_account_agg_fact_loan_account_agg_fact_id_seq'::regclass), + dw_load_date_id int4 NOT NULL DEFAULT 0, + servicer_branch_dim_id int4 NOT NULL DEFAULT 0, + main_account_status_dim_id int4 NOT NULL DEFAULT 0, + product_dim_id int4 NOT NULL DEFAULT 0, + next_due_date_id int4 NOT NULL DEFAULT 0, + account_balance numeric(15,6) NOT NULL DEFAULT 0, + loan_count int4 NOT NULL DEFAULT 0, + principal numeric(15,6) NOT NULL DEFAULT 0, + interest numeric(15,6) NOT NULL DEFAULT 0, + fees numeric(15,6) NOT NULL DEFAULT 0, + gl_principal numeric(15,6) NOT NULL DEFAULT 0, + gl_interest numeric(15,6) NOT NULL DEFAULT 0, + accruable_principal numeric(15,6) NOT NULL DEFAULT 0, + unaccruable_principal numeric(15,6) NOT NULL DEFAULT 0, + calculated_principal numeric(15,6) DEFAULT 0, + current_interest numeric(15,6) NOT NULL DEFAULT 0, + past_due_interest numeric(16,5) NOT NULL DEFAULT 0, + cash_available numeric(15,6) DEFAULT 0, + cash_collected numeric(15,6) DEFAULT 0, + cash_collected_date_id int4 DEFAULT 0, + dw_agg_load_dt timestamp(0) DEFAULT ('now'::text)::timestamp(6) with time +zone, + cash_available_principal numeric(15,6) DEFAULT 0, + cash_available_current numeric(15,6) DEFAULT 0, + cash_available_last numeric(15,6) DEFAULT 0, + cash_available_interest numeric(15,6) DEFAULT 0, + cash_available_fees numeric(15,6) DEFAULT 0, + cash_not_collected numeric(15,6) DEFAULT 0, + number_contacts_total int4 DEFAULT 0, + number_broken_commitments int4 DEFAULT 0, + loc_current_due_total numeric(15,6) DEFAULT 0, + loc_current_due_principal numeric(15,6) DEFAULT 0, + loc_current_due_interest numeric(15,6) DEFAULT 0, + loc_current_due_fees numeric(15,6) DEFAULT 0, + loc_past_due_last numeric(15,6) DEFAULT 0, + loc_past_due_total numeric(15,6) DEFAULT 0, + number_made_commitments int4 DEFAULT 0, + CONSTRAINT loan_account_agg_fact_pkey PRIMARY KEY +(loan_account_agg_fact_id) +) +WITH OIDS; + +CREATE INDEX loan_account_agg_fact_main_account_status_dim_id + ON cla_dw.loan_account_agg_fact + USING btree + (main_account_status_dim_id) + TABLESPACE fact_idx_part1_ts; + + +Here's the DDL for the table laaf_new: + +CREATE TABLE cla_dw.loan_account_agg_fact_new +( + loan_account_agg_fact_id bigserial NOT NULL, + dw_load_date_id int4 NOT NULL, + servicer_branch_dim_id int4 NOT NULL, + main_account_status_dim_id int4 NOT NULL, + product_dim_id int4 NOT NULL, + dw_agg_load_dt timestamp, + account_balance numeric(15,6) NOT NULL DEFAULT 0, + loan_count int4 NOT NULL DEFAULT 0, + principal numeric(15,6) NOT NULL DEFAULT 0, + interest numeric(15,6) NOT NULL DEFAULT 0, + fees numeric(15,6) NOT NULL DEFAULT 0, + gl_principal numeric(15,6) NOT NULL DEFAULT 0, + gl_interest numeric(15,6) NOT NULL DEFAULT 0, + accruable_principal numeric(15,6) DEFAULT 0, + unaccruable_principal numeric(15,6) DEFAULT 0, + calculated_principal numeric(15,6) DEFAULT 0, + current_interest numeric(15,6) DEFAULT 0, + past_due_interest numeric(15,6) DEFAULT 0, + cash_available numeric(15,6) DEFAULT 0, + cash_collected numeric(15,6) DEFAULT 0, + cash_available_principal numeric(15,6) DEFAULT 0, + cash_available_current numeric(15,6) DEFAULT 0, + cash_available_last numeric(15,6) DEFAULT 0, + cash_available_interest numeric(15,6) DEFAULT 0, + cash_available_fees numeric(15,6) DEFAULT 0, + cash_not_collected numeric(15,6) DEFAULT 0, + number_contacts_total int4 DEFAULT 0, + number_broken_commitments int4 DEFAULT 0, + loc_current_due_total numeric(15,6) DEFAULT 0, + loc_current_due_principal numeric(15,6) DEFAULT 0, + loc_current_due_interest numeric(15,6) DEFAULT 0, + loc_current_due_fees numeric(15,6) DEFAULT 0, + loc_past_due_last numeric(15,6) DEFAULT 0, + loc_past_due_total numeric(15,6) DEFAULT 0, + number_made_commitments int4 DEFAULT 0, + CONSTRAINT loan_account_agg_fact_pkey_new PRIMARY KEY +(loan_account_agg_fact_id) USING INDEX TABLESPACE default_ts +) +WITH OIDS TABLESPACE fact_data_part1_ts; + +CREATE INDEX laafn_main_account_status_dim + ON cla_dw.loan_account_agg_fact_new + USING btree + (main_account_status_dim_id) + TABLESPACE fact_idx_part2_ts; + +------=_Part_8773_21943576.1150394746846 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +I'm not a programmer so understanding the optimizer code is WAY beyond my limits.

My question, that I haven't seen answered elsewhere, is WHAT things can affect the choice of an index scan over a sequence scan. I understand that sometimes a sequence scan is faster and that you still have to get the data from the disk but my question relates to an issue we had pop up today. +

We have 2 tables, which we'll refer to as laaf and laaf_new. The first table has 220M rows and the second table has 4M rows. What were basically doing is aggregating the records from the first table into the second one at which point we're going to drop the first one. This is the same table I mentioned previously in my post about pg_dump. +

laaf_new has one less column than laaf and both were freshly vacuum analyzed after having an index added on a single column (other than the primary key).

The query we were doing was as follows:

select main_account_status_dim_id, count(*) +
from cla_dw.loan_account_agg_fact_new
group by main_account_status_dim_id
order by main_account_status_dim_id;

One of our problems is that we don't have any PGSQL dbas here. All of our guys are DB2 (we're still looking though). +

Now I've been told by our DBA that we should have been able to wholy satisfy that query via the indexes.

We did regular EXPLAINS on the query with seqscan enabled and disabled and even in our own tests actually running the queries, the results WERE faster with a seq scan than an index scan but the question we were discussing is WHY did it choose the index scan and why is the index scan slower than the sequence scan? He's telling me that DB2 would have been able to do the whole thing with indexes. +

EXPLAINS:

(the reason for the random_page_cost was that we had the default of 4 in the .conf file and were planning on changing it to 2 anyway to match our other server)

set random_page_cost=2;
set enable_seqscan=on; +
explain select main_account_status_dim_id, count(*)
from cla_dw.loan_account_agg_fact
group by main_account_status_dim_id
order by main_account_status_dim_id;

"Sort  (cost=8774054.54..8774054.66 rows=48 width=4)" +
"  Sort Key: main_account_status_dim_id"
"  ->  HashAggregate  (cost=8774052.60..8774053.20 rows=48 width=4)"
"        ->  Seq Scan on loan_account_agg_fact  (cost=0.00..7609745.40 + rows=232861440 width=4)"


set random_page_cost=2;
set enable_seqscan=off;
explain select main_account_status_dim_id, count(*)
from cla_dw.loan_account_agg_fact
group by main_account_status_dim_id +
order by main_account_status_dim_id;

"Sort  (cost=108774054.54..108774054.66 rows=48 width=4)"
"  Sort Key: main_account_status_dim_id"
"  ->  HashAggregate  (cost=108774052.60..108774053.20 + rows=48 width=4)"
"        ->  Seq Scan on loan_account_agg_fact  (cost=100000000.00..107609745.40 rows=232861440 width=4)"
Here's the DDL for the table laaf:


When the system is not busy again, I'll run a verbose version. The query was run against each of the tables to compare the results of aggregation change with the new table. +

CREATE TABLE cla_dw.loan_account_agg_fact
(
  loan_account_agg_fact_id int8 NOT NULL DEFAULT nextval('loan_account_agg_fact_loan_account_agg_fact_id_seq'::regclass),
  dw_load_date_id int4 NOT NULL DEFAULT 0, +
  servicer_branch_dim_id int4 NOT NULL DEFAULT 0,
  main_account_status_dim_id int4 NOT NULL DEFAULT 0,
  product_dim_id int4 NOT NULL DEFAULT 0,
  next_due_date_id int4 NOT NULL DEFAULT 0,
  account_balance numeric(15,6) NOT NULL DEFAULT 0, +
  loan_count int4 NOT NULL DEFAULT 0,
  principal numeric(15,6) NOT NULL DEFAULT 0,
  interest numeric(15,6) NOT NULL DEFAULT 0,
  fees numeric(15,6) NOT NULL DEFAULT 0,
  gl_principal numeric(15,6) NOT NULL DEFAULT 0, +
  gl_interest numeric(15,6) NOT NULL DEFAULT 0,
  accruable_principal numeric(15,6) NOT NULL DEFAULT 0,
  unaccruable_principal numeric(15,6) NOT NULL DEFAULT 0,
  calculated_principal numeric(15,6) DEFAULT 0, +
  current_interest numeric(15,6) NOT NULL DEFAULT 0,
  past_due_interest numeric(16,5) NOT NULL DEFAULT 0,
  cash_available numeric(15,6) DEFAULT 0,
  cash_collected numeric(15,6) DEFAULT 0,
  cash_collected_date_id int4 DEFAULT 0, +
  dw_agg_load_dt timestamp(0) DEFAULT ('now'::text)::timestamp(6) with time zone,
  cash_available_principal numeric(15,6) DEFAULT 0,
  cash_available_current numeric(15,6) DEFAULT 0,
  cash_available_last numeric(15,6) DEFAULT 0, +
  cash_available_interest numeric(15,6) DEFAULT 0,
  cash_available_fees numeric(15,6) DEFAULT 0,
  cash_not_collected numeric(15,6) DEFAULT 0,
  number_contacts_total int4 DEFAULT 0,
  number_broken_commitments int4 DEFAULT 0, +
  loc_current_due_total numeric(15,6) DEFAULT 0,
  loc_current_due_principal numeric(15,6) DEFAULT 0,
  loc_current_due_interest numeric(15,6) DEFAULT 0,
  loc_current_due_fees numeric(15,6) DEFAULT 0,
  loc_past_due_last numeric(15,6) DEFAULT 0, +
  loc_past_due_total numeric(15,6) DEFAULT 0,
  number_made_commitments int4 DEFAULT 0,
  CONSTRAINT loan_account_agg_fact_pkey PRIMARY KEY (loan_account_agg_fact_id)
)
WITH OIDS;

CREATE INDEX loan_account_agg_fact_main_account_status_dim_id +
  ON cla_dw.loan_account_agg_fact
  USING btree
  (main_account_status_dim_id)
  TABLESPACE fact_idx_part1_ts;


Here's the DDL for the table laaf_new:

CREATE TABLE cla_dw.loan_account_agg_fact_new +
(
  loan_account_agg_fact_id bigserial NOT NULL,
  dw_load_date_id int4 NOT NULL,
  servicer_branch_dim_id int4 NOT NULL,
  main_account_status_dim_id int4 NOT NULL,
  product_dim_id int4 NOT NULL,
  dw_agg_load_dt timestamp, +
  account_balance numeric(15,6) NOT NULL DEFAULT 0,
  loan_count int4 NOT NULL DEFAULT 0,
  principal numeric(15,6) NOT NULL DEFAULT 0,
  interest numeric(15,6) NOT NULL DEFAULT 0,
  fees numeric(15,6) NOT NULL DEFAULT 0, +
  gl_principal numeric(15,6) NOT NULL DEFAULT 0,
  gl_interest numeric(15,6) NOT NULL DEFAULT 0,
  accruable_principal numeric(15,6) DEFAULT 0,
  unaccruable_principal numeric(15,6) DEFAULT 0,
  calculated_principal numeric(15,6) DEFAULT 0, +
  current_interest numeric(15,6) DEFAULT 0,
  past_due_interest numeric(15,6) DEFAULT 0,
  cash_available numeric(15,6) DEFAULT 0,
  cash_collected numeric(15,6) DEFAULT 0,
  cash_available_principal numeric(15,6) DEFAULT 0, +
  cash_available_current numeric(15,6) DEFAULT 0,
  cash_available_last numeric(15,6) DEFAULT 0,
  cash_available_interest numeric(15,6) DEFAULT 0,
  cash_available_fees numeric(15,6) DEFAULT 0,
  cash_not_collected numeric(15,6) DEFAULT 0, +
  number_contacts_total int4 DEFAULT 0,
  number_broken_commitments int4 DEFAULT 0,
  loc_current_due_total numeric(15,6) DEFAULT 0,
  loc_current_due_principal numeric(15,6) DEFAULT 0,
  loc_current_due_interest numeric(15,6) DEFAULT 0, +
  loc_current_due_fees numeric(15,6) DEFAULT 0,
  loc_past_due_last numeric(15,6) DEFAULT 0,
  loc_past_due_total numeric(15,6) DEFAULT 0,
  number_made_commitments int4 DEFAULT 0,
  CONSTRAINT loan_account_agg_fact_pkey_new PRIMARY KEY (loan_account_agg_fact_id) USING INDEX TABLESPACE default_ts +
)
WITH OIDS TABLESPACE fact_data_part1_ts;

CREATE INDEX laafn_main_account_status_dim
  ON cla_dw.loan_account_agg_fact_new
  USING btree
  (main_account_status_dim_id)
  TABLESPACE fact_idx_part2_ts; +
+ +------=_Part_8773_21943576.1150394746846-- + +From pgsql-performance-owner@postgresql.org Thu Jun 15 15:19:24 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 15B469FA5BE + for ; + Thu, 15 Jun 2006 15:19:24 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 34856-01 for + ; + Thu, 15 Jun 2006 15:19:18 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from linux.dunaweb.hu (linux.dunaweb.hu [62.77.196.1]) + by postgresql.org (Postfix) with ESMTP id D57EB9FA13E + for ; + Thu, 15 Jun 2006 15:19:18 -0300 (ADT) +Received: from localhost (linux.dunaweb.hu [127.0.0.1]) + by linux.dunaweb.hu (Postfix) with ESMTP + id 634388E06BA; Thu, 15 Jun 2006 20:19:16 +0200 (CEST) +Received: from linux.dunaweb.hu ([127.0.0.1]) + by localhost (linux.dunaweb.hu [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 22111-01; Thu, 15 Jun 2006 20:19:12 +0200 (CEST) +Received: from [81.17.177.202] (host-81-17-177-202.dunaweb.hu [81.17.177.202]) + by linux.dunaweb.hu (Postfix) with ESMTP + id B4F308E0AEC; Thu, 15 Jun 2006 20:19:12 +0200 (CEST) +Message-ID: <4491A49E.5010105@dunaweb.hu> +Date: Thu, 15 Jun 2006 20:19:10 +0200 +From: Zoltan Boszormenyi +User-Agent: Thunderbird 1.5.0.2 (X11/20060501) +MIME-Version: 1.0 +To: "Jim C. Nasby" +Cc: Volkan YAZICI , + pgsql-performance@postgresql.org +Subject: Re: Precomputed constants? +References: <3167.213.163.11.81.1150282434.squirrel@www.dunaweb.hu> + <20060614110713.GA2277@alamut.tdm.local> + <3861.213.163.11.81.1150284610.squirrel@www.dunaweb.hu> + <20060614151804.GB34196@pervasive.com> <4490E286.90004@dunaweb.hu> + <20060615155929.GL34196@pervasive.com> +In-Reply-To: <20060615155929.GL34196@pervasive.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: amavisd-new at dunaweb.hu +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/320 +X-Sequence-Number: 19677 + +Jim C. Nasby �rta: +> On Thu, Jun 15, 2006 at 06:31:02AM +0200, Zoltan Boszormenyi wrote: +> +>> Jim C. Nasby ?rta: +>> +>>> On Wed, Jun 14, 2006 at 01:30:10PM +0200, B?sz?rm?nyi Zolt?n wrote: +>>> +>>> +>>>> Replacing random() with a true constant gives me index scan +>>>> even if it's hidden inside other function calls. E.g.: +>>>> +>>>> +>>> The database has no choice but to compute random() for every row; it's +>>> marked VOLATILE. +>>> +>>> +>> I see now, docs about CREATE FUNCTION mentions random(), +>> currval() and timeofday() as examples for VOLATILE. +>> But where in the documentation can I find this info about all +>> built-in functions? Thanks. +>> +> +> No, but you can query pg_proc for that info. The docs should have info +> about that table. +> + +Thanks! + +# select proname,provolatile from pg_proc where proname='random'; + proname | provolatile +---------+------------- + random | v +(1 sor) + +# select distinct provolatile from pg_proc; + provolatile +------------- + i + s + v +(3 sor) + +If I get this right, IMMUTABLE/STABLE/VOLATILE +are indicated with their initials. + +Best regards, +Zolt�n B�sz�rm�nyi + + +From pgsql-performance-owner@postgresql.org Thu Jun 15 15:33:57 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id F18A79FA5BE + for ; + Thu, 15 Jun 2006 15:33:56 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 34827-04 for + ; + Thu, 15 Jun 2006 15:33:47 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) + by postgresql.org (Postfix) with ESMTP id AB1F59FA13E + for ; + Thu, 15 Jun 2006 15:33:47 -0300 (ADT) +Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP + with MS-WebStorage 6.0.6249 +Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; + 15 Jun 2006 11:33:45 -0700 +Subject: Re: Optimizer internals +From: Mark Lewis +To: pgsql-performance@lusis.org +Cc: PGSQL Performance +In-Reply-To: +References: +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Organization: MIR3, Inc. +Date: Thu, 15 Jun 2006 11:33:45 -0700 +Message-Id: <1150396425.31200.66.camel@archimedes> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-27) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/321 +X-Sequence-Number: 19678 + +On Thu, 2006-06-15 at 14:05 -0400, John Vincent wrote: +> Now I've been told by our DBA that we should have been able to wholy +> satisfy that query via the indexes. + +DB2 can satisfy the query using only indexes because DB2 doesn't do +MVCC. + +Although MVCC is generally a win in terms of making the database easier +to use and applications less brittle, it also means that the database +must inspect the visibility information for each row before it can +answer a query. For most types of queries this isn't a big deal, but +for count(*) type queries, it slows things down. + +Since adding the visibility information to indexes would make them +significantly more expensive to use and maintain, it isn't done. +Therefore, each row has to be fetched from the main table anyway. + +Since in this particular query you are counting all rows of the +database, PG must fetch each row from the main table regardless, so the +sequential scan is much faster because it avoids traversing the index +and performing random read operations. + +-- Mark Lewis + +From pgsql-performance-owner@postgresql.org Thu Jun 15 15:46:20 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DE16B9FA5BE + for ; + Thu, 15 Jun 2006 15:46:19 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 37756-01 for + ; + Thu, 15 Jun 2006 15:46:12 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.172]) + by postgresql.org (Postfix) with ESMTP id A17529FA13E + for ; + Thu, 15 Jun 2006 15:46:12 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so353781ugf + for ; + Thu, 15 Jun 2006 11:46:11 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; + b=sCT0xr1jN9L/ji3L1fO6AcnDGieR3zvJwWjO/z9659UlwPMjebBiiyj84MbqtFi6hV0+efKEI3FtLMr/fpLvT8yud2XMKjS7IWeMNMrqqIk4VxenCWn+oMtzoI2E+x5Q0I/Qyqp0C2hxezILdgVIOWwx1ESvgtydQ5Lf/Mc9OMU= +Received: by 10.66.250.17 with SMTP id x17mr1998377ugh; + Thu, 15 Jun 2006 11:46:11 -0700 (PDT) +Received: by 10.66.216.11 with HTTP; Thu, 15 Jun 2006 11:46:11 -0700 (PDT) +Message-ID: +Date: Thu, 15 Jun 2006 14:46:11 -0400 +From: "John Vincent" +Reply-To: pgsql-performance@lusis.org +To: "Mark Lewis" +Subject: Re: Optimizer internals +Cc: "PGSQL Performance" +In-Reply-To: <1150396425.31200.66.camel@archimedes> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_9353_24436772.1150397171195" +References: + <1150396425.31200.66.camel@archimedes> +X-Google-Sender-Auth: e08d39f0933ec9f4 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/322 +X-Sequence-Number: 19679 + +------=_Part_9353_24436772.1150397171195 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +On 6/15/06, Mark Lewis wrote: + +> DB2 can satisfy the query using only indexes because DB2 doesn't do +> MVCC. +> +> Although MVCC is generally a win in terms of making the database easier +> to use and applications less brittle, it also means that the database +> must inspect the visibility information for each row before it can +> answer a query. For most types of queries this isn't a big deal, but +> for count(*) type queries, it slows things down. + + + +Mark, + +Thanks for the answer. My DBAs just got this look on thier face when I +showed. It's not like the couldn't have investigated this information +themselves but I think the light finally came on. + +One question that we came up with is how does this affect other aggregate +functions like MAX,MIN,SUM and whatnot? Being that this is our data +warehouse, we use these all the time. As I've said previously, I didn't know +a human could generate some of the queries we've passed through this system. + + +Since adding the visibility information to indexes would make them +> significantly more expensive to use and maintain, it isn't done. +> Therefore, each row has to be fetched from the main table anyway. +> +> Since in this particular query you are counting all rows of the +> database, PG must fetch each row from the main table regardless, so the +> sequential scan is much faster because it avoids traversing the index +> and performing random read operations. +> +> -- Mark Lewis +> + +------=_Part_9353_24436772.1150397171195 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +On 6/15/06, Mark Lewis <mark.lewis@mir3.com> wrote:

+DB2 can satisfy the query using only indexes because DB2 doesn't do
MVCC.

Although MVCC is generally a win in terms of making the database easier
to use and applications less brittle, it also means that the database +
must inspect the visibility information for each row before it can
answer a query.  For most types of queries this isn't a big deal, but
for count(*) type queries, it slows things down.


+Mark,

Thanks for the answer. My DBAs just got this look on thier face when I showed. It's not like the couldn't have investigated this information themselves but I think the light finally came on.

One question that we came up with is how does this affect other aggregate functions like MAX,MIN,SUM and whatnot? Being that this is our data warehouse, we use these all the time. As I've said previously, I didn't know a human could generate some of the queries we've passed through this system. +


Since adding the visibility information to indexes would make them
significantly more expensive to use and maintain, it isn't done. +
Therefore, each row has to be fetched from the main table anyway.

Since in this particular query you are counting all rows of the
database, PG must fetch each row from the main table regardless, so the
sequential scan is much faster because it avoids traversing the index +
and performing random read operations.

-- Mark Lewis

+ +------=_Part_9353_24436772.1150397171195-- + +From pgsql-performance-owner@postgresql.org Thu Jun 15 16:01:16 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E99199FA5BE + for ; + Thu, 15 Jun 2006 16:01:15 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 39075-01 for + ; + Thu, 15 Jun 2006 16:01:06 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) + by postgresql.org (Postfix) with ESMTP id 3F3969FA13E + for ; + Thu, 15 Jun 2006 16:01:05 -0300 (ADT) +Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP + with MS-WebStorage 6.0.6249 +Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; + 15 Jun 2006 12:01:04 -0700 +Subject: Re: Optimizer internals +From: Mark Lewis +To: pgsql-performance@lusis.org +Cc: PGSQL Performance +In-Reply-To: +References: + <1150396425.31200.66.camel@archimedes> + +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Organization: MIR3, Inc. +Date: Thu, 15 Jun 2006 12:01:03 -0700 +Message-Id: <1150398064.31200.76.camel@archimedes> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-27) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/323 +X-Sequence-Number: 19680 + +On Thu, 2006-06-15 at 14:46 -0400, John Vincent wrote: + +> One question that we came up with is how does this affect other +> aggregate functions like MAX,MIN,SUM and whatnot? Being that this is +> our data warehouse, we use these all the time. As I've said +> previously, I didn't know a human could generate some of the queries +> we've passed through this system. + +Previously, MIN and MAX would also run slowly, for the same reason as +COUNT(*). But there really isn't a need for that, since you can still +get a big speedup by scanning the index in order, looking up each row +and stopping as soon as you find a visible one. + +This has been fixed so newer versions of PG will run quickly and use the +index for MIN and MAX. I don't remember which version had that change; +it might not be until 8.2. You can dig the archives to find out for +sure. + +For older versions of PG before the fix, you can make MIN and MAX run +quickly by rewriting them in the following form: + +SELECT column FROM table ORDER BY column LIMIT 1; + +Unfortunately SUM is in the same boat as COUNT; in order for it to +return a meaningful result it must inspect visibility information for +all of the rows. + +-- Mark + +From pgsql-performance-owner@postgresql.org Thu Jun 15 16:22:05 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 624DC9FA5BE + for ; + Thu, 15 Jun 2006 16:22:04 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 40653-06 for + ; + Thu, 15 Jun 2006 16:21:52 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.174]) + by postgresql.org (Postfix) with ESMTP id 09FD49FA13E + for ; + Thu, 15 Jun 2006 16:21:51 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so372125ugf + for ; + Thu, 15 Jun 2006 12:21:50 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; + b=BHxyoH3NR8e2SQ2ZwSIjdYTJk+so8W/9aFsyo/bYUx8jTFZKzzrXwEpHgZUGr7lR4V7/VsRAbmDhxC5BP3/shM58K/lBpl0LQvO3SQwJnP03zliS8FZ4/SAU53ylEiilSElQch6S7jD2BrIIZVd1YHHl18Sg3CoqpeQyj5qK1ZA= +Received: by 10.67.96.14 with SMTP id y14mr2022890ugl; + Thu, 15 Jun 2006 12:21:50 -0700 (PDT) +Received: by 10.66.216.11 with HTTP; Thu, 15 Jun 2006 12:21:50 -0700 (PDT) +Message-ID: +Date: Thu, 15 Jun 2006 15:21:50 -0400 +From: "John Vincent" +Reply-To: pgsql-performance@lusis.org +To: "Mark Lewis" +Subject: Re: Optimizer internals +Cc: "PGSQL Performance" +In-Reply-To: <1150398064.31200.76.camel@archimedes> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_9935_17630756.1150399310686" +References: + <1150396425.31200.66.camel@archimedes> + + <1150398064.31200.76.camel@archimedes> +X-Google-Sender-Auth: c17534f664536b88 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/324 +X-Sequence-Number: 19681 + +------=_Part_9935_17630756.1150399310686 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +On 6/15/06, Mark Lewis wrote: +> +> +> Unfortunately SUM is in the same boat as COUNT; in order for it to +> return a meaningful result it must inspect visibility information for +> all of the rows. +> +> -- Mark +> + +We'll this is interesting news to say the least. We went with PostgreSQL for +our warehouse because we needed the advanced features that MySQL didn't have +at the time (views/sprocs). + +It sounds like we almost need another fact table for the places that we do +SUM (which is not a problem just an additional map. If I'm interpreting this +all correctly, we can't force PG to bypass a sequence scan even if we know +our data is stable because of the MVCC aspect. In our case, as with most +warehouses (except those that do rolling loads during the day), we only +write data to it for about 5 hours at night in batch. + +Any suggestions? FYI the original question wasn't meant as a poke at +comparing PG to MySQL to DB2. I'm not making an yvalue judgements either +way. I'm just trying to understand how we can use it the best way possible. + +If anyone from the bizgres team is watching, have they done any work in this +area? + +Thanks. +John + +------=_Part_9935_17630756.1150399310686 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +On 6/15/06, Mark Lewis <mark.lewis@mir3.com> wrote:
+
Unfortunately SUM is in the same boat as COUNT; in order for it to
return a meaningful result it must inspect visibility information for
all of the rows.

-- Mark

We'll this is interesting news to say the least. We went with PostgreSQL for our warehouse because we needed the advanced features that MySQL didn't have at the time (views/sprocs). +

It sounds like we almost need another fact table for the places that we do SUM (which is not a problem just an additional map. If I'm interpreting this all correctly, we can't force PG to bypass a sequence scan even if we know our data is stable because of the MVCC aspect. In our case, as with most warehouses (except those that do rolling loads during the day), we only write data to it for about 5 hours at night in batch. +

Any suggestions? FYI the original question wasn't meant as a poke at comparing PG to MySQL to DB2. I'm not making an yvalue judgements either way. I'm just trying to understand how we can use it the best way possible. +

If anyone from the bizgres team is watching, have they done any work in this area?

Thanks.
John
+ +------=_Part_9935_17630756.1150399310686-- + +From pgsql-performance-owner@postgresql.org Thu Jun 15 16:26:50 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4EA939FA5BE + for ; + Thu, 15 Jun 2006 16:26:50 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 40704-04 for + ; + Thu, 15 Jun 2006 16:26:42 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 254C09FA13E + for ; + Thu, 15 Jun 2006 16:26:41 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Thu, 15 Jun 2006 19:26:39 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 15 Jun 2006 14:26:39 -0500 +Subject: Re: Optimizer internals +From: Scott Marlowe +To: pgsql-performance@lusis.org +Cc: Mark Lewis , + PGSQL Performance +In-Reply-To: +References: + <1150396425.31200.66.camel@archimedes> + + <1150398064.31200.76.camel@archimedes> + +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1150399599.26538.90.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Thu, 15 Jun 2006 14:26:39 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/325 +X-Sequence-Number: 19682 + +On Thu, 2006-06-15 at 14:21, John Vincent wrote: +> On 6/15/06, Mark Lewis wrote: +> Unfortunately SUM is in the same boat as COUNT; in order for +> it to +> return a meaningful result it must inspect visibility +> information for +> all of the rows. +> +> -- Mark +> +> We'll this is interesting news to say the least. We went with +> PostgreSQL for our warehouse because we needed the advanced features +> that MySQL didn't have at the time (views/sprocs). +> +> It sounds like we almost need another fact table for the places that +> we do SUM (which is not a problem just an additional map. If I'm +> interpreting this all correctly, we can't force PG to bypass a +> sequence scan even if we know our data is stable because of the MVCC +> aspect. In our case, as with most warehouses (except those that do +> rolling loads during the day), we only write data to it for about 5 +> hours at night in batch. +> +> Any suggestions? FYI the original question wasn't meant as a poke at +> comparing PG to MySQL to DB2. I'm not making an yvalue judgements +> either way. I'm just trying to understand how we can use it the best +> way possible. +> +> If anyone from the bizgres team is watching, have they done any work +> in this area? + +This might help: + +http://jonathangardner.net/PostgreSQL/materialized_views/matviews.html + +Since you're doing a data warehouse, I would think materialized views +would be a natural addition anyway. + +From pgsql-performance-owner@postgresql.org Thu Jun 22 03:05:02 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 873CF9FA5BE + for ; + Thu, 15 Jun 2006 16:38:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 41812-07 for + ; + Thu, 15 Jun 2006 16:38:34 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.170]) + by postgresql.org (Postfix) with ESMTP id 2EE709FA13E + for ; + Thu, 15 Jun 2006 16:38:33 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so380627ugf + for ; + Thu, 15 Jun 2006 12:38:32 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=m+7mjzwABh/RRuPWFNAWM/Xw7XxhvD+ay/MOkSXYZPPoKA/EnwLpvS/s3djGYRJAZnQ5tX1WRnlvfkiI8QkWkv4QIl+3g5eR/2qvgdoBnzQs41pliPgdI8ZkSUXIuaxKeBqQ6FZsmK6hrjLMGy0vVL21zv4MFMufycgAWcnjlz0= +Received: by 10.67.100.17 with SMTP id c17mr796532ugm; + Thu, 15 Jun 2006 12:38:32 -0700 (PDT) +Received: by 10.66.216.11 with HTTP; Thu, 15 Jun 2006 12:38:32 -0700 (PDT) +Message-ID: +Date: Thu, 15 Jun 2006 15:38:32 -0400 +From: "John Vincent" +To: "Mark Lewis" +Subject: Re: Optimizer internals +Cc: "PGSQL Performance" +In-Reply-To: +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_10235_27566945.1150400312377" +References: + <1150396425.31200.66.camel@archimedes> + + <1150398064.31200.76.camel@archimedes> + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/432 +X-Sequence-Number: 19789 + +------=_Part_10235_27566945.1150400312377 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Any suggestions? FYI the original question wasn't meant as a poke at +> comparing PG to MySQL to DB2. I'm not making an yvalue judgements either +> way. I'm just trying to understand how we can use it the best way possible. +> + +Actually we just thought about something. With PG, we can create an index +that is a SUM of the column where indexing, no? We're going to test this in +a few hours. Would that be able to be satisfied by an index scan? + +------=_Part_10235_27566945.1150400312377 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +


Any suggestions? FYI the original question wasn't meant as a poke at comparing PG to MySQL to DB2. I'm not making an yvalue judgements either way. I'm just trying to understand how we can use it the best way possible. +

Actually we just thought about something. With PG, we can create an index that is a SUM of the column where indexing, no? We're going to test this in a few hours. Would that be able to be satisfied by an index scan? +


+ +------=_Part_10235_27566945.1150400312377-- + +From pgsql-performance-owner@postgresql.org Thu Jun 15 16:43:19 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3C3279FA5E7 + for ; + Thu, 15 Jun 2006 16:43:19 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 40641-09 for + ; + Thu, 15 Jun 2006 16:43:12 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from hu-out-0102.google.com (hu-out-0102.google.com [72.14.214.195]) + by postgresql.org (Postfix) with ESMTP id 528AD9FA13E + for ; + Thu, 15 Jun 2006 16:43:11 -0300 (ADT) +Received: by hu-out-0102.google.com with SMTP id 34so173756hui + for ; + Thu, 15 Jun 2006 12:43:10 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:sender:to:subject:in-reply-to:mime-version:content-type:references:x-google-sender-auth; + b=ZzcENxrXGfkBgGvJlZcUGprFWMfHklwafETyXmd3XsOdPD9v41hSBWwhgt1bFApwEbXQIECQYwGqVkRcuQbYgB0vcsMuyxKJEdfUyi6aNOnqJhrY355gFYBGLLPu3ch5XKAd5YtLp0jUxR6b0SMpmc2UtMwVUKX72DlyPnP4KOQ= +Received: by 10.67.97.7 with SMTP id z7mr2044923ugl; + Thu, 15 Jun 2006 12:43:09 -0700 (PDT) +Received: by 10.66.216.11 with HTTP; Thu, 15 Jun 2006 12:43:09 -0700 (PDT) +Message-ID: +Date: Thu, 15 Jun 2006 15:43:09 -0400 +From: "John Vincent" +Reply-To: pgsql-performance@lusis.org +To: "PGSQL Performance" +Subject: Re: Optimizer internals +In-Reply-To: +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_10291_18445274.1150400589686" +References: + <1150396425.31200.66.camel@archimedes> + + <1150398064.31200.76.camel@archimedes> + +X-Google-Sender-Auth: 07abb7d66f7e48f8 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/326 +X-Sequence-Number: 19683 + +------=_Part_10291_18445274.1150400589686 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +> Any suggestions? FYI the original question wasn't meant as a poke at +> comparing PG to MySQL to DB2. I'm not making an yvalue judgements either +> way. I'm just trying to understand how we can use it the best way possible. +> +> If anyone from the bizgres team is watching, have they done any work in +> this area? +> +> Thanks. +> John +> + +Actually we just thought about something. With PG, we can create an index +that is a SUM of the column where indexing, no? We're going to test this in +a few hours. Would that be able to be satisfied by an index scan? + +Also, we're looking at the link provided for the materialized views in PG. + +Thanks. + +------=_Part_10291_18445274.1150400589686 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +
Any suggestions? FYI the original question wasn't meant as a poke at comparing PG to MySQL to DB2. I'm not making an yvalue judgements either way. I'm just trying to understand how we can use it the best way possible. +

If anyone from the bizgres team is watching, have they done any work in this area?

Thanks.
John
+ +

Actually we just thought about something. With PG, we can create +an index that is a SUM of the column where indexing, no? We're going to +test this in a few hours. Would that be able to be satisfied by an +index scan? +

Also, we're looking at the link provided for the materialized views in PG.

Thanks.
+ +------=_Part_10291_18445274.1150400589686-- + +From pgsql-hackers-owner@postgresql.org Thu Jun 15 16:58:45 2006 +X-Original-To: pgsql-hackers-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 56C3F9FA5BE + for ; + Thu, 15 Jun 2006 16:58:45 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 42927-10 for + ; + Thu, 15 Jun 2006 16:58:35 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from cronos.madness.at (madness.at [217.196.146.217]) + by postgresql.org (Postfix) with ESMTP id 2A03C9FA13E + for ; + Thu, 15 Jun 2006 16:58:34 -0300 (ADT) +Received: from mastermind.kaltenbrunner.cc ([83.215.233.60]) + by cronos.madness.at with esmtpsa (TLSv1:AES256-SHA:256) + (Exim 4.62 (FreeBSD)) (envelope-from ) + id 1Fqxz1-000PkC-7p; Thu, 15 Jun 2006 21:58:31 +0200 +Message-ID: <4491BBE3.7070805@kaltenbrunner.cc> +Date: Thu, 15 Jun 2006 21:58:27 +0200 +From: Stefan Kaltenbrunner +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: Bruce Momjian +CC: pgsql-hackers@postgreSQL.org +Subject: Re: Test request for Stats collector performance improvement +References: <200606150405.k5F45cH11445@candle.pha.pa.us> +In-Reply-To: <200606150405.k5F45cH11445@candle.pha.pa.us> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/758 +X-Sequence-Number: 84991 + +Bruce Momjian wrote: +> Would some people please run the attached test procedure and report back +> the results? I basically need to know the patch is an improvement on +> more platforms than just my own. Thanks + + +OpenBSD 3.9-current/x86: + +without stats: + 0m6.79s real 0m1.56s user 0m1.12s system + +-HEAD + stats: + 0m10.44s real 0m2.26s user 0m1.22s system + +-HEAD + stats + patch: + 0m10.68s real 0m2.16s user 0m1.36s system + + +Stefan + +From pgsql-hackers-owner@postgresql.org Thu Jun 15 17:29:51 2006 +X-Original-To: pgsql-hackers-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B09D59FA5BE + for ; + Thu, 15 Jun 2006 17:29:50 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 45703-10 for + ; + Thu, 15 Jun 2006 17:29:42 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from cronos.madness.at (madness.at [217.196.146.217]) + by postgresql.org (Postfix) with ESMTP id DC52F9FA13E + for ; + Thu, 15 Jun 2006 17:29:42 -0300 (ADT) +Received: from mastermind.kaltenbrunner.cc ([83.215.233.60]) + by cronos.madness.at with esmtpsa (TLSv1:AES256-SHA:256) + (Exim 4.62 (FreeBSD)) (envelope-from ) + id 1FqyTA-0000S0-8D; Thu, 15 Jun 2006 22:29:40 +0200 +Message-ID: <4491C330.5020104@kaltenbrunner.cc> +Date: Thu, 15 Jun 2006 22:29:36 +0200 +From: Stefan Kaltenbrunner +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: Bruce Momjian +CC: pgsql-hackers@postgreSQL.org +Subject: Re: Test request for Stats collector performance improvement +References: <200606150405.k5F45cH11445@candle.pha.pa.us> +In-Reply-To: <200606150405.k5F45cH11445@candle.pha.pa.us> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/760 +X-Sequence-Number: 84993 + +Bruce Momjian wrote: +> Would some people please run the attached test procedure and report back +> the results? I basically need to know the patch is an improvement on +> more platforms than just my own. Thanks + + +Debian Sarge/AMD64 Kernel 2.6.16.16 (all tests done multiple times with +variation of less then 10%): + +-HEAD: + +real 0m0.486s +user 0m0.064s +sys 0m0.048s + +-HEAD with 100000 "SELECT 1;" queries: + +real 0m4.763s +user 0m0.896s +sys 0m1.232s + +-HEAD + stats: + + +real 0m0.720s +user 0m0.128s +sys 0m0.096s + + +-HEAD + stats (100k): + + +real 0m7.204s +user 0m1.504s +sys 0m1.028s + + +-HEAD + stats + patch: + +there is something weird going on here - I get either runtimes like: + +real 0m0.729s +user 0m0.092s +sys 0m0.100s + +and occasionally: + + +real 0m3.926s +user 0m0.144s +sys 0m0.140s + + +(always ~0,7 vs ~4 seconds - same variation as Qingqing Zhou seems to see) + + +-HEAD + stats + patch(100k): + +similiar variation with: + +real 0m7.955s +user 0m1.124s +sys 0m1.164s + +and + +real 0m11.836s +user 0m1.368s +sys 0m1.156s + +(ie 7-8 seconds vs 11-12 seconds) + + +looks like this patch is actually a loss on that box. + + +Stefan + +From pgsql-hackers-owner@postgresql.org Thu Jun 15 18:38:24 2006 +X-Original-To: pgsql-hackers-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 1D03C9FA5BE + for ; + Thu, 15 Jun 2006 18:38:24 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 50977-06 for + ; + Thu, 15 Jun 2006 18:38:19 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by postgresql.org (Postfix) with ESMTP id A7AB79FA13E + for ; + Thu, 15 Jun 2006 18:38:19 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO [192.168.1.27]) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 9593288; Thu, 15 Jun 2006 14:41:30 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: pgsql-hackers@postgresql.org +Subject: Re: Test request for Stats collector performance improvement +Date: Thu, 15 Jun 2006 14:38:01 -0700 +User-Agent: KMail/1.8 +Cc: Bruce Momjian , Tom Lane , + Qingqing Zhou +References: <200606151557.k5FFva918328@candle.pha.pa.us> +In-Reply-To: <200606151557.k5FFva918328@candle.pha.pa.us> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200606151438.02023.josh@agliodbs.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/761 +X-Sequence-Number: 84994 + +Bruce, + +> The report is incomplete. I need three outputs: +> +> stats off +> stats on +> stats on, patched +> +> He only reported two sets of results. + +You need stats off, patched too. + +-- +--Josh + +Josh Berkus +PostgreSQL @ Sun +San Francisco + +From pgsql-hackers-owner@postgresql.org Thu Jun 15 18:42:52 2006 +X-Original-To: pgsql-hackers-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C96B09FA5BE + for ; + Thu, 15 Jun 2006 18:42:51 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 55975-02 for + ; + Thu, 15 Jun 2006 18:42:47 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 9BD769FA13E + for ; + Thu, 15 Jun 2006 18:42:47 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5FLgGcw001387; + Thu, 15 Jun 2006 17:42:16 -0400 (EDT) +To: josh@agliodbs.com +cc: pgsql-hackers@postgresql.org, Bruce Momjian , + Qingqing Zhou +Subject: Re: Test request for Stats collector performance improvement +In-reply-to: <200606151438.02023.josh@agliodbs.com> +References: <200606151557.k5FFva918328@candle.pha.pa.us> + <200606151438.02023.josh@agliodbs.com> +Comments: In-reply-to Josh Berkus + message dated "Thu, 15 Jun 2006 14:38:01 -0700" +Date: Thu, 15 Jun 2006 17:42:16 -0400 +Message-ID: <1386.1150407736@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/762 +X-Sequence-Number: 84995 + +Josh Berkus writes: +> You need stats off, patched too. + +Shouldn't really be necessary, as the code being patched won't be +executed if stats aren't being collected... + + regards, tom lane + +From pgsql-hackers-owner@postgresql.org Thu Jun 15 18:46:40 2006 +X-Original-To: pgsql-hackers-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2CFC59FA5BE + for ; + Thu, 15 Jun 2006 18:46:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 53437-07 for + ; + Thu, 15 Jun 2006 18:46:34 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from candle.pha.pa.us (candle.pha.pa.us [70.90.9.53]) + by postgresql.org (Postfix) with ESMTP id 275BA9FA13E + for ; + Thu, 15 Jun 2006 18:46:31 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id k5FLkTK20030; + Thu, 15 Jun 2006 17:46:29 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200606152146.k5FLkTK20030@candle.pha.pa.us> +Subject: Re: Test request for Stats collector performance improvement +In-Reply-To: <200606151438.02023.josh@agliodbs.com> +To: josh@agliodbs.com +Date: Thu, 15 Jun 2006 17:46:29 -0400 (EDT) +CC: pgsql-hackers@postgresql.org, Tom Lane , + Qingqing Zhou +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/763 +X-Sequence-Number: 84996 + +Josh Berkus wrote: +> Bruce, +> +> > The report is incomplete. I need three outputs: +> > +> > stats off +> > stats on +> > stats on, patched +> > +> > He only reported two sets of results. +> +> You need stats off, patched too. + +No need --- stats off, patched too, should be the same as stats off, no +patch. + +-- + Bruce Momjian http://candle.pha.pa.us + EnterpriseDB http://www.enterprisedb.com + + + If your life is a hard drive, Christ can be your backup. + + +From pgsql-performance-owner@postgresql.org Thu Jun 15 18:50:32 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C42F39FA5BE + for ; + Thu, 15 Jun 2006 18:50:31 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 55076-08 for + ; + Thu, 15 Jun 2006 18:50:24 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from gw.proximity.com.au (147-68-185-210.static.techex.net.au + [210.185.68.147]) + by postgresql.org (Postfix) with ESMTP id E53E89FA13E + for ; + Thu, 15 Jun 2006 18:50:23 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by gw.proximity.com.au (Postfix) with ESMTP id 2362C1FDFE1 + for ; + Fri, 16 Jun 2006 07:50:18 +1000 (EST) +Received: from gw.proximity.com.au ([127.0.0.1]) + by localhost (gw [127.0.0.1]) (amavisd-new, port 10024) with ESMTP + id 09407-09 for ; + Fri, 16 Jun 2006 07:50:16 +1000 (EST) +Received: from [192.168.132.14] (unknown [192.168.132.14]) + by gw.proximity.com.au (Postfix) with ESMTP id 524591FE1EA + for ; + Fri, 16 Jun 2006 07:50:16 +1000 (EST) +Message-ID: <4491D61B.9040507@proximity.com.au> +Date: Fri, 16 Jun 2006 07:50:19 +1000 +From: Tim Allen +User-Agent: Mozilla Thunderbird 1.0 (X11/20050316) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: SAN performance mystery +Content-Type: multipart/mixed; boundary="------------070007050506070004030707" +X-Virus-Scanned: by amavisd-new at proximity.com.au +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/327 +X-Sequence-Number: 19684 + +This is a multi-part message in MIME format. +--------------070007050506070004030707 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +We have a customer who are having performance problems. They have a +large (36G+) postgres 8.1.3 database installed on an 8-way opteron with +8G RAM, attached to an EMC SAN via fibre-channel (I don't have details +of the EMC SAN model, or the type of fibre-channel card at the moment). +They're running RedHat ES3 (which means a 2.4.something Linux kernel). + +They are unhappy about their query performance. We've been doing various +things to try to work out what we can do. One thing that has been +apparent is that autovacuum has not been able to keep the database +sufficiently tamed. A pg_dump/pg_restore cycle reduced the total +database size from 81G to 36G. Performing the restore took about 23 hours. + +We tried restoring the pg_dump output to one of our machines, a +dual-core pentium D with a single SATA disk, no raid, I forget how much +RAM but definitely much less than 8G. The restore took five hours. So it +would seem that our machine, which on paper should be far less +impressive than the customer's box, does more than four times the I/O +performance. + +To simplify greatly - single local SATA disk beats EMC SAN by factor of +four. + +Is that expected performance, anyone? It doesn't sound right to me. Does +anyone have any clues about what might be going on? Buggy kernel +drivers? Buggy kernel, come to think of it? Does a SAN just not provide +adequate performance for a large database? + +I'd be grateful for any clues anyone can offer, + +Tim + + + +--------------070007050506070004030707 +Content-Type: text/x-vcard; charset=utf-8; + name="tim.vcf" +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; + filename="tim.vcf" + +begin:vcard +fn:Tim Allen +n:Allen;Tim +email;internet:tim@proximity.com.au +x-mozilla-html:FALSE +version:2.1 +end:vcard + + +--------------070007050506070004030707-- + +From pgsql-performance-owner@postgresql.org Thu Jun 15 18:57:03 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 518FE9FA5BE + for ; + Thu, 15 Jun 2006 18:57:03 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 57428-01 for + ; + Thu, 15 Jun 2006 18:56:56 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 0298A9FA13E + for ; + Thu, 15 Jun 2006 18:56:55 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Thu, 15 Jun 2006 21:56:54 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 15 Jun 2006 16:56:54 -0500 +Subject: Re: SAN performance mystery +From: Scott Marlowe +To: Tim Allen +Cc: pgsql-performance@postgresql.org +In-Reply-To: <4491D61B.9040507@proximity.com.au> +References: <4491D61B.9040507@proximity.com.au> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1150408614.26538.95.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Thu, 15 Jun 2006 16:56:54 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/328 +X-Sequence-Number: 19685 + +On Thu, 2006-06-15 at 16:50, Tim Allen wrote: +> We have a customer who are having performance problems. They have a +> large (36G+) postgres 8.1.3 database installed on an 8-way opteron with +> 8G RAM, attached to an EMC SAN via fibre-channel (I don't have details +> of the EMC SAN model, or the type of fibre-channel card at the moment). +> They're running RedHat ES3 (which means a 2.4.something Linux kernel). +> +> They are unhappy about their query performance. We've been doing various +> things to try to work out what we can do. One thing that has been +> apparent is that autovacuum has not been able to keep the database +> sufficiently tamed. A pg_dump/pg_restore cycle reduced the total +> database size from 81G to 36G. Performing the restore took about 23 hours. + +Do you have the ability to do any simple IO performance testing, like +with bonnie++ (the old bonnie is not really capable of properly testing +modern equipment, but bonnie++ will give you some idea of the throughput +of the SAN) Or even just timing a dd write to the SAN? + +> We tried restoring the pg_dump output to one of our machines, a +> dual-core pentium D with a single SATA disk, no raid, I forget how much +> RAM but definitely much less than 8G. The restore took five hours. So it +> would seem that our machine, which on paper should be far less +> impressive than the customer's box, does more than four times the I/O +> performance. +> +> To simplify greatly - single local SATA disk beats EMC SAN by factor of +> four. +> +> Is that expected performance, anyone? It doesn't sound right to me. Does +> anyone have any clues about what might be going on? Buggy kernel +> drivers? Buggy kernel, come to think of it? Does a SAN just not provide +> adequate performance for a large database? + +Yes, this is not uncommon. It is very likely that your SATA disk is +lying about fsync. + +What kind of backup are you using? insert statements or copy +statements? If insert statements, then the difference is quite +believable. If copy statements, less so. + +Next time, on their big server, see if you can try a restore with fsync +turned off and see if that makes the restore faster. Note you should +turn fsync back on after the restore, as running without it is quite +dangerous should you suffer a power outage. + +How are you mounting to the EMC SAN? NFS, iSCSI? Other? + +From pgsql-performance-owner@postgresql.org Thu Jun 15 19:02:22 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 53A429FA6B3 + for ; + Thu, 15 Jun 2006 19:02:22 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 56115-07 for + ; + Thu, 15 Jun 2006 19:02:11 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from janestcapital.com (unknown [66.155.124.107]) + by postgresql.org (Postfix) with ESMTP id B7DD39FA6B2 + for ; + Thu, 15 Jun 2006 19:02:09 -0300 (ADT) +Received: from [192.168.250.117] [209.213.205.130] by janestcapital.com with + ESMTP (SMTPD32-8.13) id A8DCA0D00A4; Thu, 15 Jun 2006 18:02:04 -0400 +Message-ID: <4491D8DC.4070906@janestcapital.com> +Date: Thu, 15 Jun 2006 18:02:04 -0400 +From: Brian Hurt +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; + rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Tim Allen +CC: pgsql-performance@postgresql.org +Subject: Re: SAN performance mystery +References: <4491D61B.9040507@proximity.com.au> +In-Reply-To: <4491D61B.9040507@proximity.com.au> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/329 +X-Sequence-Number: 19686 + +Tim Allen wrote: + +> We have a customer who are having performance problems. They have a +> large (36G+) postgres 8.1.3 database installed on an 8-way opteron +> with 8G RAM, attached to an EMC SAN via fibre-channel (I don't have +> details of the EMC SAN model, or the type of fibre-channel card at the +> moment). They're running RedHat ES3 (which means a 2.4.something Linux +> kernel). +> +> They are unhappy about their query performance. We've been doing +> various things to try to work out what we can do. One thing that has +> been apparent is that autovacuum has not been able to keep the +> database sufficiently tamed. A pg_dump/pg_restore cycle reduced the +> total database size from 81G to 36G. Performing the restore took about +> 23 hours. +> +> We tried restoring the pg_dump output to one of our machines, a +> dual-core pentium D with a single SATA disk, no raid, I forget how +> much RAM but definitely much less than 8G. The restore took five +> hours. So it would seem that our machine, which on paper should be far +> less impressive than the customer's box, does more than four times the +> I/O performance. +> +> To simplify greatly - single local SATA disk beats EMC SAN by factor +> of four. +> +> Is that expected performance, anyone? It doesn't sound right to me. +> Does anyone have any clues about what might be going on? Buggy kernel +> drivers? Buggy kernel, come to think of it? Does a SAN just not +> provide adequate performance for a large database? +> +> I'd be grateful for any clues anyone can offer, + + +I'm actually in a not dissimiliar position here- I was seeing the +performance of Postgres going to an EMC Raid over iSCSI running at about +1/2 the speed of a lesser machine hitting a local SATA drive. That was, +until I noticed that the SATA drive Postgres installation had fsync +turned off, and the EMC version had fsync turned on. Turning fsync on +on the SATA drive dropped it's performance to being about 1/4th that of EMC. + +Moral of the story: make sure you're comparing apples to apples. + +Brian + + +From pgsql-performance-owner@postgresql.org Thu Jun 15 19:15:46 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6B29A9FA5D2 + for ; + Thu, 15 Jun 2006 19:15:46 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 55861-07 for + ; + Thu, 15 Jun 2006 19:15:40 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.168]) + by postgresql.org (Postfix) with ESMTP id D51939FA160 + for ; + Thu, 15 Jun 2006 19:15:40 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so455972ugf + for ; + Thu, 15 Jun 2006 15:15:39 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; + b=PE2jXZ3KCtcTvhJh0nz7qqPLSSy/Bj2Sr5BYRURaiRDPg6JGqExBeYWfipwYcJz8oXVagTk+LOgV8bCfLqNL7qi+rvRBjlHDphNdBiv0iGwkRckSZ1GFJxwo9WUBPnjfqlTTqUXz5a5D+oo960+Wyi9rCopd+w+JV4m91IKs6/c= +Received: by 10.66.250.17 with SMTP id x17mr2144827ugh; + Thu, 15 Jun 2006 15:15:38 -0700 (PDT) +Received: by 10.66.216.11 with HTTP; Thu, 15 Jun 2006 15:15:38 -0700 (PDT) +Message-ID: +Date: Thu, 15 Jun 2006 18:15:38 -0400 +From: "John Vincent" +Reply-To: pgsql-performance@lusis.org +To: "Tim Allen" +Subject: Re: SAN performance mystery +Cc: pgsql-performance@postgresql.org +In-Reply-To: <4491D61B.9040507@proximity.com.au> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_12626_21606881.1150409738620" +References: <4491D61B.9040507@proximity.com.au> +X-Google-Sender-Auth: f75d7d92ae6bfed7 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/330 +X-Sequence-Number: 19687 + +------=_Part_12626_21606881.1150409738620 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +On 6/15/06, Tim Allen wrote: +> +> +> Is that expected performance, anyone? It doesn't sound right to me. Does +> anyone have any clues about what might be going on? Buggy kernel +> drivers? Buggy kernel, come to think of it? Does a SAN just not provide +> adequate performance for a large database? +> +> I'd be grateful for any clues anyone can offer, +> +> Tim + + +Tim, + +Here are the areas I would look at first if we're considering hardware to be +the problem: + +HBA and driver: + Since this is a Intel/Linux system, the HBA is PROBABLY a qlogic. I would +need to know the SAN model to see what the backend of the SAN is itself. EMC +has some FC-attach models that actually have SATA disks underneath. You also +might want to look at the cache size of the controllers on the SAN. + - Something also to note is that EMC provides a add-on called PowerPath +for load balancing multiple HBAs. If they don't have this, it might be worth +investigating. + - As with anything, disk layout is important. With the lower end IBM SAN +(DS4000) you actually have to operate on physical spindle level. On our +4300, when I create a LUN, I select the exact disks I want and which of the +two controllers are the preferred path. On our DS6800, I just ask for +storage. I THINK all the EMC models are the "ask for storage" type of +scenario. However with the 6800, you select your storage across extent +pools. + + +Have they done any benchmarking of the SAN outside of postgres? Before we +settle on a new LUN configuration, we always do the dd,umount,mount,dd +routine. It's not a perfect test for databases but it will help you catch +GROSS performance issues. + +SAN itself: + - Could the SAN be oversubscribed? How many hosts and LUNs total do they +have and what are the queue_depths for those hosts? With the qlogic card, +you can set the queue depth in the BIOS of the adapter when the system is +booting up. CTRL-Q I think. If the system has enough local DASD to relocate +the database internally, it might be a valid test to do so and see if you +can isolate the problem to the SAN itself. + +PG itself: + + If you think it's a pgsql configuration, I'm guessing you already +configured postgresql.conf to match thiers (or at least a fraction of thiers +since the memory isn't the same?). What about loading a "from-scratch" +config file and restarting the tuning process? + + +Just a dump of my thought process from someone who's been spending too much +time tuning his SAN and postgres lately. + +------=_Part_12626_21606881.1150409738620 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +On 6/15/06, Tim Allen <tim@proximity.com.au> wrote:
+<snipped>
Is that expected performance, anyone? It doesn't sound right to me. Does
anyone have any clues about what might be going on? Buggy kernel
drivers? Buggy kernel, come to think of it? Does a SAN just not provide +
adequate performance for a large database?

I'd be grateful for any clues anyone can offer,

Tim

Tim,

Here are the areas I would look at first if we're considering hardware to be the problem: +

HBA and driver:
   Since this is a Intel/Linux system, the HBA is PROBABLY a qlogic. I would need to know the SAN model to see what the backend of the SAN is itself. EMC has some FC-attach models that actually have SATA disks underneath. You also might want to look at the cache size of the controllers on the SAN. +
   - Something also to note is that EMC provides a add-on called PowerPath for load balancing multiple HBAs. If they don't have this, it might be worth investigating.
  - As with anything, disk layout is important. With the lower end IBM SAN (DS4000) you actually have to operate on physical spindle level. On our 4300, when I create a LUN, I select the exact disks I want and which of the two controllers are the preferred path. On our DS6800, I just ask for storage. I THINK all the EMC models are the "ask for storage" type of scenario. However with the 6800, you select your storage across extent pools. +


Have they done any benchmarking of the SAN outside of postgres? Before we settle on a new LUN configuration, we always do the dd,umount,mount,dd routine. It's not a perfect test for databases but it will help you catch GROSS performance issues. +

SAN itself:
  - Could the SAN be oversubscribed? How many hosts and LUNs total do they have and what are the queue_depths for those hosts? With the qlogic card, you can set the queue depth in the BIOS of the adapter when the system is booting up. CTRL-Q I think.  If the system has enough local DASD to relocate the database internally, it might be a valid test to do so and see if you can isolate the problem to the SAN itself. +

PG itself:
 
 If you think it's a pgsql configuration, I'm guessing you already +configured postgresql.conf to match thiers (or at least a fraction of +thiers since the memory isn't the same?). What about loading a "from-scratch" config file and restarting the tuning process?
+

Just a dump of my thought process from someone who's been spending too much time tuning his SAN and postgres lately.
+ +------=_Part_12626_21606881.1150409738620-- + +From pgsql-performance-owner@postgresql.org Thu Jun 15 19:23:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 82DE79FA5D2 + for ; + Thu, 15 Jun 2006 19:23:55 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 60363-05 for + ; + Thu, 15 Jun 2006 19:23:48 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 011449FA160 + for ; + Thu, 15 Jun 2006 19:23:48 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id B03395647A; Thu, 15 Jun 2006 17:23:47 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Thu, 15 Jun 2006 17:23:45 -0500 +Date: Thu, 15 Jun 2006 17:23:45 -0500 +From: "Jim C. Nasby" +To: John Vincent +Cc: PGSQL Performance +Subject: Re: Optimizer internals +Message-ID: <20060615222344.GB93655@pervasive.com> +References: + <1150396425.31200.66.camel@archimedes> + + <1150398064.31200.76.camel@archimedes> + + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060615:pgsql-performance@lusis.org::fH7H9BX9CFYcgmOl:0000000000 + 000000000000000000000000Bupq +X-Hashcash: + 1:20:060615:pgsql-performance@postgresql.org::9n64AhEY9uDBeq70:00000 + 000000000000000000000000IU+P +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/331 +X-Sequence-Number: 19688 + +On Thu, Jun 15, 2006 at 03:43:09PM -0400, John Vincent wrote: +> >Any suggestions? FYI the original question wasn't meant as a poke at +> >comparing PG to MySQL to DB2. I'm not making an yvalue judgements either +> >way. I'm just trying to understand how we can use it the best way possible. +> > +> >If anyone from the bizgres team is watching, have they done any work in +> >this area? +> > +> >Thanks. +> >John +> > +> +> Actually we just thought about something. With PG, we can create an index +> that is a SUM of the column where indexing, no? We're going to test this in +> a few hours. Would that be able to be satisfied by an index scan? +> +> Also, we're looking at the link provided for the materialized views in PG. +> +> Thanks. + +decibel=# create index test on i ( sum(i) ); +ERROR: cannot use aggregate function in index expression +decibel=# + +BTW, there have been a number of proposals to negate the effect of not +having visibility info in indexes. Unfortunately, none of them have come +to fruition yet, mostly because it's a very difficult problem to solve. +But it is something that the community would like to see happen. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Thu Jun 15 19:24:57 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 204F79FA5D2 + for ; + Thu, 15 Jun 2006 19:24:57 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 59040-05 for + ; + Thu, 15 Jun 2006 19:24:47 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 7A70D9FA160 + for ; + Thu, 15 Jun 2006 19:24:47 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5FMOiel001752; + Thu, 15 Jun 2006 18:24:44 -0400 (EDT) +To: Brian Hurt +cc: Tim Allen , pgsql-performance@postgresql.org +Subject: Re: SAN performance mystery +In-reply-to: <4491D8DC.4070906@janestcapital.com> +References: <4491D61B.9040507@proximity.com.au> + <4491D8DC.4070906@janestcapital.com> +Comments: In-reply-to Brian Hurt + message dated "Thu, 15 Jun 2006 18:02:04 -0400" +Date: Thu, 15 Jun 2006 18:24:44 -0400 +Message-ID: <1751.1150410284@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/332 +X-Sequence-Number: 19689 + +Brian Hurt writes: +> Tim Allen wrote: +>> To simplify greatly - single local SATA disk beats EMC SAN by factor +>> of four. + +> I'm actually in a not dissimiliar position here- I was seeing the +> performance of Postgres going to an EMC Raid over iSCSI running at about +> 1/2 the speed of a lesser machine hitting a local SATA drive. That was, +> until I noticed that the SATA drive Postgres installation had fsync +> turned off, and the EMC version had fsync turned on. Turning fsync on +> on the SATA drive dropped it's performance to being about 1/4th that of EMC. + +And that's assuming that the SATA drive isn't configured to lie about +write completion ... + +I agree with Brian's suspicion that the SATA drive isn't properly +fsync'ing to disk, resulting in bogusly high throughput. However, +ISTM a well-configured SAN ought to be able to match even the bogus +throughput, because it should be able to rely on battery-backed +cache to hold written blocks across a power failure, and hence should +be able to report write-complete as soon as it's got the page in cache +rather than having to wait till it's really down on magnetic platter. +Which is what the SATA drive is doing ... only it can't keep the promise +it's making for lack of any battery backup on its on-board cache. + +So I'm thinking *both* setups may be misconfigured. Or else you forgot +to buy the battery-backed-cache option on the SAN hardware. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jun 15 20:23:48 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E5B4F9FA5D2 + for ; + Thu, 15 Jun 2006 20:23:47 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 63180-07 for + ; + Thu, 15 Jun 2006 20:23:42 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.168]) + by postgresql.org (Postfix) with ESMTP id F1BA39FA160 + for ; + Thu, 15 Jun 2006 20:23:40 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so483128ugf + for ; + Thu, 15 Jun 2006 16:23:39 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; + b=rAsik9v0Q7vuKj+leHVgk60IWIlNSCHEXT5hl1byHu156IbMflMI4T74kw2Qea8xxpFIXneKvzJccdanr9IrIMEpLA9CIX5KO8zgXrPhXAzlA0xYN381UhZYmne4eCxkt86+nv0Th7tnGCbcruTDXCUtLy3ihxjOPHqAy0MppyI= +Received: by 10.66.252.4 with SMTP id z4mr2199493ugh; + Thu, 15 Jun 2006 16:23:39 -0700 (PDT) +Received: by 10.66.216.11 with HTTP; Thu, 15 Jun 2006 16:23:39 -0700 (PDT) +Message-ID: +Date: Thu, 15 Jun 2006 19:23:39 -0400 +From: "John Vincent" +Reply-To: pgsql-performance@lusis.org +To: "Jim C. Nasby" +Subject: Re: Optimizer internals +Cc: "PGSQL Performance" +In-Reply-To: <20060615222344.GB93655@pervasive.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_13255_9231142.1150413819314" +References: + <1150396425.31200.66.camel@archimedes> + + <1150398064.31200.76.camel@archimedes> + + + <20060615222344.GB93655@pervasive.com> +X-Google-Sender-Auth: e74d7193c8279045 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/333 +X-Sequence-Number: 19690 + +------=_Part_13255_9231142.1150413819314 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +> decibel=# create index test on i ( sum(i) ); +> ERROR: cannot use aggregate function in index expression +> decibel=# +> +> BTW, there have been a number of proposals to negate the effect of not +> having visibility info in indexes. Unfortunately, none of them have come +> to fruition yet, mostly because it's a very difficult problem to solve. +> But it is something that the community would like to see happen. +> -- +> Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +> Pervasive Software http://pervasive.com work: 512-231-6117 +> vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 +> + + +Yeah we got the same thing when we tried it. + +I thought about the whole thing on the way home and the downside is that we +might have to ditch pgsql. + +As far as implementing it, it might make sense to translate READ UNCOMMITTED +to that new functionality. If the default isolation level stays the current +level, the people who need it can use it via WITH UR or somesuch. + +I know it's not that easy but it's an idea. I'm also thinking that the table +inheritance we're going to be taking advantage of in 8.1 on the new server +might make the sequence scan less of an issue. The only reason the sequence +scan really blows is that we have a single table with 220M rows and growing. + +------=_Part_13255_9231142.1150413819314 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +


decibel=# create index test on i ( sum(i) );
ERROR:  cannot use aggregate function in index expression +
decibel=#

BTW, there have been a number of proposals to negate the effect of not
having visibility info in indexes. Unfortunately, none of them have come
to fruition yet, mostly because it's a very difficult problem to solve. +
But it is something that the community would like to see happen.
--
Jim C. Nasby, Sr. Engineering Consultant       +jnasby@pervasive.com
Pervasive Software       +http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461 +


Yeah we got the same thing when we tried it. +

I thought about the whole thing on the way home and the downside is that we might have to ditch pgsql.

As far as implementing it, it might make sense to translate READ UNCOMMITTED to that new functionality. If the default isolation level stays the current level, the people who need it can use it via WITH UR or somesuch. +

I know it's not that easy but it's an idea. I'm also thinking that the table inheritance we're going to be taking advantage of in 8.1 on the new server might make the sequence scan less of an issue. The only reason the sequence scan really blows is that we have a single table with 220M rows and growing. +
+ + +------=_Part_13255_9231142.1150413819314-- + +From pgsql-performance-owner@postgresql.org Thu Jun 15 20:25:27 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 05BF69FA5D2 + for ; + Thu, 15 Jun 2006 20:25:27 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 61184-10 for + ; + Thu, 15 Jun 2006 20:25:22 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) + by postgresql.org (Postfix) with ESMTP id ED58D9FA160 + for ; + Thu, 15 Jun 2006 20:25:21 -0300 (ADT) +Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP + with MS-WebStorage 6.0.6249 +Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; + 15 Jun 2006 16:25:17 -0700 +Subject: Re: SAN performance mystery +From: Mark Lewis +To: Tom Lane +Cc: Brian Hurt , Tim Allen , + pgsql-performance@postgresql.org +In-Reply-To: <1751.1150410284@sss.pgh.pa.us> +References: <4491D61B.9040507@proximity.com.au> + <4491D8DC.4070906@janestcapital.com> <1751.1150410284@sss.pgh.pa.us> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Organization: MIR3, Inc. +Date: Thu, 15 Jun 2006 16:25:17 -0700 +Message-Id: <1150413917.31200.109.camel@archimedes> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-27) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/334 +X-Sequence-Number: 19691 + +On Thu, 2006-06-15 at 18:24 -0400, Tom Lane wrote: +> I agree with Brian's suspicion that the SATA drive isn't properly +> fsync'ing to disk, resulting in bogusly high throughput. However, +> ISTM a well-configured SAN ought to be able to match even the bogus +> throughput, because it should be able to rely on battery-backed +> cache to hold written blocks across a power failure, and hence should +> be able to report write-complete as soon as it's got the page in cache +> rather than having to wait till it's really down on magnetic platter. +> Which is what the SATA drive is doing ... only it can't keep the promise +> it's making for lack of any battery backup on its on-board cache. + +It really depends on your SAN RAID controller. We have an HP SAN; I +don't remember the model number exactly, but we ran some tests and with +the battery-backed write cache enabled, we got some improvement in write +performance but it wasn't NEARLY as fast as an SATA drive which lied +about write completion. + +The write-and-fsync latency was only about 2-3 times better than with no +write cache at all. So I wouldn't assume that just because you've got a +write cache on your SAN, that you're getting the same speed as +fsync=off, at least for some cheap controllers. + +-- Mark Lewis + +From pgsql-performance-owner@postgresql.org Thu Jun 15 20:58:06 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8D7249FA5D2 + for ; + Thu, 15 Jun 2006 20:58:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 68112-04 for + ; + Thu, 15 Jun 2006 20:58:02 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.203]) + by postgresql.org (Postfix) with ESMTP id 2742B9FA160 + for ; + Thu, 15 Jun 2006 20:58:01 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id o1so514083nzf + for ; + Thu, 15 Jun 2006 16:58:00 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=uSSNuYrFbv0F08cTpLecRM5fsKoMFpxvCwCUGRiMl3WcLWqZWno+wJj2iFHneSbjQboB5qiGIzf5UmzRytuDU1beybm879bVQ2OPPCU4amBwCs4okS8Y6nFbdXKNLifBgQFOZXgdIU/InE5URyKfRqAP5QTs5iUt+Xfbx0pqY1w= +Received: by 10.36.227.78 with SMTP id z78mr3225137nzg; + Thu, 15 Jun 2006 16:58:00 -0700 (PDT) +Received: by 10.37.18.45 with HTTP; Thu, 15 Jun 2006 16:58:00 -0700 (PDT) +Message-ID: <33c6269f0606151658h731915d3k405b4da67c49228a@mail.gmail.com> +Date: Thu, 15 Jun 2006 19:58:00 -0400 +From: "Alex Turner" +To: "Mark Lewis" +Subject: Re: SAN performance mystery +Cc: "Tom Lane" , "Brian Hurt" , + "Tim Allen" , pgsql-performance@postgresql.org +In-Reply-To: <1150413917.31200.109.camel@archimedes> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_2392_12901501.1150415880430" +References: <4491D61B.9040507@proximity.com.au> + <4491D8DC.4070906@janestcapital.com> <1751.1150410284@sss.pgh.pa.us> + <1150413917.31200.109.camel@archimedes> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/335 +X-Sequence-Number: 19692 + +------=_Part_2392_12901501.1150415880430 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Given the fact that most SATA drives have only an 8MB cache, and your RAID +controller should have at least 64MB, I would argue that the system with the +RAID controller should always be faster. If it's not, you're getting +short-changed somewhere, which is typical on linux, because the drivers just +aren't there for a great many controllers that are out there. + +Alex. + +On 6/15/06, Mark Lewis wrote: +> +> On Thu, 2006-06-15 at 18:24 -0400, Tom Lane wrote: +> > I agree with Brian's suspicion that the SATA drive isn't properly +> > fsync'ing to disk, resulting in bogusly high throughput. However, +> > ISTM a well-configured SAN ought to be able to match even the bogus +> > throughput, because it should be able to rely on battery-backed +> > cache to hold written blocks across a power failure, and hence should +> > be able to report write-complete as soon as it's got the page in cache +> > rather than having to wait till it's really down on magnetic platter. +> > Which is what the SATA drive is doing ... only it can't keep the promise +> > it's making for lack of any battery backup on its on-board cache. +> +> It really depends on your SAN RAID controller. We have an HP SAN; I +> don't remember the model number exactly, but we ran some tests and with +> the battery-backed write cache enabled, we got some improvement in write +> performance but it wasn't NEARLY as fast as an SATA drive which lied +> about write completion. +> +> The write-and-fsync latency was only about 2-3 times better than with no +> write cache at all. So I wouldn't assume that just because you've got a +> write cache on your SAN, that you're getting the same speed as +> fsync=off, at least for some cheap controllers. +> +> -- Mark Lewis +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: In versions below 8.0, the planner will ignore your desire to +> choose an index scan if your joining column's datatypes do not +> match +> + +------=_Part_2392_12901501.1150415880430 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Given the fact that most SATA drives have only an 8MB cache, and your RAID controller should have at least 64MB, I would argue that the system with the RAID controller should always be faster.  If it's not, you're getting short-changed somewhere, which is typical on linux, because the drivers just aren't there for a great many controllers that are out there. +

Alex.

On 6/15/06, Mark Lewis <mark.lewis@mir3.com> wrote:
+On Thu, 2006-06-15 at 18:24 -0400, Tom Lane wrote:
> I agree with Brian's suspicion that the SATA drive isn't properly
> fsync'ing to disk, resulting in bogusly high throughput.  However,
> ISTM a well-configured SAN ought to be able to match even the bogus +
> throughput, because it should be able to rely on battery-backed
> cache to hold written blocks across a power failure, and hence should
> be able to report write-complete as soon as it's got the page in cache +
> rather than having to wait till it's really down on magnetic platter.
> Which is what the SATA drive is doing ... only it can't keep the promise
> it's making for lack of any battery backup on its on-board cache. +

It really depends on your SAN RAID controller.  We have an HP SAN; I
don't remember the model number exactly, but we ran some tests and with
the battery-backed write cache enabled, we got some improvement in write +
performance but it wasn't NEARLY as fast as an SATA drive which lied
about write completion.

The write-and-fsync latency was only about 2-3 times better than with no
write cache at all.  So I wouldn't assume that just because you've got a +
write cache on your SAN, that you're getting the same speed as
fsync=off, at least for some cheap controllers.

-- Mark Lewis

---------------------------(end of broadcast)---------------------------
+TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

+ +------=_Part_2392_12901501.1150415880430-- + +From pgsql-performance-owner@postgresql.org Thu Jun 15 21:28:38 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D82629FA5D2 + for ; + Thu, 15 Jun 2006 21:28:37 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 67495-08 for + ; + Thu, 15 Jun 2006 21:28:30 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from smtp1.ActiveState.com (gw.activestate.com [209.17.183.249]) + by postgresql.org (Postfix) with ESMTP id CB1289FA160 + for ; + Thu, 15 Jun 2006 21:28:30 -0300 (ADT) +Received: from smtp3.activestate.com (smtp3.activestate.com [192.168.3.19]) + by smtp1.ActiveState.com (8.12.10/8.12.10) with ESMTP id k5G0SAZt005053 + for ; Thu, 15 Jun 2006 17:28:11 -0700 + (envelope-from mischa@ca.sophos.com) +Received: from [192.168.99.210] (mallet.activestate.com [192.168.99.210]) + by smtp3.ActiveState.com (8.13.4/8.13.4) with ESMTP id k5G0S8PD000966 + for ; Thu, 15 Jun 2006 17:28:09 -0700 + (envelope-from mischa@ca.sophos.com) +Message-ID: <4491FD06.50901@ca.sophos.com> +Date: Thu, 15 Jun 2006 17:36:22 -0700 +From: Mischa Sandberg +Reply-To: mischa@ca.sophos.com +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: PGSQL Performance +Subject: Re: Optimizer internals +References: + <1150396425.31200.66.camel@archimedes> +In-Reply-To: <1150396425.31200.66.camel@archimedes> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/336 +X-Sequence-Number: 19693 + +Mark Lewis wrote: +> On Thu, 2006-06-15 at 14:05 -0400, John Vincent wrote: +>> Now I've been told by our DBA that we should have been able to wholy +>> satisfy that query via the indexes. + +> DB2 can satisfy the query using only indexes because DB2 doesn't do +> MVCC. + +You can get pretty much the same effect with materialized views. +Create a table that LOOKS like the index (just those columns), +with a foreign key relationship to the original table (cascade delete), +and have the after-insert trigger on the main table write a row to the derived table. +Now (index and) query the skinny table. + +Advantage of these tables: you can cluster them regularily, +because it doesn't hard-lock the main table. + +-- +Engineers think that equations approximate reality. +Physicists think that reality approximates the equations. +Mathematicians never make the connection. + +From pgsql-performance-owner@postgresql.org Thu Jun 15 22:04:07 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A5F6C9FA5D2 + for ; + Thu, 15 Jun 2006 22:04:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 75443-10 for + ; + Thu, 15 Jun 2006 22:03:57 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.200]) + by postgresql.org (Postfix) with ESMTP id 14B7A9FA160 + for ; + Thu, 15 Jun 2006 22:03:57 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id s1so533834nze + for ; + Thu, 15 Jun 2006 18:03:56 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=UjzFqti6ijsDB4yqnsKOE3Dn/5ZE8Ghm4V14COC4wkEhN4cZZv5P2kj7s5/OVoRUwPhe9isSbdfz8U+TbkXQqrwJjvCAZ4oTakegtEHm8FY0REGpqAc5iDjotjbguRIoBuTNbU5WVNVPe89WHHaZ5gzXZMqevb8YUoyHFU6xc2o= +Received: by 10.65.189.20 with SMTP id r20mr1117256qbp; + Thu, 15 Jun 2006 18:03:56 -0700 (PDT) +Received: by 10.65.139.14 with HTTP; Thu, 15 Jun 2006 18:03:56 -0700 (PDT) +Message-ID: +Date: Thu, 15 Jun 2006 21:03:56 -0400 +From: "Merlin Moncure" +To: "John Vincent" +Subject: Re: Performance of pg_dump on PGSQL 8.0 +Cc: "Scott Marlowe" , + "PGSQL Performance" , + "Jim C. Nasby" +In-Reply-To: <20060614212507.GR34196@pervasive.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <44902165.7020502@lusis.org> + <1150303450.26538.9.camel@state.g2switchworks.com> + + <20060614211343.GP34196@pervasive.com> + + <20060614212507.GR34196@pervasive.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/337 +X-Sequence-Number: 19694 + +Just couple of suggestions: + +I think on the current server you're pretty much hosed since you are +look like you are cpu bottlenecked. You probably should take a good +look at PITR and see if that meets your requirements. Also you +definately want to go to 8.1...it's faster, and every bit helps. + +Good luck with the new IBM server ;) + +merlin + +From pgsql-hackers-owner@postgresql.org Thu Jun 15 22:34:39 2006 +X-Original-To: pgsql-hackers-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 366A59FA160 + for ; + Thu, 15 Jun 2006 22:34:38 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 79932-04 for + ; + Thu, 15 Jun 2006 22:34:33 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id B0B039FA5D2 + for ; + Thu, 15 Jun 2006 22:34:33 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id E6B8C3093D; Fri, 16 Jun 2006 03:34:31 +0200 (MET DST) +From: "Qingqing Zhou" +X-Newsgroups: pgsql.hackers +Subject: Re: Test request for Stats collector performance improvement +Date: Fri, 16 Jun 2006 09:34:12 +0800 +Organization: Hub.Org Networking Services +Lines: 31 +Message-ID: +References: <200601021840.k02Ieed21704@candle.pha.pa.us> + <200606150405.k5F45cH11445@candle.pha.pa.us> + <27745.1150381653@sss.pgh.pa.us> +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2800.1807 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 +To: pgsql-hackers@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/767 +X-Sequence-Number: 85000 + + +"Tom Lane" wrote +> +> Hm? I don't see any improvement there: +> + +I was referening this sentence, though I am not sure why that's the +expectation: +> +> "Bruce Momjian" wrote +> If the patch worked, the first and third times will be similar, and +> the second time will be high. +> + +-- After patch -- + +real 0m1.275s +user 0m0.097s +sys 0m0.160s + +real 0m4.063s +user 0m0.663s +sys 0m0.377s + +real 0m1.259s +user 0m0.073s +sys 0m0.160s + + + + + +From pgsql-hackers-owner@postgresql.org Thu Jun 15 22:56:46 2006 +X-Original-To: pgsql-hackers-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3125C9FA5D2 + for ; + Thu, 15 Jun 2006 22:56:46 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 83513-02 for + ; + Thu, 15 Jun 2006 22:56:37 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 6C9CD9FA160 + for ; + Thu, 15 Jun 2006 22:56:37 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5G1uY7m011764; + Thu, 15 Jun 2006 21:56:34 -0400 (EDT) +To: "Qingqing Zhou" +cc: pgsql-hackers@postgresql.org +Subject: Re: Test request for Stats collector performance improvement +In-reply-to: +References: <200601021840.k02Ieed21704@candle.pha.pa.us> + <200606150405.k5F45cH11445@candle.pha.pa.us> + <27745.1150381653@sss.pgh.pa.us> + +Comments: In-reply-to "Qingqing Zhou" + message dated "Fri, 16 Jun 2006 09:34:12 +0800" +Date: Thu, 15 Jun 2006 21:56:34 -0400 +Message-ID: <11763.1150422994@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/768 +X-Sequence-Number: 85001 + +"Qingqing Zhou" writes: +> "Tom Lane" wrote +>> Hm? I don't see any improvement there: + +> I was referening this sentence, though I am not sure why that's the +> expectation: +>> "Bruce Momjian" wrote +>> If the patch worked, the first and third times will be similar, and +>> the second time will be high. + +You need to label your results more clearly then. I thought you were +showing us three repeats of the same test, and I gather Bruce thought +so too... + + regards, tom lane + +From pgsql-hackers-owner@postgresql.org Fri Jun 16 00:14:28 2006 +X-Original-To: pgsql-hackers-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E5D169FA5E6 + for ; + Fri, 16 Jun 2006 00:14:26 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 96163-03 for + ; + Fri, 16 Jun 2006 00:14:08 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from candle.pha.pa.us (candle.pha.pa.us [70.90.9.53]) + by postgresql.org (Postfix) with ESMTP id 321CA9FA5D2 + for ; + Fri, 16 Jun 2006 00:14:06 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id k5G3E6306468; + Thu, 15 Jun 2006 23:14:06 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200606160314.k5G3E6306468@candle.pha.pa.us> +Subject: Re: Test request for Stats collector performance improvement +In-Reply-To: +To: Qingqing Zhou +Date: Thu, 15 Jun 2006 23:14:06 -0400 (EDT) +CC: pgsql-hackers@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/780 +X-Sequence-Number: 85013 + +Qingqing Zhou wrote: +> +> "Tom Lane" wrote +> > +> > Hm? I don't see any improvement there: +> > +> +> I was referening this sentence, though I am not sure why that's the +> expectation: +> > +> > "Bruce Momjian" wrote +> > If the patch worked, the first and third times will be similar, and +> > the second time will be high. + +I meant that the non-stats and the patched stats should be the similar, +and the stats without the patch (the second test) should be high. + +> -- After patch -- +> +> real 0m1.275s +> user 0m0.097s +> sys 0m0.160s +> +> real 0m4.063s +> user 0m0.663s +> sys 0m0.377s +> +> real 0m1.259s +> user 0m0.073s +> sys 0m0.160s + +I assume the above is just running the same test three times, right? + +-- + Bruce Momjian http://candle.pha.pa.us + EnterpriseDB http://www.enterprisedb.com + + + If your life is a hard drive, Christ can be your backup. + + +From pgsql-hackers-owner@postgresql.org Fri Jun 16 00:28:27 2006 +X-Original-To: pgsql-hackers-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 725559FA5E6 + for ; + Fri, 16 Jun 2006 00:28:27 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 97099-08 for + ; + Fri, 16 Jun 2006 00:28:13 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id 3AEA49FA160 + for ; + Fri, 16 Jun 2006 00:28:13 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 8A20830939; Fri, 16 Jun 2006 05:28:12 +0200 (MET DST) +From: "Qingqing Zhou" +X-Newsgroups: pgsql.hackers +Subject: Re: Test request for Stats collector performance improvement +Date: Fri, 16 Jun 2006 11:27:50 +0800 +Organization: Hub.Org Networking Services +Lines: 28 +Message-ID: +References: + <200606160314.k5G3E6306468@candle.pha.pa.us> +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2800.1807 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 +To: pgsql-hackers@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/786 +X-Sequence-Number: 85019 + + +"Bruce Momjian" wrote +> +> > -- After patch -- +> > +> > real 0m1.275s +> > user 0m0.097s +> > sys 0m0.160s +> > +> > real 0m4.063s +> > user 0m0.663s +> > sys 0m0.377s +> > +> > real 0m1.259s +> > user 0m0.073s +> > sys 0m0.160s +> +> I assume the above is just running the same test three times, right? +> + +Right -- it is the result of the patched CVS tip runing three times with +stats_command_string = on. And the tests marked "--Before patch--" is the +result of CVS tip running three times with stats_command_string = on. + +Regards, +Qingqing + + + +From pgsql-hackers-owner@postgresql.org Fri Jun 16 00:57:38 2006 +X-Original-To: pgsql-hackers-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DC9989FA160 + for ; + Fri, 16 Jun 2006 00:57:37 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 00118-10 for + ; + Fri, 16 Jun 2006 00:57:22 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from candle.pha.pa.us (candle.pha.pa.us [70.90.9.53]) + by postgresql.org (Postfix) with ESMTP id 578B49FA5E6 + for ; + Fri, 16 Jun 2006 00:57:22 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id k5G3vN112941; + Thu, 15 Jun 2006 23:57:23 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200606160357.k5G3vN112941@candle.pha.pa.us> +Subject: Re: Test request for Stats collector performance improvement +In-Reply-To: +To: Qingqing Zhou +Date: Thu, 15 Jun 2006 23:57:22 -0400 (EDT) +CC: pgsql-hackers@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/789 +X-Sequence-Number: 85022 + +Qingqing Zhou wrote: +> +> "Bruce Momjian" wrote +> > +> > > -- After patch -- +> > > +> > > real 0m1.275s +> > > user 0m0.097s +> > > sys 0m0.160s +> > > +> > > real 0m4.063s +> > > user 0m0.663s +> > > sys 0m0.377s +> > > +> > > real 0m1.259s +> > > user 0m0.073s +> > > sys 0m0.160s +> > +> > I assume the above is just running the same test three times, right? +> > +> +> Right -- it is the result of the patched CVS tip runing three times with +> stats_command_string = on. And the tests marked "--Before patch--" is the +> result of CVS tip running three times with stats_command_string = on. + +Any idea why there is such a variance in the result? The second run +looks quite slow. + +-- + Bruce Momjian http://candle.pha.pa.us + EnterpriseDB http://www.enterprisedb.com + + + If your life is a hard drive, Christ can be your backup. + + +From pgsql-hackers-owner@postgresql.org Fri Jun 16 01:49:02 2006 +X-Original-To: pgsql-hackers-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0E2459FA5C8 + for ; + Fri, 16 Jun 2006 01:49:02 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 16929-05 for + ; + Fri, 16 Jun 2006 01:48:48 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id 238F39F9CAA + for ; + Fri, 16 Jun 2006 01:48:48 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 54AB330955; Fri, 16 Jun 2006 06:48:47 +0200 (MET DST) +From: "Qingqing Zhou" +X-Newsgroups: pgsql.hackers +Subject: Re: Test request for Stats collector performance improvement +Date: Fri, 16 Jun 2006 12:48:27 +0800 +Organization: Hub.Org Networking Services +Lines: 16 +Message-ID: +References: + <200606160357.k5G3vN112941@candle.pha.pa.us> +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2800.1807 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 +To: pgsql-hackers@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/792 +X-Sequence-Number: 85025 + + +"Bruce Momjian" wrote +> +> Any idea why there is such a variance in the result? The second run +> looks quite slow. +> + +No luck so far. It is quite repeatble in my machine -- runing times which +show a long execution time: 2, 11, 14, 21 ... But when I do strace, the +weiredness disappered totally. Have we seen any strange things like this +before? + +Regards, +Qingqing + + + +From pgsql-performance-owner@postgresql.org Fri Jun 16 04:06:57 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 028D49FA5C8 + for ; + Fri, 16 Jun 2006 04:06:57 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 36647-02 for + ; + Fri, 16 Jun 2006 04:06:52 -0300 (ADT) +X-Greylist: delayed 00:06:39.527362 by SQLgrey- +Received: from bioscene.co.jp (pee5980.hyogff01.ap.so-net.ne.jp + [202.238.89.128]) + by postgresql.org (Postfix) with SMTP id 3F6509F9CAA + for ; + Fri, 16 Jun 2006 04:06:50 -0300 (ADT) +Received: (qmail 6803 invoked from network); 16 Jun 2006 07:08:26 -0000 +Received: from unknown (HELO eth0.sonoda) (192.168.2.5) + by bioscene.co.jp with SMTP; 16 Jun 2006 07:08:26 -0000 +Subject: Delete operation VERY slow... +From: David Leangen +Reply-To: postgres@leangen.net +To: pgsql-performance@postgresql.org +Content-Type: text/plain +Date: Fri, 16 Jun 2006 15:58:46 +0900 +Message-Id: <1150441126.4812.23.camel@sonoda.bioscene.co.jp> +Mime-Version: 1.0 +X-Mailer: Evolution 2.6.0 (2.6.0-1) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/338 +X-Sequence-Number: 19695 + + +Hello! + +I am trying to delete an entire table. There are about 41,000 rows in +the table (based on count(*)). + +I am using the SQL comment: delete from table; + +The operation seems to take in the order of hours, rather than seconds +or minutes. + +"Explain delete from table" gives me: + + QUERY PLAN +---------------------------------------------------------------- + Seq Scan on table (cost=0.00..3967.74 rows=115374 width=6) +(1 row) + + +I am using an Intel Pentium D 2.8GHz CPU. My system has about 1.2GB of +RAM. This should be ok... my database isn't that big, I think. + + +Any ideas why this takes so long and how I could speed this up? + +Or alternatively, is there a better way to delete all the contents from +a table? + + +Thank you! + + + +From pgsql-performance-owner@postgresql.org Fri Jun 16 04:17:19 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A2B729FA5C8 + for ; + Fri, 16 Jun 2006 04:17:18 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 34066-09 for + ; + Fri, 16 Jun 2006 04:17:12 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moutng.kundenserver.de (moutng.kundenserver.de + [212.227.126.187]) + by postgresql.org (Postfix) with ESMTP id 1DF869F9CAA + for ; + Fri, 16 Jun 2006 04:17:12 -0300 (ADT) +Received: from [194.25.154.138] (helo=webserv.wug.de) + by mrelayeu.kundenserver.de (node=mrelayeu0) with ESMTP (Nemesis), + id 0MKwh2-1Fr8Zq15Tx-0000Id; Fri, 16 Jun 2006 09:17:10 +0200 +Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) + id 1Fr8Zn-00067R-00 + for pgsql-performance@postgresql.org; Fri, 16 Jun 2006 09:17:07 +0200 +Date: Fri, 16 Jun 2006 09:17:07 +0200 +From: "A. Kretschmer" +To: pgsql-performance@postgresql.org +Subject: Re: Delete operation VERY slow... +Message-ID: <20060616071707.GF19579@webserv.wug-glas.de> +References: <1150441126.4812.23.camel@sonoda.bioscene.co.jp> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1150441126.4812.23.camel@sonoda.bioscene.co.jp> +X-DEST: 208 +X-OS: Linux - weil ich es mir Wert bin! +X-Info: registrierter Linux-User 97922 http://counter.li.org +User-Agent: mutt-ng 1.5.9i (Linux) +X-Provags-ID: kundenserver.de abuse@kundenserver.de + login:51ea9561fc3f6d9539a2acd743e4748c +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/339 +X-Sequence-Number: 19696 + +am 16.06.2006, um 15:58:46 +0900 mailte David Leangen folgendes: +> +> Hello! +> +> I am trying to delete an entire table. There are about 41,000 rows in +> the table (based on count(*)). +> +> I am using the SQL comment: delete from table; + +Use TRUNCATE table. + + +Andreas +-- +Andreas Kretschmer (Kontakt: siehe Header) +Heynitz: 035242/47215, D1: 0160/7141639 +GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net + === Schollglas Unternehmensgruppe === + +From pgsql-performance-owner@postgresql.org Thu Jun 22 03:05:01 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 01C4B9FA5FC + for ; + Fri, 16 Jun 2006 04:39:19 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 38052-04 for + ; + Fri, 16 Jun 2006 04:39:13 -0300 (ADT) +X-Greylist: delayed 00:21:52.922249 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id EB4799FA5CE + for ; + Fri, 16 Jun 2006 04:39:13 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from anchor-post-32.mail.demon.net (anchor-post-32.mail.demon.net + [194.217.242.90]) + by svr4.postgresql.org (Postfix) with ESMTP id 04CD85AF036 + for ; + Fri, 16 Jun 2006 07:17:19 +0000 (GMT) +Received: from tiptree.demon.co.uk ([80.176.236.84] helo=[192.168.66.6]) + by anchor-post-32.mail.demon.net with esmtp (Exim 4.42) + id 1Fr8Zx-0001Pa-71; Fri, 16 Jun 2006 07:17:17 +0000 +Mime-Version: 1.0 (Apple Message framework v750) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <5510ED72-8266-438B-A4DF-9591ED26BA38@tiptree.demon.co.uk> +Content-Transfer-Encoding: 7bit +From: Richard Frith-Macdonald +Subject: Why is my (empty) partial index query slow? +Date: Fri, 16 Jun 2006 08:17:14 +0100 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/431 +X-Sequence-Number: 19788 + +I have a producer/consumer setup where various producer processes +insert new records into a table and consumer processes mark those +records as having been handled when they have dealt with them, but +leave the records in the table so that we can generate reports later. + +The records are added with a char(1) field specifying their state and +a timestamp, and a varchar(40) saying which class of consumer may +handle them. + +There is a partial index on consumer and timestamp where the state +field says the record is new ... so there are no records in this +index except when a producer has just added them and no consumer has +yet handled them. + +Each consumer polls the database with a query to select a batch of +unhandled records (ordered by timestamp) ... the idea being that, +even though the table has a huge number of historical records used +for reporting, the partial index based query should be tiny/quick as +there are usually few/no unhandled records. + +Problem 1 ... why does this polling query take 200-300 milliseconds +when the partial index is empty, and what can be done about it? +This is on a fast modern machine and various other queries take under +a millisecond. + +I guess that the fact that records are constantly (and rapidly) added +to and removed from the index may have caused the index to become +inefficient somehow ... +If that's the case, dropping it and creating a new one might +temporarily fix the issue... but for how long? +As the actual table is huge (44 million records) and reading all the +records to create a new index would take a long time (simply doing a +'select count(*)' on the table takes some minutes) and lock the table +while it's happening, I can't really experiment, though I could +schedule/agree downtime for the system in the middle of the night at +some point, and try rebuilding the index then. + +Problem 2 ... tentative (not readily reproducible and haven't managed +to rule out the possibility of a bug in my code yet) ... a long +running consumer process (which establishes a connection to the +database using libpq, and keeps the connection open indefinitely) was +reporting that the query in question was taking 4.5 seconds, but +starting up the psql command-line tool and running the same query +reported a 200-300 millisecond duration. Could this be a problem in +the database server process handling the connection? or in the libpq +code handling it? The disparity between the times taken for queries +as logged in psql and within the consumer application only seemed to +occur for this polling query (which gets executed very often), not +for other queries the consumer program did on other tables. +Restarting the consumer process 'cured' this ... now I'm waiting to +see if this behavior returns. +Anyone seen anything like this or know what might cause it? + + +From pgsql-performance-owner@postgresql.org Fri Jun 16 04:23:03 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5B38B9F9CAA + for ; + Fri, 16 Jun 2006 04:23:02 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 36722-03-3 + for ; + Fri, 16 Jun 2006 04:22:53 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.169]) + by postgresql.org (Postfix) with ESMTP id CF0AA9FA61D + for ; + Fri, 16 Jun 2006 04:22:50 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so644647ugf + for ; + Fri, 16 Jun 2006 00:22:49 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=O49MmkMm+vW/1CJMZ1yUre0h0Iifr+A7M5d11r+Qz5UVqcN6WZkiElVEKJ+r8h8mFyPsEPnjcjGRV3Os2IO6Lk9rPMjQmn7IjN6Il7ZjPAh2RN8xGgKrDgdVIpspzxMJZ9UJ/xHVfKCu/HHpDfsHwM58hJc3kfhCJebTEtUFuwI= +Received: by 10.66.252.4 with SMTP id z4mr2466004ugh; + Fri, 16 Jun 2006 00:22:49 -0700 (PDT) +Received: by 10.66.220.11 with HTTP; Fri, 16 Jun 2006 00:22:49 -0700 (PDT) +Message-ID: <674d1f8a0606160022p1b042676gba28553bac5ab5ea@mail.gmail.com> +Date: Fri, 16 Jun 2006 12:52:49 +0530 +From: "Gourish Singbal" +To: postgres@leangen.net +Subject: Re: Delete operation VERY slow... +Cc: pgsql-performance@postgresql.org +In-Reply-To: <1150441126.4812.23.camel@sonoda.bioscene.co.jp> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_14240_27707044.1150442569047" +References: <1150441126.4812.23.camel@sonoda.bioscene.co.jp> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/340 +X-Sequence-Number: 19697 + +------=_Part_14240_27707044.1150442569047 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +David, + +Truncate table would be a good idea if u want to delete all the data in the +table. +You need not perform vacuum in this case since there are no dead rows +created. + +~gourish + + +On 6/16/06, David Leangen wrote: +> +> +> Hello! +> +> I am trying to delete an entire table. There are about 41,000 rows in +> the table (based on count(*)). +> +> I am using the SQL comment: delete from table; +> +> The operation seems to take in the order of hours, rather than seconds +> or minutes. +> +> "Explain delete from table" gives me: +> +> QUERY PLAN +> ---------------------------------------------------------------- +> Seq Scan on table (cost=0.00..3967.74 rows=115374 width=6) +> (1 row) +> +> +> I am using an Intel Pentium D 2.8GHz CPU. My system has about 1.2GB of +> RAM. This should be ok... my database isn't that big, I think. +> +> +> Any ideas why this takes so long and how I could speed this up? +> +> Or alternatively, is there a better way to delete all the contents from +> a table? +> +> +> Thank you! +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 5: don't forget to increase your free space map settings +> + + + +-- +Best, +Gourish Singbal + +------=_Part_14240_27707044.1150442569047 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +
 
+
David,
+
 
+
Truncate table would be a good idea if u want to delete all the data in the table.
+
You need not perform vacuum in this case since there are no dead rows created.
+
 
+
~gourish

 
+
On 6/16/06, David Leangen <postgres@leangen.net> wrote: +

Hello!

I am trying to delete an entire table. There are about 41,000 rows in
the table (based on count(*)). +

I am using the SQL comment: delete from table;

The operation seems to take in the order of hours, rather than seconds
or minutes.

"Explain delete from table" gives me:

                          QUERY PLAN +
----------------------------------------------------------------
Seq Scan on table  (cost=0.00..3967.74 rows=115374 width=6)
(1 row)


I am using an Intel Pentium D 2.8GHz CPU. My system has about 1.2GB + of
RAM. This should be ok... my database isn't that big, I think.


Any ideas why this takes so long and how I could speed this up?

Or alternatively, is there a better way to delete all the contents from +
a table?


Thank you!



---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings


+
--
Best,
Gourish Singbal + +------=_Part_14240_27707044.1150442569047-- + +From pgsql-performance-owner@postgresql.org Fri Jun 16 04:48:30 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id BCA479FA5CE + for ; + Fri, 16 Jun 2006 04:48:29 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 38037-07 for + ; + Fri, 16 Jun 2006 04:48:15 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from cronos.madness.at (madness.at [217.196.146.217]) + by postgresql.org (Postfix) with ESMTP id 599309F9CAA + for ; + Fri, 16 Jun 2006 04:48:13 -0300 (ADT) +Received: from gateway.conova.com ([213.153.32.181] helo=[192.168.1.61]) + by cronos.madness.at with esmtpsa (TLSv1:AES256-SHA:256) + (Exim 4.62 (FreeBSD)) (envelope-from ) + id 1Fr93h-000Kqp-Aw; Fri, 16 Jun 2006 09:48:11 +0200 +Message-ID: <44926230.6060304@kaltenbrunner.cc> +Date: Fri, 16 Jun 2006 09:48:00 +0200 +From: Stefan Kaltenbrunner +User-Agent: Mail/News 1.5 (X11/20060228) +MIME-Version: 1.0 +To: Tim Allen +CC: pgsql-performance@postgresql.org +Subject: Re: SAN performance mystery +References: <4491D61B.9040507@proximity.com.au> +In-Reply-To: <4491D61B.9040507@proximity.com.au> +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/341 +X-Sequence-Number: 19698 + +Tim Allen wrote: +> We have a customer who are having performance problems. They have a +> large (36G+) postgres 8.1.3 database installed on an 8-way opteron with +> 8G RAM, attached to an EMC SAN via fibre-channel (I don't have details +> of the EMC SAN model, or the type of fibre-channel card at the moment). +> They're running RedHat ES3 (which means a 2.4.something Linux kernel). +> +> They are unhappy about their query performance. We've been doing various +> things to try to work out what we can do. One thing that has been +> apparent is that autovacuum has not been able to keep the database +> sufficiently tamed. A pg_dump/pg_restore cycle reduced the total +> database size from 81G to 36G. Performing the restore took about 23 hours. + +Hi Tim! + +to give you some comparision - we have a similiar sized database here +(~38GB after a fresh restore and ~76GB after some months into +production). the server is a 4 core Opteron @2,4Ghz with 16GB RAM, +connected via 2 QLogic 2Gbit HBA's to the SAN (IBM DS4300 Turbo). + +It took us quite a while to get this combination up to speed but a full +dump&restore cycle (via a pg_dump | psql pipe over the net) now takes +only about an hour. +23 hours or even 5 hours sounds really excessive - I'm wondering about +some basic issues with the SAN. +If you are using any kind of multipathing (most likely the one in the +QLA-drivers) I would at first assume that you are playing ping-pong +between the controllers (ie the FC-cards do send IO to more than one +SAN-head causing those to failover constantly completely destroying +performance). +ES3 is rather old too and I don't think that even their hacked up kernel +is very good at driving a large Opteron SMP box (2.6 should be MUCH +better in that regard). + +Other than that - how well is your postgresql instance tuned to your +hardware ? + + +Stefan + +From pgsql-performance-owner@postgresql.org Fri Jun 16 05:13:56 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E93339FA5CE + for ; + Fri, 16 Jun 2006 05:13:55 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 42636-06 for + ; + Fri, 16 Jun 2006 05:13:46 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from bioscene.co.jp (pee5980.hyogff01.ap.so-net.ne.jp + [202.238.89.128]) + by postgresql.org (Postfix) with SMTP id 175969F9CAA + for ; + Fri, 16 Jun 2006 05:13:45 -0300 (ADT) +Received: (qmail 6926 invoked from network); 16 Jun 2006 08:22:02 -0000 +Received: from unknown (HELO eth0.sonoda) (192.168.2.5) + by bioscene.co.jp with SMTP; 16 Jun 2006 08:22:02 -0000 +Subject: Re: Delete operation VERY slow... +From: David Leangen +Reply-To: postgres@leangen.net +To: pgsql-performance@postgresql.org +In-Reply-To: <674d1f8a0606160022p1b042676gba28553bac5ab5ea@mail.gmail.com> +References: <1150441126.4812.23.camel@sonoda.bioscene.co.jp> + <674d1f8a0606160022p1b042676gba28553bac5ab5ea@mail.gmail.com> +Content-Type: text/plain +Date: Fri, 16 Jun 2006 17:12:22 +0900 +Message-Id: <1150445542.4812.34.camel@sonoda.bioscene.co.jp> +Mime-Version: 1.0 +X-Mailer: Evolution 2.6.0 (2.6.0-1) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/342 +X-Sequence-Number: 19699 + + +Wow! That was almost instantaneous. I can't believe the difference. + +The only inconvenience is that I need to remove all the foreign key +constraints before truncating, then put them back after. But I suppose +it is a small price to pay for this incredible optimization. + + +Thank you! + + + +On Fri, 2006-06-16 at 12:52 +0530, Gourish Singbal wrote: +> +> David, +> +> Truncate table would be a good idea if u want to delete all the data +> in the table. +> You need not perform vacuum in this case since there are no dead rows +> created. +> +> ~gourish +> +> +> On 6/16/06, David Leangen wrote: +> +> Hello! +> +> I am trying to delete an entire table. There are about 41,000 +> rows in +> the table (based on count(*)). +> +> I am using the SQL comment: delete from table; +> +> The operation seems to take in the order of hours, rather than +> seconds +> or minutes. +> +> "Explain delete from table" gives me: +> +> QUERY PLAN +> ---------------------------------------------------------------- +> Seq Scan on table (cost=0.00..3967.74 rows=115374 width=6) +> (1 row) +> +> +> I am using an Intel Pentium D 2.8GHz CPU. My system has about +> 1.2GB of +> RAM. This should be ok... my database isn't that big, I think. +> +> +> Any ideas why this takes so long and how I could speed this +> up? +> +> Or alternatively, is there a better way to delete all the +> contents from +> a table? +> +> +> Thank you! +> +> +> +> ---------------------------(end of +> broadcast)--------------------------- +> TIP 5: don't forget to increase your free space map settings +> +> +> +> -- +> Best, +> Gourish Singbal + + +From pgsql-performance-owner@postgresql.org Fri Jun 16 06:11:13 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 701599FA5C8 + for ; + Fri, 16 Jun 2006 06:11:13 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 49928-10 for + ; + Fri, 16 Jun 2006 06:11:05 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from gw.proximity.com.au (147-68-185-210.static.techex.net.au + [210.185.68.147]) + by postgresql.org (Postfix) with ESMTP id 8AEC99F9CAA + for ; + Fri, 16 Jun 2006 06:11:05 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by gw.proximity.com.au (Postfix) with ESMTP id 561021FD7FA + for ; + Fri, 16 Jun 2006 19:11:03 +1000 (EST) +Received: from gw.proximity.com.au ([127.0.0.1]) + by localhost (gw [127.0.0.1]) (amavisd-new, port 10024) with ESMTP + id 04834-01 for ; + Fri, 16 Jun 2006 19:11:02 +1000 (EST) +Received: from [192.168.128.103] (bee.proximity.com.au [192.168.128.103]) + by gw.proximity.com.au (Postfix) with ESMTP id ECC221FE376 + for ; + Fri, 16 Jun 2006 19:11:01 +1000 (EST) +Message-ID: <449275A5.5090503@proximity.com.au> +Date: Fri, 16 Jun 2006 19:11:01 +1000 +From: Tim Allen +User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: SAN performance mystery +References: <4491D61B.9040507@proximity.com.au> +In-Reply-To: <4491D61B.9040507@proximity.com.au> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at proximity.com.au +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/343 +X-Sequence-Number: 19700 + +Tim Allen wrote: +> We have a customer who are having performance problems. They have a +> large (36G+) postgres 8.1.3 database installed on an 8-way opteron with +> 8G RAM, attached to an EMC SAN via fibre-channel (I don't have details +> of the EMC SAN model, or the type of fibre-channel card at the moment). +> They're running RedHat ES3 (which means a 2.4.something Linux kernel). + +> To simplify greatly - single local SATA disk beats EMC SAN by factor of +> four. +> +> Is that expected performance, anyone? It doesn't sound right to me. Does +> anyone have any clues about what might be going on? Buggy kernel +> drivers? Buggy kernel, come to think of it? Does a SAN just not provide +> adequate performance for a large database? +> +> I'd be grateful for any clues anyone can offer, +> +> Tim + +Thanks to all who have replied so far. I've learned a few new things in +the meantime. + +Firstly, the fibrechannel card is an Emulex LP1050. The customer seems +to have rather old drivers for it, so I have recommended that they +upgrade asap. I've also suggested they might like to upgrade their +kernel to something recent too (eg upgrade to RHEL4), but no telling +whether they'll accept that recommendation. + +The fact that SATA drives are wont to lie about write completion, which +several posters have pointed out, presumably has an effect on write +performance (ie apparent write performance is increased at the cost of +an increased risk of data-loss), but, again presumably, not much of an +effect on read performance. After loading the customer's database on our +fairly modest box with the single SATA disk, we also tested select query +performance, and while we didn't see a factor of four gain, we certainly +saw that read performance is also substantially better. So the fsync +issue possibly accounts for part of our factor-of-four, but not all of +it. Ie, the SAN is still not doing well by comparison, even allowing for +the presumption that it is more honest. + +One curious thing is that some postgres backends seem to spend an +inordinate amount of time in uninterruptible iowait state. I found a +posting to this list from December 2004 from someone who reported that +very same thing. For example, bringing down postgres on the customer box +requires kill -9, because there are invariably one or two processes so +deeply uninterruptible as to not respond to a politer signal. That +indicates something not quite right, doesn't it? + +Tim + +-- +----------------------------------------------- +Tim Allen tim@proximity.com.au +Proximity Pty Ltd http://www.proximity.com.au/ + +From pgsql-performance-owner@postgresql.org Fri Jun 16 09:23:52 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 1054E9FA5C3 + for ; + Fri, 16 Jun 2006 09:23:52 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 26411-09 for + ; + Fri, 16 Jun 2006 09:23:40 -0300 (ADT) +X-Greylist: delayed 01:00:08.618976 by SQLgrey- +Received: from vms048pub.verizon.net (vms048pub.verizon.net [206.46.252.48]) + by postgresql.org (Postfix) with ESMTP id A77CA9FA42B + for ; + Fri, 16 Jun 2006 09:23:40 -0300 (ADT) +Received: from osgiliath.mathom.us ([72.66.113.164]) + by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 + (built Sep + 9 2005)) with ESMTPA id <0J0Y00GTTAAKGED4@vms048.mailsrvcs.net> for + pgsql-performance@postgresql.org; Fri, 16 Jun 2006 06:23:08 -0500 (CDT) +Received: from localhost (localhost [127.0.0.1]) + by osgiliath.mathom.us (Postfix) with ESMTP id 74D036E5F1 for + ; + Fri, 16 Jun 2006 07:23:05 -0400 (EDT) +Received: from osgiliath.mathom.us ([127.0.0.1]) + by localhost (osgiliath.home.mathom.us [127.0.0.1]) (amavisd-new, + port 10024) + with LMTP id O4P5EeefaL5C for ; Fri, + 16 Jun 2006 07:23:04 -0400 (EDT) +Received: by osgiliath.mathom.us (Postfix, from userid 1000) + id 5A7C96F521; Fri, 16 Jun 2006 07:23:04 -0400 (EDT) +Date: Fri, 16 Jun 2006 07:23:04 -0400 +From: Michael Stone +Subject: Re: how to partition disks +In-reply-to: <44901DF7.7010200@aeccom.com> +To: pgsql-performance@postgresql.org +Mail-followup-to: pgsql-performance@postgresql.org +Message-id: <20060616112302.GE29023@mathom.us> +MIME-version: 1.0 +Content-type: text/plain; charset=us-ascii; format=flowed +Content-disposition: inline +X-Virus-Scanned: Debian amavisd-new at mathom.us +X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 +References: <20060614142344.13558.qmail@web31804.mail.mud.yahoo.com> + <44901DF7.7010200@aeccom.com> +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/348 +X-Sequence-Number: 19705 + +On Wed, Jun 14, 2006 at 04:32:23PM +0200, Sven Geisler wrote: +>For example, You run two queries with two clients and each queries needs +>to read some indices from disk. In this case it more efficient to read +>from different volumes than to read from one large volume where the disc +>arms has to jump. + +Hmm. Bad example, IMO. In the case of reading indices you're doing +random IO and the heads will be jumping all over the place anyway. The +limiting factor there will be seeks/s, and you'll possibly get better +results with the larger array. (That case is fairly complicated to +analyze and depends very much on the data.) Where multiple arrays will be +faster is if you have a lot of sequential IO--in fact, a couple of cheap +disks can blow away a fairly expensive array for purely sequential +operations since each disk can handle >60MB/s of if it doesn't have to +seek, whereas multiple sequential streams on the big array will cause +each disk in the array to seek. (The array controller will try to hide +this with its cache; its cache size & software will determine how +successful it is at doing so.) + +Mike Stone + +From pgsql-performance-owner@postgresql.org Fri Jun 16 08:22:14 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B3C089FA5C3 + for ; + Fri, 16 Jun 2006 08:22:13 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 20363-07 for + ; + Fri, 16 Jun 2006 08:22:04 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from peufeu.com (boutiquenumerique.com [82.67.9.10]) + by postgresql.org (Postfix) with ESMTP id 4083E9FA42B + for ; + Fri, 16 Jun 2006 08:22:03 -0300 (ADT) +Received: (qmail 18720 invoked from network); 16 Jun 2006 13:23:16 +0200 +Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) + by boutiquenumerique.com with SMTP; 16 Jun 2006 13:23:16 +0200 +To: postgres@leangen.net, pgsql-performance@postgresql.org +Subject: Re: Delete operation VERY slow... +References: <1150441126.4812.23.camel@sonoda.bioscene.co.jp> + <674d1f8a0606160022p1b042676gba28553bac5ab5ea@mail.gmail.com> + <1150445542.4812.34.camel@sonoda.bioscene.co.jp> +Message-ID: +Date: Fri, 16 Jun 2006 13:23:15 +0200 +From: PFC +Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <1150445542.4812.34.camel@sonoda.bioscene.co.jp> +User-Agent: Opera M2/8.54 (Linux, build 1745) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/344 +X-Sequence-Number: 19701 + + +> Wow! That was almost instantaneous. I can't believe the difference. +> +> The only inconvenience is that I need to remove all the foreign key +> constraints before truncating, then put them back after. But I suppose +> it is a small price to pay for this incredible optimization. + + In that case, your DELETE might have been slowed down by foreign key +checks. + + Suppose you have tables A and B, and table A has a column "b_id +REFERENCES B(id)" + When you delete from B postgres has to lookup in A which rows reference +the deleted rows in order to do the ON DELETE action you specified in the +constraint. + If you do not have an index on b_id, this can be quite slow... so you +should check if your foreign key relations that need indexes have them. + +From pgsql-performance-owner@postgresql.org Fri Jun 16 08:23:47 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 514B39FA42B + for ; + Fri, 16 Jun 2006 08:23:47 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 21359-05 for + ; + Fri, 16 Jun 2006 08:23:43 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by postgresql.org (Postfix) with ESMTP id 9F8359FA5C3 + for ; + Fri, 16 Jun 2006 08:23:43 -0300 (ADT) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1FrCQA-0001xe-00; Fri, 16 Jun 2006 07:23:26 -0400 +To: Mark Lewis +Cc: pgsql-performance@lusis.org, + PGSQL Performance +Subject: Re: Optimizer internals +References: + <1150396425.31200.66.camel@archimedes> +In-Reply-To: <1150396425.31200.66.camel@archimedes> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 16 Jun 2006 07:23:26 -0400 +Message-ID: <87ver18hu9.fsf@stark.xeocode.com> +Lines: 29 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/345 +X-Sequence-Number: 19702 + +Mark Lewis writes: + +> On Thu, 2006-06-15 at 14:05 -0400, John Vincent wrote: +> > Now I've been told by our DBA that we should have been able to wholy +> > satisfy that query via the indexes. +> +> DB2 can satisfy the query using only indexes because DB2 doesn't do +> MVCC. + +Well it's more subtle than that. DB2 most certainly does provide MVCC +semantics as does Oracle and MSSQL and any other serious SQL implementation. + +But there are different ways to implement MVCC and every database makes +decisions that have pros and cons. Postgres's implementation has some big +benefits over others (no rollback segments, no expensive recovery operations, +fast inserts and updates) but it also has disadvantages (periodic vacuums and +indexes don't cover the data). + +The distinction you're looking for here is sometimes called "optimistic" +versus "pessimistic" space management. (Not locking, that's something else.) +Postgres is "pessimistic" -- treats every transaction as if it might be rolled +back. Oracle and most others are "optimistic" assumes every transaction will +be committed and stores information elsewhere to implement MVCC And recover in +case it's rolled back. The flip side is that Oracle and others like it have to +do a lot of extra footwork to do if you query data that hasn't been committed +yet. That footwork has performance implications. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Fri Jun 16 08:29:03 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 597D39FA5C3 + for ; + Fri, 16 Jun 2006 08:29:03 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 12328-10 for + ; + Fri, 16 Jun 2006 08:28:52 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by postgresql.org (Postfix) with ESMTP id 7EFA39FA42B + for ; + Fri, 16 Jun 2006 08:28:52 -0300 (ADT) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1FrCVA-0001yi-00; Fri, 16 Jun 2006 07:28:36 -0400 +To: "Alex Turner" +Cc: "Mark Lewis" , "Tom Lane" , + "Brian Hurt" , "Tim Allen" , + pgsql-performance@postgresql.org +Subject: Re: SAN performance mystery +References: <4491D61B.9040507@proximity.com.au> + <4491D8DC.4070906@janestcapital.com> <1751.1150410284@sss.pgh.pa.us> + <1150413917.31200.109.camel@archimedes> + <33c6269f0606151658h731915d3k405b4da67c49228a@mail.gmail.com> +In-Reply-To: <33c6269f0606151658h731915d3k405b4da67c49228a@mail.gmail.com> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 16 Jun 2006 07:28:35 -0400 +Message-ID: <87psh98hlo.fsf@stark.xeocode.com> +Lines: 23 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/346 +X-Sequence-Number: 19703 + + +"Alex Turner" writes: + +> Given the fact that most SATA drives have only an 8MB cache, and your RAID +> controller should have at least 64MB, I would argue that the system with the +> RAID controller should always be faster. If it's not, you're getting +> short-changed somewhere, which is typical on linux, because the drivers just +> aren't there for a great many controllers that are out there. + +Alternatively Linux is using the 1-4 gigabytes of cache available to it +effectively enough that the 64 megabytes of mostly duplicated cache just isn't +especially helpful... + +I never understood why disk caches on the order of megabytes are exciting. Why +should disk manufacturers be any better about cache management than OS +authors? + +In the case of RAID 5 this could actually work against you since the RAID +controller can _only_ use its cache to find parity blocks when writing. +Software raid can use all of the OS's disk cache to that end. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Fri Jun 16 08:44:17 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A17BB9FA5C3 + for ; + Fri, 16 Jun 2006 08:44:16 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 21160-10 for + ; + Fri, 16 Jun 2006 08:44:06 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.wirelesscar.com (mail.wirelesscar.com [212.209.35.30]) + by postgresql.org (Postfix) with ESMTP id 6DEF79FA42B + for ; + Fri, 16 Jun 2006 08:44:05 -0300 (ADT) +Received: from sesrv12.wirelesscar.com ([192.168.10.17]) by + mail.wirelesscar.com with InterScan Messaging Security Suite; + Fri, 16 Jun 2006 13:43:54 +0200 +X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: SAN performance mystery +Date: Fri, 16 Jun 2006 13:45:09 +0200 +Message-ID: <7F10D26ECFA1FB458B89C5B4B0D72C2B45ABFC@sesrv12.wirelesscar.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] SAN performance mystery +Thread-Index: AcaQxiyd6eOH2Xs7RE2m+RvKM8NGLAAWXpmQ +From: "Mikael Carneholm" +To: "Tim Allen" , + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/347 +X-Sequence-Number: 19704 + +We've seen similar results with our EMC CX200 (fully equipped) when +compared to a single (1) SCSI disk machine. For sequential reads/writes +(import, export, updates on 5-10 30M+ row tables), performance is +downright awful. A big DB update took 5-6h in pre-prod (single SCSI), +and 10-14?h (don't recall the exact details) in production (EMC SAN). +And this was with a proprietary DB, btw - no fsync on/off affecting the +results here. + +FC isn't exactly known for great bandwidth, iirc a 2Gbit FC channel tops +at 192Mb/s. So, especially if you mostly have DW/BI type of workloads, +go for DAD (Direct Attached Disks) instead. + +/Mikael + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Tim Allen +Sent: den 15 juni 2006 23:50 +To: pgsql-performance@postgresql.org +Subject: [PERFORM] SAN performance mystery + +We have a customer who are having performance problems. They have a +large (36G+) postgres 8.1.3 database installed on an 8-way opteron with +8G RAM, attached to an EMC SAN via fibre-channel (I don't have details +of the EMC SAN model, or the type of fibre-channel card at the moment).=20 +They're running RedHat ES3 (which means a 2.4.something Linux kernel). + +They are unhappy about their query performance. We've been doing various +things to try to work out what we can do. One thing that has been +apparent is that autovacuum has not been able to keep the database +sufficiently tamed. A pg_dump/pg_restore cycle reduced the total +database size from 81G to 36G. Performing the restore took about 23 +hours. + +We tried restoring the pg_dump output to one of our machines, a +dual-core pentium D with a single SATA disk, no raid, I forget how much +RAM but definitely much less than 8G. The restore took five hours. So it +would seem that our machine, which on paper should be far less +impressive than the customer's box, does more than four times the I/O +performance. + +To simplify greatly - single local SATA disk beats EMC SAN by factor of +four. + +Is that expected performance, anyone? It doesn't sound right to me. Does +anyone have any clues about what might be going on? Buggy kernel +drivers? Buggy kernel, come to think of it? Does a SAN just not provide +adequate performance for a large database? + +I'd be grateful for any clues anyone can offer, + +Tim + + + + +From pgsql-performance-owner@postgresql.org Fri Jun 16 09:51:40 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id CBE959FA5C3 + for ; + Fri, 16 Jun 2006 09:51:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 29164-07 for + ; + Fri, 16 Jun 2006 09:51:36 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.174]) + by postgresql.org (Postfix) with ESMTP id 1AFF69FA42B + for ; + Fri, 16 Jun 2006 09:51:35 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so771323ugf + for ; + Fri, 16 Jun 2006 05:51:33 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=fOpcL+dsPL8WrX5H0g/BPwmyOFSek4JswatxkyVIM7cuLOCKDP8jjBYezZtpUZSifA8hNIV+avw3AX2g6kRPUo8XRNlVSL0JBLf03E4KDKNdYmbeTD9EaPo1qtipoPeAg1GgehFzTKe33NGVwuLvFYmIdamo1JXjW5SUQT9SlwM= +Received: by 10.66.216.6 with SMTP id o6mr1474703ugg; + Fri, 16 Jun 2006 05:51:33 -0700 (PDT) +Received: by 10.67.32.9 with HTTP; Fri, 16 Jun 2006 05:51:33 -0700 (PDT) +Message-ID: <36e682920606160551v6b98bcfek32f01b895c53e057@mail.gmail.com> +Date: Fri, 16 Jun 2006 08:51:33 -0400 +From: "Jonah H. Harris" +To: "Greg Stark" +Subject: Re: Optimizer internals +Cc: "Mark Lewis" , pgsql-performance@lusis.org, + "PGSQL Performance" +In-Reply-To: <87ver18hu9.fsf@stark.xeocode.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: + <1150396425.31200.66.camel@archimedes> + <87ver18hu9.fsf@stark.xeocode.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/349 +X-Sequence-Number: 19706 + +On 16 Jun 2006 07:23:26 -0400, Greg Stark wrote: +> The flip side is that Oracle and others like it have to +> do a lot of extra footwork to do if you query data +> that hasn't been committed yet. That footwork +> has performance implications. + +Not disagreeing here at all, but considering that Oracle, DB2, and SQL +Server, et al have proven themselves to perform extremely well under +heavy load (in multiple benchmarks), the overhead of an UNDO +implementation has a calculable break even point. + +Feel free to debate it, but the optimistic approach adopted by nearly +every commercial database vendor is *generally* a better approach for +OLTP. + +Consider Weikum & Vossen (p. 442): + +We also need to consider the extra work that the recovery algorithm +incurs during normal operation. This is exactly the catch with the +class of no-undo/no-redo algorithms. By and large, they come at the +expense of a substantial overhead during normal operations that may +increase the execution cost per transaction by a factor of two or even +higher. In other words, it reduces the achievable transaction +throughput of a given server configuration by a factor of two or more. + +Now, if we're considering UPDATES (the worst case for PostgreSQL's +current MVCC architecture), then this is (IMHO) a true statement. +There aren't many *successful* commercial databases that incur the +additional overhead of creating another version of the record, marking +the old one as having been updated, inserting N-number of new index +entries to point to said record, and having to WAL-log all +aforementioned changes. I have yet to see any successful commercial +RDBMS using some sort of no-undo algorithm that doesn't follow the, +"factor of two or more" performance reduction. However, if you +consider an INSERT or DELETE in PostgreSQL, those are implemented much +better than in most commercial database systems due to PostgreSQL's +MVCC design. I've done a good amount of research on enhancing +PostgreSQL's MVCC in UPDATE conditions and believe there is a nice +happy medium for us. + +/me waits for the obligatory and predictable, "the benchmarks are +flawed" response. + +-- +Jonah H. Harris, Software Architect | phone: 732.331.1300 +EnterpriseDB Corporation | fax: 732.331.1301 +33 Wood Ave S, 2nd Floor | jharris@enterprisedb.com +Iselin, New Jersey 08830 | http://www.enterprisedb.com/ + +From pgsql-performance-owner@postgresql.org Fri Jun 16 10:21:21 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 50F359FA5C3 + for ; + Fri, 16 Jun 2006 10:21:21 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 33770-09 for + ; + Fri, 16 Jun 2006 10:21:10 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by postgresql.org (Postfix) with ESMTP id 469049FA42B + for ; + Fri, 16 Jun 2006 10:21:10 -0300 (ADT) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1FrEFx-0000bn-00; Fri, 16 Jun 2006 09:21:01 -0400 +To: "Jonah H. Harris" +Cc: "Greg Stark" , "Mark Lewis" , + pgsql-performance@lusis.org, + "PGSQL Performance" +Subject: Re: Optimizer internals +References: + <1150396425.31200.66.camel@archimedes> + <87ver18hu9.fsf@stark.xeocode.com> + <36e682920606160551v6b98bcfek32f01b895c53e057@mail.gmail.com> +In-Reply-To: <36e682920606160551v6b98bcfek32f01b895c53e057@mail.gmail.com> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 16 Jun 2006 09:21:01 -0400 +Message-ID: <8764j18cea.fsf@stark.xeocode.com> +Lines: 44 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/350 +X-Sequence-Number: 19707 + +"Jonah H. Harris" writes: + +> Now, if we're considering UPDATES (the worst case for PostgreSQL's +> current MVCC architecture), then this is (IMHO) a true statement. +> There aren't many *successful* commercial databases that incur the +> additional overhead of creating another version of the record, marking +> the old one as having been updated, inserting N-number of new index +> entries to point to said record, and having to WAL-log all +> aforementioned changes. + +Well Oracle has to do almost all that same work, it's just doing it in a +separate place called a rollback segment. There are pros and cons especially +where it comes to indexes, but also where it comes to what happens when the +new record is larger than the old one. + +> I've done a good amount of research on enhancing PostgreSQL's MVCC in UPDATE +> conditions and believe there is a nice happy medium for us. + +IMHO the biggest problem Postgres has is when you're updating a lot of records +in a table with little free space. Postgres has to keep jumping back and forth +between the old records it's reading in and the new records it's writing out. +That can in theory turn a simple linear update scan into a O(n^2) operation. +In practice read-ahead and caching should help but I'm not clear to what +extent. + +That and of course the visibility bitmap that has been much-discussed that +might make vacuum not have to visit every page and allow index scans to skip +checking visibility info for some pages would be major wins. + +> /me waits for the obligatory and predictable, "the benchmarks are +> flawed" response. + +I wouldnt' say the benchmarks are flawed but I also don't think you can point +to any specific design feature and say it's essential just on the basis of +bottom-line results. You have to look at the actual benefit the specific wins. + +Oracle and the others all implement tons of features intended to optimize +applications like the benchmarks (and the benchmarks specifically of course:) +that have huge effects on the results. Partitioned tables, materialized views, +etc allow algorithmic improvements that do much more than any low level +optimizations can do. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Fri Jun 16 10:30:47 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 43C7C9FA5C3 + for ; + Fri, 16 Jun 2006 10:30:47 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 36762-01 for + ; + Fri, 16 Jun 2006 10:30:38 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 8043B9FA42B + for ; + Fri, 16 Jun 2006 10:30:38 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5GDUWZR016187; + Fri, 16 Jun 2006 09:30:32 -0400 (EDT) +To: postgres@leangen.net +cc: pgsql-performance@postgresql.org +Subject: Re: Delete operation VERY slow... +In-reply-to: <1150445542.4812.34.camel@sonoda.bioscene.co.jp> +References: <1150441126.4812.23.camel@sonoda.bioscene.co.jp> + <674d1f8a0606160022p1b042676gba28553bac5ab5ea@mail.gmail.com> + <1150445542.4812.34.camel@sonoda.bioscene.co.jp> +Comments: In-reply-to David Leangen + message dated "Fri, 16 Jun 2006 17:12:22 +0900" +Date: Fri, 16 Jun 2006 09:30:32 -0400 +Message-ID: <16186.1150464632@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/351 +X-Sequence-Number: 19708 + +David Leangen writes: +> The only inconvenience is that I need to remove all the foreign key +> constraints before truncating, then put them back after. + +I was about to ask if you had any. Usually the reason for DELETE being +slow is that you have foreign key references to (not from) the table and +the referencing columns aren't indexed. This forces a seqscan search +of the referencing table for each row deleted :-( + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Jun 16 10:44:08 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 703899FA5C3 + for ; + Fri, 16 Jun 2006 10:44:08 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 35463-08 for + ; + Fri, 16 Jun 2006 10:43:58 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.168]) + by postgresql.org (Postfix) with ESMTP id 63B829FA42B + for ; + Fri, 16 Jun 2006 10:43:57 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so796818ugf + for ; + Fri, 16 Jun 2006 06:43:56 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=Qa16nUT0sOY1/JkWK4aslle0okNv8aU8OZaS/7V6NcXvfTQEQrqkhh0DKBr+0lWUVZ741AQVfn9Co9onFK/DEGY7acVkhBhpoDdIPX7vm3hWk1pqRNnNTnMpNG66FtXdXTb2Hy9bImU+VNwjZbJS9529MITuBXnM1q6JePYpBQE= +Received: by 10.67.25.9 with SMTP id c9mr2765552ugj; + Fri, 16 Jun 2006 06:43:55 -0700 (PDT) +Received: by 10.67.32.9 with HTTP; Fri, 16 Jun 2006 06:43:55 -0700 (PDT) +Message-ID: <36e682920606160643u1d2f559fxe09f8acc970c1c53@mail.gmail.com> +Date: Fri, 16 Jun 2006 09:43:55 -0400 +From: "Jonah H. Harris" +To: "Greg Stark" +Subject: Re: Optimizer internals +Cc: "Mark Lewis" , pgsql-performance@lusis.org, + "PGSQL Performance" +In-Reply-To: <8764j18cea.fsf@stark.xeocode.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: + <1150396425.31200.66.camel@archimedes> + <87ver18hu9.fsf@stark.xeocode.com> + <36e682920606160551v6b98bcfek32f01b895c53e057@mail.gmail.com> + <8764j18cea.fsf@stark.xeocode.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/352 +X-Sequence-Number: 19709 + +On 16 Jun 2006 09:21:01 -0400, Greg Stark wrote: +> Well Oracle has to do almost all that same work, it's just doing it in a +> separate place called a rollback segment. + +Well, it's not really the same work. The process by which Oracle +manages UNDO is actually pretty simple and efficient, but complex in +its implementation. There has also been some significant performance +improvements in this area in both 9i and 10g. + +> There are pros and cons especially where it comes +> to indexes, but also where it comes to what happens +> when the new record is larger than the old one. + +Certainly, you want to avoid row chaining at all costs; which is why +PCTFREE is there. I have researched update-in-place for PostgreSQL +and can avoid row-chaining... so I think we can get the same benefit +without the management and administration cost. + +> IMHO the biggest problem Postgres has is when you're +> updating a lot of records in a table with little free space. + +Yes, this is certainly the most noticible case. This is one reason +I'm behind the freespace patch. Unfortunately, a lot of inexperienced +people use VACUUM FULL and don't understand why VACUUM is *generally* +better.(to free up block-level freespace and update FSM) assuming they +have enough hard disk space for the database. + +> That and of course the visibility bitmap that has been +> much-discussed + +I'd certainly like to see it. + +> I wouldnt' say the benchmarks are flawed but I also +> don't think you can point to any specific design +> feature and say it's essential just on the basis of +> bottom-line results. You have to look at the actual +> benefit the specific wins. + +True. + +-- +Jonah H. Harris, Software Architect | phone: 732.331.1300 +EnterpriseDB Corporation | fax: 732.331.1301 +33 Wood Ave S, 2nd Floor | jharris@enterprisedb.com +Iselin, New Jersey 08830 | http://www.enterprisedb.com/ + +From pgsql-performance-owner@postgresql.org Fri Jun 16 11:19:14 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 417659FA5C3 + for ; + Fri, 16 Jun 2006 11:19:14 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 41279-09 for + ; + Fri, 16 Jun 2006 11:19:07 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.203]) + by postgresql.org (Postfix) with ESMTP id BEBAC9FA42B + for ; + Fri, 16 Jun 2006 11:19:07 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id s1so654721nze + for ; + Fri, 16 Jun 2006 07:19:06 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=chPusFlwPnIQENKHMKsBlYvSZsLnMyxJzhKvVT8bdt2cF8DuhgPbk1fPWJVaLYiY9gO1f3npYwj9ZcSGSDaIWdx59d4UK6IcZV8J7v5OGB8gWgGvWKvvZttCT8jWBiI1WBVc7aV9FpSja5WzNM4ufUrIxoNBU7X8o8+77LVBVew= +Received: by 10.65.72.15 with SMTP id z15mr1707865qbk; + Fri, 16 Jun 2006 07:19:05 -0700 (PDT) +Received: by 10.65.139.14 with HTTP; Fri, 16 Jun 2006 07:19:05 -0700 (PDT) +Message-ID: +Date: Fri, 16 Jun 2006 10:19:05 -0400 +From: "Merlin Moncure" +To: "Mikael Carneholm" +Subject: Re: SAN performance mystery +Cc: "Tim Allen" , pgsql-performance@postgresql.org +In-Reply-To: <7F10D26ECFA1FB458B89C5B4B0D72C2B45ABFC@sesrv12.wirelesscar.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <7F10D26ECFA1FB458B89C5B4B0D72C2B45ABFC@sesrv12.wirelesscar.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/353 +X-Sequence-Number: 19710 + +On 6/16/06, Mikael Carneholm wrote: +> We've seen similar results with our EMC CX200 (fully equipped) when +> compared to a single (1) SCSI disk machine. For sequential reads/writes +> (import, export, updates on 5-10 30M+ row tables), performance is +> downright awful. A big DB update took 5-6h in pre-prod (single SCSI), +> and 10-14?h (don't recall the exact details) in production (EMC SAN). +> And this was with a proprietary DB, btw - no fsync on/off affecting the +> results here. + +You are in good company. We bought a Hitachi AMS200, 2gb FC and a +gigabyte of cache. We were shocked and dismayed to find the unit +could do about 50 mb/sec measured from dd (yes, around the performance +of a single consumer grade sata drive). It is my (unconfirmted) +belief that the unit was governed internally to encourage you to buy +the more expensive version, AMS500, etc. + +needless to say, we sent the unit back, and are now waiting on a +xyratex 4gb FC attached SAS unit. we spoke directly to their +performance people who told us to expect the unit to be network +bandwitdh bottlenecked as you would expect. they were even talking +about a special mode where you could bond the dual fc ports, now +that's power. If the unit really does what they claim, I will be back +here talking about it for sure ;) + +The bottom line is that most SANs, even from some of the biggest +vendors, are simply worthless from a performance angle. You have to +be really critical when you buy them, don't beleive anything the sales +rep tells you, and make sure to negotiate in advance a return policy +if the unit does not perform. There is tons of b.s. out there, but so +far my impression of xyratex is really favorable (fingers crossed), +and I'm hearing lots of great stuff about them from the channel. + +merlin + +From pgsql-performance-owner@postgresql.org Fri Jun 16 12:22:03 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C4A6A9FA5FB; + Fri, 16 Jun 2006 12:22:02 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 46690-09; Fri, 16 Jun 2006 12:21:57 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id A0F389FA42B; + Fri, 16 Jun 2006 12:21:57 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from nwkea-pix-1.sun.com (nwkea-pix-1.sun.com [192.18.42.249]) + by svr4.postgresql.org (Postfix) with ESMTP id E422B5AF03B; + Fri, 16 Jun 2006 15:21:56 +0000 (GMT) +Received: from d1-sfbay-02.sun.com ([192.18.39.112]) + by nwkea-pix-1.sun.com (8.13.6+Sun/8.12.9) with ESMTP id k5GFLlBG018687; + Fri, 16 Jun 2006 08:21:47 -0700 (PDT) +Received: from conversion-daemon.d1-sfbay-02.sun.com by d1-sfbay-02.sun.com + (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) + id <0J0Y00C01KO4A200@d1-sfbay-02.sun.com> + (original mail from Robert.Lor@Sun.COM); + Fri, 16 Jun 2006 08:21:47 -0700 (PDT) +Received: from [129.150.12.121] by d1-sfbay-02.sun.com + (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) + with ESMTPSA id <0J0Y006C9LBXFY20@d1-sfbay-02.sun.com>; Fri, + 16 Jun 2006 08:21:47 -0700 (PDT) +Date: Fri, 16 Jun 2006 08:18:58 -0700 +From: Robert Lor +Subject: Sun Donated a Sun Fire T2000 to the PostgreSQL community +To: pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org +Message-id: <4492CBE2.3090509@sun.com> +MIME-version: 1.0 +Content-type: text/plain; format=flowed; charset=us-ascii +Content-transfer-encoding: 7BIT +X-Accept-Language: en-us, en +User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.7) Gecko/20060307 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/354 +X-Sequence-Number: 19711 + + +I am thrill to inform you all that Sun has just donated a fully loaded +T2000 system to the PostgreSQL community, and it's being setup by Corey +Shields at OSL (osuosl.org) and should be online probably early next +week. The system has + +* 8 cores, 4 hw threads/core @ 1.2 GHz. Solaris sees the system as +having 32 virtual CPUs, and each can be enabled or disabled individually +* 32 GB of DDR2 SDRAM memory +* 2 @ 73GB internal SAS drives (10000 RPM) +* 4 Gigabit ethernet ports + +For complete spec, visit +http://www.sun.com/servers/coolthreads/t2000/specifications.jsp + +I think this system is well suited for PG scalability testing, among +others. We did an informal test using an internal OLTP benchmark and +noticed that PG can scale to around 8 CPUs. Would be really cool if all +32 virtual CPUs can be utilized!!! + +Anyways, if you need to access the system for testing purposes, please +contact Josh Berkus. + +Regards, + +Robert Lor +Sun Microsystems, Inc. +01-510-574-7189 + + + + +From pgsql-general-owner@postgresql.org Fri Jun 16 12:28:08 2006 +X-Original-To: pgsql-general-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3F5ED9FA42B + for ; + Fri, 16 Jun 2006 12:28:08 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 51193-01 for + ; + Fri, 16 Jun 2006 12:27:59 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from wolff.to (wolff.to [66.93.197.194]) + by postgresql.org (Postfix) with SMTP id 778929FA5C3 + for ; + Fri, 16 Jun 2006 12:27:59 -0300 (ADT) +Received: (qmail 12719 invoked by uid 500); 16 Jun 2006 15:31:32 -0000 +Date: Fri, 16 Jun 2006 10:31:32 -0500 +From: Bruno Wolff III +To: Benjamin Arai +Cc: pgsql-general@postgresql.org, pgsql-performance@postgresql.org +Subject: Re: Question about clustering multiple columns +Message-ID: <20060616153132.GA9056@wolff.to> +Mail-Followup-To: Bruno Wolff III , + Benjamin Arai , pgsql-general@postgresql.org, + pgsql-performance@postgresql.org +References: <002e01c68f03$05f00e10$6501a8c0@uni> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <002e01c68f03$05f00e10$6501a8c0@uni> +User-Agent: Mutt/1.4.2.1i +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/676 +X-Sequence-Number: 97048 + +On Tue, Jun 13, 2006 at 09:04:15 -0700, + Benjamin Arai wrote: +> Hi, +> +> I have a database where there are three columns (name,date,data). The +> queries are almost always something like SELECT date,data FROM table WHERE +> name=blah AND date > 1/1/2005 AND date < 1/1/2006;. I currently have three +> B-tree indexes, one for each of the columns. Is clustering on date index +> going to be what I want, or do I need a index that contains both name and +> date? + +I would expect that clustering on the name would be better for the above +query. +You probably want an index on name and date combined. + +From pgsql-hackers-owner@postgresql.org Fri Jun 16 13:03:36 2006 +X-Original-To: pgsql-hackers-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6EB6D9FA6B1 + for ; + Fri, 16 Jun 2006 13:03:36 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 51710-08 for + ; + Fri, 16 Jun 2006 13:03:26 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from candle.pha.pa.us (candle.pha.pa.us [70.90.9.53]) + by postgresql.org (Postfix) with ESMTP id B11279FA159 + for ; + Fri, 16 Jun 2006 13:03:25 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id k5GG3MS27858; + Fri, 16 Jun 2006 12:03:22 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200606161603.k5GG3MS27858@candle.pha.pa.us> +Subject: Re: Test request for Stats collector performance improvement +In-Reply-To: +To: Qingqing Zhou +Date: Fri, 16 Jun 2006 12:03:22 -0400 (EDT) +CC: pgsql-hackers@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/803 +X-Sequence-Number: 85036 + + +OK, based on reports I have seen, generally stats_query_string adds 50% +to the total runtime of a "SELECT 1" query, and the patch reduces the +overhead to 25%. + +However, that 25% is still much too large. Consider that "SELECT 1" has +to travel from psql to the server, go through the +parser/optimizer/executor, and then return, it is clearly wrong that the +stats_query_string performance hit should be measurable. + +I am actually surprised that so few people in the community are +concerned about this. While we have lots of people studying large +queries, these small queries should also get attention from a +performance perspective. + +I have created a new test that also turns off writing of the stats file. +This will not pass regression tests, but it will show the stats write +overhead. + +Updated test to be run: + +--------------------------------------------------------------------------- + +1) Run this script and record the time reported: + + ftp://candle.pha.pa.us/pub/postgresql/mypatches/stat.script + + It should take only a few seconds. + +2) Modify postgresql.conf: + + stats_command_string = on + + and reload the server. Do "SELECT * FROM pg_stat_activity;" to verify + the command string is enabled. You should see your query in the + "current query" column. + +3) Rerun the stat.script again and record the time. + +4) Apply this patch to CVS HEAD: + + ftp://candle.pha.pa.us/pub/postgresql/mypatches/stat.nobuffer + +5) Run the stat.script again and record the time. + +6) Revert the patch and apply this patch to CVS HEAD: + + ftp://candle.pha.pa.us/pub/postgresql/mypatches/stat.nobuffer_nowrite + +7) Run the stat.script again and record the time. + +8) Report the four results and your platform via email to + pgman@candle.pha.pa.us. Label times: + + stats_command_string = off + stats_command_string = on + stat.nobuffer patch + stat.nobuffer_nowrite patch + + +--------------------------------------------------------------------------- + +Qingqing Zhou wrote: +> +> "Bruce Momjian" wrote +> > +> > Any idea why there is such a variance in the result? The second run +> > looks quite slow. +> > +> +> No luck so far. It is quite repeatble in my machine -- runing times which +> show a long execution time: 2, 11, 14, 21 ... But when I do strace, the +> weiredness disappered totally. Have we seen any strange things like this +> before? +> +> Regards, +> Qingqing +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 4: Have you searched our list archives? +> +> http://archives.postgresql.org +> + +-- + Bruce Momjian http://candle.pha.pa.us + EnterpriseDB http://www.enterprisedb.com + + + If your life is a hard drive, Christ can be your backup. + + +From pgsql-hackers-owner@postgresql.org Fri Jun 16 13:13:16 2006 +X-Original-To: pgsql-hackers-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7ED0D9FA4C1 + for ; + Fri, 16 Jun 2006 13:13:16 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 54942-02 for + ; + Fri, 16 Jun 2006 13:13:07 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from cronos.madness.at (madness.at [217.196.146.217]) + by postgresql.org (Postfix) with ESMTP id 0EFD99FA5D8 + for ; + Fri, 16 Jun 2006 13:13:07 -0300 (ADT) +Received: from mastermind.kaltenbrunner.cc ([83.215.233.60]) + by cronos.madness.at with esmtpsa (TLSv1:AES256-SHA:256) + (Exim 4.62 (FreeBSD)) (envelope-from ) + id 1FrGwE-00062A-Sw; Fri, 16 Jun 2006 18:13:00 +0200 +Message-ID: <4492D882.6030109@kaltenbrunner.cc> +Date: Fri, 16 Jun 2006 18:12:50 +0200 +From: Stefan Kaltenbrunner +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: Bruce Momjian +CC: Qingqing Zhou , pgsql-hackers@postgresql.org +Subject: Re: Test request for Stats collector performance improvement +References: <200606161603.k5GG3MS27858@candle.pha.pa.us> +In-Reply-To: <200606161603.k5GG3MS27858@candle.pha.pa.us> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/804 +X-Sequence-Number: 85037 + +Bruce Momjian wrote: +> OK, based on reports I have seen, generally stats_query_string adds 50% +> to the total runtime of a "SELECT 1" query, and the patch reduces the +> overhead to 25%. + +that is actually not true for both of the platforms(a slow OpenBSD +3.9/x86 and a very fast Linux/x86_64) I tested on. Both of them show +virtually no improvement with the patch and even worst it causes +considerable (negative) variance on at least the Linux box. + +> +> However, that 25% is still much too large. Consider that "SELECT 1" has +> to travel from psql to the server, go through the +> parser/optimizer/executor, and then return, it is clearly wrong that the +> stats_query_string performance hit should be measurable. +> +> I am actually surprised that so few people in the community are +> concerned about this. While we have lots of people studying large +> queries, these small queries should also get attention from a +> performance perspective. +> +> I have created a new test that also turns off writing of the stats file. +> This will not pass regression tests, but it will show the stats write +> overhead. + +will try to run those too in a few. + + +Stefan + +From pgsql-hackers-owner@postgresql.org Fri Jun 16 13:27:43 2006 +X-Original-To: pgsql-hackers-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 19EEE9FA4C1 + for ; + Fri, 16 Jun 2006 13:27:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 53555-10 for + ; + Fri, 16 Jun 2006 13:27:33 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from candle.pha.pa.us (candle.pha.pa.us [70.90.9.53]) + by postgresql.org (Postfix) with ESMTP id BB5829FA10A + for ; + Fri, 16 Jun 2006 13:27:32 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id k5GGO3N03466; + Fri, 16 Jun 2006 12:24:03 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200606161624.k5GGO3N03466@candle.pha.pa.us> +Subject: Re: Test request for Stats collector performance improvement +In-Reply-To: <4492D882.6030109@kaltenbrunner.cc> +To: Stefan Kaltenbrunner +Date: Fri, 16 Jun 2006 12:24:03 -0400 (EDT) +CC: Qingqing Zhou , pgsql-hackers@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/805 +X-Sequence-Number: 85038 + +Stefan Kaltenbrunner wrote: +> Bruce Momjian wrote: +> > OK, based on reports I have seen, generally stats_query_string adds 50% +> > to the total runtime of a "SELECT 1" query, and the patch reduces the +> > overhead to 25%. +> +> that is actually not true for both of the platforms(a slow OpenBSD +> 3.9/x86 and a very fast Linux/x86_64) I tested on. Both of them show +> virtually no improvement with the patch and even worst it causes +> considerable (negative) variance on at least the Linux box. + +I see the results I suggested on OpenBSD that you reported. + +> OpenBSD 3.9-current/x86: +> +> without stats: +> 0m6.79s real 0m1.56s user 0m1.12s system +> +> -HEAD + stats: +> 0m10.44s real 0m2.26s user 0m1.22s system +> +> -HEAD + stats + patch: +> 0m10.68s real 0m2.16s user 0m1.36s system + +and I got similar results reported from a Debian: + + Linux 2.6.16 on a single processor HT 2.8Ghz Pentium compiled + with gcc 4.0.4. + + > > real 0m3.306s + > > real 0m4.905s + > > real 0m4.448s + +I am unclear on the cuase for the widely varying results you saw in +Debian. + +-- + Bruce Momjian http://candle.pha.pa.us + EnterpriseDB http://www.enterprisedb.com + + + If your life is a hard drive, Christ can be your backup. + + +From pgsql-performance-owner@postgresql.org Fri Jun 16 14:02:28 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 35E799FA4C1; + Fri, 16 Jun 2006 14:02:27 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 60367-03; Fri, 16 Jun 2006 14:02:21 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by postgresql.org (Postfix) with ESMTP id C02079FA10A; + Fri, 16 Jun 2006 14:02:19 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO [192.168.1.27]) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 9598031; Fri, 16 Jun 2006 10:05:32 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Robert Lor +Subject: Re: Sun Donated a Sun Fire T2000 to the PostgreSQL community +Date: Fri, 16 Jun 2006 10:01:56 -0700 +User-Agent: KMail/1.8 +Cc: pgsql-hackers@postgresql.org, + pgsql-performance@postgresql.org +References: <4492CBE2.3090509@sun.com> +In-Reply-To: <4492CBE2.3090509@sun.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200606161001.57142.josh@agliodbs.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/356 +X-Sequence-Number: 19713 + +Folks, + +> I am thrill to inform you all that Sun has just donated a fully loaded +> T2000 system to the PostgreSQL community, and it's being setup by Corey +> Shields at OSL (osuosl.org) and should be online probably early next +> week. The system has + +So this system will be hosted by Open Source Lab in Oregon. It's going to +be "donated" to Software In the Public Interest, who will own for the +PostgreSQL fund. + +We'll want to figure out a scheduling system to schedule performance and +compatibility testing on this machine; I'm not sure exactly how that will +work. Suggestions welcome. As a warning, Gavin Sherry and I have a bunch +of pending tests already to run. + +First thing as soon as I have a login, of course, is to set up a Buildfarm +instance. + +-- +--Josh + +Josh Berkus +PostgreSQL @ Sun +San Francisco + +From pgsql-performance-owner@postgresql.org Fri Jun 16 14:58:38 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 24AFD9FA4C1 + for ; + Fri, 16 Jun 2006 14:58:38 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 66335-01 for + ; + Fri, 16 Jun 2006 14:58:32 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from insiderscore.com (mail01.insiderscore.com [69.84.139.233]) + by postgresql.org (Postfix) with ESMTP id E51ED9FA10A + for ; + Fri, 16 Jun 2006 14:58:32 -0300 (ADT) +Received: from [10.10.10.105] (pool-71-248-161-243.bstnma.fios.verizon.net + [71.248.161.243]) + by insiderscore.com (Postfix) with ESMTP id BA63D556ACD; + Fri, 16 Jun 2006 13:58:30 -0400 (EDT) +In-Reply-To: <449275A5.5090503@proximity.com.au> +References: <4491D61B.9040507@proximity.com.au> + <449275A5.5090503@proximity.com.au> +Mime-Version: 1.0 (Apple Message framework v750) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <922914D7-46ED-4623-905A-C56058551905@torgo.978.org> +Cc: pgsql-performance@postgresql.org +Content-Transfer-Encoding: 7bit +From: Jeff Trout +Subject: Re: SAN performance mystery +Date: Fri, 16 Jun 2006 13:58:31 -0400 +To: Tim Allen +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/357 +X-Sequence-Number: 19714 + + +On Jun 16, 2006, at 5:11 AM, Tim Allen wrote: +> +> One curious thing is that some postgres backends seem to spend an +> inordinate amount of time in uninterruptible iowait state. I found +> a posting to this list from December 2004 from someone who reported +> that very same thing. For example, bringing down postgres on the +> customer box requires kill -9, because there are invariably one or +> two processes so deeply uninterruptible as to not respond to a +> politer signal. That indicates something not quite right, doesn't it? +> + +Sounds like there could be a driver/array/kernel bug there that is +kicking the performance down the tube. +If it was PG's fault it wouldn't be stuck uninterruptable. + +-- +Jeff Trout +http://www.dellsmartexitin.com/ +http://www.stuarthamm.net/ + + + + +From pgsql-hackers-owner@postgresql.org Fri Jun 16 15:15:00 2006 +X-Original-To: pgsql-hackers-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D56269FA60C + for ; + Fri, 16 Jun 2006 15:14:59 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 67736-05 for + ; + Fri, 16 Jun 2006 15:14:54 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from cronos.madness.at (madness.at [217.196.146.217]) + by postgresql.org (Postfix) with ESMTP id 6086D9FA10A + for ; + Fri, 16 Jun 2006 15:14:54 -0300 (ADT) +Received: from mastermind.kaltenbrunner.cc ([83.215.233.60]) + by cronos.madness.at with esmtpsa (TLSv1:AES256-SHA:256) + (Exim 4.62 (FreeBSD)) (envelope-from ) + id 1FrIqF-0009R4-FB; Fri, 16 Jun 2006 20:14:52 +0200 +Message-ID: <4492F517.7060405@kaltenbrunner.cc> +Date: Fri, 16 Jun 2006 20:14:47 +0200 +From: Stefan Kaltenbrunner +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: Bruce Momjian +CC: Qingqing Zhou , pgsql-hackers@postgresql.org +Subject: Re: Test request for Stats collector performance improvement +References: <200606161624.k5GGO3N03466@candle.pha.pa.us> +In-Reply-To: <200606161624.k5GGO3N03466@candle.pha.pa.us> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/808 +X-Sequence-Number: 85041 + +Bruce Momjian wrote: +> Stefan Kaltenbrunner wrote: +>> Bruce Momjian wrote: +>>> OK, based on reports I have seen, generally stats_query_string adds 50% +>>> to the total runtime of a "SELECT 1" query, and the patch reduces the +>>> overhead to 25%. +>> that is actually not true for both of the platforms(a slow OpenBSD +>> 3.9/x86 and a very fast Linux/x86_64) I tested on. Both of them show +>> virtually no improvement with the patch and even worst it causes +>> considerable (negative) variance on at least the Linux box. +> +> I see the results I suggested on OpenBSD that you reported. +> +>> OpenBSD 3.9-current/x86: +>> +>> without stats: +>> 0m6.79s real 0m1.56s user 0m1.12s system +>> +>> -HEAD + stats: +>> 0m10.44s real 0m2.26s user 0m1.22s system +>> +>> -HEAD + stats + patch: +>> 0m10.68s real 0m2.16s user 0m1.36s system + +yep those are very stable even over a large number of runs + +> +> and I got similar results reported from a Debian: +> +> Linux 2.6.16 on a single processor HT 2.8Ghz Pentium compiled +> with gcc 4.0.4. +> +> > > real 0m3.306s +> > > real 0m4.905s +> > > real 0m4.448s +> +> I am unclear on the cuase for the widely varying results you saw in +> Debian. +> + +I can reproduce the widely varying results on a number of x86 and x86_64 +based Linux boxes here (Debian,Fedora and CentOS) though I cannot +reproduce it on a Fedora core 5/ppc box. +All the x86 boxes are SMP - while the ppc one is not - that might have +some influence on the results. + +Stefan + +From pgsql-performance-owner@postgresql.org Thu Jun 22 03:05:05 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7DF279FA4C1 + for ; + Fri, 16 Jun 2006 16:00:16 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 71688-10 for + ; + Fri, 16 Jun 2006 16:00:10 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from server10.araisoft.com (server10.araisoft.com [72.9.228.195]) + by postgresql.org (Postfix) with ESMTP id 6637A9FA10A + for ; + Fri, 16 Jun 2006 16:00:10 -0300 (ADT) +Received: from akami (puravida.cs.ucr.edu [138.23.204.204]) + by server10.araisoft.com (Postfix) with ESMTP + id B86303D6200C; Fri, 16 Jun 2006 11:59:58 -0700 (PDT) +From: "Benjamin Arai" +To: "'Bruno Wolff III'" +Cc: +References: <002e01c68f03$05f00e10$6501a8c0@uni> + <20060616153132.GA9056@wolff.to> + <002301c69170$5d715170$1853f450$@com> + <20060616185556.GA12618@wolff.to> +In-Reply-To: <20060616185556.GA12618@wolff.to> +Subject: Re: Question about clustering multiple columns +Date: Fri, 16 Jun 2006 11:55:38 -0700 +Message-ID: <003201c69176$7694f5c0$63bee140$@com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +X-Mailer: Microsoft Office Outlook 12.0 +Thread-Index: AcaRdgagmFUnhF7qTVGuXpGetV0RLAAAEBZQ +Content-Language: en-us +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/433 +X-Sequence-Number: 19790 + +Thanks! This exactly what I was looking for. + +Benjamin Arai +Benjamin@araisoft.com +http://www.benjaminarai.com + +-----Original Message----- +From: Bruno Wolff III [mailto:bruno@wolff.to] +Sent: Friday, June 16, 2006 11:56 AM +To: Benjamin Arai +Cc: pgsql-performance@postgresql.org +Subject: Re: Question about clustering multiple columns + +On Fri, Jun 16, 2006 at 11:11:59 -0700, + Benjamin Arai wrote: +> Hi, +> +> Thanks for the reply. I have one more question. Does it matter in +> which order that I make the index? + +Please keep replies copied to the lists so that other people can learn from +and crontibute to the discussion. + +In this case I am just going to copy back to the performance list, since it +is generally better for perfomance questions than the general list. + +> For example, should I create an index cusip,date or date,cusip, does +> it matter which order. My goal is to cluster the entries by cusip, +> then for each cusip order the data by date (maybe the order by data +> occurs automatically). Hm, in that case maybe I only need to cluster +> by cusip, but then how do I ensure that each cusip had its data ordered by +date? + +I think that you want to order by cusip (assuming that corresponds to "name" +in you sample query below) first. You won't end up having to go through +values in the index that will be filtered out if you do it that way. + +The documentation for the cluster command says that it clusters on indexes, +not columns. So if the index is on (cusip, date), then the records will be +ordered by cusip, date immediately after the cluster. (New records added +after the cluster are not guarenteed to be ordered by the index.) + +> +> Benjamin +> +> -----Original Message----- +> From: Bruno Wolff III [mailto:bruno@wolff.to] +> Sent: Friday, June 16, 2006 8:32 AM +> To: Benjamin Arai +> Cc: pgsql-general@postgresql.org; pgsql-performance@postgresql.org +> Subject: Re: Question about clustering multiple columns +> +> On Tue, Jun 13, 2006 at 09:04:15 -0700, +> Benjamin Arai wrote: +> > Hi, +> > +> > I have a database where there are three columns (name,date,data). +> > The queries are almost always something like SELECT date,data FROM +> > table WHERE name=blah AND date > 1/1/2005 AND date < 1/1/2006;. I +> > currently have three B-tree indexes, one for each of the columns. +> > Is clustering on date index going to be what I want, or do I need a +> > index that contains both name and date? +> +> I would expect that clustering on the name would be better for the +> above query. +> You probably want an index on name and date combined. +> +> +> + +!DSPAM:4492fdfd193631139819016! + + +From pgsql-performance-owner@postgresql.org Fri Jun 16 15:52:28 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 18E229FA4C1 + for ; + Fri, 16 Jun 2006 15:52:28 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 71432-08 for + ; + Fri, 16 Jun 2006 15:52:21 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from wolff.to (wolff.to [66.93.197.194]) + by postgresql.org (Postfix) with SMTP id 91C539FA10A + for ; + Fri, 16 Jun 2006 15:52:21 -0300 (ADT) +Received: (qmail 13775 invoked by uid 500); 16 Jun 2006 18:55:56 -0000 +Date: Fri, 16 Jun 2006 13:55:56 -0500 +From: Bruno Wolff III +To: Benjamin Arai +Cc: pgsql-performance@postgresql.org +Subject: Re: Question about clustering multiple columns +Message-ID: <20060616185556.GA12618@wolff.to> +Mail-Followup-To: Bruno Wolff III , + Benjamin Arai , + pgsql-performance@postgresql.org +References: <002e01c68f03$05f00e10$6501a8c0@uni> + <20060616153132.GA9056@wolff.to> + <002301c69170$5d715170$1853f450$@com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <002301c69170$5d715170$1853f450$@com> +User-Agent: Mutt/1.4.2.1i +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/358 +X-Sequence-Number: 19715 + +On Fri, Jun 16, 2006 at 11:11:59 -0700, + Benjamin Arai wrote: +> Hi, +> +> Thanks for the reply. I have one more question. Does it matter in which +> order that I make the index? + +Please keep replies copied to the lists so that other people can learn from +and crontibute to the discussion. + +In this case I am just going to copy back to the performance list, since it +is generally better for perfomance questions than the general list. + +> For example, should I create an index cusip,date or date,cusip, does it +> matter which order. My goal is to cluster the entries by cusip, then for +> each cusip order the data by date (maybe the order by data occurs +> automatically). Hm, in that case maybe I only need to cluster by cusip, but +> then how do I ensure that each cusip had its data ordered by date? + +I think that you want to order by cusip (assuming that corresponds to "name" +in you sample query below) first. You won't end up having to go through values +in the index that will be filtered out if you do it that way. + +The documentation for the cluster command says that it clusters on indexes, +not columns. So if the index is on (cusip, date), then the records will be +ordered by cusip, date immediately after the cluster. (New records added +after the cluster are not guarenteed to be ordered by the index.) + +> +> Benjamin +> +> -----Original Message----- +> From: Bruno Wolff III [mailto:bruno@wolff.to] +> Sent: Friday, June 16, 2006 8:32 AM +> To: Benjamin Arai +> Cc: pgsql-general@postgresql.org; pgsql-performance@postgresql.org +> Subject: Re: Question about clustering multiple columns +> +> On Tue, Jun 13, 2006 at 09:04:15 -0700, +> Benjamin Arai wrote: +> > Hi, +> > +> > I have a database where there are three columns (name,date,data). The +> > queries are almost always something like SELECT date,data FROM table +> > WHERE name=blah AND date > 1/1/2005 AND date < 1/1/2006;. I currently +> > have three B-tree indexes, one for each of the columns. Is clustering +> > on date index going to be what I want, or do I need a index that +> > contains both name and date? +> +> I would expect that clustering on the name would be better for the above +> query. +> You probably want an index on name and date combined. +> +> !DSPAM:4492ce0d180368658827628! +> + +From pgsql-performance-owner@postgresql.org Fri Jun 16 19:34:28 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6F3C19FA6B4; + Fri, 16 Jun 2006 19:34:26 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 93604-01; Fri, 16 Jun 2006 19:34:17 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id AA1359FA5D8; + Fri, 16 Jun 2006 19:34:17 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from olive.qinip.net (olive.qinip.net [62.100.30.40]) + by svr4.postgresql.org (Postfix) with ESMTP id B65DC5AF02A; + Fri, 16 Jun 2006 22:34:16 +0000 (GMT) +Received: from [127.0.0.1] (h8441139206.dsl.speedlinq.nl [84.41.139.206]) + by olive.qinip.net (Postfix) with ESMTP id 49C2E18111; + Sat, 17 Jun 2006 00:34:13 +0200 (MEST) +Message-ID: <449331EC.10207@tweakers.net> +Date: Sat, 17 Jun 2006 00:34:20 +0200 +From: Arjen van der Meijden +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: Robert Lor +Cc: pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org +Subject: Re: Sun Donated a Sun Fire T2000 to the PostgreSQL community +References: <4492CBE2.3090509@sun.com> +In-Reply-To: <4492CBE2.3090509@sun.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Antivirus: avast! (VPS 0624-2, 15-06-2006), Outbound message +X-Antivirus-Status: Clean +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/359 +X-Sequence-Number: 19716 + +On 16-6-2006 17:18, Robert Lor wrote: +> +> I think this system is well suited for PG scalability testing, among +> others. We did an informal test using an internal OLTP benchmark and +> noticed that PG can scale to around 8 CPUs. Would be really cool if all +> 32 virtual CPUs can be utilized!!! + +I can already confirm very good scalability (with our workload) on +postgresql on that machine. We've been testing a 32thread/16G-version +and it shows near-linear scaling when enabling 1, 2, 4, 6 and 8 cores +(with all four threads enabled). + +The threads are a bit less scalable, but still pretty good. Enabling 1, +2 or 4 threads for each core yields resp 60 and 130% extra performance. + +Best regards, + +Arjen + +From pgsql-performance-owner@postgresql.org Fri Jun 16 20:24:43 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 9C53D9FA5F8; + Fri, 16 Jun 2006 20:24:42 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 96782-03; Fri, 16 Jun 2006 20:24:33 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by postgresql.org (Postfix) with ESMTP id 929B39FA5D8; + Fri, 16 Jun 2006 20:24:33 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO [192.168.1.27]) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 9600309; Fri, 16 Jun 2006 16:27:46 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: pgsql-hackers@postgresql.org +Subject: Re: [HACKERS] Sun Donated a Sun Fire T2000 to the PostgreSQL + community +Date: Fri, 16 Jun 2006 16:24:16 -0700 +User-Agent: KMail/1.8 +Cc: Arjen van der Meijden , + Robert Lor , pgsql-performance@postgresql.org +References: <4492CBE2.3090509@sun.com> <449331EC.10207@tweakers.net> +In-Reply-To: <449331EC.10207@tweakers.net> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200606161624.17081.josh@agliodbs.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/360 +X-Sequence-Number: 19717 + +Arjen, + +> I can already confirm very good scalability (with our workload) on +> postgresql on that machine. We've been testing a 32thread/16G-version +> and it shows near-linear scaling when enabling 1, 2, 4, 6 and 8 cores +> (with all four threads enabled). + +Keen. We're trying to keep the linear scaling going up to 32 cores of +course (which doesn't happen, presently). Would you be interested in +helping us troubleshoot some of the performance issues? + +-- +--Josh + +Josh Berkus +PostgreSQL @ Sun +San Francisco + +From pgsql-performance-owner@postgresql.org Fri Jun 16 23:02:43 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id CC6CD9FA5D8; + Fri, 16 Jun 2006 23:02:41 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 05086-10; Fri, 16 Jun 2006 23:02:35 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sraigw.sra.co.jp (sraigw.sra.co.jp [202.32.10.2]) + by postgresql.org (Postfix) with ESMTP id A7B5B9FA646; + Fri, 16 Jun 2006 23:02:34 -0300 (ADT) +Received: from srascb.sra.co.jp (srascb [133.137.8.65]) + by sraigw.sra.co.jp (Postfix) with ESMTP + id 16E34629E1; Sat, 17 Jun 2006 11:02:32 +0900 (JST) +Received: from srascb.sra.co.jp (localhost [127.0.0.1]) + by localhost.sra.co.jp (Postfix) with ESMTP + id E857810CD06; Sat, 17 Jun 2006 11:02:31 +0900 (JST) +Received: from sranhm.sra.co.jp (sranhm [133.137.16.38]) + by srascb.sra.co.jp (Postfix) with ESMTP + id 965CD10CD04; Sat, 17 Jun 2006 11:02:31 +0900 (JST) +Received: from localhost (sraihb-hub.sra.co.jp [133.137.8.6]) + by sranhm.sra.co.jp (8.9.3+3.2W/3.7W-srambox) with ESMTP id LAA13536; + Sat, 17 Jun 2006 11:02:31 +0900 +Date: Sat, 17 Jun 2006 10:15:21 +0900 (JST) +Message-Id: <20060617.101521.95879771.t-ishii@sraoss.co.jp> +To: Robert.Lor@Sun.COM +Cc: pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org +Subject: Re: Sun Donated a Sun Fire T2000 to the PostgreSQL +From: Tatsuo Ishii +In-Reply-To: <4492CBE2.3090509@sun.com> +References: <4492CBE2.3090509@sun.com> +X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) +Mime-Version: 1.0 +Content-Type: Text/Plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/361 +X-Sequence-Number: 19718 + +> I am thrill to inform you all that Sun has just donated a fully loaded +> T2000 system to the PostgreSQL community, and it's being setup by Corey +> Shields at OSL (osuosl.org) and should be online probably early next +> week. The system has +> +> * 8 cores, 4 hw threads/core @ 1.2 GHz. Solaris sees the system as +> having 32 virtual CPUs, and each can be enabled or disabled individually +> * 32 GB of DDR2 SDRAM memory +> * 2 @ 73GB internal SAS drives (10000 RPM) +> * 4 Gigabit ethernet ports +> +> For complete spec, visit +> http://www.sun.com/servers/coolthreads/t2000/specifications.jsp +> +> I think this system is well suited for PG scalability testing, among +> others. We did an informal test using an internal OLTP benchmark and +> noticed that PG can scale to around 8 CPUs. Would be really cool if all +> 32 virtual CPUs can be utilized!!! + +Interesting. We (some Japanese companies including SRA OSS, +Inc. Japan) did some PG scalability testing using a Unisys's big 16 +(physical) CPU machine and found PG scales up to 8 CPUs. However +beyond 8 CPU PG does not scale anymore. The result can be viewed at +"OSS iPedia" web site (http://ossipedia.ipa.go.jp). Our conclusion was +PG has a serious lock contention problem in the environment by +analyzing the oprofile result. + +You can take a look at the detailed report at: +http://ossipedia.ipa.go.jp/capacity/EV0604210111/ +(unfortunately only Japanese contents is available at the +moment. Please use some automatic translation services) + +Evalution environment was: +PostgreSQL 8.1.2 +OSDL DBT-1 2.1 +Miracle Linux 4.0 +Unisys ES700 Xeon 2.8GHz CPU x 16 Mem 16GB(HT off) +-- +Tatsuo Ishii +SRA OSS, Inc. Japan + +From pgsql-performance-owner@postgresql.org Sat Jun 17 00:05:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0E8A39FA646; + Sat, 17 Jun 2006 00:05:55 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 16239-07; Sat, 17 Jun 2006 00:05:50 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sraigw.sra.co.jp (sraigw.sra.co.jp [202.32.10.2]) + by postgresql.org (Postfix) with ESMTP id DFF5E9FA5F8; + Sat, 17 Jun 2006 00:05:49 -0300 (ADT) +Received: from srascb.sra.co.jp (srascb [133.137.8.65]) + by sraigw.sra.co.jp (Postfix) with ESMTP + id BA57B62A85; Sat, 17 Jun 2006 12:05:48 +0900 (JST) +Received: from srascb.sra.co.jp (localhost [127.0.0.1]) + by localhost.sra.co.jp (Postfix) with ESMTP + id A282A10CD06; Sat, 17 Jun 2006 12:05:48 +0900 (JST) +Received: from sranhm.sra.co.jp (sranhm [133.137.16.38]) + by srascb.sra.co.jp (Postfix) with ESMTP + id 7E62310CD04; Sat, 17 Jun 2006 12:05:48 +0900 (JST) +Received: from localhost (sraihb-hub.sra.co.jp [133.137.8.6]) + by sranhm.sra.co.jp (8.9.3+3.2W/3.7W-srambox) with ESMTP id MAA14683; + Sat, 17 Jun 2006 12:05:48 +0900 +Date: Sat, 17 Jun 2006 11:18:38 +0900 (JST) +Message-Id: <20060617.111838.39487910.t-ishii@sraoss.co.jp> +To: tgl@sss.pgh.pa.us +Cc: ishii@sraoss.co.jp, Robert.Lor@Sun.COM, + pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org +Subject: Re: Sun Donated a Sun Fire T2000 to the PostgreSQL +From: Tatsuo Ishii +In-Reply-To: <10226.1150511655@sss.pgh.pa.us> +References: <4492CBE2.3090509@sun.com> + <20060617.101521.95879771.t-ishii@sraoss.co.jp> + <10226.1150511655@sss.pgh.pa.us> +X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) +Mime-Version: 1.0 +Content-Type: Text/Plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/363 +X-Sequence-Number: 19720 + +> Tatsuo Ishii writes: +> > Interesting. We (some Japanese companies including SRA OSS, +> > Inc. Japan) did some PG scalability testing using a Unisys's big 16 +> > (physical) CPU machine and found PG scales up to 8 CPUs. However +> > beyond 8 CPU PG does not scale anymore. The result can be viewed at +> > "OSS iPedia" web site (http://ossipedia.ipa.go.jp). Our conclusion was +> > PG has a serious lock contention problem in the environment by +> > analyzing the oprofile result. +> +> 18% in s_lock is definitely bad :-(. Were you able to determine which +> LWLock(s) are accounting for the contention? + +Yes. We were interested in that too. Some people did addtional tests +to determin that. I don't have the report handy now. I will report +back next week. + +> The test case seems to be spending a remarkable amount of time in LIKE +> comparisons, too. That probably is not a representative condition. + +I know. I think point is 18% in s_lock only appears with 12 CPUs or more. +-- +Tatsuo Ishii +SRA OSS, Inc. Japan + +From pgsql-performance-owner@postgresql.org Fri Jun 16 23:34:26 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7028A9FA5D8; + Fri, 16 Jun 2006 23:34:24 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 14711-02; Fri, 16 Jun 2006 23:34:17 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 980DB9FA5F8; + Fri, 16 Jun 2006 23:34:17 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5H2YFvr010227; + Fri, 16 Jun 2006 22:34:15 -0400 (EDT) +To: Tatsuo Ishii +cc: Robert.Lor@Sun.COM, pgsql-hackers@postgresql.org, + pgsql-performance@postgresql.org +Subject: Re: Sun Donated a Sun Fire T2000 to the PostgreSQL +In-reply-to: <20060617.101521.95879771.t-ishii@sraoss.co.jp> +References: <4492CBE2.3090509@sun.com> + <20060617.101521.95879771.t-ishii@sraoss.co.jp> +Comments: In-reply-to Tatsuo Ishii + message dated "Sat, 17 Jun 2006 10:15:21 +0900" +Date: Fri, 16 Jun 2006 22:34:15 -0400 +Message-ID: <10226.1150511655@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/362 +X-Sequence-Number: 19719 + +Tatsuo Ishii writes: +> Interesting. We (some Japanese companies including SRA OSS, +> Inc. Japan) did some PG scalability testing using a Unisys's big 16 +> (physical) CPU machine and found PG scales up to 8 CPUs. However +> beyond 8 CPU PG does not scale anymore. The result can be viewed at +> "OSS iPedia" web site (http://ossipedia.ipa.go.jp). Our conclusion was +> PG has a serious lock contention problem in the environment by +> analyzing the oprofile result. + +18% in s_lock is definitely bad :-(. Were you able to determine which +LWLock(s) are accounting for the contention? + +The test case seems to be spending a remarkable amount of time in LIKE +comparisons, too. That probably is not a representative condition. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sat Jun 17 01:19:52 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 855A29FA692; + Sat, 17 Jun 2006 01:19:51 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 29293-04; Sat, 17 Jun 2006 01:19:47 -0300 (ADT) +X-Greylist: delayed 12:57:50.152956 by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from nwkea-pix-1.sun.com (nwkea-pix-1.sun.com [192.18.42.249]) + by postgresql.org (Postfix) with ESMTP id 274AB9FA68D; + Sat, 17 Jun 2006 01:19:46 -0300 (ADT) +Received: from d1-sfbay-01.sun.com ([192.18.39.111]) + by nwkea-pix-1.sun.com (8.13.6+Sun/8.12.9) with ESMTP id k5H4JfIS022134; + Fri, 16 Jun 2006 21:19:41 -0700 (PDT) +Received: from conversion-daemon.d1-sfbay-01.sun.com by d1-sfbay-01.sun.com + (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) + id <0J0Z00H01G26E600@d1-sfbay-01.sun.com> + (original mail from Robert.Lor@Sun.COM); + Fri, 16 Jun 2006 21:19:41 -0700 (PDT) +Received: from [129.150.12.121] by d1-sfbay-01.sun.com + (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) + with ESMTPSA id <0J0Z00IDULCSRW00@d1-sfbay-01.sun.com>; Fri, + 16 Jun 2006 21:19:41 -0700 (PDT) +Date: Fri, 16 Jun 2006 21:17:04 -0700 +From: Robert Lor +Subject: Re: Sun Donated a Sun Fire T2000 to the PostgreSQL community +In-reply-to: <449331EC.10207@tweakers.net> +To: Arjen van der Meijden +Cc: pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org +Message-id: <44938240.6040804@sun.com> +MIME-version: 1.0 +Content-type: text/plain; format=flowed; charset=us-ascii +Content-transfer-encoding: 7BIT +X-Accept-Language: en-us, en +References: <4492CBE2.3090509@sun.com> <449331EC.10207@tweakers.net> +User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.7) Gecko/20060307 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/364 +X-Sequence-Number: 19721 + +Arjen van der Meijden wrote: + +> +> I can already confirm very good scalability (with our workload) on +> postgresql on that machine. We've been testing a 32thread/16G-version +> and it shows near-linear scaling when enabling 1, 2, 4, 6 and 8 cores +> (with all four threads enabled). +> +> The threads are a bit less scalable, but still pretty good. Enabling +> 1, 2 or 4 threads for each core yields resp 60 and 130% extra +> performance. + +Wow, what type of workload is it? And did you do much tuning to get +near-linear scalability to 32 threads? + +Regards, +-Robert + +From pgsql-hackers-owner@postgresql.org Sat Jun 17 14:43:18 2006 +X-Original-To: pgsql-hackers-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0EC189FA6B3 + for ; + Sat, 17 Jun 2006 14:43:18 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 17846-07 for + ; + Sat, 17 Jun 2006 14:43:12 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 083B69FA5E7 + for ; + Sat, 17 Jun 2006 14:43:12 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5HHh68S022041; + Sat, 17 Jun 2006 13:43:06 -0400 (EDT) +To: Bruce Momjian +cc: Qingqing Zhou , pgsql-hackers@postgresql.org +Subject: Re: Test request for Stats collector performance improvement +In-reply-to: <200606161603.k5GG3MS27858@candle.pha.pa.us> +References: <200606161603.k5GG3MS27858@candle.pha.pa.us> +Comments: In-reply-to Bruce Momjian + message dated "Fri, 16 Jun 2006 12:03:22 -0400" +Date: Sat, 17 Jun 2006 13:43:06 -0400 +Message-ID: <22040.1150566186@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/853 +X-Sequence-Number: 85086 + +Bruce Momjian writes: +> 1) Run this script and record the time reported: +> ftp://candle.pha.pa.us/pub/postgresql/mypatches/stat.script + +One thing you neglected to specify is that the test must be done on a +NON ASSERT CHECKING build of CVS HEAD (or recent head, at least). +On these trivial "SELECT 1" commands, an assert-checking backend is +going to spend over 50% of its time doing end-of-transaction assert +checks. I was reminded of this upon trying to do oprofile: + +CPU: P4 / Xeon with 2 hyper-threads, speed 2793.03 MHz (estimated) +Counted GLOBAL_POWER_EVENTS events (time during which processor is not stopped) +with a unit mask of 0x01 (mandatory) count 240000 +samples % symbol name +129870 37.0714 AtEOXact_CatCache +67112 19.1571 AllocSetCheck +16611 4.7416 AtEOXact_Buffers +10054 2.8699 base_yyparse +7499 2.1406 hash_seq_search +7037 2.0087 AllocSetAlloc +4267 1.2180 hash_search +4060 1.1589 AtEOXact_RelationCache +2537 0.7242 base_yylex +1984 0.5663 grouping_planner +1873 0.5346 LWLockAcquire +1837 0.5244 AllocSetFree +1808 0.5161 exec_simple_query +1763 0.5032 ExecutorStart +1527 0.4359 PostgresMain +1464 0.4179 MemoryContextAllocZeroAligned + +Let's be sure we're all measuring the same thing. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sat Jun 17 16:19:49 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3D13D9FA5E7; + Sat, 17 Jun 2006 16:19:48 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 27876-01; Sat, 17 Jun 2006 16:19:37 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by postgresql.org (Postfix) with ESMTP id A3A3D9FA6B3; + Sat, 17 Jun 2006 16:19:37 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO + spooky.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 9604301; Sat, 17 Jun 2006 12:22:48 -0700 +From: Josh Berkus +Organization: PostgreSQL @ Sun +To: pgsql-hackers@postgresql.org +Subject: Re: [HACKERS] Sun Donated a Sun Fire T2000 to the PostgreSQL +Date: Sat, 17 Jun 2006 12:19:40 -0700 +User-Agent: KMail/1.8.2 +Cc: Tom Lane , Tatsuo Ishii , + Robert.Lor@sun.com, pgsql-performance@postgresql.org +References: <4492CBE2.3090509@sun.com> + <20060617.101521.95879771.t-ishii@sraoss.co.jp> + <10226.1150511655@sss.pgh.pa.us> +In-Reply-To: <10226.1150511655@sss.pgh.pa.us> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +Message-Id: <200606171219.40374.josh@agliodbs.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/365 +X-Sequence-Number: 19722 + +Tom, + +> 18% in s_lock is definitely bad :-(. =C2=A0Were you able to determine whi= +ch +> LWLock(s) are accounting for the contention? + +Gavin Sherry and Tom Daly (Sun) are currently working on identifying the=20 +problem lock using DLWLOCK_STATS. Any luck, Gavin? + +=2D-=20 +Josh Berkus +PostgreSQL @ Sun +San Francisco + +From pgsql-performance-owner@postgresql.org Sat Jun 17 16:45:10 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 116D29FA6B2 + for ; + Sat, 17 Jun 2006 16:45:10 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 27634-10 for + ; + Sat, 17 Jun 2006 16:45:03 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 983F69FA5E7 + for ; + Sat, 17 Jun 2006 16:45:04 -0300 (ADT) +Received: from [10.195.119.225] (unknown [66.209.15.235]) + (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by noel.decibel.org (Postfix) with ESMTP id CD6CF56408; + Sat, 17 Jun 2006 14:44:54 -0500 (CDT) +In-Reply-To: <4491A49E.5010105@dunaweb.hu> +References: <3167.213.163.11.81.1150282434.squirrel@www.dunaweb.hu> + <20060614110713.GA2277@alamut.tdm.local> + <3861.213.163.11.81.1150284610.squirrel@www.dunaweb.hu> + <20060614151804.GB34196@pervasive.com> <4490E286.90004@dunaweb.hu> + <20060615155929.GL34196@pervasive.com> + <4491A49E.5010105@dunaweb.hu> +Mime-Version: 1.0 (Apple Message framework v750) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: +Cc: Volkan YAZICI , + pgsql-performance@postgresql.org +Content-Transfer-Encoding: 7bit +From: Jim Nasby +Subject: Re: Precomputed constants? +Date: Sat, 17 Jun 2006 14:25:14 -0500 +To: Zoltan Boszormenyi +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/366 +X-Sequence-Number: 19723 + +On Jun 15, 2006, at 1:19 PM, Zoltan Boszormenyi wrote: +> # select distinct provolatile from pg_proc; +> provolatile +> ------------- +> i +> s +> v +> (3 sor) +> +> If I get this right, IMMUTABLE/STABLE/VOLATILE +> are indicated with their initials. + +That's probably correct. If the docs don't specify this then the code +would. Or you could just create 3 test functions and see what you end +up with, but I can't see it being any different from your guess. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + + + +From pgsql-performance-owner@postgresql.org Sat Jun 17 16:54:11 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 75B0E9FA6B2 + for ; + Sat, 17 Jun 2006 16:54:09 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 27309-10 for + ; + Sat, 17 Jun 2006 16:53:58 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 63BAB9FA5E7 + for ; + Sat, 17 Jun 2006 16:53:59 -0300 (ADT) +Received: from [10.195.119.225] (unknown [66.209.15.235]) + (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by noel.decibel.org (Postfix) with ESMTP id 99F9956431; + Sat, 17 Jun 2006 14:53:31 -0500 (CDT) +In-Reply-To: <36e682920606160643u1d2f559fxe09f8acc970c1c53@mail.gmail.com> +References: + <1150396425.31200.66.camel@archimedes> + <87ver18hu9.fsf@stark.xeocode.com> + <36e682920606160551v6b98bcfek32f01b895c53e057@mail.gmail.com> + <8764j18cea.fsf@stark.xeocode.com> + <36e682920606160643u1d2f559fxe09f8acc970c1c53@mail.gmail.com> +Mime-Version: 1.0 (Apple Message framework v750) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <5F206F7D-D7F8-4F73-B932-13E7BC612524@decibel.org> +Cc: "Greg Stark" , "Mark Lewis" , + pgsql-performance@lusis.org, + "PGSQL Performance" +Content-Transfer-Encoding: 7bit +From: Jim Nasby +Subject: Re: Optimizer internals +Date: Sat, 17 Jun 2006 14:33:17 -0500 +To: Jonah H. Harris +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/367 +X-Sequence-Number: 19724 + +On Jun 16, 2006, at 8:43 AM, Jonah H. Harris wrote: +> Yes, this is certainly the most noticible case. This is one reason +> I'm behind the freespace patch. Unfortunately, a lot of inexperienced +> people use VACUUM FULL and don't understand why VACUUM is *generally* +> better.(to free up block-level freespace and update FSM) assuming they +> have enough hard disk space for the database. + +Another reason to turn autovac on by default in 8.2... + +>> That and of course the visibility bitmap that has been +>> much-discussed +> I'd certainly like to see it. + +What's the hold-up on this? I thought there were some technical +issues that had yet to be resolved? + +BTW, I'll point out that DB2 and MSSQL didn't switch to MVCC until +their most recent versions. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + + + +From pgsql-performance-owner@postgresql.org Sat Jun 17 16:59:03 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 99BBB9FA6B4 + for ; + Sat, 17 Jun 2006 16:59:03 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 32955-07 for + ; + Sat, 17 Jun 2006 16:58:58 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 0447F9FA5E7 + for ; + Sat, 17 Jun 2006 16:58:57 -0300 (ADT) +Received: from [10.195.119.225] (unknown [66.209.15.235]) + (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by noel.decibel.org (Postfix) with ESMTP id DE56A56431; + Sat, 17 Jun 2006 14:58:25 -0500 (CDT) +In-Reply-To: <87psh98hlo.fsf@stark.xeocode.com> +References: <4491D61B.9040507@proximity.com.au> + <4491D8DC.4070906@janestcapital.com> + <1751.1150410284@sss.pgh.pa.us> + <1150413917.31200.109.camel@archimedes> + <33c6269f0606151658h731915d3k405b4da67c49228a@mail.gmail.com> + <87psh98hlo.fsf@stark.xeocode.com> +Mime-Version: 1.0 (Apple Message framework v750) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: +Cc: "Alex Turner" , "Mark Lewis" , + "Tom Lane" , "Brian Hurt" , + "Tim Allen" , pgsql-performance@postgresql.org +Content-Transfer-Encoding: 7bit +From: Jim Nasby +Subject: Re: SAN performance mystery +Date: Sat, 17 Jun 2006 14:53:03 -0500 +To: Greg Stark +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/368 +X-Sequence-Number: 19725 + +On Jun 16, 2006, at 6:28 AM, Greg Stark wrote: +> I never understood why disk caches on the order of megabytes are +> exciting. Why +> should disk manufacturers be any better about cache management than OS +> authors? +> +> In the case of RAID 5 this could actually work against you since +> the RAID +> controller can _only_ use its cache to find parity blocks when +> writing. +> Software raid can use all of the OS's disk cache to that end. + +IIRC some of the Bizgres folks have found better performance with +software raid for just that reason. The big advantage HW raid has is +that you can do a battery-backed cache, something you'll never be +able to duplicate in a general-purpose computer (sure, you could +battery-back the DRAM if you really wanted to, but if the kernel +crashed you'd be completely screwed, which isn't the case with a +battery-backed RAID controller). + +The quality of the RAID controller also makes a huge difference. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + + + + +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + + + +From pgsql-performance-owner@postgresql.org Sat Jun 17 16:59:33 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C78249FA6B2; + Sat, 17 Jun 2006 16:59:31 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 28058-08; Sat, 17 Jun 2006 16:59:25 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 133A09FA5E7; + Sat, 17 Jun 2006 16:59:25 -0300 (ADT) +Received: from [10.195.119.225] (unknown [66.209.15.235]) + (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by noel.decibel.org (Postfix) with ESMTP id 508B75644B; + Sat, 17 Jun 2006 14:59:13 -0500 (CDT) +In-Reply-To: <200606161001.57142.josh@agliodbs.com> +References: <4492CBE2.3090509@sun.com> <200606161001.57142.josh@agliodbs.com> +Mime-Version: 1.0 (Apple Message framework v750) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <0590A28B-A34C-43C0-BBF7-2DDF28BABAF6@pervasive.com> +Cc: Robert Lor , pgsql-hackers@postgresql.org, + pgsql-performance@postgresql.org +Content-Transfer-Encoding: 7bit +From: Jim Nasby +Subject: Re: Sun Donated a Sun Fire T2000 to the PostgreSQL community +Date: Sat, 17 Jun 2006 14:53:04 -0500 +To: josh@agliodbs.com +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/369 +X-Sequence-Number: 19726 + +On Jun 16, 2006, at 12:01 PM, Josh Berkus wrote: + +> Folks, +> +>> I am thrill to inform you all that Sun has just donated a fully +>> loaded +>> T2000 system to the PostgreSQL community, and it's being setup by +>> Corey +>> Shields at OSL (osuosl.org) and should be online probably early next +>> week. The system has +> +> So this system will be hosted by Open Source Lab in Oregon. It's +> going to +> be "donated" to Software In the Public Interest, who will own for the +> PostgreSQL fund. +> +> We'll want to figure out a scheduling system to schedule +> performance and +> compatibility testing on this machine; I'm not sure exactly how +> that will +> work. Suggestions welcome. As a warning, Gavin Sherry and I have +> a bunch +> of pending tests already to run. +> +> First thing as soon as I have a login, of course, is to set up a +> Buildfarm +> instance. +> +> -- +> --Josh +> +> Josh Berkus +> PostgreSQL @ Sun +> San Francisco +> +> ---------------------------(end of +> broadcast)--------------------------- +> TIP 1: if posting/reading through Usenet, please send an appropriate +> subscribe-nomail command to majordomo@postgresql.org so that +> your +> message can get through to the mailing list cleanly +> + +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + + + +From pgsql-performance-owner@postgresql.org Sat Jun 17 17:00:46 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id BCE369FA8EF; + Sat, 17 Jun 2006 17:00:45 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 26767-09; Sat, 17 Jun 2006 17:00:38 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 527C69FA5E7; + Sat, 17 Jun 2006 17:00:39 -0300 (ADT) +Received: from [10.195.119.225] (unknown [66.209.15.235]) + (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by noel.decibel.org (Postfix) with ESMTP id 1102E5644B; + Sat, 17 Jun 2006 15:00:26 -0500 (CDT) +In-Reply-To: <200606161001.57142.josh@agliodbs.com> +References: <4492CBE2.3090509@sun.com> <200606161001.57142.josh@agliodbs.com> +Mime-Version: 1.0 (Apple Message framework v750) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: +Cc: Robert Lor , pgsql-hackers@postgresql.org, + pgsql-performance@postgresql.org +Content-Transfer-Encoding: 7bit +From: Jim Nasby +Subject: Re: Sun Donated a Sun Fire T2000 to the PostgreSQL community +Date: Sat, 17 Jun 2006 14:54:50 -0500 +To: josh@agliodbs.com +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/370 +X-Sequence-Number: 19727 + +On Jun 16, 2006, at 12:01 PM, Josh Berkus wrote: +> First thing as soon as I have a login, of course, is to set up a +> Buildfarm +> instance. + +Keep in mind that buildfarm clients and benchmarking stuff don't +usually mix well. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + + + +From pgsql-performance-owner@postgresql.org Thu Jun 22 03:05:09 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 16E949FA5E7; + Sat, 17 Jun 2006 18:47:15 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 75936-01; Sat, 17 Jun 2006 18:47:05 -0300 (ADT) +X-Greylist: whitelisted by SQLgrey- +X-Greylist: whitelisted by SQLgrey- +Received: from ms-smtp-02.southeast.rr.com (ms-smtp-02.southeast.rr.com + [24.25.9.101]) by postgresql.org (Postfix) with ESMTP id 465129FA6B2; + Sat, 17 Jun 2006 18:47:06 -0300 (ADT) +Received: from [192.168.10.105] (cpe-024-211-165-134.nc.res.rr.com + [24.211.165.134]) + by ms-smtp-02.southeast.rr.com (8.13.6/8.13.6) with ESMTP id + k5HLkklO003257; Sat, 17 Jun 2006 17:46:47 -0400 (EDT) +Message-ID: <44947840.8040806@dunslane.net> +Date: Sat, 17 Jun 2006 17:46:40 -0400 +From: Andrew Dunstan +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.12) Gecko/20060210 Fedora/1.7.12-1.3.3.legacy +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Jim Nasby +CC: josh@agliodbs.com, Robert Lor , + pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org +Subject: Re: [HACKERS] Sun Donated a Sun Fire T2000 to the PostgreSQL +References: <4492CBE2.3090509@sun.com> <200606161001.57142.josh@agliodbs.com> + +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Symantec AntiVirus Scan Engine +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/434 +X-Sequence-Number: 19791 + + + +Jim Nasby wrote: + +> On Jun 16, 2006, at 12:01 PM, Josh Berkus wrote: +> +>> First thing as soon as I have a login, of course, is to set up a +>> Buildfarm +>> instance. +> +> +> Keep in mind that buildfarm clients and benchmarking stuff don't +> usually mix well. +> + +On a fast machine like this a buildfarm run is not going to take very +long. You could run those once a day at times of low demand. Or even +once or twice a week. + +cheers + +andrew + +From pgsql-performance-owner@postgresql.org Sun Jun 18 06:18:05 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id BDE7A9FA5E6; + Sun, 18 Jun 2006 06:18:02 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 62521-07; Sun, 18 Jun 2006 06:17:51 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id EA18C9F9AD3; + Sun, 18 Jun 2006 06:17:49 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from olive.qinip.net (olive.qinip.net [62.100.30.40]) + by svr4.postgresql.org (Postfix) with ESMTP id DB57E5AF037; + Sun, 18 Jun 2006 09:17:48 +0000 (GMT) +Received: from [127.0.0.1] (h8441139206.dsl.speedlinq.nl [84.41.139.206]) + by olive.qinip.net (Postfix) with ESMTP id 36CDA1806A; + Sun, 18 Jun 2006 11:17:43 +0200 (MEST) +Message-ID: <44951A42.6060007@tweakers.net> +Date: Sun, 18 Jun 2006 11:17:54 +0200 +From: Arjen van der Meijden +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: josh@agliodbs.com +Cc: pgsql-hackers@postgresql.org, Robert Lor , + pgsql-performance@postgresql.org +Subject: Re: [HACKERS] Sun Donated a Sun Fire T2000 to the PostgreSQL +References: <4492CBE2.3090509@sun.com> <449331EC.10207@tweakers.net> + <200606161624.17081.josh@agliodbs.com> +In-Reply-To: <200606161624.17081.josh@agliodbs.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Antivirus: avast! (VPS 0624-2, 15-06-2006), Outbound message +X-Antivirus-Status: Clean +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/371 +X-Sequence-Number: 19728 + +On 17-6-2006 1:24, Josh Berkus wrote: +> Arjen, +> +>> I can already confirm very good scalability (with our workload) on +>> postgresql on that machine. We've been testing a 32thread/16G-version +>> and it shows near-linear scaling when enabling 1, 2, 4, 6 and 8 cores +>> (with all four threads enabled). +> +> Keen. We're trying to keep the linear scaling going up to 32 cores of +> course (which doesn't happen, presently). Would you be interested in +> helping us troubleshoot some of the performance issues? + +You can ask your questions, if I happen to do know the answer, you're a +step further in the right direction. + +But actually, I didn't do much to get this scalability... So I won't be +of much help to you, its not that I spent hours on getting this performance. +I just started out with the "normal" attempts to get a good config. +Currently the shared buffers is set to 30k. Larger settings didn't seem +to differ much on our previous 4-core version, so I didn't even check it +out on this one. I noticed I forgot to set the effective cache size to +more than 6G for this one too, but since our database is smaller than +that, that shouldn't make any difference. The work memory was increased +a bit to 2K. So there are no magic tricks here. + +I do have to add its a recent checkout of 8.2devel compiled using Sun +Studio 11. It was compiled using this as CPPFLAGS: -xtarget=ultraT1 +-fast -xnolibmopt + +The -xnolibmopt was added because we couldn't figure out why it yielded +several linking errors at the end of the compilation when the -xlibmopt +from -fast was enabled, so we disabled that particular setting from the +-fast macro. + + +The workload generated is an abstraction and simplification of our +website's workload, used for benchmarking. Its basically a news and +price comparision site and it runs on LAMP (with the M of MySQL), i.e. a +lot of light queries, many primary-key or indexed "foreign-key" lookups +for little amounts of records. Some aggregations for summaries, etc. +There are little writes and hardly any on the most read tables. +The database easily fits in memory, the total size of the actively read +tables is about 3G. +This PostgreSQL-version is not a direct copy of the queries and tables, +but I made an effort of getting it more PostgreSQL-minded as much as +possible. I.e. I combined a few queries, I changed "boolean"-enum's in +MySQL to real booleans in Postgres, I added specific indexes (including +partials) etc. + +We use apache+php as clients and just open X apache processes using 'ab' +at the same time to generate various amounts of concurrent workloads. +Solaris scales really well to higher concurrencies and PostgreSQL +doesn't seem to have problems with it either in our workload. + +So its not really a real-life scenario, but its not a synthetic +benchmark either. + +Here is a graph of our performance measured on PostgreSQL: +http://achelois.tweakers.net/~acm/pgsql-t2000/T2000-schaling-postgresql.png + +What you see are three lines. Each represents the amount of total "page +views" processed in 600 seconds for a specific amount of Niagara-cores +(i.e. 1, 2, 4, 6 and 8). Each core had all its threads enabled, so its +actually 4, 8, 16, 24 and 32 virtual cpu's you're looking at. +The "Max"-line displays the maximum generated "page views" on a specific +core-amount for any concurrency, respectively: 5, 13, 35, 45 and 60. +The "Bij 50" is the amount of "page views" it generated with 50 +apache-processes working at the same time (on two dual xeon machines, so +25 each). I took 50 a bit arbitrary but all core-configs seemed to do +pretty well under that workload. + +The "perfect" line is based on the "Max" value for 1 core and then just +multiplied by the amount of cores to have a linear reference. The "Bij +50" and the "perfect" line don't differ too much in color, but the +top-one is the "perfect" line. + +In the near future we'll be presenting an article on this on our +website, although that will be in dutch the graphs should still be easy +to read for you guys. +And because of that I can't promise too much detailed information until +then. + +I hope I clarified things a bit now, if not ask me about it, +Best regards, + +Arjen + +From pgsql-performance-owner@postgresql.org Mon Jun 19 03:12:24 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7F6649FA501 + for ; + Mon, 19 Jun 2006 03:12:23 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 82005-02 for + ; + Mon, 19 Jun 2006 03:12:14 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from gw.proximity.com.au (147-68-185-210.static.techex.net.au + [210.185.68.147]) + by postgresql.org (Postfix) with ESMTP id D3CB39FA19B + for ; + Mon, 19 Jun 2006 03:12:13 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by gw.proximity.com.au (Postfix) with ESMTP id 833131F2CAD; + Mon, 19 Jun 2006 16:12:10 +1000 (EST) +Received: from gw.proximity.com.au ([127.0.0.1]) + by localhost (gw [127.0.0.1]) (amavisd-new, port 10024) with ESMTP + id 07464-09; Mon, 19 Jun 2006 16:12:07 +1000 (EST) +Received: from [192.168.128.103] (bee.proximity.com.au [192.168.128.103]) + by gw.proximity.com.au (Postfix) with ESMTP id AFFA61FD48A; + Mon, 19 Jun 2006 16:12:07 +1000 (EST) +Message-ID: <44964037.6060605@proximity.com.au> +Date: Mon, 19 Jun 2006 16:12:07 +1000 +From: Tim Allen +User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Jeff Trout +Cc: pgsql-performance@postgresql.org +Subject: Re: SAN performance mystery +References: <4491D61B.9040507@proximity.com.au> + <449275A5.5090503@proximity.com.au> + <922914D7-46ED-4623-905A-C56058551905@torgo.978.org> +In-Reply-To: <922914D7-46ED-4623-905A-C56058551905@torgo.978.org> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at proximity.com.au +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/372 +X-Sequence-Number: 19729 + +Jeff Trout wrote: +> On Jun 16, 2006, at 5:11 AM, Tim Allen wrote: +>> One curious thing is that some postgres backends seem to spend an +>> inordinate amount of time in uninterruptible iowait state. I found a +>> posting to this list from December 2004 from someone who reported +>> that very same thing. For example, bringing down postgres on the +>> customer box requires kill -9, because there are invariably one or +>> two processes so deeply uninterruptible as to not respond to a +>> politer signal. That indicates something not quite right, doesn't it? +> +> Sounds like there could be a driver/array/kernel bug there that is +> kicking the performance down the tube. +> If it was PG's fault it wouldn't be stuck uninterruptable. + +That's what I thought. I've advised the customer to upgrade their kernel +drivers, and to preferably upgrade their kernel as well. We'll see if +they accept the advice :-|. + +Tim + +-- +----------------------------------------------- +Tim Allen tim@proximity.com.au +Proximity Pty Ltd http://www.proximity.com.au/ + +From pgsql-performance-owner@postgresql.org Mon Jun 19 07:09:59 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 9BD2B9FA6A2 + for ; + Mon, 19 Jun 2006 07:09:59 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 10361-08 for + ; + Mon, 19 Jun 2006 07:09:53 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from gw.proximity.com.au (147-68-185-210.static.techex.net.au + [210.185.68.147]) + by postgresql.org (Postfix) with ESMTP id B0BCD9FA634 + for ; + Mon, 19 Jun 2006 07:09:52 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by gw.proximity.com.au (Postfix) with ESMTP id A7EFE1FE904; + Mon, 19 Jun 2006 20:09:49 +1000 (EST) +Received: from gw.proximity.com.au ([127.0.0.1]) + by localhost (gw [127.0.0.1]) (amavisd-new, port 10024) with ESMTP + id 08987-08; Mon, 19 Jun 2006 20:09:48 +1000 (EST) +Received: from [192.168.128.103] (bee.proximity.com.au [192.168.128.103]) + by gw.proximity.com.au (Postfix) with ESMTP id 20A981FE8FF; + Mon, 19 Jun 2006 20:09:48 +1000 (EST) +Message-ID: <449677EB.50609@proximity.com.au> +Date: Mon, 19 Jun 2006 20:09:47 +1000 +From: Tim Allen +User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Scott Marlowe +Cc: pgsql-performance@postgresql.org +Subject: Re: SAN performance mystery +References: <4491D61B.9040507@proximity.com.au> + <1150408614.26538.95.camel@state.g2switchworks.com> +In-Reply-To: <1150408614.26538.95.camel@state.g2switchworks.com> +Content-Type: text/plain; charset=ISO-8859-15; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at proximity.com.au +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/373 +X-Sequence-Number: 19730 + +Scott Marlowe wrote: +> On Thu, 2006-06-15 at 16:50, Tim Allen wrote: +> +>>We have a customer who are having performance problems. They have a +>>large (36G+) postgres 8.1.3 database installed on an 8-way opteron with +>>8G RAM, attached to an EMC SAN via fibre-channel (I don't have details +>>of the EMC SAN model, or the type of fibre-channel card at the moment). +>>They're running RedHat ES3 (which means a 2.4.something Linux kernel). +>> +>>They are unhappy about their query performance. We've been doing various +>>things to try to work out what we can do. One thing that has been +>>apparent is that autovacuum has not been able to keep the database +>>sufficiently tamed. A pg_dump/pg_restore cycle reduced the total +>>database size from 81G to 36G. Performing the restore took about 23 hours. +> +> Do you have the ability to do any simple IO performance testing, like +> with bonnie++ (the old bonnie is not really capable of properly testing +> modern equipment, but bonnie++ will give you some idea of the throughput +> of the SAN) Or even just timing a dd write to the SAN? + +I've done some timed dd's. The timing results vary quite a bit, but it +seems you can write to the SAN at about 20MB/s and read from it at about + 12MB/s. Not an entirely scientific test, as I wasn't able to stop +other activity on the machine, though I don't think much else was +happening. Certainly not impressive figures, compared with our machine +with the SATA disk (referred to below), which can get 161MB/s copying +files on the same disk, and 48MB/s and 138Mb/s copying files from the +sata disk respectively to and from a RAID5 array. + +The customer is a large organisation, with a large IT department who +guard their turf carefully, so there is no way I could get away with +installing any heavier duty testing tools like bonnie++ on their machine. + +>>We tried restoring the pg_dump output to one of our machines, a +>>dual-core pentium D with a single SATA disk, no raid, I forget how much +>>RAM but definitely much less than 8G. The restore took five hours. So it +>>would seem that our machine, which on paper should be far less +>>impressive than the customer's box, does more than four times the I/O +>>performance. +>> +>>To simplify greatly - single local SATA disk beats EMC SAN by factor of +>>four. +>> +>>Is that expected performance, anyone? It doesn't sound right to me. Does +>>anyone have any clues about what might be going on? Buggy kernel +>>drivers? Buggy kernel, come to think of it? Does a SAN just not provide +>>adequate performance for a large database? + +> Yes, this is not uncommon. It is very likely that your SATA disk is +> lying about fsync. + +I guess a sustained write will flood the disk's cache and negate the +effect of the write-completion dishonesty. But I have no idea how large +a copy would have to be to do that - can anyone suggest a figure? +Certainly, the read performance of the SATA disk still beats the SAN, +and there is no way to lie about read performance. + +> What kind of backup are you using? insert statements or copy +> statements? If insert statements, then the difference is quite +> believable. If copy statements, less so. + +A binary pg_dump, which amounts to copy statements, if I'm not mistaken. + +> Next time, on their big server, see if you can try a restore with fsync +> turned off and see if that makes the restore faster. Note you should +> turn fsync back on after the restore, as running without it is quite +> dangerous should you suffer a power outage. +> +> How are you mounting to the EMC SAN? NFS, iSCSI? Other? + +iSCSI, I believe. Some variant of SCSI, anyway, of that I'm certain. + +The conclusion I'm drawing here is that this SAN does not perform at all +well, and is not a good database platform. It's sounding from replies +from other people that this might be a general property of SAN's, or at +least the ones that are not stratospherically priced. + +Tim + +-- +----------------------------------------------- +Tim Allen tim@proximity.com.au +Proximity Pty Ltd http://www.proximity.com.au/ + +From pgsql-performance-owner@postgresql.org Mon Jun 19 07:24:48 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7150D9FA6B3 + for ; + Mon, 19 Jun 2006 07:24:47 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 10361-10 for + ; + Mon, 19 Jun 2006 07:24:38 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from vms040pub.verizon.net (vms040pub.verizon.net [206.46.252.40]) + by postgresql.org (Postfix) with ESMTP id D3EE89FA634 + for ; + Mon, 19 Jun 2006 07:24:38 -0300 (ADT) +Received: from osgiliath.mathom.us ([72.66.113.225]) + by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 + (built Sep + 9 2005)) with ESMTPA id <0J1300DDIRL1C4L8@vms040.mailsrvcs.net> for + pgsql-performance@postgresql.org; Mon, 19 Jun 2006 05:24:37 -0500 (CDT) +Received: from localhost (localhost [127.0.0.1]) + by osgiliath.mathom.us (Postfix) with ESMTP id D35D66E5EF for + ; + Mon, 19 Jun 2006 06:24:33 -0400 (EDT) +Received: from osgiliath.mathom.us ([127.0.0.1]) + by localhost (osgiliath.home.mathom.us [127.0.0.1]) (amavisd-new, + port 10024) + with LMTP id mFSNVmv1HPm1 for ; Mon, + 19 Jun 2006 06:24:33 -0400 (EDT) +Received: by osgiliath.mathom.us (Postfix, from userid 1000) + id E02EB6E925; Mon, 19 Jun 2006 06:24:32 -0400 (EDT) +Date: Mon, 19 Jun 2006 06:24:32 -0400 +From: Michael Stone +Subject: Re: SAN performance mystery +In-reply-to: <449677EB.50609@proximity.com.au> +To: pgsql-performance@postgresql.org +Mail-followup-to: pgsql-performance@postgresql.org +Message-id: <20060619102430.GD3303@mathom.us> +MIME-version: 1.0 +Content-type: text/plain; charset=us-ascii; format=flowed +Content-disposition: inline +X-Virus-Scanned: Debian amavisd-new at mathom.us +X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 +References: <4491D61B.9040507@proximity.com.au> + <1150408614.26538.95.camel@state.g2switchworks.com> + <449677EB.50609@proximity.com.au> +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/374 +X-Sequence-Number: 19731 + +On Mon, Jun 19, 2006 at 08:09:47PM +1000, Tim Allen wrote: +>Certainly, the read performance of the SATA disk still beats the SAN, +>and there is no way to lie about read performance. + +Sure there is: you have the data cached in system RAM. I find it real +hard to believe that you can sustain 161MB/s off a single SATA disk. + +Mike Stone + +From pgsql-performance-owner@postgresql.org Mon Jun 19 07:28:18 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 176619FB1BB + for ; + Mon, 19 Jun 2006 07:28:18 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 11499-08 for + ; + Mon, 19 Jun 2006 07:28:11 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from gw.proximity.com.au (147-68-185-210.static.techex.net.au + [210.185.68.147]) + by postgresql.org (Postfix) with ESMTP id 411309FB1BA + for ; + Mon, 19 Jun 2006 07:28:10 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by gw.proximity.com.au (Postfix) with ESMTP id 2B22B1FE91E; + Mon, 19 Jun 2006 20:28:09 +1000 (EST) +Received: from gw.proximity.com.au ([127.0.0.1]) + by localhost (gw [127.0.0.1]) (amavisd-new, port 10024) with ESMTP + id 09193-04; Mon, 19 Jun 2006 20:28:07 +1000 (EST) +Received: from [192.168.128.103] (bee.proximity.com.au [192.168.128.103]) + by gw.proximity.com.au (Postfix) with ESMTP id C44861FE91F; + Mon, 19 Jun 2006 20:28:07 +1000 (EST) +Message-ID: <44967C37.3030006@proximity.com.au> +Date: Mon, 19 Jun 2006 20:28:07 +1000 +From: Tim Allen +User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@lusis.org +Cc: pgsql-performance@postgresql.org +Subject: Re: SAN performance mystery +References: <4491D61B.9040507@proximity.com.au> + +In-Reply-To: +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at proximity.com.au +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/375 +X-Sequence-Number: 19732 + +John Vincent wrote: +> +> Is that expected performance, anyone? It doesn't sound right to me. Does +> anyone have any clues about what might be going on? Buggy kernel +> drivers? Buggy kernel, come to think of it? Does a SAN just not provide +> adequate performance for a large database? +> +> Tim, +> +> Here are the areas I would look at first if we're considering hardware +> to be the problem: +> +> HBA and driver: +> Since this is a Intel/Linux system, the HBA is PROBABLY a qlogic. I +> would need to know the SAN model to see what the backend of the SAN is +> itself. EMC has some FC-attach models that actually have SATA disks +> underneath. You also might want to look at the cache size of the +> controllers on the SAN. + +As I noted in another thread, the HBA is an Emulex LP1050, and they have +a rather old driver for it. I've recommended that they update ASAP. This +hasn't happened yet. + +I know very little about the SAN itself - the customer hasn't provided +any information other than the brand name, as they selected it and +installed it themselves. I shall ask for more information. + +> - Something also to note is that EMC provides a add-on called +> PowerPath for load balancing multiple HBAs. If they don't have this, it +> might be worth investigating. + +OK, thanks, I'll ask the customer whether they've used PowerPath at all. +They do seem to have it installed on the machine, but I suppose that +doesn't guarantee it's being used correctly. However, it looks like they +have just the one HBA, so, if I've correctly understood what load +balancing means in this context, it's not going to help; right? + +> - As with anything, disk layout is important. With the lower end IBM +> SAN (DS4000) you actually have to operate on physical spindle level. On +> our 4300, when I create a LUN, I select the exact disks I want and which +> of the two controllers are the preferred path. On our DS6800, I just ask +> for storage. I THINK all the EMC models are the "ask for storage" type +> of scenario. However with the 6800, you select your storage across +> extent pools. +> +> Have they done any benchmarking of the SAN outside of postgres? Before +> we settle on a new LUN configuration, we always do the +> dd,umount,mount,dd routine. It's not a perfect test for databases but it +> will help you catch GROSS performance issues. + +I've done some dd'ing myself, as described in another thread. The +results are not at all encouraging - their SAN seems to do about 20MB/s +or less. + +> SAN itself: +> - Could the SAN be oversubscribed? How many hosts and LUNs total do +> they have and what are the queue_depths for those hosts? With the qlogic +> card, you can set the queue depth in the BIOS of the adapter when the +> system is booting up. CTRL-Q I think. If the system has enough local +> DASD to relocate the database internally, it might be a valid test to do +> so and see if you can isolate the problem to the SAN itself. + +The SAN possibly is over-subscribed. Can you suggest any easy ways for +me to find out? The customer has an IT department who look after their +SANs, and they're not keen on outsiders poking their noses in. It's hard +for me to get any direct access to the SAN itself. + +> PG itself: +> +> If you think it's a pgsql configuration, I'm guessing you already +> configured postgresql.conf to match thiers (or at least a fraction of +> thiers since the memory isn't the same?). What about loading a +> "from-scratch" config file and restarting the tuning process? + +The pg configurations are not identical. However, given the differences +in raw I/O speed observed, it doesn't seem likely that the difference in +configuration is responsible. Yes, as you guessed, we set more +conservative options on the less capable box. Doing proper double-blind +tests on the customer box is difficult, as it is in production and the +customer has a very low tolerance for downtime. + +> Just a dump of my thought process from someone who's been spending too +> much time tuning his SAN and postgres lately. + +Thanks for all the suggestions, John. I'll keep trying to follow some of +them up. + +Tim + +-- +----------------------------------------------- +Tim Allen tim@proximity.com.au +Proximity Pty Ltd http://www.proximity.com.au/ + +From pgsql-performance-owner@postgresql.org Mon Jun 19 09:42:11 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 11C769FB1BA + for ; + Mon, 19 Jun 2006 09:42:10 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 31439-07 for + ; + Mon, 19 Jun 2006 09:41:55 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from kenobi.snowman.net (kenobi.snowman.net [70.84.9.186]) + by postgresql.org (Postfix) with ESMTP id C19449FA3AF + for ; + Mon, 19 Jun 2006 09:41:55 -0300 (ADT) +Received: by kenobi.snowman.net (Postfix, from userid 1000) + id 41B9758051; Mon, 19 Jun 2006 07:41:54 -0500 (CDT) +Date: Mon, 19 Jun 2006 08:41:54 -0400 +From: Stephen Frost +To: Tim Allen +Cc: Scott Marlowe , + pgsql-performance@postgresql.org +Subject: Re: SAN performance mystery +Message-ID: <20060619124153.GQ8588@kenobi.snowman.net> +Mail-Followup-To: Tim Allen , + Scott Marlowe , + pgsql-performance@postgresql.org +References: <4491D61B.9040507@proximity.com.au> + <1150408614.26538.95.camel@state.g2switchworks.com> + <449677EB.50609@proximity.com.au> +MIME-Version: 1.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; boundary="CRtNIOhYBPVBLkTX" +Content-Disposition: inline +In-Reply-To: <449677EB.50609@proximity.com.au> +X-Editor: Vim http://www.vim.org/ +X-Info: http://www.snowman.net +X-Operating-System: Linux/2.6.16-1-vserver-686 (i686) +X-Uptime: 08:34:13 up 42 days, 6:29, 11 users, load average: 0.59, 0.88, 0.92 +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/376 +X-Sequence-Number: 19733 + + +--CRtNIOhYBPVBLkTX +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable + +* Tim Allen (tim@proximity.com.au) wrote: +> The conclusion I'm drawing here is that this SAN does not perform at all= +=20 +> well, and is not a good database platform. It's sounding from replies=20 +> from other people that this might be a general property of SAN's, or at= +=20 +> least the ones that are not stratospherically priced. + +I'd have to agree with you about the specific SAN/setup you're working +with there. I certainly disagree that it's a general property of SAN's +though. We've got a DS4300 with FC controllers and drives, hosts are +generally dual-controller load-balanced and it works quite decently. + +Indeed, the EMC SANs are generally the high-priced ones too, so not +really sure what to tell you about the poor performance you're seeing +out of it. Your IT folks and/or your EMC rep. should be able to resolve +that, really... + + Enjoy, + + Stephen + +--CRtNIOhYBPVBLkTX +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: Digital signature +Content-Disposition: inline + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.3 (GNU/Linux) + +iD8DBQFElpuRrzgMPqB3kigRAuo8AJ9vlxRK7VPMb9rN7AFm/qMNHLbdBwCfZiih +ZHApIcDhhj/J/Es9KPXEl/s= +=25MX +-----END PGP SIGNATURE----- + +--CRtNIOhYBPVBLkTX-- + +From pgsql-performance-owner@postgresql.org Mon Jun 19 09:54:34 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 9C1C99FA64B + for ; + Mon, 19 Jun 2006 09:54:33 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 33038-07 for + ; + Mon, 19 Jun 2006 09:54:21 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.168]) + by postgresql.org (Postfix) with ESMTP id 6D1F69FA3AF + for ; + Mon, 19 Jun 2006 09:54:20 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so1762029ugf + for ; + Mon, 19 Jun 2006 05:54:19 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; + b=Aa5b52iIL2dxg3ksgCkacwsF0igmNqX7cEFxdng6NvxjfGUPjsWeek21wxs16bGhC21uTR3LTHFVMg8Lgj+/rVwJRo/GoM4EUFSQpZD6UNetNA82hIhtAh1hQwxFFB2m2WlVciMOKlY7R1qNpChw6tDwmSKDC7X9t4h/6suJkJQ= +Received: by 10.67.103.7 with SMTP id f7mr2022841ugm; + Mon, 19 Jun 2006 05:54:19 -0700 (PDT) +Received: by 10.66.216.11 with HTTP; Mon, 19 Jun 2006 05:54:18 -0700 (PDT) +Message-ID: +Date: Mon, 19 Jun 2006 08:54:18 -0400 +From: "John Vincent" +Reply-To: pgsql-performance@lusis.org +To: "Tim Allen" +Subject: Re: SAN performance mystery +Cc: pgsql-performance@postgresql.org +In-Reply-To: <44967C37.3030006@proximity.com.au> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_3055_17613055.1150721658878" +References: <4491D61B.9040507@proximity.com.au> + + <44967C37.3030006@proximity.com.au> +X-Google-Sender-Auth: 5e80b8c0ce26b339 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/377 +X-Sequence-Number: 19734 + +------=_Part_3055_17613055.1150721658878 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +On 6/19/06, Tim Allen wrote: +> +> +> As I noted in another thread, the HBA is an Emulex LP1050, and they have +> a rather old driver for it. I've recommended that they update ASAP. This +> hasn't happened yet. + + +Yeah, I saw that in a later thread. I would suggest also that the BIOS +settings on the HBA itself have been investigated. An example is the Qlogic +HBAs have a profile of sorts, one for tape and one for disk. Could be +something there. + + +> OK, thanks, I'll ask the customer whether they've used PowerPath at all. +> They do seem to have it installed on the machine, but I suppose that +> doesn't guarantee it's being used correctly. However, it looks like they +> have just the one HBA, so, if I've correctly understood what load +> balancing means in this context, it's not going to help; right? + + +If they have a single HBA then no it won't help. I'm not very intimate on +powerpath but it might even HURT if they have it enabled with one HBA. As an +example, we were in the process of migrating an AIX LPAR to our DS6800. We +only had one spare HBA to assign it. The default policy with the SDD driver +is lb (load balancing). The problem is that with the SDD driver you see +multiple hdisks per HBA per controller port on the SAN. Since we had 4 +controller ports active on the SAN, our HBA saw 4 hdisks per LUN. The SDD +driver abstracts that out as a single vpath and you use the vpaths as your +pv on the system. The problem was that it was attempting to load balance +across a single hba which was NOT what we wanted. + + + +> +> I've done some dd'ing myself, as described in another thread. The +> results are not at all encouraging - their SAN seems to do about 20MB/s +> or less. + + +I saw that as well. + + +> The SAN possibly is over-subscribed. Can you suggest any easy ways for +> me to find out? The customer has an IT department who look after their +> SANs, and they're not keen on outsiders poking their noses in. It's hard +> for me to get any direct access to the SAN itself. + + +When I say over-subscribed, you have to look at all the active LUNs and all +of the systems attached as well. With the DS4300 (standard not turbo +option), the SAN can handle 512 I/Os per second. If I have 4 LUNs assigned +to four systems (1 per system), and each LUN has a queue_depth of 128 from +each system, I''ll oversubscribe with the next host attach unless I back the +queue_depth off on each host. Contrast that with the Turbo controller option +which does 1024 I/Os per sec and I can duplicate what I have now or add a +second LUN per host. I can't even find how much our DS6800 supports. + + +> Thanks for all the suggestions, John. I'll keep trying to follow some of +> them up. + + + From what I can tell, it sounds like the SATA problem other people have +mentioned sounds like the culprit. + +------=_Part_3055_17613055.1150721658878 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +On 6/19/06, Tim Allen <tim@proximity.com.au> wrote:
+
As I noted in another thread, the HBA is an Emulex LP1050, and they have
a rather old driver for it. I've recommended that they update ASAP. This
hasn't happened yet.

Yeah, I saw that in a later thread. I would suggest also that the BIOS settings on the HBA itself have been investigated. An example is the Qlogic HBAs have a profile of sorts, one for tape and one for disk. Could be something there. +


OK, thanks, I'll ask the customer whether they've used PowerPath at all.
+They do seem to have it installed on the machine, but I suppose that
doesn't guarantee it's being used correctly. However, it looks like they
have just the one HBA, so, if I've correctly understood what load
balancing means in this context, it's not going to help; right? +

If they have a single HBA then no it won't help. I'm not very intimate on powerpath but it might even HURT if they have it enabled with one HBA. As an example, we were in the process of migrating an AIX LPAR to our DS6800. We only had one spare HBA to assign it. The default policy with the SDD driver is lb (load balancing). The problem is that with the SDD driver you see multiple hdisks per HBA per controller port on the SAN. Since we had 4 controller ports active on the SAN, our HBA saw 4 hdisks per LUN. The SDD driver abstracts that out as a single vpath and you use the vpaths as your pv on the system. The problem was that it was attempting to load balance across a single hba which was NOT what we wanted. +




I've done some dd'ing myself, as described in another thread. The
+results are not at all encouraging - their SAN seems to do about 20MB/s
or less.

I saw that as well.

+
The SAN possibly is over-subscribed. Can you suggest any easy ways for
me to find out? The customer has an IT department who look after their
SANs, and they're not keen on outsiders poking their noses in. It's hard +
for me to get any direct access to the SAN itself.

When I say over-subscribed, you have to look at all the active LUNs and all of the systems attached as well. With the DS4300 (standard not turbo option), the SAN can handle 512 I/Os per second. If I have 4 LUNs assigned to four systems (1 per system), and each LUN has a queue_depth of 128 from each system, I''ll oversubscribe with the next host attach unless I back the queue_depth off on each host. Contrast that with the Turbo controller option which does 1024 I/Os per sec and I can duplicate what I have now or add a second LUN per host. I can't even find how much our DS6800 supports. +


Thanks for all the suggestions, John. I'll keep trying to follow some of
+them up.

From what I can tell, it sounds like the SATA problem other people have mentioned sounds like the culprit.



+ +------=_Part_3055_17613055.1150721658878-- + +From pgsql-performance-owner@postgresql.org Thu Jun 22 03:05:12 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8A9299FA3AF + for ; + Mon, 19 Jun 2006 09:58:56 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 36573-01 for + ; + Mon, 19 Jun 2006 09:58:50 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.168]) + by postgresql.org (Postfix) with ESMTP id 428249FA64B + for ; + Mon, 19 Jun 2006 09:58:49 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so1763626ugf + for ; + Mon, 19 Jun 2006 05:58:48 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; + b=hTuc735/AuXHLhRYz4rxQbwaLhMjE5kcpkyUXt1KNVwOfC4tCzoDR4Z3VJes4Sk13TK+9XDTS+dsAawd2rNgQMYQwh5PtcWvUqbdqKkpeVZh/2cAEWV3V/l39Cd5s4BNBj/Z9Y9xAXfO9ODuRdoKOu0BpW0HFUzl1ZrD3IfapPo= +Received: by 10.67.106.3 with SMTP id i3mr1839881ugm; + Mon, 19 Jun 2006 05:58:47 -0700 (PDT) +Received: by 10.66.216.11 with HTTP; Mon, 19 Jun 2006 05:58:47 -0700 (PDT) +Message-ID: +Date: Mon, 19 Jun 2006 08:58:47 -0400 +From: "John Vincent" +To: "Tim Allen" , + "Scott Marlowe" , + pgsql-performance@postgresql.org +Subject: Re: SAN performance mystery +In-Reply-To: <20060619124153.GQ8588@kenobi.snowman.net> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_3131_491715.1150721927454" +References: <4491D61B.9040507@proximity.com.au> + <1150408614.26538.95.camel@state.g2switchworks.com> + <449677EB.50609@proximity.com.au> + <20060619124153.GQ8588@kenobi.snowman.net> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/435 +X-Sequence-Number: 19792 + +------=_Part_3131_491715.1150721927454 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +> I'd have to agree with you about the specific SAN/setup you're working +> with there. I certainly disagree that it's a general property of SAN's +> though. We've got a DS4300 with FC controllers and drives, hosts are +> generally dual-controller load-balanced and it works quite decently. + + +How are you guys doing the load balancing? IIRC, the RDAC driver only does +failover. Or are you using the OS level multipathing instead? While we were +on the 4300 for our AIX boxes, we just created two big RAID5 LUNs and +assigned one to each controller. With 2 HBAs and LVM stripping that was +about the best we could get in terms of load balancing. + +Indeed, the EMC SANs are generally the high-priced ones too, so not +> really sure what to tell you about the poor performance you're seeing +> out of it. Your IT folks and/or your EMC rep. should be able to resolve +> that, really... + + +The only exception I've heard to this is the Clarion AX150. We looked at one +and we were warned off of it by some EMC gearheads. + + Enjoy, +> +> Stephen +> +> +> -----BEGIN PGP SIGNATURE----- +> Version: GnuPG v1.4.3 (GNU/Linux) +> +> iD8DBQFElpuRrzgMPqB3kigRAuo8AJ9vlxRK7VPMb9rN7AFm/qMNHLbdBwCfZiih +> ZHApIcDhhj/J/Es9KPXEl/s= +> =25MX +> -----END PGP SIGNATURE----- +> +> +> + +------=_Part_3131_491715.1150721927454 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +



I'd have to agree with you about the specific SAN/setup you're working +
with there.  I certainly disagree that it's a general property of SAN's
though.  We've got a DS4300 with FC controllers and drives, hosts are
generally dual-controller load-balanced and it works quite decently.
+

How are you guys doing the load balancing? IIRC, the RDAC driver only does failover. Or are you using the OS level multipathing instead? While we were on the 4300 for our AIX boxes, we just created two big RAID5 LUNs and assigned one to each controller. With 2 HBAs and LVM stripping that was about the best we could get in terms of load balancing. +

Indeed, the EMC SANs are generally the high-priced ones too, so not
really sure what to tell you about the poor performance you're seeing +
out of it.  Your IT folks and/or your EMC rep. should be able to resolve
that, really...

The only exception I've heard to this is the Clarion AX150. We looked at one and we were warned off of it by some EMC gearheads. +

        Enjoy,

                Stephen


-----BEGIN PGP SIGNATURE----- +
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFElpuRrzgMPqB3kigRAuo8AJ9vlxRK7VPMb9rN7AFm/qMNHLbdBwCfZiih
ZHApIcDhhj/J/Es9KPXEl/s=
=25MX
-----END PGP SIGNATURE-----



+ +------=_Part_3131_491715.1150721927454-- + +From pgsql-performance-owner@postgresql.org Mon Jun 19 10:00:01 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 9C6299FA64B + for ; + Mon, 19 Jun 2006 10:00:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 32983-08 for + ; + Mon, 19 Jun 2006 09:59:51 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.169]) + by postgresql.org (Postfix) with ESMTP id 2D9D59FA3AF + for ; + Mon, 19 Jun 2006 09:59:50 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so1763996ugf + for ; + Mon, 19 Jun 2006 05:59:49 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:sender:to:subject:in-reply-to:mime-version:content-type:references:x-google-sender-auth; + b=m3V8MlniOW5qxN12PF2Dg9ZCfEphjjVQ4F4qL5sLhL4F84N6aCuhxzVQ4lwX/m6WISiJSUAay6QOTg92x9Pi5/jDlPLPoTiaoXDo4BVUcLeMXITyoJy8IZQIFMGT8z8Iz/EJiLhtE3JQlTXoQ4GS7eoKFrjFVP71BO707ddYdL4= +Received: by 10.67.96.14 with SMTP id y14mr5510448ugl; + Mon, 19 Jun 2006 05:59:49 -0700 (PDT) +Received: by 10.66.216.11 with HTTP; Mon, 19 Jun 2006 05:59:48 -0700 (PDT) +Message-ID: +Date: Mon, 19 Jun 2006 08:59:48 -0400 +From: "John Vincent" +Reply-To: pgsql-performance@lusis.org +To: pgsql-performance@postgresql.org +Subject: Re: SAN performance mystery +In-Reply-To: +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_3155_27678493.1150721988836" +References: <4491D61B.9040507@proximity.com.au> + <1150408614.26538.95.camel@state.g2switchworks.com> + <449677EB.50609@proximity.com.au> + <20060619124153.GQ8588@kenobi.snowman.net> + +X-Google-Sender-Auth: b5e67af619f4f42a +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/378 +X-Sequence-Number: 19735 + +------=_Part_3155_27678493.1150721988836 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +> +> > I'd have to agree with you about the specific SAN/setup you're working +> > with there. I certainly disagree that it's a general property of SAN's +> > though. We've got a DS4300 with FC controllers and drives, hosts are +> > generally dual-controller load-balanced and it works quite decently. +> > +> How are you guys doing the load balancing? IIRC, the RDAC driver only does +> failover. Or are you using the OS level multipathing instead? While we were +> on the 4300 for our AIX boxes, we just created two big RAID5 LUNs and +> assigned one to each controller. With 2 HBAs and LVM stripping that was +> about the best we could get in terms of load balancing. +> +> Indeed, the EMC SANs are generally the high-priced ones too, so not +> > really sure what to tell you about the poor performance you're seeing +> > out of it. Your IT folks and/or your EMC rep. should be able to resolve +> > that, really... +> +> +> The only exception I've heard to this is the Clarion AX150. We looked at +> one and we were warned off of it by some EMC gearheads. +> +> +> + +------=_Part_3155_27678493.1150721988836 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +


+

I'd have to agree with you about the specific SAN/setup you're working +
with there.  I certainly disagree that it's a general property of SAN's
though.  We've got a DS4300 with FC controllers and drives, hosts are
generally dual-controller load-balanced and it works quite decently. +
How are you guys doing the load balancing? IIRC, the RDAC driver only does failover. Or are you using the OS level multipathing instead? While we were on the 4300 for our AIX boxes, we just created two big RAID5 LUNs and assigned one to each controller. With 2 HBAs and LVM stripping that was about the best we could get in terms of load balancing. +

Indeed, the EMC SANs are generally the high-priced ones too, so not +
really sure what to tell you about the poor performance you're seeing +
out of it.  Your IT folks and/or your EMC rep. should be able to resolve
that, really...

The only exception I've heard to this is the Clarion AX150. We looked at one and we were warned off of it by some EMC gearheads. +


+ +

+ +------=_Part_3155_27678493.1150721988836-- + +From pgsql-performance-owner@postgresql.org Mon Jun 19 12:04:33 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3072D9FA3AF + for ; + Mon, 19 Jun 2006 12:04:33 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 52778-03 for + ; + Mon, 19 Jun 2006 12:04:26 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from kenobi.snowman.net (kenobi.snowman.net [70.84.9.186]) + by postgresql.org (Postfix) with ESMTP id 7FCCF9FA64B + for ; + Mon, 19 Jun 2006 12:04:26 -0300 (ADT) +Received: by kenobi.snowman.net (Postfix, from userid 1000) + id E0DB958052; Mon, 19 Jun 2006 10:04:25 -0500 (CDT) +Date: Mon, 19 Jun 2006 11:04:25 -0400 +From: Stephen Frost +To: John Vincent +Cc: pgsql-performance@postgresql.org +Subject: Re: SAN performance mystery +Message-ID: <20060619150425.GS8588@kenobi.snowman.net> +Mail-Followup-To: John Vincent , + pgsql-performance@postgresql.org +References: <4491D61B.9040507@proximity.com.au> + <1150408614.26538.95.camel@state.g2switchworks.com> + <449677EB.50609@proximity.com.au> + <20060619124153.GQ8588@kenobi.snowman.net> + + +MIME-Version: 1.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; boundary="DgpHF3aoTWw+12pn" +Content-Disposition: inline +In-Reply-To: +X-Editor: Vim http://www.vim.org/ +X-Info: http://www.snowman.net +X-Operating-System: Linux/2.6.16-1-vserver-686 (i686) +X-Uptime: 09:03:03 up 42 days, 6:58, 11 users, load average: 0.38, 0.77, 0.92 +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/379 +X-Sequence-Number: 19736 + + +--DgpHF3aoTWw+12pn +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline + +* John Vincent (pgsql-performance@lusis.org) wrote: +> >> I'd have to agree with you about the specific SAN/setup you're working +> >> with there. I certainly disagree that it's a general property of SAN's +> >> though. We've got a DS4300 with FC controllers and drives, hosts are +> >> generally dual-controller load-balanced and it works quite decently. +> >> +> >How are you guys doing the load balancing? IIRC, the RDAC driver only does +> >failover. Or are you using the OS level multipathing instead? While we were +> >on the 4300 for our AIX boxes, we just created two big RAID5 LUNs and +> >assigned one to each controller. With 2 HBAs and LVM stripping that was +> >about the best we could get in terms of load balancing. + +We're using the OS-level multipathing. I tend to prefer using things +like multipath over specific-driver options. I havn't spent a huge +amount of effort profiling the SAN, honestly, but it's definitely faster +than the direct-attached hardware-RAID5 SCSI system we used to use (from +nStor), though that could have been because they were smaller, slower, +regular SCSI disks (not FC). + +A simple bonnie++ run on one of the systems on the SAN gave me this: +Version 1.03 ------Sequential Output------ --Sequential Input- --Random- + -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- +Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP +vardamir 32200M 40205 15 22399 5 102572 10 288.4 0 + ------Sequential Create------ --------Random Create-------- + -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- + files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP + 16 2802 99 +++++ +++ +++++ +++ 2600 99 +++++ +++ 10205 100 + +So, 40MB/s out, 102MB/s in, or so. This was on an ext3 filesystem. +Underneath that array it's a 3-disk RAID5 of 300GB 10k RPM FC disks. +We also have a snapshot on that array, but it was disabled at the time. + +> >Indeed, the EMC SANs are generally the high-priced ones too, so not +> >> really sure what to tell you about the poor performance you're seeing +> >> out of it. Your IT folks and/or your EMC rep. should be able to resolve +> >> that, really... +> > +> > +> >The only exception I've heard to this is the Clarion AX150. We looked at +> >one and we were warned off of it by some EMC gearheads. + +Yeah, the Clarion is the EMC "cheap" line, and I think the AX150 was the +extra-cheap one which Dell rebranded and sold. + + Thanks, + + Stephen + +--DgpHF3aoTWw+12pn +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: Digital signature +Content-Disposition: inline + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.3 (GNU/Linux) + +iD8DBQFElrz5rzgMPqB3kigRAgtjAJ9ILzAoMVaXLbm2sA4aYb0Ll1AVOwCfSybk +kyVSHnI4dS4zC9yUWRv/Po4= +=Nf+A +-----END PGP SIGNATURE----- + +--DgpHF3aoTWw+12pn-- + +From pgsql-performance-owner@postgresql.org Mon Jun 19 20:17:08 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 454B89F9F2D + for ; + Mon, 19 Jun 2006 20:17:08 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 12892-06 for + ; + Mon, 19 Jun 2006 20:17:02 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from linda-4.paradise.net.nz (bm-4a.paradise.net.nz + [203.96.152.183]) + by postgresql.org (Postfix) with ESMTP id 08B609F9316 + for ; + Mon, 19 Jun 2006 20:17:01 -0300 (ADT) +Received: from smtp-3.paradise.net.nz + (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by + linda-4.paradise.net.nz (Paradise.net.nz) with ESMTP id + <0J140010GRCC0Y@linda-4.paradise.net.nz> for + pgsql-performance@postgresql.org; Tue, 20 Jun 2006 11:17:00 +1200 (NZST) +Received: from [192.168.1.11] (218-101-29-53.dsl.clear.net.nz [218.101.29.53]) + by smtp-3.paradise.net.nz (Postfix) with ESMTP id 9F9E1755EBF; Tue, + 20 Jun 2006 11:16:59 +1200 (NZST) +Date: Tue, 20 Jun 2006 11:16:35 +1200 +From: Mark Kirkwood +Subject: Re: SAN performance mystery +In-reply-to: <20060619102430.GD3303@mathom.us> +To: pgsql-performance@postgresql.org +Cc: tim@proximity.com.au, mstone+postgres@mathom.us +Message-id: <44973053.4080906@paradise.net.nz> +MIME-version: 1.0 +Content-type: text/plain; format=flowed; charset=ISO-8859-1 +Content-transfer-encoding: 7bit +User-Agent: Thunderbird 1.5 (X11/20060417) +References: <4491D61B.9040507@proximity.com.au> + <1150408614.26538.95.camel@state.g2switchworks.com> + <449677EB.50609@proximity.com.au> <20060619102430.GD3303@mathom.us> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/380 +X-Sequence-Number: 19737 + +Michael Stone wrote: +> On Mon, Jun 19, 2006 at 08:09:47PM +1000, Tim Allen wrote: +>> Certainly, the read performance of the SATA disk still beats the SAN, +>> and there is no way to lie about read performance. +> +> Sure there is: you have the data cached in system RAM. I find it real +> hard to believe that you can sustain 161MB/s off a single SATA disk. +> + +Agreed - approx 60-70Mb/s seems to be the ballpark for modern SATA +drives, so get get 161Mb/s you would need about 3 of them striped +together (or a partially cached file as indicated). + +What is interesting is that (presumably) the same test is getting such +uninspiring results on the SAN... + +Having said that, I've been there too, about 4 years ago with a SAN that +had several 6 disk RAID5 arrays, and the best sequential *read* +performance we ever saw from them was about 50Mb/s. I recall trying to +get performance data from the vendor - only to be told that if we were +doing benchmarks - could they have our results when we were finished! + +regards + +Mark + + +From pgsql-performance-owner@postgresql.org Mon Jun 19 21:09:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2728B9F9F2D + for ; + Mon, 19 Jun 2006 21:09:55 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 20634-05 for + ; + Mon, 19 Jun 2006 21:09:44 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from janestcapital.com (unknown [66.155.124.107]) + by postgresql.org (Postfix) with ESMTP id 0F4C79F9316 + for ; + Mon, 19 Jun 2006 21:09:43 -0300 (ADT) +Received: from [192.168.250.117] [209.213.205.130] by janestcapital.com with + ESMTP (SMTPD32-8.13) id ACC648D00AE; Mon, 19 Jun 2006 20:09:42 -0400 +Message-ID: <44973CC6.20309@janestcapital.com> +Date: Mon, 19 Jun 2006 20:09:42 -0400 +From: Brian Hurt +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; + rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Some performance numbers, with thoughts +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/381 +X-Sequence-Number: 19738 + + +For long involved reasons I'm hanging out late at work today, and rather +than doing real, productive work, I thought I'd run some benchmarks +against our development PostgreSQL database server. My conclusions are +at the end. + +The purpose of the benchmarking was to find out how fast Postgres was, +or to compare Postgres to other databases, but to instead answer the +question: when does it become worthwhile to switch over to using COPYs +instead of INSERTS, and by how much? This benchmark should in no way be +used to gauge absolute performance of PostgreSQL. + +The machine in question: a new HP-145 rack mount server, with a +single-socket dual-core 1.8GHz Opteron 275, 1M of cache per core, with +4G of memory, running Redhat Linux (forget which version). Database was +on the local single SATA hard disk- no raid. From the numbers, I'm +assuming the disk honors fsync. Some tuning of the database was done, +specifically shared_buffers was upped to 2500 and temp_buffers to 1500 +(mental note to self: must increase these signifigantly more. Forgot +they were so low). fsync is definately on. Test program was written in +Ocaml, compiled to native code, using the Ocaml Postgresql connection +library (Ocaml bindings of the libpgsql library). The test was single +threaded- only one insert going on at a time, run over the local gigabit +ethernet network from a remote machine. + +The table design was very simple: +CREATE TABLE copytest ( + id SERIAL PRIMARY KEY NOT NULL, + name VARCHAR(64), + thread INT, + block INT, + num INT); + +The id column was not specified either in the inserts or in the copies, +instead it just came from the sequence. Other than the id, there are no +indexes on the table. Numbers are approximate. + +Results: + +Inserts, 1 per transaction* 83 inserts/second +Inserts, 5 per transaction 419 inserts/second +Inserts, 10 per transaction 843 inserts/second +Inserts, 50 per transaction ~3,100 inserts/second +Inserts, 100 per transaction ~4,200 inserts/second +Inserts, 1,000 per transaction ~5,400 inserts/second +Copy, 5 element blocks ~405 inserts/second +Copy, 10 element blocks ~700 inserts/second +Copy, 50 element blocks ~3,400 inserts/second +Copy, 100 element blocks ~6,000 inserts/second +Copy, 1,000 element blocks ~20,000 inserts/second +Copy, 10,000 element blocks ~27,500 inserts/second +Copy, 100,000 element blocks ~27,600 inserts/second + +* The singleton inserts were not done in an explicit begin/end block, +but were instead "unadorned" inserts. + +Some conclusions: + +1) Transaction time is a huge hit on the small block sizes. Going from +1 insert per transaction to 10 inserts per transaction gives a 10x speed +up. Once the block size gets large enough (10's to 100's of elements +per block) the cost of a transaction becomes less of a problem. + +2) Both insert methods hit fairly hard walls of diminishing returns were +larger block sizes gave little performance advantage, tending to no +performance advantage. + +3) For small enough block sizes, inserts are actually faster than +copies- but not by much. There is a broad plateau, spanning at least +the 5 through 100 elements per block (more than an order of magnitude), +where the performance of the two are roughly identical. For the general +case, I'd be inclined to switch to copies sooner (at 5 or so elements +per block) rather than later. + +4) At the high end, copies vastly outperformed inserts. At 1,000 +elements per block, the copy was almost 4x faster than inserts. This +widened to ~5x before copy started topping out. + +5) The performance of Postgres, at least on inserts, depends critically +on how you program it. One the same hardware, performance for me varied +over a factor of over 300-fold, 2.5 orders of magnitude. Programs which +are unaware of transactions and are designed to be highly portable are +likely to hit the abysmal side of performance, where the transaction +overhead kills performance. I'm not sure there is a fix for this (let +alone an easy fix)- simply dropping transactions is obviously not it. +Programs that are transaction aware and willing to use +PostgreSQL-specific features can get surprisingly excellent +performance. Simply being transaction-aware and doing multiple inserts +per transaction greatly increases performance, giving an easy order of +magnitude increase (wrapping 10 inserts in a transaction gives a 10x +performance boost). + +Brian + + + +From pgsql-performance-owner@postgresql.org Mon Jun 19 22:19:00 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 88A6D9F9F2D + for ; + Mon, 19 Jun 2006 22:18:58 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 24302-09 for + ; + Mon, 19 Jun 2006 22:18:48 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id CCD599F9316 + for ; + Mon, 19 Jun 2006 22:18:47 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5K1HKMB023028; + Mon, 19 Jun 2006 21:17:20 -0400 (EDT) +To: Brian Hurt +cc: pgsql-performance@postgresql.org +Subject: Re: Some performance numbers, with thoughts +In-reply-to: <44973CC6.20309@janestcapital.com> +References: <44973CC6.20309@janestcapital.com> +Comments: In-reply-to Brian Hurt + message dated "Mon, 19 Jun 2006 20:09:42 -0400" +Date: Mon, 19 Jun 2006 21:17:19 -0400 +Message-ID: <23027.1150766239@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/382 +X-Sequence-Number: 19739 + +Brian Hurt writes: +> For long involved reasons I'm hanging out late at work today, and rather +> than doing real, productive work, I thought I'd run some benchmarks +> against our development PostgreSQL database server. My conclusions are +> at the end. + +Ummm ... you forgot to mention Postgres version? Also, which client and +server encodings did you use (that starts to get to be a noticeable +issue for high COPY rates)? + +> 1) Transaction time is a huge hit on the small block sizes. + +Right. For small transactions with a drive honoring fsync, you should +expect to get a max of about one commit per platter revolution. Your +numbers work out to a shade under 5000 commits/minute, from which I +speculate a 7200 RPM drive ... do you know what it really is? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jun 19 22:24:16 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 05FA79FA29B + for ; + Mon, 19 Jun 2006 22:24:16 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 28687-01 for + ; + Mon, 19 Jun 2006 22:24:12 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) + by postgresql.org (Postfix) with ESMTP id 506CB9F9F2D + for ; + Mon, 19 Jun 2006 22:24:12 -0300 (ADT) +Received: from 172.16.1.148 by mail.mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D2)); Mon, 19 Jun 2006 21:24:05 -0400 +X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by + D01HOST02.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 19 Jun + 2006 21:24:05 -0400 +Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Tue, 20 Jun + 2006 01:24:05 +0000 +User-Agent: Microsoft-Entourage/11.2.4.060510 +Date: Mon, 19 Jun 2006 18:24:02 -0700 +Subject: Re: Some performance numbers, with thoughts +From: "Luke Lonergan" +To: "Brian Hurt" , + pgsql-performance@postgresql.org +Message-ID: +Thread-Topic: [PERFORM] Some performance numbers, with thoughts +Thread-Index: AcaT/hbvv6YBzFmJRw+iWd7BrxuOJAACh93s +In-Reply-To: <44973CC6.20309@janestcapital.com> +MIME-Version: 1.0 +X-OriginalArrivalTime: 20 Jun 2006 01:24:05.0404 (UTC) + FILETIME=[386E4DC0:01C69408] +X-WSS-ID: 688991BF2DC12703747-02-01 +Content-Type: text/plain; + charset=iso-8859-1 +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/383 +X-Sequence-Number: 19740 + +Brian, + +Any idea what your bottleneck is? You can find out at a crude level by +attaching an strace to the running backend, assuming it=B9s running long +enough to grab it, then look at what the system call breakdown is. +Basically, run one of your long insert streams, do a =B3top=B2 to find which +process id the backend is using (the ), then run this: + + strace -p -c + +And CTRL-C after a few seconds to see a breakdown of system calls. + +I think what you'll see is that for the small number of inserts per TXN, +you'll be bottlenecked on fsync() calls, or fdatasync() if you defaulted it= +. +Things might speed up a whole lot there depending on your choice of one or +the other. =20 + +- Luke=20 + + +On 6/19/06 5:09 PM, "Brian Hurt" wrote: + +>=20 +>=20 +> For long involved reasons I'm hanging out late at work today, and rather +> than doing real, productive work, I thought I'd run some benchmarks +> against our development PostgreSQL database server. My conclusions are +> at the end. +>=20 +> The purpose of the benchmarking was to find out how fast Postgres was, +> or to compare Postgres to other databases, but to instead answer the +> question: when does it become worthwhile to switch over to using COPYs +> instead of INSERTS, and by how much? This benchmark should in no way be +> used to gauge absolute performance of PostgreSQL. +>=20 +> The machine in question: a new HP-145 rack mount server, with a +> single-socket dual-core 1.8GHz Opteron 275, 1M of cache per core, with +> 4G of memory, running Redhat Linux (forget which version). Database was +> on the local single SATA hard disk- no raid. From the numbers, I'm +> assuming the disk honors fsync. Some tuning of the database was done, +> specifically shared_buffers was upped to 2500 and temp_buffers to 1500 +> (mental note to self: must increase these signifigantly more. Forgot +> they were so low). fsync is definately on. Test program was written in +> Ocaml, compiled to native code, using the Ocaml Postgresql connection +> library (Ocaml bindings of the libpgsql library). The test was single +> threaded- only one insert going on at a time, run over the local gigabit +> ethernet network from a remote machine. +>=20 +> The table design was very simple: +> CREATE TABLE copytest ( +> id SERIAL PRIMARY KEY NOT NULL, +> name VARCHAR(64), +> thread INT, +> block INT, +> num INT); +>=20 +> The id column was not specified either in the inserts or in the copies, +> instead it just came from the sequence. Other than the id, there are no +> indexes on the table. Numbers are approximate. +>=20 +> Results: +>=20 +> Inserts, 1 per transaction* 83 inserts/second +> Inserts, 5 per transaction 419 inserts/second +> Inserts, 10 per transaction 843 inserts/second +> Inserts, 50 per transaction ~3,100 inserts/second +> Inserts, 100 per transaction ~4,200 inserts/second +> Inserts, 1,000 per transaction ~5,400 inserts/second +> Copy, 5 element blocks ~405 inserts/second +> Copy, 10 element blocks ~700 inserts/second +> Copy, 50 element blocks ~3,400 inserts/second +> Copy, 100 element blocks ~6,000 inserts/second +> Copy, 1,000 element blocks ~20,000 inserts/second +> Copy, 10,000 element blocks ~27,500 inserts/second +> Copy, 100,000 element blocks ~27,600 inserts/second +>=20 +> * The singleton inserts were not done in an explicit begin/end block, +> but were instead "unadorned" inserts. +>=20 +> Some conclusions: +>=20 +> 1) Transaction time is a huge hit on the small block sizes. Going from +> 1 insert per transaction to 10 inserts per transaction gives a 10x speed +> up. Once the block size gets large enough (10's to 100's of elements +> per block) the cost of a transaction becomes less of a problem. +>=20 +> 2) Both insert methods hit fairly hard walls of diminishing returns were +> larger block sizes gave little performance advantage, tending to no +> performance advantage. +>=20 +> 3) For small enough block sizes, inserts are actually faster than +> copies- but not by much. There is a broad plateau, spanning at least +> the 5 through 100 elements per block (more than an order of magnitude), +> where the performance of the two are roughly identical. For the general +> case, I'd be inclined to switch to copies sooner (at 5 or so elements +> per block) rather than later. +>=20 +> 4) At the high end, copies vastly outperformed inserts. At 1,000 +> elements per block, the copy was almost 4x faster than inserts. This +> widened to ~5x before copy started topping out. +>=20 +> 5) The performance of Postgres, at least on inserts, depends critically +> on how you program it. One the same hardware, performance for me varied +> over a factor of over 300-fold, 2.5 orders of magnitude. Programs which +> are unaware of transactions and are designed to be highly portable are +> likely to hit the abysmal side of performance, where the transaction +> overhead kills performance. I'm not sure there is a fix for this (let +> alone an easy fix)- simply dropping transactions is obviously not it. +> Programs that are transaction aware and willing to use +> PostgreSQL-specific features can get surprisingly excellent +> performance. Simply being transaction-aware and doing multiple inserts +> per transaction greatly increases performance, giving an easy order of +> magnitude increase (wrapping 10 inserts in a transaction gives a 10x +> performance boost). +>=20 +> Brian +>=20 +>=20 +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: explain analyze is your friend +>=20 +>=20 + + + + +From pgsql-performance-owner@postgresql.org Tue Jun 20 06:59:30 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 31B459FA19B + for ; + Tue, 20 Jun 2006 06:59:30 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 99699-10 for + ; + Tue, 20 Jun 2006 06:59:20 -0300 (ADT) +X-Greylist: delayed 00:23:50.685894 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id B37E09FA219 + for ; + Tue, 20 Jun 2006 06:59:20 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from smtp2-v.fe.bosch.de (smtp2-v.fe.bosch.de [139.15.237.6]) + by svr4.postgresql.org (Postfix) with ESMTP id C70775AF052 + for ; + Tue, 20 Jun 2006 09:35:28 +0000 (GMT) +Received: from mta1.fe.internet.bosch.com (unknown [10.4.98.30]) + by imta5.fe.bosch.de (Postfix) with ESMTP id 3BD473C04E + for ; + Tue, 20 Jun 2006 11:35:21 +0200 (CEST) +Received: from si-imc02.de.bosch.com (virusscan8.fe.internet.bosch.com + [10.4.98.13]) + by mta1.fe.internet.bosch.com (Postfix) with ESMTP id E417B8C089 + for ; + Tue, 20 Jun 2006 11:35:18 +0200 (CEST) +Received: from si-mail48.de.bosch.com ([10.3.12.81]) by si-imc02.de.bosch.com + with Microsoft SMTPSVC(6.0.3790.1830); + Tue, 20 Jun 2006 11:35:18 +0200 +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----_=_NextPart_001_01C6944C.D756091A" +Subject: Big array speed issues +Date: Tue, 20 Jun 2006 11:35:17 +0200 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: Big array speed issues +thread-index: AcaUTNZr/ftKaBFVSI+e+u0ds75vbg== +From: "Merkel Marcel (CR/AEM4)" +To: +X-OriginalArrivalTime: 20 Jun 2006 09:35:18.0309 (UTC) + FILETIME=[D7A6B550:01C6944C] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/384 +X-Sequence-Number: 19741 + +This is a multi-part message in MIME format. + +------_=_NextPart_001_01C6944C.D756091A +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + +Hi, + +I have some speed issues with a big array in a table. I hope you can +help me to tune my query.=20 + +My table looks like this: + +Id | timestamp | map +Primary key | timestamp | array of real [34][28] + +With an index on timestamp=20 + +My query is the following: + +Select map[1,1], map[1,2] .... Map[34,28] from table where timestamp > x +and timestamp < y order by timestamp + +Expected return is about 5000 rows of the table. I have to run this +query multiple times with different x and y values + +The table is huge (about 60000 entries) but will get even much more +bigger. + +The query takes ages on a 3.GhZ Xeon processor with 2 GB RAM. I'm using +postgresql 7.4 . + +Any hints how I can speedup this ? (use postgres 8.1, change table +setup, query one row or column of the array ) + +I use libpqxx to access the database. This might be another bottleneck, +but I assume my query and table setup is the bigger bottleneck. Would it +make sense to fetch the whole array ? (Select map from table where ... +and parse the array manually) + +Thanks for your help. + +Marcel + + + + +------_=_NextPart_001_01C6944C.D756091A +Content-Type: text/html; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + + + + + + +Big array speed issues + + + + +

Hi, +

+ +

I have some speed issues with a big = +array in a table. I hope you can help me to tune my query. +

+ +

My table looks like this: +

+ +

Id         &n= +bsp;      |  timestamp  | map + +
Primary key |  timestamp  | = +array of real [34][28] +

+ +

With an index on timestamp +

+ +

My query is the following: +

+ +

Select map[1,1], map[1,2] …. = +Map[34,28] from table where timestamp > x and timestamp < y order = +by timestamp +

+ +

Expected return is about 5000 rows of = +the table. I have to run this query multiple times with different x and = +y values +

+ +

The table is huge (about 60000 entries) = +but will get even much more bigger. +

+ +

The query takes ages on a 3.GhZ Xeon = +processor with 2 GB RAM.  I'm using postgresql 7.4 . +

+ +

Any hints how I can speedup this = +?  (use postgres 8.1, change table setup, query one row or column = +of the array ) +

+ +

I use libpqxx to access the database. = +This might be another bottleneck, but I assume my query and table setup = +is the bigger bottleneck. Would it make sense to fetch the whole array ? = +(Select map from table where …  and parse the array = +manually)

+ +

Thanks for your help. +

+ +

Marcel +

+
+
+ + + +------_=_NextPart_001_01C6944C.D756091A-- + +From pgsql-performance-owner@postgresql.org Tue Jun 20 10:02:47 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A80719FA219 + for ; + Tue, 20 Jun 2006 10:02:46 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 33794-02 for + ; + Tue, 20 Jun 2006 10:02:40 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 668819FA64B + for ; + Tue, 20 Jun 2006 10:02:40 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from s38.superhost.pl (s38.superhost.pl [83.149.106.26]) + by svr4.postgresql.org (Postfix) with ESMTP id 99C665AF04F + for ; + Tue, 20 Jun 2006 12:41:06 +0000 (GMT) +Received: from cpanel by s38.superhost.pl with local (Exim 4.52) + id 1FsfW0-0003qk-Oe + for pgsql-performance@postgresql.org; Tue, 20 Jun 2006 14:39:32 +0200 +Received: from 193.138.110.138 ([193.138.110.138]) by gdn.superhost.pl + (Horde MIME library) with HTTP; Tue, 20 Jun 2006 14:39:32 +0200 +Message-ID: <20060620143932.e7u8gr5s53i808ss@gdn.superhost.pl> +Date: Tue, 20 Jun 2006 14:39:32 +0200 +From: biuro@globeinphotos.com +To: pgsql-performance@postgresql.org +Subject: Curson prbolem +MIME-Version: 1.0 +Content-Type: text/plain; + charset=ISO-8859-2 +Content-Disposition: inline +Content-Transfer-Encoding: 7bit +User-Agent: Internet Messaging Program (IMP) H3 (4.0.3) +X-AntiAbuse: This header was added to track abuse, + please include it with any abuse report +X-AntiAbuse: Primary Hostname - s38.superhost.pl +X-AntiAbuse: Original Domain - postgresql.org +X-AntiAbuse: Originator/Caller UID/GID - [32001 32001] / [47 12] +X-AntiAbuse: Sender Address Domain - globeinphotos.com +X-Source: +X-Source-Args: +X-Source-Dir: +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/385 +X-Sequence-Number: 19742 + +Hi +I have following table: +CREATE TABLE alias ( + alias_id BIGSERIAL PRIMARY KEY, + mask VARCHAR(20) NOT NULL DEFAULT '', +); + +with index: +CREATE INDEX alias_mask_ind ON alias(mask); + + +and this table has about 1 million rows. + + +In DB procedure I execute: + LOOP + <........> + OPEN cursor1 FOR SELECT * FROM alias WHERE mask>=alias_out +ORDER BY mask; + i:=0; + LOOP + i:=i+1; + FETCH cursor1 INTO alias_row; + EXIT WHEN i=10; + END LOOP; + CLOSE cursor1; + EXIT WHEN end_number=10000; + END LOOP; + + +Such construction is very slow (20 sec. per one iteration) but when I modify SQL +to: + OPEN cursor1 FOR SELECT * FROM alias WHERE mask>=alias_out +ORDER BY mask LIMIT 100; + + +it works very fast(whole program executes in 4-7s). It is strange for me becuase +I've understood so far +that when cursor is open select is executed but Postgres does not +select all rows - only cursor is positioned on first row, when you +execute fetch next row is read. But this example shows something +different. + + +Can somebody clarify what is wrong with my example? I need select +without LIMIT 100 part. + + +Regards +Michal Szymanski +http://blog.szymanskich.net + + + + +From pgsql-performance-owner@postgresql.org Tue Jun 20 11:28:32 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id AB2629FA5F0 + for ; + Tue, 20 Jun 2006 11:28:32 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 44126-08 for + ; + Tue, 20 Jun 2006 11:28:22 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 5781D9FA219 + for ; + Tue, 20 Jun 2006 11:28:22 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5KESI0O027875; + Tue, 20 Jun 2006 10:28:18 -0400 (EDT) +To: biuro@globeinphotos.com +cc: pgsql-performance@postgresql.org +Subject: Re: Curson prbolem +In-reply-to: <20060620143932.e7u8gr5s53i808ss@gdn.superhost.pl> +References: <20060620143932.e7u8gr5s53i808ss@gdn.superhost.pl> +Comments: In-reply-to biuro@globeinphotos.com + message dated "Tue, 20 Jun 2006 14:39:32 +0200" +Date: Tue, 20 Jun 2006 10:28:18 -0400 +Message-ID: <27874.1150813698@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/386 +X-Sequence-Number: 19743 + +biuro@globeinphotos.com writes: +> [slow:] +> OPEN cursor1 FOR SELECT * FROM alias WHERE mask>=alias_out +> ORDER BY mask; +> [fast:] +> OPEN cursor1 FOR SELECT * FROM alias WHERE mask>=alias_out +> ORDER BY mask LIMIT 100; + +The difference is that in the first case the planner has to assume you +intend to fetch all the rows with mask>=something (and I'll bet the +something is a plpgsql variable, so the planner can't even see its +value). In this case a sort-based plan looks like a winner. In the +second case, since you only need to fetch 100 rows, it's clearly best to +scan the index beginning at mask = alias_out. + +> Can somebody clarify what is wrong with my example? I need select +> without LIMIT 100 part. + +Why? You should always tell the SQL engine what it is that you really +want --- leaving it in the dark about your intentions is a good way to +destroy performance, as you are finding out. If I were you I would get +rid of the row-counting inside the loop entirely, and use the "LIMIT n" +clause to handle that. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jun 20 12:12:22 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E6FA59FA60A + for ; + Tue, 20 Jun 2006 12:12:21 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 52792-02 for + ; + Tue, 20 Jun 2006 12:12:16 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) + by postgresql.org (Postfix) with ESMTP id 0F1EB9FA219 + for ; + Tue, 20 Jun 2006 12:12:14 -0300 (ADT) +Received: from kingfisher.intern.logix-tt.com (T8ef4.t.pppool.de + [89.55.142.244]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.logix-tt.com (Postfix) with ESMTP id 61F2E6587A; + Tue, 20 Jun 2006 17:13:42 +0200 (CEST) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 1C2981852E435; + Tue, 20 Jun 2006 17:12:17 +0200 (CEST) +Message-ID: <44981050.4050109@logix-tt.com> +Date: Tue, 20 Jun 2006 17:12:16 +0200 +From: Markus Schaber +Organization: Logical Tracking and Tracing International AG, Switzerland +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: Chris Mair +Cc: pgsql-performance@postgresql.org +Subject: Re: lowering priority automatically at connection +References: <1148573784.6017.26.camel@dell.home.lan> +In-Reply-To: <1148573784.6017.26.camel@dell.home.lan> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/387 +X-Sequence-Number: 19744 + +Hi, Chris, + +Chris Mair wrote: + +> Now I was wondering whether one could have a +> SELECT pg_setpriority(10); +> executed automatically each time a certain user +> connects (not necessarily using psql)? +> +> Any ideas if and how this might be possible? + +When using Java, most Datasource implementations (e. G. the JBoss one) +allow to specify SQL statements that are executed on connection init. + +Markus + +-- +Markus Schaber | Logical Tracking&Tracing International AG +Dipl. Inf. | Software Development GIS + +Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org + +From pgsql-performance-owner@postgresql.org Tue Jun 20 14:25:31 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5FCFA9FA5F8 + for ; + Tue, 20 Jun 2006 14:25:31 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 88032-04 for + ; + Tue, 20 Jun 2006 14:25:21 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.193]) + by postgresql.org (Postfix) with ESMTP id 28F059F9998 + for ; + Tue, 20 Jun 2006 14:25:20 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id o1so1383745nzf + for ; + Tue, 20 Jun 2006 10:25:20 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=DNaL841staB58ZuTFOq6+yJB8TjQkMtGC1cx2fHZ1/3J3yED1xWfBa3bs9y3JF7i6SPpmHfbjAr2BlYK9TDtAb5n4avkqPEO6QbM9/lQzMp0uAqf3cq6oAwTArYTg2r47PvCanXCniAe1MPJdunXOHDusalVOfYlR0P9TuNZslU= +Received: by 10.36.91.5 with SMTP id o5mr7366522nzb; + Tue, 20 Jun 2006 10:25:20 -0700 (PDT) +Received: by 10.36.49.15 with HTTP; Tue, 20 Jun 2006 10:25:19 -0700 (PDT) +Message-ID: +Date: Tue, 20 Jun 2006 12:25:19 -0500 +From: "Meetesh Karia" +Reply-To: meetesh.karia@alumni.duke.edu +To: "Craig A. James" +Subject: Re: Query hanging/not finishing inconsistently +Cc: pgsql-performance@postgresql.org, "Jean-David Dahan" +In-Reply-To: +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_2237_25602053.1150824319894" +References: + <447207C3.8000104@modgraph-usa.com> + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/388 +X-Sequence-Number: 19745 + +------=_Part_2237_25602053.1150824319894 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hi all, + +I just saw another email on the mailing list to this effect as well. We +recently updated the kernel versions on our machines to the latest stable +versions (which contained both HyperThreading and IO bug fixes) and we +updated Postgres to version 8.0.8. We thought we were in the clear when we +didn't encounter a hang for 6+ days. But, once again we ran into the same +situation where a query that normally executes in ~15ms wouldn't finish. As +before, there were no ungranted locks and threads weren't waiting on a +lock. I attached gdb to one of the stuck postgres processes and got the +following stack trace: + +#0 0x008967a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2 +#1 0x00977e5b in semop () from /lib/tls/libc.so.6 +#2 0x08167298 in PGSemaphoreLock () +#3 0x0818bcb5 in LWLockAcquire () +#4 0x080a47f5 in SimpleLruWritePage () +#5 0x080a48ad in SimpleLruReadPage () +#6 0x080a519a in SubTransGetParent () +#7 0x080a51f2 in SubTransGetTopmostTransaction () +#8 0x0821371c in HeapTupleSatisfiesSnapshot () +#9 0x080822a2 in heap_release_fetch () +#10 0x080880fb in index_getnext () +#11 0x08128507 in ExecReScanHashJoin () +#12 0x08122a09 in ExecScan () +#13 0x081287f9 in ExecIndexScan () +#14 0x0811dfdd in ExecProcNode () +#15 0x0812a49f in ExecNestLoop () +#16 0x0811df9d in ExecProcNode () +#17 0x0812b74d in ExecSort () +#18 0x0811df5d in ExecProcNode () +#19 0x0812b941 in ExecUnique () +#20 0x0811df2c in ExecProcNode () +#21 0x0811ce18 in ExecutorRun () +#22 0x081947ec in PortalSetResultFormat () +#23 0x08194df4 in PortalRun () +#24 0x08192ef7 in PostgresMain () +#25 0x08169780 in ClosePostmasterPorts () +#26 0x0816b0ae in PostmasterMain () +#27 0x0813a5a6 in main () + +We then upgraded glibc to 2.3.4-2.19 but we encountered the problem within a +day. Our latest attempt at isolating the problem has been to reboot the +machine with a 'noht' kernel param. The machine has been up for 1 day, +13:18 since then and we haven't seen the problem yet. + +Has anyone been able to solve this problem? + +Thanks, +Meetesh + +On 5/22/06, Meetesh Karia wrote: +> +> Hi Craig, +> +> Thanks for your response. This did start recently and it wasn't after a +> kernel update, but it was after we moved the db from Machine B to Machine A +> (which have slightly different kernel versions). However, the problem took +> about a week to show up after we moved from one machine to the other. +> Unfortunately, the problem only reappears after 15 mins once it occurs the +> first time. If it occurs again today I'll attach gdb to it and see whether +> it's stuck on a mutex. +> +> Meetesh +> +> +> On 5/22/06, Craig A. James wrote: +> > +> > Meetesh Karia wrote: +> > > Hi all, +> > > +> > > We've recently started having a problem where a query that normally +> > > executes in ~15ms starts to take upwards of 20s to complete. When the +> > > connection that ran query is returned to the connection pool, it +> > appears +> > > as though a transaction is still in progress so the connection pool +> > > tries to cancel the transaction and close the connection. This fails +> > > and the connection is removed from the connection pool. At this +> > point, +> > > the situation rapidly degrades and we run out of connections to the +> > > postgres server. +> > > +> > > An inspection of the pg_stat_activity table shows that practically +> > every +> > > connection is running the above-mentioned query and some of those +> > > queries have been active for many minutes! We've looked at the +> > pg_locks +> > > table as well and the only exclusive locks are on transactions that +> > are +> > > open. All other locks are AccessShareLocks. Also, as far as we can +> > > tell (from looking at the Hibernate stats), every db session that is +> > > opened is closed. +> > > +> > > When this happens, if I kill one of the running postgres processes +> > (just +> > > by picking the last process returned from "ps -ef | grep postgres"), +> > the +> > > other queries will immediately finish and the system will respond. +> > > However, within 15 minutes, we'll be back in the same state as before. +> > > At that point, I've cycled Apache, Tomcat and Postgres and the system +> > > then seems to come back. +> > +> > This sounds suspiciously like a question I asked a few weeks ago, on +> > April 4. I have a process that just gets stuck. After some questions from +> > various of the experts in this forum, I used gdb(1) to attach to one of the +> > frozen Postgress backend processes, and here's what I found: +> > +> > On 5/12/2006, I wrote: +> > > Thanks, good advice. You're absolutely right, it's stuck on a +> > > mutex. After doing what you suggest, I discovered that the query +> > > in progress is a user-written function (mine). When I log in as +> > > root, and use "gdb -p " to attach to the process, here's +> > > what I find. Notice the second function in the stack, a mutex +> > > lock: +> > > +> > > (gdb) bt +> > > #0 0x0087f7a2 in _dl_sysinfo_int80 () from /lib/ld- linux.so.2 +> > > #1 0x0096cbfe in __lll_mutex_lock_wait () from /lib/tls/libc.so.6 +> > > #2 0x008ff67b in _L_mutex_lock_3220 () from /lib/tls/libc.so.6 +> > > #3 0x4f5fc1b4 in ?? () +> > > #4 0x00dc5e64 in std::string::_Rep::_S_empty_rep_storage () from +> > /usr/local/pgsql/lib/libchmoogle.so +> > > #5 0x009ffcf0 in ?? () from /usr/lib/libz.so.1 +> > > #6 0xbfe71c04 in ?? () +> > > #7 0xbfe71e50 in ?? () +> > > #8 0xbfe71b78 in ?? () +> > > #9 0x009f7019 in zcfree () from /usr/lib/libz.so.1 +> > > #10 0x009f7019 in zcfree () from /usr/lib/libz.so.1 +> > > #11 0x009f8b7c in inflateEnd () from /usr/lib/libz.so.1 +> > > #12 0x00c670a2 in ~basic_unzip_streambuf (this=0xbfe71be0) at +> > zipstreamimpl.h:332 +> > > #13 0x00c60b61 in OpenBabel::OBConversion::Read (this=0x1, +> > pOb=0xbfd923b8, pin=0xffffffea) at istream:115 +> > > #14 0x00c60fd8 in OpenBabel::OBConversion::ReadString (this=0x8672b50, +> > pOb=0xbfd923b8) at obconversion.cpp:780 +> > > #15 0x00c19d69 in chmoogle_ichem_mol_alloc () at stl_construct.h:120 +> > > #16 0x00c1a203 in chmoogle_ichem_normalize_parent () at +> > stl_construct.h:120 +> > > #17 0x00c1b172 in chmoogle_normalize_parent_sdf () at vector.tcc:243 +> > > #18 0x0810ae4d in ExecMakeFunctionResult () +> > > #19 0x0810de2e in ExecProject () +> > > #20 0x08115972 in ExecResult () +> > > #21 0x08109e01 in ExecProcNode () +> > > #22 0x00000020 in ?? () +> > > #23 0xbed4b340 in ?? () +> > > #24 0xbf92d9a0 in ?? () +> > > #25 0xbed4b0c0 in ?? () +> > > #26 0x00000000 in ?? () +> > > +> > > It looks to me like my code is trying to read the input parameter +> > > (a fairly long string, maybe 2K) from a buffer that was gzip'ed +> > > by Postgres for the trip between the client and server... somewhere +> > > along the way, a mutex gets set, and then ... it's stuck forever. +> > > +> > > ps(1) shows that this thread had been running for about 7 hours, +> > > and the job status showed that this function had been +> > > successfully called about 1 million times, before this mutex lock +> > > occurred. +> > +> > This is not an issue that's been resolved. Nobody had ever seen this +> > before. Tom Lane suggested it might be a libc/c++ bug, but unfortunately in +> > my case this lockup occurs so rarely (every few days) that it will be very +> > difficult to know if we've fixed the problem. +> > +> > If gdb(1) reveals that your process is stuck in a mutex, then you might +> > have a better chance testing this hypothesis, since your problem happens +> > within 15 minutes or so. +> > +> > Did this start recently, perhaps right after a kernel update? +> > +> > Craig +> > +> +> + +------=_Part_2237_25602053.1150824319894 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hi all,

I just saw another email on the mailing list to this effect as well.  We recently updated the kernel versions on our machines to the latest stable versions (which contained both HyperThreading and IO bug fixes) and we updated Postgres to version +8.0.8.  We thought we were in the clear when we didn't encounter a hang for 6+ days.  But, once again we ran into the same situation where a query that normally executes in ~15ms wouldn't finish.  As before, there were no ungranted locks and threads weren't waiting on a lock.  I attached gdb to one of the stuck postgres processes and got the following stack trace: +

#0  0x008967a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0x00977e5b in semop () from /lib/tls/libc.so.6
#2  0x08167298 in PGSemaphoreLock ()
#3  0x0818bcb5 in LWLockAcquire ()
#4  0x080a47f5 in SimpleLruWritePage () +
#5  0x080a48ad in SimpleLruReadPage ()
#6  0x080a519a in SubTransGetParent ()
#7  0x080a51f2 in SubTransGetTopmostTransaction ()
#8  0x0821371c in HeapTupleSatisfiesSnapshot ()
#9  0x080822a2 in heap_release_fetch () +
#10 0x080880fb in index_getnext ()
#11 0x08128507 in ExecReScanHashJoin ()
#12 0x08122a09 in ExecScan ()
#13 0x081287f9 in ExecIndexScan ()
#14 0x0811dfdd in ExecProcNode ()
#15 0x0812a49f in ExecNestLoop () +
#16 0x0811df9d in ExecProcNode ()
#17 0x0812b74d in ExecSort ()
#18 0x0811df5d in ExecProcNode ()
#19 0x0812b941 in ExecUnique ()
#20 0x0811df2c in ExecProcNode ()
#21 0x0811ce18 in ExecutorRun ()
#22 0x081947ec in PortalSetResultFormat () +
#23 0x08194df4 in PortalRun ()
#24 0x08192ef7 in PostgresMain ()
#25 0x08169780 in ClosePostmasterPorts ()
#26 0x0816b0ae in PostmasterMain ()
#27 0x0813a5a6 in main ()

We then upgraded glibc to 2.3.4-2.19 + but we encountered the problem within a day.  Our latest attempt at isolating the problem has been to reboot the machine with a 'noht' kernel param.  The machine has been up for 1 day, 13:18 since then and we haven't seen the problem yet. +

Has anyone been able to solve this problem?

Thanks,
Meetesh

On 5/22/06, Meetesh Karia < +meetesh.karia@gmail.com +> wrote:
Hi Craig,

Thanks for your response.  This did start recently and it wasn't after a kernel update, but it was after we moved the db from Machine B to Machine A (which have slightly different kernel versions).  However, the problem took about a week to show up after we moved from one machine to the other.  Unfortunately, the problem only reappears after 15 mins once it occurs the first time.  If it occurs again today I'll attach gdb to it and see whether it's stuck on a mutex. +

Meetesh


On 5/22/06, Craig A. James + <cjames@modgraph-usa.com> wrote:
+ + + +Meetesh Karia wrote:
> Hi all,
>
> We've recently started having a problem where a query that normally
> executes in ~15ms starts to take upwards of 20s to complete.  When the
> connection that ran query is returned to the connection pool, it appears +
> as though a transaction is still in progress so the connection pool
> tries to cancel the transaction and close the connection.  This fails
> and the connection is removed from the connection pool.  At this point, +
> the situation rapidly degrades and we run out of connections to the
> postgres server.
>
> An inspection of the pg_stat_activity table shows that practically every
> connection is running the above-mentioned query and some of those +
> queries have been active for many minutes!  We've looked at the pg_locks
> table as well and the only exclusive locks are on transactions that are
> open.  All other locks are AccessShareLocks.  Also, as far as we can +
> tell (from looking at the Hibernate stats), every db session that is
> opened is closed.
>
> When this happens, if I kill one of the running postgres processes (just
> by picking the last process returned from "ps -ef | grep postgres"), the +
> other queries will immediately finish and the system will respond.
> However, within 15 minutes, we'll be back in the same state as before.
> At that point, I've cycled Apache, Tomcat and Postgres and the system +
> then seems to come back.

This sounds suspiciously like a question I asked a few weeks ago, on April 4.  I have a process that just gets stuck.  After some questions from various of the experts in this forum, I used gdb(1) to attach to one of the frozen Postgress backend processes, and here's what I found: +

On 5/12/2006, I wrote:
> Thanks, good advice.  You're absolutely right, it's stuck on a
> mutex.  After doing what you suggest, I discovered that the query
> in progress is a user-written function (mine).  When I log in as +
> root, and use "gdb -p <pid>" to attach to the process, here's
> what I find.  Notice the second function in the stack, a mutex
> lock:
>
> (gdb) bt
> #0  0x0087f7a2 in _dl_sysinfo_int80 () from /lib/ld- +linux.so.2
> #1  0x0096cbfe in __lll_mutex_lock_wait () from /lib/tls/libc.so.6
> #2  0x008ff67b in _L_mutex_lock_3220 () from /lib/tls/libc.so.6
> #3  0x4f5fc1b4 in ?? ()
> #4  0x00dc5e64 in std::string::_Rep::_S_empty_rep_storage () from /usr/local/pgsql/lib/libchmoogle.so +
> #5  0x009ffcf0 in ?? () from /usr/lib/libz.so.1
> #6  0xbfe71c04 in ?? ()
> #7  0xbfe71e50 in ?? ()
> #8  0xbfe71b78 in ?? ()
> #9  0x009f7019 in zcfree () from /usr/lib/libz.so.1
> #10 0x009f7019 in zcfree () from /usr/lib/libz.so.1 +
> #11 0x009f8b7c in inflateEnd () from /usr/lib/libz.so.1
> #12 0x00c670a2 in ~basic_unzip_streambuf (this=0xbfe71be0) at zipstreamimpl.h:332
> #13 0x00c60b61 in OpenBabel::OBConversion::Read (this=0x1, pOb=0xbfd923b8, pin=0xffffffea) at istream:115 +
> #14 0x00c60fd8 in OpenBabel::OBConversion::ReadString (this=0x8672b50, pOb=0xbfd923b8) at obconversion.cpp:780
> #15 0x00c19d69 in chmoogle_ichem_mol_alloc () at stl_construct.h:120
> #16 0x00c1a203 in chmoogle_ichem_normalize_parent () at stl_construct.h:120 +
> #17 0x00c1b172 in chmoogle_normalize_parent_sdf () at vector.tcc:243
> #18 0x0810ae4d in ExecMakeFunctionResult ()
> #19 0x0810de2e in ExecProject ()
> #20 0x08115972 in ExecResult ()
> #21 0x08109e01 in ExecProcNode () +
> #22 0x00000020 in ?? ()
> #23 0xbed4b340 in ?? ()
> #24 0xbf92d9a0 in ?? ()
> #25 0xbed4b0c0 in ?? ()
> #26 0x00000000 in ?? ()
>
> It looks to me like my code is trying to read the input parameter +
> (a fairly long string, maybe 2K) from a buffer that was gzip'ed
> by Postgres for the trip between the client and server... somewhere
> along the way, a mutex gets set, and then ... it's stuck forever. +
>
> ps(1) shows that this thread had been running for about 7 hours,
> and the job status showed that this function had been
> successfully called about 1 million times, before this mutex lock
+ + + +> occurred.

This is not an issue that's been resolved.  Nobody had ever seen this before.  Tom Lane suggested it might be a libc/c++ bug, but unfortunately in my case this lockup occurs so rarely (every few days) that it will be very difficult to know if we've fixed the problem. +

If gdb(1) reveals that your process is stuck in a mutex, then you might have a better chance testing this hypothesis, since your problem happens within 15 minutes or so.

Did this start recently, perhaps right after a kernel update? +

Craig

+ + +

+ + +------=_Part_2237_25602053.1150824319894-- + +From pgsql-performance-owner@postgresql.org Tue Jun 20 23:56:39 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7588A9FA5E7 + for ; + Tue, 20 Jun 2006 23:56:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 55793-08 for + ; + Tue, 20 Jun 2006 23:56:34 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.194]) + by postgresql.org (Postfix) with ESMTP id 7F5109FA5E6 + for ; + Tue, 20 Jun 2006 23:56:34 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id n1so58061nzf + for ; + Tue, 20 Jun 2006 19:56:32 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=jvEbo9/flDKRfbMeiKV4RWDXUjRBxq0bWC822jQRO7IJ+e29H9nyc4IEwbKoms5KufkRtAB0PpeSrsyL4xPL4OTFJeC35L8ywu3uECjnnglBD2mXya9EOnMdZafnmJXtnIwN+E43sf3/U8gf6x8rJEJLRQa4IOry7pe/1uhJA4o= +Received: by 10.65.251.1 with SMTP id d1mr161734qbs; + Tue, 20 Jun 2006 19:56:32 -0700 (PDT) +Received: by 10.65.139.14 with HTTP; Tue, 20 Jun 2006 19:56:32 -0700 (PDT) +Message-ID: +Date: Tue, 20 Jun 2006 22:56:32 -0400 +From: "Merlin Moncure" +To: "Merkel Marcel (CR/AEM4)" +Subject: Re: Big array speed issues +Cc: pgsql-performance@postgresql.org +In-Reply-To: +MIME-Version: 1.0 +Content-Type: text/plain; charset=WINDOWS-1252; format=flowed +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/389 +X-Sequence-Number: 19746 + +On 6/20/06, Merkel Marcel (CR/AEM4) wrote: + +> I use libpqxx to access the database. This might be another bottleneck, b= +ut +> I assume my query and table setup is the bigger bottleneck. Would it make +> sense to fetch the whole array ? (Select map from table where =85 and pa= +rse +> the array manually) + +have you tried similar approach without using arrays? + +merlin + +From pgsql-performance-owner@postgresql.org Wed Jun 21 01:52:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B5A569FB1B7 + for ; + Wed, 21 Jun 2006 01:52:54 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 79359-06 for + ; + Wed, 21 Jun 2006 01:52:51 -0300 (ADT) +X-Greylist: delayed 00:25:21.929863 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id D62509FADD1 + for ; + Wed, 21 Jun 2006 01:52:48 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from asmail001.abovesecurity.com (asmail001.abovesecurity.com + [206.162.148.235]) + by svr4.postgresql.org (Postfix) with ESMTP id B948F5AF04B + for ; + Wed, 21 Jun 2006 04:27:25 +0000 (GMT) +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.181 +Content-Class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: ACL cleanup +Date: Wed, 21 Jun 2006 00:27:23 -0400 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Importance: normal +Thread-Topic: ACL cleanup +thread-index: AcaU6v4IhLgWYC1lR42SkBFAZdh6Jg== +From: "Eric Lauzon" +To: +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/390 +X-Sequence-Number: 19747 + +This might not be 100% performance compilant but i guess its better than = +-hackers since +these day's there seem to be some big consern :) +=20 +So feel free to comment +=20 +[Abstract: Underlyin plpgsql should remove all public user ACL's from = +Function,Table Sequence,View ... ] +=20 +-elz +=20 +--------------------------------------------- +--------------------------------------------- +=20 +CREATE OR REPLACE FUNCTION cleanup_public_perm_on_function() + RETURNS int4 AS +' +DECLARE +r_record record; +v_record record; +exec_string text; +argument_string text; +i int2; +BEGIN + FOR r_record IN SELECT * FROM pg_proc WHERE proowner !=3D''1'' LOOP + =20 + exec_string =3D ''''; + argument_string =3D ''''; + =20 + exec_string =3D ''REVOKE ALL ON FUNCTION '' || r_record.proname || = +''(''; +=20 + IF (r_record.pronargs > 0) THEN + i =3D 0; + WHILE (i < r_record.pronargs) LOOP + IF i > 0 THEN + argument_string =3D argument_string || '','' ; + END IF; + FOR v_record IN SELECT * from pg_type WHERE = +oid=3Dr_record.proargtypes[i] LOOP=20 + argument_string =3D argument_string || v_record.typname ; + END LOOP; + i =3D i+1; + END LOOP; + END IF; +=20 +=20 + exec_string =3D exec_string || argument_string || '') FROM public;''; +=20 + IF exec_string !=3D '''' THEN + =20 + RAISE NOTICE ''exec_string is %'', exec_string; + EXECUTE exec_string; + END IF; + END LOOP; + RETURN 1; +END; +' + LANGUAGE 'plpgsql' VOLATILE; + +CREATE OR REPLACE FUNCTION cleaup_public_on_table_sequence_view() + RETURNS int4 AS +' +DECLARE +r_record record; +exec_string text; +BEGIN + FOR r_record IN SELECT * FROM pg_class WHERE relowner !=3D''1'' LOOP + =20 + exec_string =3D ''''; + IF (r_record.relkind::char =3D ''r''::char) THEN + exec_string =3D ''REVOKE ALL ON TABLE '' || r_record.relname || '' FROM = +public''; + END IF; + IF (r_record.relkind::char =3D ''c''::char) THEN + =20 + exec_string =3D ''REVOKE ALL ON TABLE '' || r_record.relname || '' FROM = +public''; + =20 + END IF; + IF (r_record.relkind::char =3D ''v''::char) THEN + =20 + exec_string =3D ''REVOKE ALL ON TABLE '' || r_record.relname || '' FROM = +public''; + =20 + END IF; + =20 + IF (r_record.relkind::char =3D ''S''::char) THEN +=20 + exec_string =3D ''REVOKE ALL ON TABLE '' || r_record.relname || = +'' FROM public''; + END IF; +=20 + IF exec_string !=3D '''' THEN + =20 + RAISE NOTICE ''exec_string is %'', exec_string; + EXECUTE exec_string; + END IF; + END LOOP; + RETURN 1; +END; +' + LANGUAGE 'plpgsql' VOLATILE; +=20 + +SELECT * FROM cleanup_public_perm_on_function(); +SELECT * FROM cleaup_public_on_table_sequence_view(); +DROP FUNCTION cleanup_public_perm_on_function(); +DROP FUNCTION cleaup_public_on_table_sequence_view(); + +AVERTISSEMENT CONCERNANT LA CONFIDENTIALIT=C9=20 + +Le pr=E9sent message est =E0 l'usage exclusif du ou des destinataires = +mentionn=E9s ci-dessus. Son contenu est confidentiel et peut =EAtre = +assujetti au secret professionnel. Si vous avez re=E7u le pr=E9sent = +message par erreur, veuillez nous en aviser imm=E9diatement et le = +d=E9truire en vous abstenant d'en faire une copie, d'en divulguer le = +contenu ou d'y donner suite. + +CONFIDENTIALITY NOTICE + +This communication is intended for the exclusive use of the addressee = +identified above. Its content is confidential and may contain privileged = +information. If you have received this communication by error, please = +notify the sender and delete the message without copying or disclosing = +it. + +From pgsql-performance-owner@postgresql.org Wed Jun 21 04:28:36 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C313C9FB2AF + for ; + Wed, 21 Jun 2006 04:28:35 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 04590-01-7 + for ; + Wed, 21 Jun 2006 04:28:30 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) + by postgresql.org (Postfix) with ESMTP id 90E009FB43A + for ; + Wed, 21 Jun 2006 04:26:04 -0300 (ADT) +Received: from kingfisher.intern.logix-tt.com (p549D194D.dip0.t-ipconnect.de + [84.157.25.77]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.logix-tt.com (Postfix) with ESMTP id 97C1865876; + Wed, 21 Jun 2006 09:27:31 +0200 (CEST) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 82A93181C1C06; + Wed, 21 Jun 2006 09:26:05 +0200 (CEST) +Message-ID: <4498F48D.2070305@logix-tt.com> +Date: Wed, 21 Jun 2006 09:26:05 +0200 +From: Markus Schaber +Organization: Logical Tracking and Tracing International AG, Switzerland +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: fzied@planet.tn +Cc: pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> +In-Reply-To: <200606030931.k539V38Y007877@smtp2.planet.net.tn> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/391 +X-Sequence-Number: 19748 + +Hi, Fzied, + +fzied@planet.tn wrote: + +> I'm using httperf/autobench for measurments and the best result I can +> get is that my system can handle a trafiic of almost 1600 New +> con/sec. + +Are you using connection pooling or persistent connections between +PostgreSQL and the Apaches? + +Maybe it simply is the network latency between the two machines - as the +database is read-only, did you think about having both PostgreSQL and +Apache on both machines, and then load-balancing ingoing http requests +between them? + +> I cannot scale beyond that value and the funny thing, is that none of +> the servers is swapping, or heavy loaded, neither postgres nor apache +> are refusing connexions. + +And for measuring, are you really throwing parallel http connections to +the server? This sounds like you measure request latency, but the +maximum throughput might be much higher. + +> my database is only 58M it's a read only DB and will lasts only for a +> month. + +I guess it is a simple table with a single PK (some subscription numer) +- no joins or other things. + +For this cases, a special non-RDBMS like MySQL, SQLite, or even some +hancrafted thingy may give you better results. + + +Markus + + +-- +Markus Schaber | Logical Tracking&Tracing International AG +Dipl. Inf. | Software Development GIS + +Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org + +From pgsql-performance-owner@postgresql.org Wed Jun 21 04:32:20 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C446D9FB2E4 + for ; + Wed, 21 Jun 2006 04:32:19 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 06484-02-8 + for ; + Wed, 21 Jun 2006 04:32:13 -0300 (ADT) +X-Greylist: delayed 21:53:46.178482 by SQLgrey- +Received: from smtp2-v.fe.bosch.de (smtp2-v.fe.bosch.de [139.15.237.6]) + by postgresql.org (Postfix) with ESMTP id A9D3E9FB48E + for ; + Wed, 21 Jun 2006 04:29:11 -0300 (ADT) +Received: from mta1.fe.internet.bosch.com (unknown [10.4.98.30]) + by imta8.fe.bosch.de (Postfix) with ESMTP id 108D73C002 + for ; + Wed, 21 Jun 2006 09:29:01 +0200 (CEST) +Received: from si-imc02.de.bosch.com (virusscan2.fe.internet.bosch.com + [10.4.98.14]) + by mta1.fe.internet.bosch.com (Postfix) with ESMTP id 678D88C0A5 + for ; + Wed, 21 Jun 2006 09:29:04 +0200 (CEST) +Received: from si-mail48.de.bosch.com ([10.3.12.81]) by si-imc02.de.bosch.com + with Microsoft SMTPSVC(6.0.3790.1830); + Wed, 21 Jun 2006 09:29:03 +0200 +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Big array speed issues +Date: Wed, 21 Jun 2006 09:29:03 +0200 +Message-ID: +In-Reply-To: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Big array speed issues +thread-index: AcaU3k5jAF/zy/GZSHqLLbuRcNlEGwAJND0w +From: "Merkel Marcel (CR/AEM4)" +To: +X-OriginalArrivalTime: 21 Jun 2006 07:29:03.0951 (UTC) + FILETIME=[5F6525F0:01C69504] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/392 +X-Sequence-Number: 19749 + +=20 + +Von: Merlin Moncure [mailto:mmoncure@gmail.com]=20 +An: Merkel Marcel (CR/AEM4) +Cc: pgsql-performance@postgresql.org +Betreff: Re: [PERFORM] Big array speed issues + +On 6/20/06, Merkel Marcel (CR/AEM4) wrote: + +> I use libpqxx to access the database. This might be another +bottleneck, but +> I assume my query and table setup is the bigger bottleneck. Would it +make +> sense to fetch the whole array ? (Select map from table where ... and +parse +> the array manually) + +have you tried similar approach without using arrays? + +Merlin + + +Not yet. I would first like to know what is the time consuming part and +what is a work around. If you are sure individual columns for every +entry of the array solve the issue I will joyfully implement it. The +downsize of this approch is that the array dimensions are not always the +same in my scenario. But I have a workaround in mind for this issue. + +Cheers + +Marcel + + + + +From pgsql-performance-owner@postgresql.org Wed Jun 21 04:33:33 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6B36B9FB1D2 + for ; + Wed, 21 Jun 2006 04:33:33 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 07793-01-2 + for ; + Wed, 21 Jun 2006 04:33:28 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) + by postgresql.org (Postfix) with ESMTP id DA3849FB3A1 + for ; + Wed, 21 Jun 2006 04:31:15 -0300 (ADT) +Received: from kingfisher.intern.logix-tt.com (p549D194D.dip0.t-ipconnect.de + [84.157.25.77]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.logix-tt.com (Postfix) with ESMTP id AEB3F65876; + Wed, 21 Jun 2006 09:32:48 +0200 (CEST) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 4F72C181C1C06; + Wed, 21 Jun 2006 09:31:23 +0200 (CEST) +Message-ID: <4498F5CA.9050602@logix-tt.com> +Date: Wed, 21 Jun 2006 09:31:22 +0200 +From: Markus Schaber +Organization: Logical Tracking and Tracing International AG, Switzerland +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: Zydoon +Cc: pgsql-performance@postgresql.org +Subject: Re: scaling up postgres +References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> + <20060603094355.GA23297@uio.no> + <1150062140.23423.0.camel@localhost.localdomain> + <448D3B65.7090709@aeccom.com> <448DE0DB.1020107@planet.tn> +In-Reply-To: <448DE0DB.1020107@planet.tn> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/393 +X-Sequence-Number: 19750 + +Hi, Zydoon, + +Zydoon wrote: + +> Now I'm trying to make my tests, and I'm not that sure I will make the +> switch to the PSeries, since my dual xeon with 4 G RAM can handle 3500 +> concurrent postmasters consuming 3.7 G of the RAM. I cannot reach this +> number on the PSeries with 2 G. + +This sounds like you want to have one postgresql backend per apache +frontend. + +Did you try running pgpool on the Apache machine, and have only a few +(hundred) connections to the backend? + +Maybe http://en.wikipedia.org/wiki/Memcached could be helpful, too. + + +Markus + +-- +Markus Schaber | Logical Tracking&Tracing International AG +Dipl. Inf. | Software Development GIS + +Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org + +From pgsql-performance-owner@postgresql.org Wed Jun 21 04:49:14 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 94EC49FA4A6 + for ; + Wed, 21 Jun 2006 04:49:14 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 08268-09 for + ; + Wed, 21 Jun 2006 04:49:10 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) + by postgresql.org (Postfix) with ESMTP id B2AD59FA5BA + for ; + Wed, 21 Jun 2006 04:49:10 -0300 (ADT) +Received: from kingfisher.intern.logix-tt.com (p549D194D.dip0.t-ipconnect.de + [84.157.25.77]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.logix-tt.com (Postfix) with ESMTP id 3F98565876; + Wed, 21 Jun 2006 09:50:41 +0200 (CEST) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id B8214181C1C06; + Wed, 21 Jun 2006 09:49:15 +0200 (CEST) +Message-ID: <4498F9FB.6000505@logix-tt.com> +Date: Wed, 21 Jun 2006 09:49:15 +0200 +From: Markus Schaber +Organization: Logical Tracking and Tracing International AG, Switzerland +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: Chris Beecroft +Cc: pgsql-performance@postgresql.org +Subject: Re: Some queries starting to hang +References: <22706.1149538039@sss.pgh.pa.us> + <1149539978.8606.51.camel@bg002441.pro-unlimited.com> +In-Reply-To: <1149539978.8606.51.camel@bg002441.pro-unlimited.com> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/394 +X-Sequence-Number: 19751 + +Hi, Chris, + +Chris Beecroft wrote: + +> Query is now returning with results on our replicated database. Will +> vacuum analyze production now. So it seems to have done the trick. Now +> the question is has our auto vacuum failed or was not set up properly... +> A question for my IT people. + +Most of the cases when we had database bloat despite running autovacuum, +it was due to a low free_space_map setting. + +Markus + +-- +Markus Schaber | Logical Tracking&Tracing International AG +Dipl. Inf. | Software Development GIS + +Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org + +From pgsql-performance-owner@postgresql.org Wed Jun 21 11:19:30 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B827C9FA19B + for ; + Wed, 21 Jun 2006 11:19:29 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 96024-05-2 + for ; + Wed, 21 Jun 2006 11:19:22 -0300 (ADT) +X-Greylist: delayed 00:31:54.425916 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 5C4959FA42B + for ; + Wed, 21 Jun 2006 11:19:21 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from smtp-vbr16.xs4all.nl (smtp-vbr16.xs4all.nl [194.109.24.36]) + by svr4.postgresql.org (Postfix) with ESMTP id 1B4C05AF02E + for ; + Wed, 21 Jun 2006 13:47:24 +0000 (GMT) +Received: from [10.0.0.12] (a80-126-182-198.adsl.xs4all.nl [80.126.182.198]) + (authenticated bits=0) + by smtp-vbr16.xs4all.nl (8.13.6/8.13.6) with ESMTP id k5LDlJa1097665 + for ; + Wed, 21 Jun 2006 15:47:19 +0200 (CEST) + (envelope-from nicky@valuecare.nl) +Message-ID: <44994DE7.5070801@valuecare.nl> +Date: Wed, 21 Jun 2006 15:47:19 +0200 +From: nicky +User-Agent: Thunderbird 1.5 (X11/20060317) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Speeding up query, Joining 55mil and 43mil records. +Content-Type: multipart/alternative; + boundary="------------050802070604070607020802" +X-Virus-Scanned: by XS4ALL Virus Scanner +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/398 +X-Sequence-Number: 19755 + +This is a multi-part message in MIME format. +--------------050802070604070607020802 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Hello People, + +I'm trying to solve a 'what i feel is a' performance/configuration/query +error on my side. I'm fairly new to configuring PostgreSQL so, i might +be completely wrong with my configuration. + +My database consists of 44 tables, about 20GB. Two of those tables are +'big/huge'. Table src.src_faktuur_verricht contains 43million records +(9GB) and table src.src_faktuur_verrsec contains 55million records (6GB). + +Below is the 'slow' query. + +INSERT INTO rpt.rpt_verrichting +(verrichting_id +,verrichting_secid +,fout_status +,patientnr +,verrichtingsdatum +,locatie_code +,afdeling_code +,uitvoerder_code +,aanvrager_code +,verrichting_code +,dbcnr +,aantal_uitgevoerd +,kostenplaats_code +,vc_patientnr +,vc_verrichting_code +,vc_dbcnr +) +SELECT t1.id +, t0.secid +, t1.status +, t1.patientnr +, t1.datum +, t1.locatie +, t1.afdeling +, t1.uitvoerder +, t1.aanvrager +, t0.code +, t1.casenr +, t0.aantal +, t0.kostplaats +, null +, null +, null +FROM src.src_faktuur_verrsec t0 JOIN + src.src_faktuur_verricht t1 ON + t0.id = t1.id +WHERE substr(t0.code,1,2) not in ('14','15','16','17') +AND (substr(t0.correctie,4,1) <> '1' OR t0.correctie is null) +AND EXTRACT(YEAR from t1.datum) > 2004; + + +Output from explain + +Hash Join (cost=1328360.12..6167462.76 rows=7197568 width=118) + Hash Cond: (("outer".id)::text = ("inner".id)::text) + + -> Seq Scan on src_faktuur_verrsec t0 (cost=0.00..2773789.90 +rows=40902852 width=52) + Filter: ((substr((code)::text, 1, 2) <> '14'::text) AND +(substr((code)::text, 1, 2) <> '15'::text) AND (substr((code)::text, 1, +2) <> '16'::text) AND (substr((code)::text, 1, 2) <> '17'::text) AND +((substr((correctie)::text, 4, 1) <> '1'::text) OR (correctie IS NULL))) + -> Hash (cost=1188102.97..1188102.97 rows=8942863 width=80) + -> Bitmap Heap Scan on src_faktuur_verricht t1 +(cost=62392.02..1188102.97 rows=8942863 width=80) + Recheck Cond: (date_part('year'::text, datum) > +2004::double precision) + -> Bitmap Index Scan on src_faktuur_verricht_idx1 +(cost=0.00..62392.02 rows=8942863 width=0) + Index Cond: (date_part('year'::text, datum) > +2004::double precision) + + +The db server runs PostgreSQL 8.1.4 on FreeBSD 6.1-Stable. 2GB of RAM. +It contains two SATA150 disks, one contains PostgreSQL and the rest of +the operating system and the other disk holds the pg_xlog directory. + +Changed lines from my postgresql.conf file + +shared_buffers = 8192 +temp_buffers = 4096 +work_mem = 65536 +maintenance_work_mem = 1048576 +max_fsm_pages = 40000 +fsync = off +wal_buffers = 64 +effective_cache_size = 174848 + +The query above takes around 42 minutes. + +However, i also have a wimpy desktop machine with 1gb ram. Windows with +MSSQL 2000 (default installation), same database structure, same +indexes, same query, etc and it takes 17 minutes. The big difference +makes me think that i've made an error with my PostgreSQL configuration. +I just can't seem to figure it out. + +Could someone perhaps give me some pointers, advice? + +Thanks in advance. + +Nicky + + + + + +--------------050802070604070607020802 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + + + + + + + +Hello People,
+
+I'm trying to solve a 'what i feel is a' +performance/configuration/query error on my side. I'm fairly new to +configuring PostgreSQL so, i might be completely wrong with my +configuration.
+
+My database consists of 44 tables, about 20GB. Two of those tables are +'big/huge'. Table src.src_faktuur_verricht contains 43million records +(9GB) and table src.src_faktuur_verrsec contains 55million records +(6GB).
+
+Below is the 'slow' query.
+
+INSERT INTO rpt.rpt_verrichting
+(verrichting_id
+,verrichting_secid
+,fout_status
+,patientnr
+,verrichtingsdatum
+,locatie_code
+,afdeling_code
+,uitvoerder_code
+,aanvrager_code
+,verrichting_code
+,dbcnr
+,aantal_uitgevoerd
+,kostenplaats_code
+,vc_patientnr
+,vc_verrichting_code
+,vc_dbcnr
+)
+SELECT  t1.id
+,       t0.secid
+,       t1.status
+,       t1.patientnr
+,       t1.datum
+,       t1.locatie
+,       t1.afdeling
+,       t1.uitvoerder
+,       t1.aanvrager
+,       t0.code
+,       t1.casenr
+,       t0.aantal
+,       t0.kostplaats
+,       null
+,       null
+,       null
+FROM    src.src_faktuur_verrsec t0 JOIN
+        src.src_faktuur_verricht t1 ON
+        t0.id = t1.id
+WHERE   substr(t0.code,1,2) not in ('14','15','16','17')
+AND     (substr(t0.correctie,4,1) <> '1' OR t0.correctie is null)
+AND     EXTRACT(YEAR from t1.datum) > 2004;
+
+
+Output from explain
+
+Hash Join  (cost=1328360.12..6167462.76 rows=7197568 width=118)
+  Hash Cond: (("outer".id)::text = ("inner".id)::text)
+
+  ->  Seq Scan on src_faktuur_verrsec t0  (cost=0.00..2773789.90 +rows=40902852 width=52)
+        Filter: ((substr((code)::text, 1, 2) <> '14'::text) AND +(substr((code)::text, 1, 2) <> '15'::text) AND +(substr((code)::text, 1, 2) <> '16'::text) AND +(substr((code)::text, 1, 2) <> '17'::text) AND +((substr((correctie)::text, 4, 1) <> '1'::text) OR (correctie IS +NULL)))
+  ->  Hash  (cost=1188102.97..1188102.97 rows=8942863 width=80)
+        ->  Bitmap Heap Scan on src_faktuur_verricht t1  +(cost=62392.02..1188102.97 rows=8942863 width=80)
+              Recheck Cond: (date_part('year'::text, datum) > +2004::double precision)
+              ->  Bitmap Index Scan on src_faktuur_verricht_idx1  +(cost=0.00..62392.02 rows=8942863 width=0)
+                    Index Cond: (date_part('year'::text, datum) > +2004::double precision)
+
+
+The db server runs PostgreSQL 8.1.4 on FreeBSD 6.1-Stable. 2GB of RAM.
+It contains two SATA150 disks, one contains PostgreSQL and the rest of +the operating system and the other disk holds the pg_xlog directory.
+
+Changed lines from my postgresql.conf file
+
+shared_buffers = 8192
+temp_buffers = 4096
+work_mem = 65536
+maintenance_work_mem = 1048576
+max_fsm_pages = 40000
+fsync = off
+wal_buffers = 64
+effective_cache_size = 174848
+
+The query above takes around 42 minutes.
+
+However, i also have a wimpy desktop machine with 1gb ram. Windows with +MSSQL 2000 (default installation), same database structure, same +indexes, same query, etc and it takes 17 minutes. The big difference +makes me think that i've made an error with my PostgreSQL +configuration. I just can't seem to figure it out.
+
+Could someone perhaps give me some pointers, advice?
+
+Thanks in advance.
+
+Nicky
+
+
+
+
+
+ + + +--------------050802070604070607020802-- + +From pgsql-performance-owner@postgresql.org Wed Jun 21 10:53:00 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 581699FA42B + for ; + Wed, 21 Jun 2006 10:53:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 93455-08 for + ; + Wed, 21 Jun 2006 10:52:51 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from q1exch01.Q1LABS.INC (Q1EXCH01.Q1Labs.com [205.174.165.4]) + by postgresql.org (Postfix) with ESMTP id 90D9B9FA19B + for ; + Wed, 21 Jun 2006 10:52:51 -0300 (ADT) +Received: from q1exch02.Q1LABS.INC ([10.100.50.8]) by q1exch01.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 10:52:43 -0300 +X-PMWin-Version: 2.5.0e, Antispam-Engine: 2.3.0.1, Antivirus-Engine: 2.34.3 +thread-index: AcaVOfeZ2ZoT8/nFQQyYfxJsu+59hA== +Received: from [10.100.100.123] ([10.100.100.123]) by q1exch02.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 10:52:42 -0300 +From: "jody brownell" +To: +Subject: Help tuning autovacuum - seeing lots of relation bloat +Date: Wed, 21 Jun 2006 10:52:42 -0300 +Content-Class: urn:content-classes:message +Importance: normal +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2663 +User-Agent: KMail/1.8.3 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-ID: <200606211052.43227.jody.brownell@q1labs.com> +X-OriginalArrivalTime: 21 Jun 2006 13:52:42.0636 (UTC) + FILETIME=[F799BCC0:01C69539] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/395 +X-Sequence-Number: 19752 + +Hey - I am running into a data relation bloat problem which I believe is causing fairly significant +slowdown of my updates. I am using version + + version +----------------------------------------------------------------------------- + PostgreSQL 8.1.4 on i586-trustix-linux-gnu, compiled by GCC gcc (GCC) 3.2.3 + +After about 12 hours of running, my updates are causing lots of reads and iowait (45%) slowing +everything down. The DB bloats from 259MB to 2.4 - 3.4GB. + +The primary table which is troubled is called target and reaches a size of in mb of 834MB from its +freshly 'vacuum full analyze' size of 39MB. + +qradar=# select * from q_table_size; + tablename | size +--------------------------------+--------- + target | 834.496 + +My configuration includes. + +shared_buffers = 32767 +work_mem = 20480 +maintenance_work_mem = 32768 +max_fsm_pages = 4024000 +max_fsm_relations = 2000 +fsync = false +wal_sync_method = fsync +wal_buffers = 4096 +checkpoint_segments = 32 +checkpoint_timeout = 1200 +checkpoint_warning = 60 +commit_delay = 5000 +commit_siblings = 5 +effective_cache_size = 175000 +random_page_cost = 2 +autovacuum = true +autovacuum_naptime = 60 +autovacuum_vacuum_threshold = 500 +autovacuum_analyze_threshold = 250 +autovacuum_vacuum_scale_factor = 0.08 +autovacuum_analyze_scale_factor = 0.08 +#autovacuum_vacuum_cost_delay=100 +#autovacuum_vacuum_cost_limit=100 +default_statistics_target = 40 + +For the particular table I have pg_autovacuum overrides as + +app=# select * from pg_autovacuum where vacrelid = 16603; + vacrelid | enabled | vac_base_thresh | vac_scale_factor | anl_base_thresh | anl_scale_factor | vac_cost_delay | vac_cost_limit +----------+---------+-----------------+------------------+-----------------+------------------+----------------+---------------- + 16603 | t | 200 | 0.01 | 200 | 0.01 | 0 | 400 + + +What I am seeing is, after about 12 hours an update of a few thousand records takes about 2+ minutes as opposed the 100ms it used +to take. I can restore performance only be stopping everything, perform a vacuum full analyze and restarting. + +After the vacuum full, my table returns to the expected 250+ MB from the previous size. + +qradar=# select * from q_table_size ; + tablename | size +--------------------------------+--------- + target | 841.536 + +I can see autovacuum in top every 60 seconds as configured, but it is there and gone in the 1 second refresh. My table grows consistent +every transaction to no avail. To stop the growth, I had to perform a manual vacuum analyze. But at this point, performance is so poor +I have to perform vacuum analyze full. + +Anyway, I am totally confused. My first cut at changing the autovacuum configuration was using Jim Nasby' advice by cutting all values in +half leaving my tables at roughly 20% dead space, for this table, that would be just over 50k tuples. This however yields the same results +as the above configuration with continous bloat. So, I was WAY more aggressive as shown above with no improvment. By calculation, Jims advice +would suffice for our system. + +I just checked a production box which is running 8.1.1 and it is behaving as expected. This configuration only specifies "autovacuum = true", +everything else is left to the defaults. + +Is there something whacked about my configuration? Is there a way I can troubleshoot what autovacuum is doing or why it is not performing +the work? + +Here is the output for the vacuum full of target... + +qradar=# vacuum full analyze verbose target; +INFO: vacuuming "public.target" +INFO: "target": found 5048468 removable, 266778 nonremovable row versions in 96642 pages +DETAIL: 0 dead row versions cannot be removed yet. +Nonremovable row versions range from 140 to 144 bytes long. +There were 1696 unused item pointers. +Total free space (including removable row versions) is 730074628 bytes. +89347 pages are or will become empty, including 0 at the end of the table. +95261 pages containing 730030436 free bytes are potential move destinations. +CPU 2.31s/1.27u sec elapsed 6.46 sec. +INFO: index "target_pkey" now contains 266778 row versions in 18991 pages +DETAIL: 5048468 index row versions were removed. +40 index pages have been deleted, 40 are currently reusable. +CPU 0.91s/5.29u sec elapsed 6.24 sec. +INFO: index "target_network_key" now contains 266778 row versions in 15159 pages +DETAIL: 5048468 index row versions were removed. +30 index pages have been deleted, 30 are currently reusable. +CPU 0.45s/4.96u sec elapsed 5.43 sec. +INFO: index "target_tulu_idx" now contains 266778 row versions in 19453 pages +DETAIL: 5048468 index row versions were removed. +17106 index pages have been deleted, 17106 are currently reusable. +CPU 0.79s/3.31u sec elapsed 4.10 sec. +INFO: "target": moved 266719 row versions, truncated 96642 to 4851 pages +DETAIL: CPU 5.19s/8.86u sec elapsed 14.27 sec. +INFO: index "target_pkey" now contains 266778 row versions in 18991 pages +DETAIL: 266719 index row versions were removed. +41 index pages have been deleted, 41 are currently reusable. +CPU 0.78s/0.54u sec elapsed 1.32 sec. +INFO: index "target_network_key" now contains 266778 row versions in 15159 pages +DETAIL: 266719 index row versions were removed. +31 index pages have been deleted, 31 are currently reusable. +CPU 0.49s/0.44u sec elapsed 0.93 sec. +INFO: index "target_tulu_idx" now contains 266778 row versions in 19453 pages +DETAIL: 266719 index row versions were removed. +16726 index pages have been deleted, 16726 are currently reusable. +CPU 0.33s/0.38u sec elapsed 0.76 sec. +INFO: analyzing "public.target" +INFO: "target": scanned 4851 of 4851 pages, containing 266778 live rows and 0 dead rows; 12000 rows in sample, 266778 estimated total rows +VACUUM + +A db wide vacuum full outputs this at the end. + +INFO: free space map contains 32848 pages in 159 relations +DETAIL: A total of 24192 page slots are in use (including overhead). +24192 page slots are required to track all free space. +Current limits are: 4024000 page slots, 2000 relations, using 23705 KB. + +So, it appears my autovacuum is just NOT working... I must have screwed something up, but I cannot see what. + +Thanks again. +Jody + + + + +From pgsql-performance-owner@postgresql.org Wed Jun 21 11:08:45 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B6CDE9FA42B + for ; + Wed, 21 Jun 2006 11:08:44 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 94061-05 for + ; + Wed, 21 Jun 2006 11:08:35 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.ecircle.de (mail.ecircle.de [195.140.186.200]) + by postgresql.org (Postfix) with ESMTP id 85ACE9FA19B + for ; + Wed, 21 Jun 2006 11:08:35 -0300 (ADT) +Received: from einstein.muc.ecircle.de (einstein.muc.ecircle.de [192.168.1.7]) + by mail.ecircle.de (READY) with ESMTP id 6F41B55C001; + Wed, 21 Jun 2006 16:08:33 +0200 (CEST) +Received: from [192.168.1.91] ([192.168.1.91]) by einstein.muc.ecircle.de with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 16:08:53 +0200 +Subject: Re: Help tuning autovacuum - seeing lots of relation +From: Csaba Nagy +To: jody brownell +Cc: postgres performance list +In-Reply-To: <200606211052.43227.jody.brownell@q1labs.com> +References: <200606211052.43227.jody.brownell@q1labs.com> +Content-Type: text/plain +Message-Id: <1150898912.3309.23.camel@coppola.muc.ecircle.de> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Wed, 21 Jun 2006 16:08:33 +0200 +Content-Transfer-Encoding: 7bit +X-OriginalArrivalTime: 21 Jun 2006 14:08:53.0966 (UTC) + FILETIME=[3A8EEEE0:01C6953C] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/396 +X-Sequence-Number: 19753 + +> So, it appears my autovacuum is just NOT working... I must have screwed something up, but I cannot see what. + +Is it possible that you have long running transactions ? If yes, VACUUM +is simply not efficient, as it won't eliminate the dead space +accumulated during the long running transaction. In that case VACUUM +FULL won't help you either as it also can't eliminate dead space still +visible by old transactions, but from what you say I guess you really +stop everything before doing VACUUM FULL so you might as well stopped +the culprit transaction too... that's why the VACUUM FULL worked (if my +assumption is correct). + +To check if this is the case, look for "idle in transaction" in your +process listing (ps auxww|grep "idle in transaction"). If you got one +(or more) of that, you found your problem. If not, hopefully others will +help you :-) + +Cheers, +Csaba. + + + + +From pgsql-performance-owner@postgresql.org Wed Jun 21 11:17:18 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D35149FA42B + for ; + Wed, 21 Jun 2006 11:17:17 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 95573-09 for + ; + Wed, 21 Jun 2006 11:17:09 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id EA2619FA19B + for ; + Wed, 21 Jun 2006 11:17:08 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5LEH5fo009962; + Wed, 21 Jun 2006 10:17:05 -0400 (EDT) +To: Csaba Nagy +cc: jody brownell , + postgres performance list +Subject: Re: Help tuning autovacuum - seeing lots of relation +In-reply-to: <1150898912.3309.23.camel@coppola.muc.ecircle.de> +References: <200606211052.43227.jody.brownell@q1labs.com> + <1150898912.3309.23.camel@coppola.muc.ecircle.de> +Comments: In-reply-to Csaba Nagy + message dated "Wed, 21 Jun 2006 16:08:33 +0200" +Date: Wed, 21 Jun 2006 10:17:04 -0400 +Message-ID: <9961.1150899424@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/397 +X-Sequence-Number: 19754 + +Csaba Nagy writes: +>> So, it appears my autovacuum is just NOT working... I must have screwed something up, but I cannot see what. + +> Is it possible that you have long running transactions ? + +The other question I was wondering about is if autovacuum is actually +choosing to vacuum the target table or not. The only way to check that +in 8.1 is to crank log_min_messages up to DEBUG2 and then trawl through +the postmaster log looking for "autovac" messages. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Jun 21 11:53:28 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 851079FA42B + for ; + Wed, 21 Jun 2006 11:53:28 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 99799-06 for + ; + Wed, 21 Jun 2006 11:53:13 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from globalrelay.com (mail1.globalrelay.com [216.18.71.77]) + by postgresql.org (Postfix) with ESMTP id 61D119FA19B + for ; + Wed, 21 Jun 2006 11:53:10 -0300 (ADT) +X-Virus-Scanned: Scanned by GRC-AntiVirus Gateway +X-GR-Acctd: YES +Received: from [63.226.156.118] (HELO DaveEMachine) + by globalrelay.com (CommuniGate Pro SMTP 4.2.3) + with ESMTP id 94272236; Wed, 21 Jun 2006 07:53:04 -0700 +From: "Dave Dutcher" +To: "'nicky'" , + +Subject: Re: Speeding up query, Joining 55mil and 43mil records. +Date: Wed, 21 Jun 2006 09:53:03 -0500 +Message-ID: <00cb01c69542$663f1c30$8300a8c0@tridecap.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_NextPart_000_00CC_01C69518.7D691430" +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook, Build 10.0.2627 +In-Reply-To: <44994DE7.5070801@valuecare.nl> +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +Importance: Normal +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/399 +X-Sequence-Number: 19756 + +This is a multi-part message in MIME format. + +------=_NextPart_000_00CC_01C69518.7D691430 +Content-Type: text/plain; + charset="US-ASCII" +Content-Transfer-Encoding: 7bit + +Could you post an explain analyze of the query? Just FYI, if you do an +explain analyze of the insert statement, it will actually do the insert. +If you don't want that just post an explain analyze of the select part. + +To me it would be interesting to compare just the select parts of the +query between Postgres and MSSQL. That way you would know if your +Postgres install is slower at the query or slower at the insert. + + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of nicky +Sent: Wednesday, June 21, 2006 8:47 AM +To: pgsql-performance@postgresql.org +Subject: [PERFORM] Speeding up query, Joining 55mil and 43mil records. + + +Hello People, + +I'm trying to solve a 'what i feel is a' performance/configuration/query +error on my side. I'm fairly new to configuring PostgreSQL so, i might +be completely wrong with my configuration. + +My database consists of 44 tables, about 20GB. Two of those tables are +'big/huge'. Table src.src_faktuur_verricht contains 43million records +(9GB) and table src.src_faktuur_verrsec contains 55million records +(6GB). + +Below is the 'slow' query. + +INSERT INTO rpt.rpt_verrichting +(verrichting_id +,verrichting_secid +,fout_status +,patientnr +,verrichtingsdatum +,locatie_code +,afdeling_code +,uitvoerder_code +,aanvrager_code +,verrichting_code +,dbcnr +,aantal_uitgevoerd +,kostenplaats_code +,vc_patientnr +,vc_verrichting_code +,vc_dbcnr +) +SELECT t1.id +, t0.secid +, t1.status +, t1.patientnr +, t1.datum +, t1.locatie +, t1.afdeling +, t1.uitvoerder +, t1.aanvrager +, t0.code +, t1.casenr +, t0.aantal +, t0.kostplaats +, null +, null +, null +FROM src.src_faktuur_verrsec t0 JOIN + src.src_faktuur_verricht t1 ON + t0.id = t1.id +WHERE substr(t0.code,1,2) not in ('14','15','16','17') +AND (substr(t0.correctie,4,1) <> '1' OR t0.correctie is null) +AND EXTRACT(YEAR from t1.datum) > 2004; + + +Output from explain + +Hash Join (cost=1328360.12..6167462.76 rows=7197568 width=118) + Hash Cond: (("outer".id)::text = ("inner".id)::text) + + -> Seq Scan on src_faktuur_verrsec t0 (cost=0.00..2773789.90 +rows=40902852 width=52) + Filter: ((substr((code)::text, 1, 2) <> '14'::text) AND +(substr((code)::text, 1, 2) <> '15'::text) AND (substr((code)::text, 1, +2) <> '16'::text) AND (substr((code)::text, 1, 2) <> '17'::text) AND +((substr((correctie)::text, 4, 1) <> '1'::text) OR (correctie IS NULL))) + -> Hash (cost=1188102.97..1188102.97 rows=8942863 width=80) + -> Bitmap Heap Scan on src_faktuur_verricht t1 +(cost=62392.02..1188102.97 rows=8942863 width=80) + Recheck Cond: (date_part('year'::text, datum) > +2004::double precision) + -> Bitmap Index Scan on src_faktuur_verricht_idx1 +(cost=0.00..62392.02 rows=8942863 width=0) + Index Cond: (date_part('year'::text, datum) > +2004::double precision) + + +The db server runs PostgreSQL 8.1.4 on FreeBSD 6.1-Stable. 2GB of RAM. +It contains two SATA150 disks, one contains PostgreSQL and the rest of +the operating system and the other disk holds the pg_xlog directory. + +Changed lines from my postgresql.conf file + +shared_buffers = 8192 +temp_buffers = 4096 +work_mem = 65536 +maintenance_work_mem = 1048576 +max_fsm_pages = 40000 +fsync = off +wal_buffers = 64 +effective_cache_size = 174848 + +The query above takes around 42 minutes. + +However, i also have a wimpy desktop machine with 1gb ram. Windows with +MSSQL 2000 (default installation), same database structure, same +indexes, same query, etc and it takes 17 minutes. The big difference +makes me think that i've made an error with my PostgreSQL configuration. +I just can't seem to figure it out. + +Could someone perhaps give me some pointers, advice? + +Thanks in advance. + +Nicky + + + + + + + +------=_NextPart_000_00CC_01C69518.7D691430 +Content-Type: text/html; + charset="US-ASCII" +Content-Transfer-Encoding: quoted-printable + + + + +Message + + + +
Could=20 +you post an explain analyze of the query?  Just FYI, if you do an = +explain=20 +analyze of the insert statement, it will actually do the insert.  = +If you=20 +don't want that just post an explain analyze of the select=20 +part.
+
 
+
To me=20 +it would be interesting to compare just the select parts of the query = +between=20 +Postgres and MSSQL.  That way you would know if your Postgres = +install is=20 +slower at the query or slower at the insert.
+
 
+ +
+
-----Original Message-----
From:=20 + pgsql-performance-owner@postgresql.org=20 + [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of=20 + nicky
Sent: Wednesday, June 21, 2006 8:47 = +AM
To:=20 + pgsql-performance@postgresql.org
Subject: [PERFORM] Speeding = +up=20 + query, Joining 55mil and 43mil records.

Hello People,

I'm trying to solve a 'what i = +feel is a'=20 + performance/configuration/query error on my side. I'm fairly new to=20 + configuring PostgreSQL so, i might be completely wrong with my = +configuration.=20 +

My database consists of 44 tables, about 20GB. Two of those = +tables are=20 + 'big/huge'. Table src.src_faktuur_verricht contains 43million records = +(9GB)=20 + and table src.src_faktuur_verrsec contains 55million records (6GB).=20 +

Below is the 'slow' query.

INSERT INTO=20 + = +rpt.rpt_verrichting
(verrichting_id
,verrichting_secid
,fout_sta= +tus
,patientnr
,verrichtingsdatum
,locatie_code
,afdeling_cod= +e
,uitvoerder_code
,aanvrager_code
,verrichting_code
,dbcnr,aantal_uitgevoerd
,kostenplaats_code
,vc_patientnr
,vc_verric= +hting_code
,vc_dbcnr
)
SELECT =20 + t1.id
,      =20 + t0.secid
,      =20 + t1.status
,      =20 + t1.patientnr
,      =20 + t1.datum
,      =20 + t1.locatie
,      =20 + t1.afdeling
,      =20 + t1.uitvoerder
,      =20 + t1.aanvrager
,      =20 + t0.code
,      =20 + t1.casenr
,      =20 + t0.aantal
,      =20 + t0.kostplaats
,      =20 + null
,      =20 + null
,       = +null
FROM   =20 + src.src_faktuur_verrsec t0 = +JOIN
       =20 + src.src_faktuur_verricht t1 = +ON
       =20 + t0.id =3D t1.id
WHERE   substr(t0.code,1,2) not in=20 + ('14','15','16','17')
AND     = +(substr(t0.correctie,4,1)=20 + <> '1' OR t0.correctie is null)
AND    =20 + EXTRACT(YEAR from t1.datum) > 2004;


Output from=20 + explain

Hash Join  (cost=3D1328360.12..6167462.76 = +rows=3D7197568=20 + width=3D118)
  Hash Cond: (("outer".id)::text =3D=20 + ("inner".id)::text)

  ->  Seq Scan on = +src_faktuur_verrsec=20 + t0  (cost=3D0.00..2773789.90 rows=3D40902852=20 + width=3D52)
        Filter:=20 + ((substr((code)::text, 1, 2) <> '14'::text) AND = +(substr((code)::text, 1,=20 + 2) <> '15'::text) AND (substr((code)::text, 1, 2) <> = +'16'::text)=20 + AND (substr((code)::text, 1, 2) <> '17'::text) AND=20 + ((substr((correctie)::text, 4, 1) <> '1'::text) OR (correctie IS = + + NULL)))
  ->  Hash  = +(cost=3D1188102.97..1188102.97=20 + rows=3D8942863 = +width=3D80)
       =20 + ->  Bitmap Heap Scan on src_faktuur_verricht t1 =20 + (cost=3D62392.02..1188102.97 rows=3D8942863=20 + = +width=3D80)
         &nbs= +p;   =20 + Recheck Cond: (date_part('year'::text, datum) > 2004::double=20 + = +precision)
          = +;   =20 + ->  Bitmap Index Scan on src_faktuur_verricht_idx1 =20 + (cost=3D0.00..62392.02 rows=3D8942863=20 + = +width=3D0)
          = +;         =20 + Index Cond: (date_part('year'::text, datum) > 2004::double=20 + precision)


The db server runs PostgreSQL 8.1.4 on FreeBSD=20 + 6.1-Stable. 2GB of RAM.
It contains two SATA150 disks, one = +contains=20 + PostgreSQL and the rest of the operating system and the other disk = +holds the=20 + pg_xlog directory.

Changed lines from my postgresql.conf=20 + file

shared_buffers =3D 8192
temp_buffers =3D = +4096
work_mem =3D=20 + 65536
maintenance_work_mem =3D 1048576
max_fsm_pages =3D = +40000
fsync =3D=20 + off
wal_buffers =3D 64
effective_cache_size =3D = +174848

The query=20 + above takes around 42 minutes.

However, i also have a wimpy = +desktop=20 + machine with 1gb ram. Windows with MSSQL 2000 (default installation), = +same=20 + database structure, same indexes, same query, etc and it takes 17 = +minutes. The=20 + big difference makes me think that i've made an error with my = +PostgreSQL=20 + configuration. I just can't seem to figure it out.

Could = +someone=20 + perhaps give me some pointers, advice?

Thanks in advance.=20 +

Nicky




+ +------=_NextPart_000_00CC_01C69518.7D691430-- + + +From pgsql-performance-owner@postgresql.org Wed Jun 21 12:27:23 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D103D9FA19B + for ; + Wed, 21 Jun 2006 12:27:22 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 07850-02 for + ; + Wed, 21 Jun 2006 12:27:10 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from q1exch01.Q1LABS.INC (Q1EXCH01.Q1Labs.com [205.174.165.4]) + by postgresql.org (Postfix) with ESMTP id 32EDE9FA42B + for ; + Wed, 21 Jun 2006 12:27:09 -0300 (ADT) +Received: from q1exch02.Q1LABS.INC ([10.100.50.8]) by q1exch01.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 12:27:06 -0300 +X-PMWin-Version: 2.5.0e, Antispam-Engine: 2.3.0.1, Antivirus-Engine: 2.34.3 +thread-index: AcaVRydr+C4xGUiZQiOxxqabSMb9XA== +Received: from [10.100.100.123] ([10.100.100.123]) by q1exch02.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 12:27:06 -0300 +From: "jody brownell" +To: "Csaba Nagy" +Subject: Re: Help tuning autovacuum - seeing lots of relationbloat +Date: Wed, 21 Jun 2006 12:27:06 -0300 +Content-Class: urn:content-classes:message +Importance: normal +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2663 +User-Agent: KMail/1.8.3 +Cc: "postgres performance list" +References: <200606211052.43227.jody.brownell@q1labs.com> + <1150898912.3309.23.camel@coppola.muc.ecircle.de> +In-Reply-To: <1150898912.3309.23.camel@coppola.muc.ecircle.de> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-ID: <200606211227.06618.jody.brownell@q1labs.com> +X-OriginalArrivalTime: 21 Jun 2006 15:27:06.0320 (UTC) + FILETIME=[276B5500:01C69547] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/400 +X-Sequence-Number: 19757 + +Our application is broken down quite well. We have two main writing processes +writing to two separate sets of tables. No crossing over, nothign to prohibit the +vacuuming in the nature which you describe. + +My longest transaction on the tables in question are typically quite short until +of course they begin to bloat. + + + +On Wednesday 21 June 2006 11:08, Csaba Nagy wrote: +> > So, it appears my autovacuum is just NOT working... I must have screwed something up, but I cannot see what. +> +> Is it possible that you have long running transactions ? If yes, VACUUM +> is simply not efficient, as it won't eliminate the dead space +> accumulated during the long running transaction. In that case VACUUM +> FULL won't help you either as it also can't eliminate dead space still +> visible by old transactions, but from what you say I guess you really +> stop everything before doing VACUUM FULL so you might as well stopped +> the culprit transaction too... that's why the VACUUM FULL worked (if my +> assumption is correct). +> +> To check if this is the case, look for "idle in transaction" in your +> process listing (ps auxww|grep "idle in transaction"). If you got one +> (or more) of that, you found your problem. If not, hopefully others will +> help you :-) +> +> Cheers, +> Csaba. +> +> +> +> + +From pgsql-performance-owner@postgresql.org Wed Jun 21 12:37:31 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id F1EA99FA501 + for ; + Wed, 21 Jun 2006 12:37:30 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 10245-02 for + ; + Wed, 21 Jun 2006 12:37:14 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.aeccom.com (port-83-236-156-26.static.qsc.de + [83.236.156.26]) + by postgresql.org (Postfix) with ESMTP id C546B9FA42B + for ; + Wed, 21 Jun 2006 12:37:13 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mail.aeccom.com (Postfix) with ESMTP id D873D1C637; + Wed, 21 Jun 2006 17:37:10 +0200 (CEST) +Received: from mail.aeccom.com ([127.0.0.1]) + by localhost (gate6.aeccom.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 18766-01-43; Wed, 21 Jun 2006 17:37:08 +0200 (CEST) +Received: from [192.168.2.140] (unknown [192.168.2.140]) + by mail.aeccom.com (Postfix) with ESMTP id D10BD1C633; + Wed, 21 Jun 2006 17:37:08 +0200 (CEST) +Message-ID: <449967A3.3030801@aeccom.com> +Date: Wed, 21 Jun 2006 17:37:07 +0200 +From: Sven Geisler +Organization: AEC/communications GmbH +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +CC: nicky +Subject: Re: Speeding up query, Joining 55mil and 43mil records. +References: <44994DE7.5070801@valuecare.nl> +In-Reply-To: <44994DE7.5070801@valuecare.nl> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: amavisd-new at aeccom.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/401 +X-Sequence-Number: 19758 + +Hi Nicky, + +I guess, you should try to upgrade the memory setting of PostgreSQL first. + +work_mem = 65536 + +Is a bit low for such large joins. + +Did you get a change to watch the directory +/base//pgsql_tmp to see how large the temporary file is +during this query. I'm sure that there is large file. + +Anyhow, you can upgrade 'work_mem' to 1000000 which is 1 GB. Please note +that the parameter work_mem is per backend process. You will get +problems with multiple large queries at the same time. +You may move (link) the directory 'pgsql_tmp' to a very fast file system +if you still get large files in this directory. + +You also can try to increase this settings: + +checkpoint_segments = 256 +checkpoint_timeout = 3600 # range 30-3600, in seconds +checkpoint_warning = 0 # 0 is off + +Please read the PostgreSQL documentation about the drawbacks of this +setting as well as your setting 'fsync=off'. + +Cheers +Sven. + +nicky schrieb: +> Hello People, +> +> I'm trying to solve a 'what i feel is a' performance/configuration/query +> error on my side. I'm fairly new to configuring PostgreSQL so, i might +> be completely wrong with my configuration. +> +> My database consists of 44 tables, about 20GB. Two of those tables are +> 'big/huge'. Table src.src_faktuur_verricht contains 43million records +> (9GB) and table src.src_faktuur_verrsec contains 55million records (6GB). +> +> Below is the 'slow' query. +> +> INSERT INTO rpt.rpt_verrichting +> (verrichting_id +> ,verrichting_secid +> ,fout_status +> ,patientnr +> ,verrichtingsdatum +> ,locatie_code +> ,afdeling_code +> ,uitvoerder_code +> ,aanvrager_code +> ,verrichting_code +> ,dbcnr +> ,aantal_uitgevoerd +> ,kostenplaats_code +> ,vc_patientnr +> ,vc_verrichting_code +> ,vc_dbcnr +> ) +> SELECT t1.id +> , t0.secid +> , t1.status +> , t1.patientnr +> , t1.datum +> , t1.locatie +> , t1.afdeling +> , t1.uitvoerder +> , t1.aanvrager +> , t0.code +> , t1.casenr +> , t0.aantal +> , t0.kostplaats +> , null +> , null +> , null +> FROM src.src_faktuur_verrsec t0 JOIN +> src.src_faktuur_verricht t1 ON +> t0.id = t1.id +> WHERE substr(t0.code,1,2) not in ('14','15','16','17') +> AND (substr(t0.correctie,4,1) <> '1' OR t0.correctie is null) +> AND EXTRACT(YEAR from t1.datum) > 2004; +> +> +> Output from explain +> +> Hash Join (cost=1328360.12..6167462.76 rows=7197568 width=118) +> Hash Cond: (("outer".id)::text = ("inner".id)::text) +> +> -> Seq Scan on src_faktuur_verrsec t0 (cost=0.00..2773789.90 +> rows=40902852 width=52) +> Filter: ((substr((code)::text, 1, 2) <> '14'::text) AND +> (substr((code)::text, 1, 2) <> '15'::text) AND (substr((code)::text, 1, +> 2) <> '16'::text) AND (substr((code)::text, 1, 2) <> '17'::text) AND +> ((substr((correctie)::text, 4, 1) <> '1'::text) OR (correctie IS NULL))) +> -> Hash (cost=1188102.97..1188102.97 rows=8942863 width=80) +> -> Bitmap Heap Scan on src_faktuur_verricht t1 +> (cost=62392.02..1188102.97 rows=8942863 width=80) +> Recheck Cond: (date_part('year'::text, datum) > +> 2004::double precision) +> -> Bitmap Index Scan on src_faktuur_verricht_idx1 +> (cost=0.00..62392.02 rows=8942863 width=0) +> Index Cond: (date_part('year'::text, datum) > +> 2004::double precision) +> +> +> The db server runs PostgreSQL 8.1.4 on FreeBSD 6.1-Stable. 2GB of RAM. +> It contains two SATA150 disks, one contains PostgreSQL and the rest of +> the operating system and the other disk holds the pg_xlog directory. +> +> Changed lines from my postgresql.conf file +> +> shared_buffers = 8192 +> temp_buffers = 4096 +> work_mem = 65536 +> maintenance_work_mem = 1048576 +> max_fsm_pages = 40000 +> fsync = off +> wal_buffers = 64 +> effective_cache_size = 174848 +> +> The query above takes around 42 minutes. +> +> However, i also have a wimpy desktop machine with 1gb ram. Windows with +> MSSQL 2000 (default installation), same database structure, same +> indexes, same query, etc and it takes 17 minutes. The big difference +> makes me think that i've made an error with my PostgreSQL configuration. +> I just can't seem to figure it out. +> +> Could someone perhaps give me some pointers, advice? +> +> Thanks in advance. +> +> Nicky +> + +From pgsql-performance-owner@postgresql.org Thu Jun 22 03:06:56 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B5D6D9FA42B + for ; + Wed, 21 Jun 2006 12:42:04 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 06098-07 for + ; + Wed, 21 Jun 2006 12:41:54 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from pd4mo2so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net + [24.71.223.10]) by postgresql.org (Postfix) with ESMTP id B9CF39FA19B + for ; + Wed, 21 Jun 2006 12:41:53 -0300 (ADT) +Received: from pd4mr6so.prod.shaw.ca (pd4mr6so-qfe3.prod.shaw.ca + [10.0.141.69]) + by l-daemon (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 + 2004)) with ESMTP id <0J1700MRZVH8Z910@l-daemon> for + pgsql-performance@postgresql.org; Wed, 21 Jun 2006 09:39:08 -0600 (MDT) +Received: from pn2ml7so.prod.shaw.ca ([10.0.121.151]) + by pd4mr6so.prod.shaw.ca (Sun ONE Messaging Server 6.0 HotFix 1.01 + (built Mar + 15 2004)) with ESMTP id <0J17004HUVH8IRQ0@pd4mr6so.prod.shaw.ca> for + pgsql-performance@postgresql.org; Wed, 21 Jun 2006 09:39:08 -0600 (MDT) +Received: from [192.168.0.100] ([24.68.104.139]) + by l-daemon (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 + 2004)) with ESMTP id <0J17000PGVH5GSA0@l-daemon> for + pgsql-performance@postgresql.org; Wed, 21 Jun 2006 09:39:07 -0600 (MDT) +Date: Wed, 21 Jun 2006 08:37:51 -0700 +From: Ron St-Pierre +Subject: Tuning New Server (slow function) +To: pgsql-performance@postgresql.org +Message-id: <449967CF.6070105@shaw.ca> +MIME-version: 1.0 +Content-type: text/plain; charset=ISO-8859-1; format=flowed +Content-transfer-encoding: 7bit +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/438 +X-Sequence-Number: 19795 + +We just purchased a new Dell PowerEdge 2800 (dual xeon, 8GB RAM, raid 4, +RHEL, postgres 8.1) and ported our old database over to it (single cpu, +2GB RAM, no raid, postgres 7.4). Our apps perform great on it, however +some queries are super slow. One function in particular, which used to +take 15-30 minutes on the old server, has been running now for over 12 +hours: + BEGIN + TRUNCATE stock.datacount; + FOR rec IN SELECT itemID, item, hexValue FROM stock.activeitem LOOP + histdate := (SELECT updatedate FROM stock.historical s WHERE +s.itemID=rec.itemID ORDER BY updatedate DESC LIMIT 1); + IF histdate IS NOT NULL THEN + funddate := (SELECT updatedate FROM stock.funddata s +WHERE s.itemID=rec.itemID); + techdate := (SELECT updatedate FROM stock.techsignals s +WHERE s.itemID=rec.itemID); + IF (histdate <> funddate) OR (histdate <> techdate) OR +(funddate IS NULL) OR (techdate IS NULL) THEN + counter := counter + 1; + outrec.itemID := rec.itemID; + outrec.item := rec.item; + outrec.hexvalue := rec.hexvalue; + RETURN NEXT outrec; + END IF; + END IF; + END LOOP; + INSERT INTO stock.datacount (itemcount) VALUES (counter); + COPY stock.datacount TO ''/tmp/datacount''; + RETURN; + END; + +"top" shows: +CPU states: cpu user nice system irq softirq iowait idle + total 5.8% 0.6% 31.2% 0.0% 0.0% 0.5% 61.6% +Mem: 8152592k av, 8143012k used, 9580k free, 0k shrd, 179888k +buff + 6342296k actv, 1206340k in_d, 137916k in_c +Swap: 8385760k av, 259780k used, 8125980k free 7668624k +cached + + PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND +17027 postgres 25 0 566M 561M 560M R 24.9 7.0 924:34 1 postmaster + +I've likely set some parameter(s) to the wrong values, but I don't know +which one(s). Here are my relevant postgresql.conf settings: +shared_buffers = 70000 +work_mem = 9192 +maintenance_work_mem = 131072 +max_fsm_pages = 70000 +fsync = off (temporarily, will be turned back on) +checkpoint_segments = 64 +checkpoint_timeout = 1800 +effective_cache_size = 70000 + +[root@new-server root]# cat /proc/sys/kernel/shmmax +660000000 + +We want to put this into production soon, but this is a showstopper. Can +anyone help me out with this? + + +Thanks + +Ron St.Pierre + +From pgsql-performance-owner@postgresql.org Wed Jun 21 12:42:38 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 96ED49FA42B + for ; + Wed, 21 Jun 2006 12:42:38 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 07810-09 for + ; + Wed, 21 Jun 2006 12:42:26 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.ecircle.de (mail.ecircle.de [195.140.186.200]) + by postgresql.org (Postfix) with ESMTP id 9BF7E9FA19B + for ; + Wed, 21 Jun 2006 12:42:25 -0300 (ADT) +Received: from einstein.muc.ecircle.de (einstein.muc.ecircle.de [192.168.1.7]) + by mail.ecircle.de (READY) with ESMTP id D0B0355C003; + Wed, 21 Jun 2006 17:42:24 +0200 (CEST) +Received: from [192.168.1.91] ([192.168.1.91]) by einstein.muc.ecircle.de with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 17:42:42 +0200 +Subject: Re: Help tuning autovacuum - seeing lots of relationbloat +From: Csaba Nagy +To: jody brownell +Cc: postgres performance list +In-Reply-To: <200606211227.06618.jody.brownell@q1labs.com> +References: <200606211052.43227.jody.brownell@q1labs.com> + <1150898912.3309.23.camel@coppola.muc.ecircle.de> + <200606211227.06618.jody.brownell@q1labs.com> +Content-Type: text/plain +Message-Id: <1150904541.3309.38.camel@coppola.muc.ecircle.de> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Wed, 21 Jun 2006 17:42:21 +0200 +Content-Transfer-Encoding: 7bit +X-OriginalArrivalTime: 21 Jun 2006 15:42:42.0418 (UTC) + FILETIME=[55608D20:01C69549] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/402 +X-Sequence-Number: 19759 + +On Wed, 2006-06-21 at 17:27, jody brownell wrote: +> Our application is broken down quite well. We have two main writing processes +> writing to two separate sets of tables. No crossing over, nothign to prohibit the +> vacuuming in the nature which you describe. + +It really doesn't matter what table are you touching, as it doesn't +matter if you read or write either, what matters is how long ago was the +last "begin" without "commit" or "rollback". VACUUM will not touch +tuples which were deleted after the oldest not yet finished transaction +started, regardless if that transaction touched the vacuumed table or +not in any way... + +> My longest transaction on the tables in question are typically quite short until +> of course they begin to bloat. + +Well, your application might be completely well behaved and still your +DBA (or your favorite DB access tool for that matter) can leave open +transactions in an interactive session. It never hurts to check if you +actually have "idle in transaction" sessions. It happened a few times to +us, some of those were bad coding on ad-hoc tools written by us, others +were badly behaved DB access tools opening a transaction immediately +after connect and after each successful command, effectively leaving an +open transaction when leaving it open while having lunch... + +So it might very well be that some interactive or ad hoc tools you're +using to manage the DB are your problem. + +Cheers, +Csaba. + + + +From pgsql-performance-owner@postgresql.org Thu Jun 22 03:06:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 49DB29FA4A5 + for ; + Wed, 21 Jun 2006 12:59:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 11947-03-2 + for ; + Wed, 21 Jun 2006 12:59:28 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from pd2mo3so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net + [24.71.223.10]) by postgresql.org (Postfix) with ESMTP id 99D269FA4F4 + for ; + Wed, 21 Jun 2006 12:59:27 -0300 (ADT) +Received: from pd5mr3so.prod.shaw.ca + (pd5mr3so-qfe3.prod.shaw.ca [10.0.141.144]) by l-daemon + (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 2004)) + with ESMTP id <0J1700FD7WEM6L60@l-daemon> for + pgsql-performance@postgresql.org; Wed, 21 Jun 2006 09:59:10 -0600 (MDT) +Received: from pn2ml7so.prod.shaw.ca ([10.0.121.151]) + by pd5mr3so.prod.shaw.ca (Sun ONE Messaging Server 6.0 HotFix 1.01 + (built Mar + 15 2004)) with ESMTP id <0J1700747WEM4XM0@pd5mr3so.prod.shaw.ca> for + pgsql-performance@postgresql.org; Wed, 21 Jun 2006 09:59:10 -0600 (MDT) +Received: from [192.168.0.100] ([24.68.104.139]) + by l-daemon (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 + 2004)) with ESMTP id <0J1700HSDWELRDF0@l-daemon> for + pgsql-performance@postgresql.org; Wed, 21 Jun 2006 09:59:10 -0600 (MDT) +Date: Wed, 21 Jun 2006 08:57:55 -0700 +From: Ron St-Pierre +Subject: Tuning New Server (slow function) +To: pgsql-performance@postgresql.org +Message-id: <44996C83.5040302@shaw.ca> +MIME-version: 1.0 +Content-type: text/plain; charset=ISO-8859-1; format=flowed +Content-transfer-encoding: 7bit +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/437 +X-Sequence-Number: 19794 + +We just purchased a new Dell PowerEdge 2800 (dual xeon, 8GB RAM, raid 4, +RHEL, postgres 8.1) and ported our old database over to it (single cpu, +2GB RAM, no raid, postgres 7.4). Our apps perform great on it, however +some queries are super slow. One function in particular, which used to +take 15-30 minutes on the old server, has been running now for over 12 +hours: + BEGIN + TRUNCATE stock.datacount; + FOR rec IN SELECT itemID, item, hexValue FROM stock.activeitem LOOP + histdate := (SELECT updatedate FROM stock.historical s WHERE +s.itemID=rec.itemID ORDER BY updatedate DESC LIMIT 1); + IF histdate IS NOT NULL THEN + funddate := (SELECT updatedate FROM stock.funddata s +WHERE s.itemID=rec.itemID); + techdate := (SELECT updatedate FROM stock.techsignals s +WHERE s.itemID=rec.itemID); + IF (histdate <> funddate) OR (histdate <> techdate) OR +(funddate IS NULL) OR (techdate IS NULL) THEN + counter := counter + 1; + outrec.itemID := rec.itemID; + outrec.item := rec.item; + outrec.hexvalue := rec.hexvalue; + RETURN NEXT outrec; + END IF; + END IF; + END LOOP; + INSERT INTO stock.datacount (itemcount) VALUES (counter); + COPY stock.datacount TO ''/tmp/datacount''; + RETURN; + END; + +"top" shows: +CPU states: cpu user nice system irq softirq iowait idle + total 5.8% 0.6% 31.2% 0.0% 0.0% 0.5% 61.6% +Mem: 8152592k av, 8143012k used, 9580k free, 0k shrd, 179888k +buff + 6342296k actv, 1206340k in_d, 137916k in_c +Swap: 8385760k av, 259780k used, 8125980k free 7668624k +cached + + PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND +17027 postgres 25 0 566M 561M 560M R 24.9 7.0 924:34 1 +postmaster + +I've likely set some parameter(s) to the wrong values, but I don't know +which one(s). Here are my relevant postgresql.conf settings: +shared_buffers = 70000 +work_mem = 9192 +maintenance_work_mem = 131072 +max_fsm_pages = 70000 +fsync = off (temporarily, will be turned back on) +checkpoint_segments = 64 +checkpoint_timeout = 1800 +effective_cache_size = 70000 + +[root@new-server root]# cat /proc/sys/kernel/shmmax +660000000 + +We want to put this into production soon, but this is a showstopper. Can +anyone help me out with this? + + +Thanks + +Ron St.Pierre + +From pgsql-performance-owner@postgresql.org Wed Jun 21 13:21:24 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6F68D9FABE7 + for ; + Wed, 21 Jun 2006 13:21:24 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 13573-05 for + ; + Wed, 21 Jun 2006 13:21:08 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from q1exch01.Q1LABS.INC (Q1EXCH01.Q1Labs.com [205.174.165.4]) + by postgresql.org (Postfix) with ESMTP id B6B669FA9BD + for ; + Wed, 21 Jun 2006 13:21:06 -0300 (ADT) +Received: from q1exch02.Q1LABS.INC ([10.100.50.8]) by q1exch01.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 13:21:06 -0300 +X-PMWin-Version: 2.5.0e, Antispam-Engine: 2.3.0.1, Antivirus-Engine: 2.34.3 +thread-index: AcaVTrJcsvHk6dMFSyayhVly+h+Hbw== +Received: from [10.100.100.123] ([10.100.100.123]) by q1exch02.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 13:21:05 -0300 +From: "jody brownell" +To: "Csaba Nagy" +Subject: Re: Help tuning autovacuum - seeing lots of relationbloat +Content-Class: urn:content-classes:message +Importance: normal +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2663 +Date: Wed, 21 Jun 2006 13:21:05 -0300 +User-Agent: KMail/1.8.3 +Cc: "postgres performance list" +References: <200606211052.43227.jody.brownell@q1labs.com> + <200606211227.06618.jody.brownell@q1labs.com> + <1150904541.3309.38.camel@coppola.muc.ecircle.de> +In-Reply-To: <1150904541.3309.38.camel@coppola.muc.ecircle.de> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-ID: <200606211321.06253.jody.brownell@q1labs.com> +X-OriginalArrivalTime: 21 Jun 2006 16:21:05.0904 (UTC) + FILETIME=[B25C9F00:01C6954E] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/403 +X-Sequence-Number: 19760 + +That is interesting. + +There is one thread keeping a transaction open it appears from ps + +postgres: app app xxx(42644) idle in transaction + +however, I created a test table "t" not configured in pg_autovacuum. I inserted a whack of rows and saw this. + +Jun 21 12:38:45 vanquish postgres[1525]: [8-1] LOG: autovacuum: processing database "qradar" +Jun 21 12:38:45 vanquish postgres[1525]: [9-1] DEBUG: autovac: will VACUUM ANALYZE t +Jun 21 12:38:45 vanquish postgres[1525]: [10-1] DEBUG: vacuuming "public.t" +Jun 21 12:38:48 vanquish postgres[1525]: [11-1] DEBUG: "t": removed 8104311 row versions in 51620 pages +Jun 21 12:38:48 vanquish postgres[1525]: [11-2] DETAIL: CPU 0.93s/0.70u sec elapsed 1.70 sec. +Jun 21 12:38:48 vanquish postgres[1525]: [12-1] DEBUG: "t": found 8104311 removable, 0 nonremovable row versions in 51620 pages +Jun 21 12:38:48 vanquish postgres[1525]: [12-2] DETAIL: 0 dead row versions cannot be removed yet. + +followed a later (after I did a similar insert op on target) by this + +Jun 21 13:00:46 vanquish postgres[3311]: [12-1] LOG: autovacuum: processing database "qradar" +Jun 21 13:00:46 vanquish postgres[3311]: [13-1] DEBUG: autovac: will VACUUM target +Jun 21 13:00:46 vanquish postgres[3311]: [14-1] DEBUG: vacuuming "public.target" +Jun 21 13:01:51 vanquish postgres[3311]: [15-1] DEBUG: index "target_pkey" now contains 1296817 row versions in 25116 pages +Jun 21 13:01:51 vanquish postgres[3311]: [15-2] DETAIL: 5645230 index row versions were removed. +Jun 21 13:01:51 vanquish postgres[3311]: [15-3] ^I116 index pages have been deleted, 60 are currently reusable. +Jun 21 13:01:51 vanquish postgres[3311]: [15-4] ^ICPU 1.29s/7.44u sec elapsed 48.65 sec. +Jun 21 13:02:19 vanquish postgres[3311]: [16-1] DEBUG: index "target_network_key" now contains 1296817 row versions in 19849 pages +Jun 21 13:02:19 vanquish postgres[3311]: [16-2] DETAIL: 5645230 index row versions were removed. +Jun 21 13:02:19 vanquish postgres[3311]: [16-3] ^I32 index pages have been deleted, 0 are currently reusable. +Jun 21 13:02:19 vanquish postgres[3311]: [16-4] ^ICPU 0.89s/6.61u sec elapsed 27.77 sec. +Jun 21 13:02:47 vanquish postgres[3311]: [17-1] DEBUG: index "target_network_details_id_idx" now contains 1296817 row versions in 23935 pages +Jun 21 13:02:47 vanquish postgres[3311]: [17-2] DETAIL: 5645230 index row versions were removed. +Jun 21 13:02:47 vanquish postgres[3311]: [17-3] ^I17814 index pages have been deleted, 0 are currently reusable. +Jun 21 13:02:47 vanquish postgres[3311]: [17-4] ^ICPU 0.93s/7.52u sec elapsed 27.36 sec. +Jun 21 13:03:23 vanquish postgres[3311]: [18-1] DEBUG: index "target_tulu_idx" now contains 1296817 row versions in 24341 pages +Jun 21 13:03:23 vanquish postgres[3311]: [18-2] DETAIL: 5645230 index row versions were removed. +Jun 21 13:03:23 vanquish postgres[3311]: [18-3] ^I18495 index pages have been deleted, 0 are currently reusable. +Jun 21 13:03:23 vanquish postgres[3311]: [18-4] ^ICPU 1.37s/5.38u sec elapsed 36.95 sec. +Jun 21 13:04:04 vanquish postgres[3311]: [19-1] DEBUG: "target": removed 5645231 row versions in 106508 pages +Jun 21 13:04:04 vanquish postgres[3311]: [19-2] DETAIL: CPU 3.37s/1.23u sec elapsed 40.63 sec. +Jun 21 13:04:04 vanquish postgres[3311]: [20-1] DEBUG: "target": found 5645231 removable, 1296817 nonremovable row versions in 114701 pages +Jun 21 13:04:04 vanquish postgres[3311]: [20-2] DETAIL: 0 dead row versions cannot be removed yet. + +this was with the "Idle in transaction" though..... + +Ah HA! Wondering, my autovacuum naptime is 60 seconds, that is also the interval which I wake up and begin persistence. +Wondering if I am simply locking autovacuum out of the tables b/c they are on a similar timeline. + +I will try a 30 second naptime, if this is it, that should increase the likely hood of falling on the right side of the TX more often. + +make sense? + + +On Wednesday 21 June 2006 12:42, Csaba Nagy wrote: +> On Wed, 2006-06-21 at 17:27, jody brownell wrote: +> > Our application is broken down quite well. We have two main writing processes +> > writing to two separate sets of tables. No crossing over, nothign to prohibit the +> > vacuuming in the nature which you describe. +> +> It really doesn't matter what table are you touching, as it doesn't +> matter if you read or write either, what matters is how long ago was the +> last "begin" without "commit" or "rollback". VACUUM will not touch +> tuples which were deleted after the oldest not yet finished transaction +> started, regardless if that transaction touched the vacuumed table or +> not in any way... +> +> > My longest transaction on the tables in question are typically quite short until +> > of course they begin to bloat. +> +> Well, your application might be completely well behaved and still your +> DBA (or your favorite DB access tool for that matter) can leave open +> transactions in an interactive session. It never hurts to check if you +> actually have "idle in transaction" sessions. It happened a few times to +> us, some of those were bad coding on ad-hoc tools written by us, others +> were badly behaved DB access tools opening a transaction immediately +> after connect and after each successful command, effectively leaving an +> open transaction when leaving it open while having lunch... +> +> So it might very well be that some interactive or ad hoc tools you're +> using to manage the DB are your problem. +> +> Cheers, +> Csaba. +> +> +> + +From pgsql-performance-owner@postgresql.org Wed Jun 21 13:34:07 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 519579FA65C + for ; + Wed, 21 Jun 2006 13:34:07 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 18292-01 for + ; + Wed, 21 Jun 2006 13:34:00 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from q1exch01.Q1LABS.INC (Q1EXCH01.Q1Labs.com [205.174.165.4]) + by postgresql.org (Postfix) with ESMTP id CD0FE9FB1BC + for ; + Wed, 21 Jun 2006 13:33:59 -0300 (ADT) +Received: from q1exch02.Q1LABS.INC ([10.100.50.8]) by q1exch01.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 13:33:59 -0300 +X-PMWin-Version: 2.5.0e, Antispam-Engine: 2.3.0.1, Antivirus-Engine: 2.34.3 +thread-index: AcaVUH74jyate1AJRc6JIgROC/aOiw== +Received: from [10.100.100.123] ([10.100.100.123]) by q1exch02.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 13:33:58 -0300 +From: "jody brownell" +To: +Subject: Re: Help tuning autovacuum - seeing lots of relationbloat +Content-Class: urn:content-classes:message +Importance: normal +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2663 +Date: Wed, 21 Jun 2006 13:33:58 -0300 +User-Agent: KMail/1.8.3 +Cc: "Csaba Nagy" +References: <200606211052.43227.jody.brownell@q1labs.com> + <1150904541.3309.38.camel@coppola.muc.ecircle.de> + <200606211321.06253.jody.brownell@q1labs.com> +In-Reply-To: <200606211321.06253.jody.brownell@q1labs.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-ID: <200606211333.59034.jody.brownell@q1labs.com> +X-OriginalArrivalTime: 21 Jun 2006 16:33:58.0659 (UTC) + FILETIME=[7EF5AD30:01C69550] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/404 +X-Sequence-Number: 19761 + +Opps - that was confusing. The idle in transaction was from one box and the autovacuum was from another. + +So, one question was answered, auto vacuum is running and selecting the tables but apparently not at the +same time as my app probably due to this "idle in transaction". I will track it down and see what the difference is. + +thanks + +On Wednesday 21 June 2006 13:21, jody brownell wrote: +> That is interesting. +> +> There is one thread keeping a transaction open it appears from ps +> +> postgres: app app xxx(42644) idle in transaction +> +> however, I created a test table "t" not configured in pg_autovacuum. I inserted a whack of rows and saw this. +> +> Jun 21 12:38:45 vanquish postgres[1525]: [8-1] LOG: autovacuum: processing database "qradar" +> Jun 21 12:38:45 vanquish postgres[1525]: [9-1] DEBUG: autovac: will VACUUM ANALYZE t +> Jun 21 12:38:45 vanquish postgres[1525]: [10-1] DEBUG: vacuuming "public.t" +> Jun 21 12:38:48 vanquish postgres[1525]: [11-1] DEBUG: "t": removed 8104311 row versions in 51620 pages +> Jun 21 12:38:48 vanquish postgres[1525]: [11-2] DETAIL: CPU 0.93s/0.70u sec elapsed 1.70 sec. +> Jun 21 12:38:48 vanquish postgres[1525]: [12-1] DEBUG: "t": found 8104311 removable, 0 nonremovable row versions in 51620 pages +> Jun 21 12:38:48 vanquish postgres[1525]: [12-2] DETAIL: 0 dead row versions cannot be removed yet. +> +> followed a later (after I did a similar insert op on target) by this +> +> Jun 21 13:00:46 vanquish postgres[3311]: [12-1] LOG: autovacuum: processing database "qradar" +> Jun 21 13:00:46 vanquish postgres[3311]: [13-1] DEBUG: autovac: will VACUUM target +> Jun 21 13:00:46 vanquish postgres[3311]: [14-1] DEBUG: vacuuming "public.target" +> Jun 21 13:01:51 vanquish postgres[3311]: [15-1] DEBUG: index "target_pkey" now contains 1296817 row versions in 25116 pages +> Jun 21 13:01:51 vanquish postgres[3311]: [15-2] DETAIL: 5645230 index row versions were removed. +> Jun 21 13:01:51 vanquish postgres[3311]: [15-3] ^I116 index pages have been deleted, 60 are currently reusable. +> Jun 21 13:01:51 vanquish postgres[3311]: [15-4] ^ICPU 1.29s/7.44u sec elapsed 48.65 sec. +> Jun 21 13:02:19 vanquish postgres[3311]: [16-1] DEBUG: index "target_network_key" now contains 1296817 row versions in 19849 pages +> Jun 21 13:02:19 vanquish postgres[3311]: [16-2] DETAIL: 5645230 index row versions were removed. +> Jun 21 13:02:19 vanquish postgres[3311]: [16-3] ^I32 index pages have been deleted, 0 are currently reusable. +> Jun 21 13:02:19 vanquish postgres[3311]: [16-4] ^ICPU 0.89s/6.61u sec elapsed 27.77 sec. +> Jun 21 13:02:47 vanquish postgres[3311]: [17-1] DEBUG: index "target_network_details_id_idx" now contains 1296817 row versions in 23935 pages +> Jun 21 13:02:47 vanquish postgres[3311]: [17-2] DETAIL: 5645230 index row versions were removed. +> Jun 21 13:02:47 vanquish postgres[3311]: [17-3] ^I17814 index pages have been deleted, 0 are currently reusable. +> Jun 21 13:02:47 vanquish postgres[3311]: [17-4] ^ICPU 0.93s/7.52u sec elapsed 27.36 sec. +> Jun 21 13:03:23 vanquish postgres[3311]: [18-1] DEBUG: index "target_tulu_idx" now contains 1296817 row versions in 24341 pages +> Jun 21 13:03:23 vanquish postgres[3311]: [18-2] DETAIL: 5645230 index row versions were removed. +> Jun 21 13:03:23 vanquish postgres[3311]: [18-3] ^I18495 index pages have been deleted, 0 are currently reusable. +> Jun 21 13:03:23 vanquish postgres[3311]: [18-4] ^ICPU 1.37s/5.38u sec elapsed 36.95 sec. +> Jun 21 13:04:04 vanquish postgres[3311]: [19-1] DEBUG: "target": removed 5645231 row versions in 106508 pages +> Jun 21 13:04:04 vanquish postgres[3311]: [19-2] DETAIL: CPU 3.37s/1.23u sec elapsed 40.63 sec. +> Jun 21 13:04:04 vanquish postgres[3311]: [20-1] DEBUG: "target": found 5645231 removable, 1296817 nonremovable row versions in 114701 pages +> Jun 21 13:04:04 vanquish postgres[3311]: [20-2] DETAIL: 0 dead row versions cannot be removed yet. +> +> this was with the "Idle in transaction" though..... +> +> Ah HA! Wondering, my autovacuum naptime is 60 seconds, that is also the interval which I wake up and begin persistence. +> Wondering if I am simply locking autovacuum out of the tables b/c they are on a similar timeline. +> +> I will try a 30 second naptime, if this is it, that should increase the likely hood of falling on the right side of the TX more often. +> +> make sense? +> +> +> On Wednesday 21 June 2006 12:42, Csaba Nagy wrote: +> > On Wed, 2006-06-21 at 17:27, jody brownell wrote: +> > > Our application is broken down quite well. We have two main writing processes +> > > writing to two separate sets of tables. No crossing over, nothign to prohibit the +> > > vacuuming in the nature which you describe. +> > +> > It really doesn't matter what table are you touching, as it doesn't +> > matter if you read or write either, what matters is how long ago was the +> > last "begin" without "commit" or "rollback". VACUUM will not touch +> > tuples which were deleted after the oldest not yet finished transaction +> > started, regardless if that transaction touched the vacuumed table or +> > not in any way... +> > +> > > My longest transaction on the tables in question are typically quite short until +> > > of course they begin to bloat. +> > +> > Well, your application might be completely well behaved and still your +> > DBA (or your favorite DB access tool for that matter) can leave open +> > transactions in an interactive session. It never hurts to check if you +> > actually have "idle in transaction" sessions. It happened a few times to +> > us, some of those were bad coding on ad-hoc tools written by us, others +> > were badly behaved DB access tools opening a transaction immediately +> > after connect and after each successful command, effectively leaving an +> > open transaction when leaving it open while having lunch... +> > +> > So it might very well be that some interactive or ad hoc tools you're +> > using to manage the DB are your problem. +> > +> > Cheers, +> > Csaba. +> > +> > +> > +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 5: don't forget to increase your free space map settings +> + +From pgsql-performance-owner@postgresql.org Wed Jun 21 13:36:56 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7100D9FA65C + for ; + Wed, 21 Jun 2006 13:36:56 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 18422-03 for + ; + Wed, 21 Jun 2006 13:36:41 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.ecircle.de (mail.ecircle.de [195.140.186.200]) + by postgresql.org (Postfix) with ESMTP id 6C9869FB1BC + for ; + Wed, 21 Jun 2006 13:36:40 -0300 (ADT) +Received: from einstein.muc.ecircle.de (einstein.muc.ecircle.de [192.168.1.7]) + by mail.ecircle.de (READY) with ESMTP id 77C7955C005; + Wed, 21 Jun 2006 18:36:39 +0200 (CEST) +Received: from [192.168.1.91] ([192.168.1.91]) by einstein.muc.ecircle.de with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 18:37:00 +0200 +Subject: Re: Help tuning autovacuum - seeing lots of relationbloat +From: Csaba Nagy +To: jody brownell +Cc: postgres performance list +In-Reply-To: <200606211321.06253.jody.brownell@q1labs.com> +References: <200606211052.43227.jody.brownell@q1labs.com> + <200606211227.06618.jody.brownell@q1labs.com> + <1150904541.3309.38.camel@coppola.muc.ecircle.de> + <200606211321.06253.jody.brownell@q1labs.com> +Content-Type: text/plain +Message-Id: <1150907799.3309.53.camel@coppola.muc.ecircle.de> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Wed, 21 Jun 2006 18:36:39 +0200 +Content-Transfer-Encoding: 7bit +X-OriginalArrivalTime: 21 Jun 2006 16:37:00.0059 (UTC) + FILETIME=[EB151EB0:01C69550] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/405 +X-Sequence-Number: 19762 + +On Wed, 2006-06-21 at 18:21, jody brownell wrote: +> That is interesting. +> +> There is one thread keeping a transaction open it appears from ps +> +> postgres: app app xxx(42644) idle in transaction + +That shouldn't be a problem on itself, "idle in transaction" happens all +the time between 2 commands in the same transaction... you only have a +problem if you see the same PID always "idle", that means somebody left +an open transaction and left for lunch. + +[snip] +> this was with the "Idle in transaction" though..... + +This probably means you don't have long running transactions currently. +However, if you happen to have just one such long transaction, the dead +space accumulates and normal vacuum will not be able to clean that +anymore. But I guess if you didn't find one now then you should take a +look at Tom's suggestion and bump up debug level to see if autovacuum +picks your table at all... + +> Ah HA! Wondering, my autovacuum naptime is 60 seconds, that is also the interval which I wake up and begin persistence. +> Wondering if I am simply locking autovacuum out of the tables b/c they are on a similar timeline. +> +> I will try a 30 second naptime, if this is it, that should increase the likely hood of falling on the right side of the TX more often. +> +> make sense? + +I don't think that's your problem... vacuum wouldn't be locked out by +any activity which doesn't lock exclusively the table (and I guess +you're not doing that). If your persistence finishes quickly then that's +not the problem. + +Oh, just occured to me... in order to use autovacuum you also need to +enable the statistics collector on row level: + +stats_start_collector = on +stats_row_level = on + +See also: +http://www.postgresql.org/docs/8.1/static/maintenance.html#AUTOVACUUM + +This was not mentioned in the settings in your original post, so I guess +you didn't touch that, and I think they are disabled by default. + +If this is disabled, you should enable it and "pg_ctl reload ....", that +should fix the problem. + +Cheers, +Csaba. + + + +From pgsql-performance-owner@postgresql.org Wed Jun 21 13:39:40 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4CB109FA65C + for ; + Wed, 21 Jun 2006 13:39:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 16911-10 for + ; + Wed, 21 Jun 2006 13:39:34 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from q1exch01.Q1LABS.INC (Q1EXCH01.Q1Labs.com [205.174.165.4]) + by postgresql.org (Postfix) with ESMTP id EC8B09F9CC1 + for ; + Wed, 21 Jun 2006 13:39:33 -0300 (ADT) +Received: from q1exch02.Q1LABS.INC ([10.100.50.8]) by q1exch01.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 13:39:33 -0300 +X-PMWin-Version: 2.5.0e, Antispam-Engine: 2.3.0.1, Antivirus-Engine: 2.34.3 +thread-index: AcaVUUYvS38GLVVeQqqAk9IvMH7y5Q== +Received: from [10.100.100.123] ([10.100.100.123]) by q1exch02.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 13:39:32 -0300 +From: "jody brownell" +To: "Csaba Nagy" +Subject: Re: Help tuning autovacuum - seeing lots of relationbloat +Content-Class: urn:content-classes:message +Importance: normal +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2663 +Date: Wed, 21 Jun 2006 13:39:33 -0300 +User-Agent: KMail/1.8.3 +Cc: "postgres performance list" +References: <200606211052.43227.jody.brownell@q1labs.com> + <200606211321.06253.jody.brownell@q1labs.com> + <1150907799.3309.53.camel@coppola.muc.ecircle.de> +In-Reply-To: <1150907799.3309.53.camel@coppola.muc.ecircle.de> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-ID: <200606211339.33262.jody.brownell@q1labs.com> +X-OriginalArrivalTime: 21 Jun 2006 16:39:32.0889 (UTC) + FILETIME=[462D2090:01C69551] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/406 +X-Sequence-Number: 19763 + +that is exactly what I am seeing, one process, no change, always in idle while the others are constantly +changing their state. + +looks like someone opened a tx then is blocking on a queue lock or something. dang. + + + +On Wednesday 21 June 2006 13:36, Csaba Nagy wrote: +> On Wed, 2006-06-21 at 18:21, jody brownell wrote: +> > That is interesting. +> > +> > There is one thread keeping a transaction open it appears from ps +> > +> > postgres: app app xxx(42644) idle in transaction +> +> That shouldn't be a problem on itself, "idle in transaction" happens all +> the time between 2 commands in the same transaction... you only have a +> problem if you see the same PID always "idle", that means somebody left +> an open transaction and left for lunch. +> +> [snip] +> > this was with the "Idle in transaction" though..... +> +> This probably means you don't have long running transactions currently. +> However, if you happen to have just one such long transaction, the dead +> space accumulates and normal vacuum will not be able to clean that +> anymore. But I guess if you didn't find one now then you should take a +> look at Tom's suggestion and bump up debug level to see if autovacuum +> picks your table at all... +> +> > Ah HA! Wondering, my autovacuum naptime is 60 seconds, that is also the interval which I wake up and begin persistence. +> > Wondering if I am simply locking autovacuum out of the tables b/c they are on a similar timeline. +> > +> > I will try a 30 second naptime, if this is it, that should increase the likely hood of falling on the right side of the TX more often. +> > +> > make sense? +> +> I don't think that's your problem... vacuum wouldn't be locked out by +> any activity which doesn't lock exclusively the table (and I guess +> you're not doing that). If your persistence finishes quickly then that's +> not the problem. +> +> Oh, just occured to me... in order to use autovacuum you also need to +> enable the statistics collector on row level: +> +> stats_start_collector = on +> stats_row_level = on +> +> See also: +> http://www.postgresql.org/docs/8.1/static/maintenance.html#AUTOVACUUM +> +> This was not mentioned in the settings in your original post, so I guess +> you didn't touch that, and I think they are disabled by default. +> +> If this is disabled, you should enable it and "pg_ctl reload ....", that +> should fix the problem. +> +> Cheers, +> Csaba. +> +> +> + +From pgsql-performance-owner@postgresql.org Wed Jun 21 13:44:52 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5A8959F9CC1 + for ; + Wed, 21 Jun 2006 13:44:52 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 17984-08 for + ; + Wed, 21 Jun 2006 13:44:40 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.ecircle.de (mail.ecircle.de [195.140.186.200]) + by postgresql.org (Postfix) with ESMTP id 531F49FA65C + for ; + Wed, 21 Jun 2006 13:44:40 -0300 (ADT) +Received: from einstein.muc.ecircle.de (einstein.muc.ecircle.de [192.168.1.7]) + by mail.ecircle.de (READY) with ESMTP id 796EB55C003; + Wed, 21 Jun 2006 18:44:39 +0200 (CEST) +Received: from [192.168.1.91] ([192.168.1.91]) by einstein.muc.ecircle.de with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 18:45:00 +0200 +Subject: Re: Help tuning autovacuum - seeing lots of relationbloat +From: Csaba Nagy +To: jody brownell +Cc: postgres performance list +In-Reply-To: <200606211339.33262.jody.brownell@q1labs.com> +References: <200606211052.43227.jody.brownell@q1labs.com> + <200606211321.06253.jody.brownell@q1labs.com> + <1150907799.3309.53.camel@coppola.muc.ecircle.de> + <200606211339.33262.jody.brownell@q1labs.com> +Content-Type: text/plain +Message-Id: <1150908279.3309.56.camel@coppola.muc.ecircle.de> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Wed, 21 Jun 2006 18:44:39 +0200 +Content-Transfer-Encoding: 7bit +X-OriginalArrivalTime: 21 Jun 2006 16:45:00.0068 (UTC) + FILETIME=[0930AE40:01C69552] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/407 +X-Sequence-Number: 19764 + +On Wed, 2006-06-21 at 18:39, jody brownell wrote: +> that is exactly what I am seeing, one process, no change, always in idle while the others are constantly +> changing their state. +> +> looks like someone opened a tx then is blocking on a queue lock or something. dang. + +Don't forget to check the statistics collector settings (see below), if +that is not correct then autovacuum is indeed not working correctly... I +should have put that on the beginning of the mail so you won't overlook +it ;-) + +> > +> > Oh, just occured to me... in order to use autovacuum you also need to +> > enable the statistics collector on row level: +> > +> > stats_start_collector = on +> > stats_row_level = on +> > +> > See also: +> > http://www.postgresql.org/docs/8.1/static/maintenance.html#AUTOVACUUM +> > +> > This was not mentioned in the settings in your original post, so I guess +> > you didn't touch that, and I think they are disabled by default. +> > +> > If this is disabled, you should enable it and "pg_ctl reload ....", that +> > should fix the problem. +> > +> > Cheers, +> > Csaba. + + + + +From pgsql-performance-owner@postgresql.org Wed Jun 21 13:50:00 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D5B389F9CC1 + for ; + Wed, 21 Jun 2006 13:49:59 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 19090-07 for + ; + Wed, 21 Jun 2006 13:49:54 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from q1exch01.Q1LABS.INC (Q1EXCH01.Q1Labs.com [205.174.165.4]) + by postgresql.org (Postfix) with ESMTP id 173A99FA65C + for ; + Wed, 21 Jun 2006 13:49:50 -0300 (ADT) +Received: from q1exch02.Q1LABS.INC ([10.100.50.8]) by q1exch01.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 13:49:49 -0300 +X-PMWin-Version: 2.5.0e, Antispam-Engine: 2.3.0.1, Antivirus-Engine: 2.34.3 +thread-index: AcaVUrVuOfNxGKVBT6O9+wR2bbQMXg== +Received: from [10.100.100.123] ([10.100.100.123]) by q1exch02.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 13:49:48 -0300 +From: "jody brownell" +To: "Csaba Nagy" +Subject: Re: Help tuning autovacuum - seeing lots of relationbloat +Content-Class: urn:content-classes:message +Importance: normal +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2663 +Date: Wed, 21 Jun 2006 13:49:49 -0300 +User-Agent: KMail/1.8.3 +Cc: "postgres performance list" +References: <200606211052.43227.jody.brownell@q1labs.com> + <200606211339.33262.jody.brownell@q1labs.com> + <1150908279.3309.56.camel@coppola.muc.ecircle.de> +In-Reply-To: <1150908279.3309.56.camel@coppola.muc.ecircle.de> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-ID: <200606211349.49305.jody.brownell@q1labs.com> +X-OriginalArrivalTime: 21 Jun 2006 16:49:48.0975 (UTC) + FILETIME=[B56463F0:01C69552] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/408 +X-Sequence-Number: 19765 + +block and row are always configured on - they are my friend :) + +thanks +On Wednesday 21 June 2006 13:44, Csaba Nagy wrote: +> On Wed, 2006-06-21 at 18:39, jody brownell wrote: +> > that is exactly what I am seeing, one process, no change, always in idle while the others are constantly +> > changing their state. +> > +> > looks like someone opened a tx then is blocking on a queue lock or something. dang. +> +> Don't forget to check the statistics collector settings (see below), if +> that is not correct then autovacuum is indeed not working correctly... I +> should have put that on the beginning of the mail so you won't overlook +> it ;-) +> +> > > +> > > Oh, just occured to me... in order to use autovacuum you also need to +> > > enable the statistics collector on row level: +> > > +> > > stats_start_collector = on +> > > stats_row_level = on +> > > +> > > See also: +> > > http://www.postgresql.org/docs/8.1/static/maintenance.html#AUTOVACUUM +> > > +> > > This was not mentioned in the settings in your original post, so I guess +> > > you didn't touch that, and I think they are disabled by default. +> > > +> > > If this is disabled, you should enable it and "pg_ctl reload ....", that +> > > should fix the problem. +> > > +> > > Cheers, +> > > Csaba. +> +> +> +> + +From pgsql-performance-owner@postgresql.org Wed Jun 21 14:03:59 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E1BE49FA65C + for ; + Wed, 21 Jun 2006 14:03:58 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 20096-07 for + ; + Wed, 21 Jun 2006 14:03:50 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 398D69F9CC1 + for ; + Wed, 21 Jun 2006 14:03:48 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Wed, 21 Jun 2006 17:03:41 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 21 Jun 2006 12:03:41 -0500 +Subject: Re: Speeding up query, Joining 55mil and 43mil records. +From: Scott Marlowe +To: nicky +Cc: pgsql-performance@postgresql.org +In-Reply-To: <44994DE7.5070801@valuecare.nl> +References: <44994DE7.5070801@valuecare.nl> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1150909421.26538.135.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Wed, 21 Jun 2006 12:03:41 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/409 +X-Sequence-Number: 19766 + +On Wed, 2006-06-21 at 08:47, nicky wrote: +> Hello People, + +SNIPPAGE + +> The query above takes around 42 minutes. +> +> However, i also have a wimpy desktop machine with 1gb ram. Windows +> with MSSQL 2000 (default installation), same database structure, same +> indexes, same query, etc and it takes 17 minutes. The big difference +> makes me think that i've made an error with my PostgreSQL +> configuration. I just can't seem to figure it out. + +What is the difference between the two plans (i.e. explain on both boxes +and compare) + +From pgsql-performance-owner@postgresql.org Wed Jun 21 14:12:24 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id F2B919FB1BC + for ; + Wed, 21 Jun 2006 14:12:23 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 20366-08 for + ; + Wed, 21 Jun 2006 14:12:16 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 28F659FA65C + for ; + Wed, 21 Jun 2006 14:12:14 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5LHCBec011648; + Wed, 21 Jun 2006 13:12:11 -0400 (EDT) +To: Scott Marlowe +cc: nicky , pgsql-performance@postgresql.org +Subject: Re: Speeding up query, Joining 55mil and 43mil records. +In-reply-to: <1150909421.26538.135.camel@state.g2switchworks.com> +References: <44994DE7.5070801@valuecare.nl> + <1150909421.26538.135.camel@state.g2switchworks.com> +Comments: In-reply-to Scott Marlowe + message dated "Wed, 21 Jun 2006 12:03:41 -0500" +Date: Wed, 21 Jun 2006 13:12:11 -0400 +Message-ID: <11647.1150909931@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/410 +X-Sequence-Number: 19767 + +Scott Marlowe writes: +> What is the difference between the two plans (i.e. explain on both boxes +> and compare) + +Even more to the point, let's see EXPLAIN ANALYZE output from both boxes... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Jun 21 15:26:38 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id EBC219FA65C + for ; + Wed, 21 Jun 2006 15:26:37 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 32918-04 for + ; + Wed, 21 Jun 2006 15:26:25 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail6.sea5.speakeasy.net (mail6.sea5.speakeasy.net + [69.17.117.8]) by postgresql.org (Postfix) with ESMTP id A4B889F9CC1 + for ; + Wed, 21 Jun 2006 15:26:24 -0300 (ADT) +Received: (qmail 10140 invoked from network); 21 Jun 2006 18:26:20 -0000 +Received: from dsl093-038-250.pdx1.dsl.speakeasy.net (HELO [192.168.1.21]) + (davidw@[66.93.38.250]) (envelope-sender ) + by mail6.sea5.speakeasy.net (qmail-ldap-1.03) with RC4-SHA encrypted + SMTP + for ; 21 Jun 2006 18:26:20 -0000 +Mime-Version: 1.0 (Apple Message framework v750) +Content-Transfer-Encoding: 7bit +Message-Id: <54D833BE-A58F-47B8-B070-2AEDC0802468@kineticode.com> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +To: PostgreSQL Performance List +From: David Wheeler +Subject: Performance of DOMAINs +Date: Wed, 21 Jun 2006 11:26:16 -0700 +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/411 +X-Sequence-Number: 19768 + +Howdy, + +Didn't see anything in the archives, so I thought I'd ask: has anyone +done any work to gauge the performance penalty of using DOMAINs? I'm +thinking of something like Elein's email DOMAIN: + + http://www.varlena.com/GeneralBits/ + +I figured that most simple domains that have a constraint check are +no faster or slower than tables with constraints that validate a +particular column. Is that the case? + +But I'm also interested in how Elein made the email domain case- +insensitive, since I'd like to have/create a truly case-insensitive +text type (ITEXT anyone?). The functions for the operator class there +were mainly written in SQL, and if it adds a significant overhead, +I'm not sure it'd be a good idea to use that approach for a case- +insensitive text type, since I use it quite a lot in my apps, and +often do LIKE queries against text data. Thoughts? + +Many TIA, + +David + +From pgsql-performance-owner@postgresql.org Wed Jun 21 15:33:16 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D88429FA65C + for ; + Wed, 21 Jun 2006 15:33:15 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 33971-03 for + ; + Wed, 21 Jun 2006 15:33:08 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 0ACBC9F9CC1 + for ; + Wed, 21 Jun 2006 15:33:07 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id AE18656481; Wed, 21 Jun 2006 13:33:06 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Wed, 21 Jun 2006 13:33:05 -0500 +Date: Wed, 21 Jun 2006 13:33:05 -0500 +From: "Jim C. Nasby" +To: "Merkel Marcel (CR/AEM4)" +Cc: pgsql-performance@postgresql.org +Subject: Re: Big array speed issues +Message-ID: <20060621183305.GB93655@pervasive.com> +References: + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060621:marcel.merkel@de.bosch.com::/h4lFm1yoN8ppC/+:00000000000 + 000000000000000000000000CIcV +X-Hashcash: + 1:20:060621:pgsql-performance@postgresql.org::/AFNu85tRIMgHATj:00000 + 0000000000000000000000003XIs +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/412 +X-Sequence-Number: 19769 + +On Wed, Jun 21, 2006 at 09:29:03AM +0200, Merkel Marcel (CR/AEM4) wrote: +> +> +> Von: Merlin Moncure [mailto:mmoncure@gmail.com] +> An: Merkel Marcel (CR/AEM4) +> Cc: pgsql-performance@postgresql.org +> Betreff: Re: [PERFORM] Big array speed issues +> +> On 6/20/06, Merkel Marcel (CR/AEM4) wrote: +> +> > I use libpqxx to access the database. This might be another +> bottleneck, but +> > I assume my query and table setup is the bigger bottleneck. Would it +> make +> > sense to fetch the whole array ? (Select map from table where ... and +> parse +> > the array manually) +> +> have you tried similar approach without using arrays? +> +> Merlin +> +> +> Not yet. I would first like to know what is the time consuming part and +> what is a work around. If you are sure individual columns for every +> entry of the array solve the issue I will joyfully implement it. The +> downsize of this approch is that the array dimensions are not always the +> same in my scenario. But I have a workaround in mind for this issue. + +Before mucking about with the code, I'd absolutely try 8.1. I've +generally seen it double the performance of 7.4. + +Also, output from EXPLAIN ANALYZE would make it a lot easier to figure +out what the issue is, and it would be good to try this without +selecting any of the arrays. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Wed Jun 21 15:48:18 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3EC119FA65C + for ; + Wed, 21 Jun 2006 15:48:18 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 36362-03 for + ; + Wed, 21 Jun 2006 15:48:07 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 7F0FC9F9CC1 + for ; + Wed, 21 Jun 2006 15:48:06 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 41AAB56482; Wed, 21 Jun 2006 13:48:04 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Wed, 21 Jun 2006 13:48:03 -0500 +Date: Wed, 21 Jun 2006 13:48:03 -0500 +From: "Jim C. Nasby" +To: nicky +Cc: pgsql-performance@postgresql.org +Subject: Re: Speeding up query, Joining 55mil and 43mil records. +Message-ID: <20060621184803.GC93655@pervasive.com> +References: <44994DE7.5070801@valuecare.nl> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <44994DE7.5070801@valuecare.nl> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060621:nicky@valuecare.nl::3Rw0ynAfVznpJun1:0000000000000000000 + 0000000000000000000000002OP9 +X-Hashcash: + 1:20:060621:pgsql-performance@postgresql.org::HsYnSw5oRY4Za+B8:00000 + 0000000000000000000000001oRh +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/413 +X-Sequence-Number: 19770 + +On Wed, Jun 21, 2006 at 03:47:19PM +0200, nicky wrote: +> WHERE substr(t0.code,1,2) not in ('14','15','16','17') +> AND (substr(t0.correctie,4,1) <> '1' OR t0.correctie is null) +> AND EXTRACT(YEAR from t1.datum) > 2004; + +How much data do you expect to be getting back from that where clause? +Unless you plan on inserting most of the table, some well-placed indexes +would probably help, and fixing the datum portion might as well +(depending on how far back the data goes). Specifically: + +CREATE INDEX t0_code_partial ON t0(substr(code,1,2)); +(yeah, I know t0 is an alias, but I already snipped the table name) + +and + +AND t1.datum >= '1/1/2005' + +(might need to cast that to a date or whatever). +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Wed Jun 21 15:58:03 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id AC18E9FA65C + for ; + Wed, 21 Jun 2006 15:58:02 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 33977-10 for + ; + Wed, 21 Jun 2006 15:57:56 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id CFDDD9F9CC1 + for ; + Wed, 21 Jun 2006 15:57:55 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 373C25647C; Wed, 21 Jun 2006 13:57:53 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Wed, 21 Jun 2006 13:57:53 -0500 +Date: Wed, 21 Jun 2006 13:57:53 -0500 +From: "Jim C. Nasby" +To: jody brownell +Cc: pgsql-performance@postgresql.org +Subject: Re: Help tuning autovacuum - seeing lots of relation bloat +Message-ID: <20060621185752.GD93655@pervasive.com> +References: <200606211052.43227.jody.brownell@q1labs.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <200606211052.43227.jody.brownell@q1labs.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060621:jody.brownell@q1labs.com::HENsyWoSEXuzHXn6:0000000000000 + 0000000000000000000000000LDv +X-Hashcash: + 1:20:060621:pgsql-performance@postgresql.org::s1q3wOywVpwR2o8h:00000 + 0000000000000000000000000l1l +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/414 +X-Sequence-Number: 19771 + +On Wed, Jun 21, 2006 at 10:52:42AM -0300, jody brownell wrote: +> A db wide vacuum full outputs this at the end. +> +> INFO: free space map contains 32848 pages in 159 relations +> DETAIL: A total of 24192 page slots are in use (including overhead). +> 24192 page slots are required to track all free space. +> Current limits are: 4024000 page slots, 2000 relations, using 23705 KB. + +FWIW, the tail end of a db-wide vacuum FULL doesn't provide useful info +about FSM utilization, because it just made everything as compact as +possible. + +My suspicion is that it's taking too long for autovac to get around to +this database/table. Dropping the sleep time might help. I see that this +table is vacuumed with a delay setting of 0, but if there are other +tables with a high delay that could pose a problem. + +Getting detailed output of what autovac is actually doing as Tom +suggested would be a good idea. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Wed Jun 21 16:03:00 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 9B05E9F9CC1 + for ; + Wed, 21 Jun 2006 16:02:59 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 37673-01 for + ; + Wed, 21 Jun 2006 16:02:45 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 2CD179FB1C0 + for ; + Wed, 21 Jun 2006 16:02:45 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 747F756458; Wed, 21 Jun 2006 14:02:43 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Wed, 21 Jun 2006 14:02:43 -0500 +Date: Wed, 21 Jun 2006 14:02:43 -0500 +From: "Jim C. Nasby" +To: David Wheeler +Cc: PostgreSQL Performance List +Subject: Re: Performance of DOMAINs +Message-ID: <20060621190243.GE93655@pervasive.com> +References: <54D833BE-A58F-47B8-B070-2AEDC0802468@kineticode.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <54D833BE-A58F-47B8-B070-2AEDC0802468@kineticode.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060621:david@kineticode.com::5cht1hqIp0jupcJt:00000000000000000 + 00000000000000000000000001a0 +X-Hashcash: + 1:20:060621:pgsql-performance@postgresql.org::Moqa9k8SognTMDI2:00000 + 0000000000000000000000000nJe +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/415 +X-Sequence-Number: 19772 + +On Wed, Jun 21, 2006 at 11:26:16AM -0700, David Wheeler wrote: +> Howdy, +> +> Didn't see anything in the archives, so I thought I'd ask: has anyone +> done any work to gauge the performance penalty of using DOMAINs? I'm +> thinking of something like Elein's email DOMAIN: +> +> http://www.varlena.com/GeneralBits/ +> +> I figured that most simple domains that have a constraint check are +> no faster or slower than tables with constraints that validate a +> particular column. Is that the case? + +Probably. Only thing that might pose a difference is if you're doing a +lot of manipulating of the domain that didn't involve table access; +presumably PostgreSQL will perform the checks every time you cast +something to a domain. + +> But I'm also interested in how Elein made the email domain case- +> insensitive, since I'd like to have/create a truly case-insensitive +> text type (ITEXT anyone?). The functions for the operator class there + +http://gborg.postgresql.org/project/citext/projdisplay.php + +> were mainly written in SQL, and if it adds a significant overhead, +> I'm not sure it'd be a good idea to use that approach for a case- +> insensitive text type, since I use it quite a lot in my apps, and +> often do LIKE queries against text data. Thoughts? +> +> Many TIA, +> +> David +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: In versions below 8.0, the planner will ignore your desire to +> choose an index scan if your joining column's datatypes do not +> match +> + +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Wed Jun 21 16:38:38 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6A78F9FA65C + for ; + Wed, 21 Jun 2006 16:38:38 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 40418-06 for + ; + Wed, 21 Jun 2006 16:38:28 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id E18D59F9CC1 + for ; + Wed, 21 Jun 2006 16:38:25 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id A56E356450; Wed, 21 Jun 2006 14:38:24 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Wed, 21 Jun 2006 14:38:24 -0500 +Date: Wed, 21 Jun 2006 14:38:24 -0500 +From: "Jim C. Nasby" +To: jody brownell +Cc: Csaba Nagy , + postgres performance list +Subject: Re: Help tuning autovacuum - seeing lots of relationbloat +Message-ID: <20060621193823.GI93655@pervasive.com> +References: <200606211052.43227.jody.brownell@q1labs.com> + <200606211227.06618.jody.brownell@q1labs.com> + <1150904541.3309.38.camel@coppola.muc.ecircle.de> + <200606211321.06253.jody.brownell@q1labs.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <200606211321.06253.jody.brownell@q1labs.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060621:jody.brownell@q1labs.com::md2IlG9b60DDotoc:0000000000000 + 0000000000000000000000000d95 +X-Hashcash: + 1:20:060621:nagy@ecircle-ag.com::1PqVNnTWoQ14COAL:000000000000000000 + 0000000000000000000000000wFf +X-Hashcash: + 1:20:060621:pgsql-performance@postgresql.org::X2ry0qT1TiRKf7z9:00000 + 0000000000000000000000003ynh +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/416 +X-Sequence-Number: 19773 + +On Wed, Jun 21, 2006 at 01:21:05PM -0300, jody brownell wrote: +> Jun 21 13:04:04 vanquish postgres[3311]: [19-1] DEBUG: "target": removed 5645231 row versions in 106508 pages +> Jun 21 13:04:04 vanquish postgres[3311]: [19-2] DETAIL: CPU 3.37s/1.23u sec elapsed 40.63 sec. +> Jun 21 13:04:04 vanquish postgres[3311]: [20-1] DEBUG: "target": found 5645231 removable, 1296817 nonremovable row versions in 114701 pages +> Jun 21 13:04:04 vanquish postgres[3311]: [20-2] DETAIL: 0 dead row versions cannot be removed yet. + +So the table contained 5.6M dead rows and 1.3M live rows. + +I think you should forget about having autovacuum keep this table +in-check and add manual vacuum commands to your code. Autovac is +intended to deal with 99% of use cases; this is pretty clearly in the 1% +it can't handle. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Wed Jun 21 16:40:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id BAC359FA65C + for ; + Wed, 21 Jun 2006 16:40:54 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 41855-04 for + ; + Wed, 21 Jun 2006 16:40:46 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from q1exch01.Q1LABS.INC (Q1EXCH01.Q1Labs.com [205.174.165.4]) + by postgresql.org (Postfix) with ESMTP id C50849F9CC1 + for ; + Wed, 21 Jun 2006 16:40:45 -0300 (ADT) +Received: from q1exch02.Q1LABS.INC ([10.100.50.8]) by q1exch01.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 16:40:40 -0300 +X-PMWin-Version: 2.5.0e, Antispam-Engine: 2.3.0.1, Antivirus-Engine: 2.34.3 +thread-index: AcaVapOXFCjqkaxmS06DGn7pPSZMQw== +Received: from [10.100.100.123] ([10.100.100.123]) by q1exch02.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 16:40:40 -0300 +From: "jody brownell" +To: "Jim C. Nasby" +Content-Class: urn:content-classes:message +Subject: Re: Help tuning autovacuum - seeing lots of relationbloat +Importance: normal +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2663 +Date: Wed, 21 Jun 2006 16:40:40 -0300 +User-Agent: KMail/1.8.3 +Cc: "Csaba Nagy" , + "postgres performance list" +References: <200606211052.43227.jody.brownell@q1labs.com> + <200606211321.06253.jody.brownell@q1labs.com> + <20060621193823.GI93655@pervasive.com> +In-Reply-To: <20060621193823.GI93655@pervasive.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-ID: <200606211640.40605.jody.brownell@q1labs.com> +X-OriginalArrivalTime: 21 Jun 2006 19:40:40.0188 (UTC) + FILETIME=[93975BC0:01C6956A] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/417 +X-Sequence-Number: 19774 + +OK.... this was over a 12 - 16 hour period of not having anything done with it though right? + +I am assuming if autovacuum were active through out that period, we would be somewhat better off ...is that not accurate? + + +On Wednesday 21 June 2006 16:38, Jim C. Nasby wrote: +> 5 + +From pgsql-performance-owner@postgresql.org Wed Jun 21 16:41:51 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C1E229FA65C + for ; + Wed, 21 Jun 2006 16:41:50 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 41830-05 for + ; + Wed, 21 Jun 2006 16:41:47 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from q1exch01.Q1LABS.INC (Q1EXCH01.Q1Labs.com [205.174.165.4]) + by postgresql.org (Postfix) with ESMTP id B1B319F9CC1 + for ; + Wed, 21 Jun 2006 16:41:46 -0300 (ADT) +Received: from q1exch02.Q1LABS.INC ([10.100.50.8]) by q1exch01.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 16:41:45 -0300 +X-PMWin-Version: 2.5.0e, Antispam-Engine: 2.3.0.1, Antivirus-Engine: 2.34.3 +thread-index: AcaVarpLqs0bODFmTIufeoQlbdDHRA== +Received: from [10.100.100.123] ([10.100.100.123]) by q1exch02.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 16:41:45 -0300 +From: "jody brownell" +To: "Jim C. Nasby" +Content-Class: urn:content-classes:message +Subject: Re: Help tuning autovacuum - seeing lots of relationbloat +Importance: normal +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2663 +Date: Wed, 21 Jun 2006 16:41:45 -0300 +User-Agent: KMail/1.8.3 +Cc: "Csaba Nagy" , + "postgres performance list" +References: <200606211052.43227.jody.brownell@q1labs.com> + <200606211321.06253.jody.brownell@q1labs.com> + <20060621193823.GI93655@pervasive.com> +In-Reply-To: <20060621193823.GI93655@pervasive.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-ID: <200606211641.45674.jody.brownell@q1labs.com> +X-OriginalArrivalTime: 21 Jun 2006 19:41:45.0124 (UTC) + FILETIME=[BA4BCE40:01C6956A] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/418 +X-Sequence-Number: 19775 + +BTW, in production with a similar load - autovacuum with default out of the box +settings seems to work quite well.... + +I double checked this earlier today. + +On Wednesday 21 June 2006 16:38, Jim C. Nasby wrote: +> 5 + +From pgsql-performance-owner@postgresql.org Wed Jun 21 16:49:22 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 76B549FB1BD + for ; + Wed, 21 Jun 2006 16:49:20 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 40634-07 for + ; + Wed, 21 Jun 2006 16:49:06 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.205]) + by postgresql.org (Postfix) with ESMTP id F29589FA65C + for ; + Wed, 21 Jun 2006 16:49:05 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id n1so227560nzf + for ; + Wed, 21 Jun 2006 12:49:04 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=JqNNvbIHvrTLPYPpe53BOKE5k7GvSwwc7tlFuSUG/8iRNPty6rSlR5ig8a+pgvcWdmrKK6bOuvf4EsC90jhZYs5/qjNDNPZ1/MNfUC5s5noaO9ZJgcZWmuAF/6vHpD4OoD4FltWOKn9AfB+7hclRTrnEqLErmTXsn7uGFFg9Xm8= +Received: by 10.65.210.8 with SMTP id m8mr1558478qbq; + Wed, 21 Jun 2006 12:49:04 -0700 (PDT) +Received: by 10.65.139.14 with HTTP; Wed, 21 Jun 2006 12:49:04 -0700 (PDT) +Message-ID: +Date: Wed, 21 Jun 2006 15:49:04 -0400 +From: "Merlin Moncure" +To: "Merkel Marcel (CR/AEM4)" +Subject: Re: Big array speed issues +Cc: pgsql-performance@postgresql.org +In-Reply-To: +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/419 +X-Sequence-Number: 19776 + +> Not yet. I would first like to know what is the time consuming part and +> what is a work around. If you are sure individual columns for every +> entry of the array solve the issue I will joyfully implement it. The +> downsize of this approch is that the array dimensions are not always the +> same in my scenario. But I have a workaround in mind for this issue. + +The first thing I would try would be to completely normalize te file, aka + +create table data as +( + id int, + t timestamp, + map_x int, + map_y int, + value float +); + +and go with denormalized approach only when this doesn't work for some reason. + +merlin + +From pgsql-performance-owner@postgresql.org Wed Jun 21 17:08:31 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 40EC19FB1BC + for ; + Wed, 21 Jun 2006 17:08:31 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 40443-10 for + ; + Wed, 21 Jun 2006 17:08:19 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id B89C89FA65C + for ; + Wed, 21 Jun 2006 17:08:18 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5LK8Ggi015920; + Wed, 21 Jun 2006 16:08:16 -0400 (EDT) +To: David Wheeler +cc: PostgreSQL Performance List +Subject: Re: Performance of DOMAINs +In-reply-to: <54D833BE-A58F-47B8-B070-2AEDC0802468@kineticode.com> +References: <54D833BE-A58F-47B8-B070-2AEDC0802468@kineticode.com> +Comments: In-reply-to David Wheeler + message dated "Wed, 21 Jun 2006 11:26:16 -0700" +Date: Wed, 21 Jun 2006 16:08:16 -0400 +Message-ID: <15919.1150920496@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/420 +X-Sequence-Number: 19777 + +David Wheeler writes: +> Didn't see anything in the archives, so I thought I'd ask: has anyone +> done any work to gauge the performance penalty of using DOMAINs? + +There are some reports in the archives of particular usage patterns +where they pretty much suck, because GetDomainConstraints() searches +pg_constraint every time it's called. We do what we can to avoid +calling that multiple times per query, but for something like a simple +INSERT ... VALUES into a domain column, the setup overhead is still bad. + +I've been intending to try to fix things so that the search result can +be cached by typcache.c, but not gotten round to it. (The hard part, +if anyone wants to tackle it, is figuring out a way to clear the cache +entry when needed.) + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Jun 21 17:46:58 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 53D539F9CC1 + for ; + Wed, 21 Jun 2006 17:46:57 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 46966-10 for + ; + Wed, 21 Jun 2006 17:46:17 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.193]) + by postgresql.org (Postfix) with ESMTP id 372989FA65C + for ; + Wed, 21 Jun 2006 17:46:16 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id 14so243681nzn + for ; + Wed, 21 Jun 2006 13:46:15 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:mime-version:content-type; + b=YiQ4X/X6M/vHhi1GVsMx5igLbiy2JUkLxoLIDLGiekbVaSi0Oxw3S6RSeMmHULD/D1QXxSI6sem0uVFpVaLSoL/H9jc1HU1TsdyubqI5YlCUJwBJvg98Ez2WJ+saCwo/kbnkVRvHLNFcs+fFuMjdYSIZL3qc0pb5gPuucyedagE= +Received: by 10.37.12.66 with SMTP id p66mr949449nzi; + Wed, 21 Jun 2006 13:46:15 -0700 (PDT) +Received: by 10.37.18.45 with HTTP; Wed, 21 Jun 2006 13:46:15 -0700 (PDT) +Message-ID: <33c6269f0606211346m778a7d5di7a7d23bb2c6a1c96@mail.gmail.com> +Date: Wed, 21 Jun 2006 16:46:15 -0400 +From: "Alex Turner" +To: "Pgsql-Performance ((E-mail))" +Subject: Quick question about top... +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_618_29164740.1150922775515" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/421 +X-Sequence-Number: 19778 + +------=_Part_618_29164740.1150922775515 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +I have a really stupid question about top, what exactly is iowait CPU time? + +Alex + +------=_Part_618_29164740.1150922775515 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +I have a really stupid question about top, what exactly is iowait CPU time?

Alex
+ +------=_Part_618_29164740.1150922775515-- + +From pgsql-performance-owner@postgresql.org Wed Jun 21 18:18:34 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 1B0129FA65C + for ; + Wed, 21 Jun 2006 18:18:34 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 51761-04 for + ; + Wed, 21 Jun 2006 18:18:27 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by postgresql.org (Postfix) with ESMTP id 4C2739F9CC1 + for ; + Wed, 21 Jun 2006 18:18:27 -0300 (ADT) +Received: from [2001:700:300:dc0f:216:3eff:fe40:5a47] (helo=trofast.sesse.net) + by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1FtA5g-0007aB-Lc + for pgsql-performance@postgresql.org; Wed, 21 Jun 2006 23:18:25 +0200 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1FtA5g-0001Vl-00 + for ; Wed, 21 Jun 2006 23:18:24 +0200 +Date: Wed, 21 Jun 2006 23:18:24 +0200 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Re: Quick question about top... +Message-ID: <20060621211824.GA5782@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <33c6269f0606211346m778a7d5di7a7d23bb2c6a1c96@mail.gmail.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +In-Reply-To: <33c6269f0606211346m778a7d5di7a7d23bb2c6a1c96@mail.gmail.com> +X-Operating-System: Linux 2.6.16trofastxen on a x86_64 +X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/422 +X-Sequence-Number: 19779 + +On Wed, Jun 21, 2006 at 04:46:15PM -0400, Alex Turner wrote: +> I have a really stupid question about top, what exactly is iowait CPU time? + +Time while the CPU is idle, but at least one I/O request is outstanding. + +In other words, if you're at 100% I/O-wait, you're heavily I/O-bound and your +processor is bored to death. + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Wed Jun 21 18:31:43 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8834F9FA65C + for ; + Wed, 21 Jun 2006 18:31:42 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 51506-10 for + ; + Wed, 21 Jun 2006 18:31:32 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from pd2mo3so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net + [24.71.223.10]) by postgresql.org (Postfix) with ESMTP id 340AF9F9CC1 + for ; + Wed, 21 Jun 2006 18:31:32 -0300 (ADT) +Received: from pd3mr7so.prod.shaw.ca (pd3mr7so-qfe3.prod.shaw.ca + [10.0.141.23]) + by l-daemon (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 + 2004)) with ESMTP id <0J18002IBBO8ZW40@l-daemon> for + pgsql-performance@postgresql.org; Wed, 21 Jun 2006 15:28:56 -0600 (MDT) +Received: from pn2ml7so.prod.shaw.ca ([10.0.121.151]) + by pd3mr7so.prod.shaw.ca (Sun ONE Messaging Server 6.0 HotFix 1.01 + (built Mar + 15 2004)) with ESMTP id <0J18009G1BO8O7H0@pd3mr7so.prod.shaw.ca> for + pgsql-performance@postgresql.org; Wed, 21 Jun 2006 15:28:56 -0600 (MDT) +Received: from [192.168.0.100] ([24.68.104.139]) + by l-daemon (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 + 2004)) with ESMTP id <0J18008YFBO7OY60@l-daemon> for + pgsql-performance@postgresql.org; Wed, 21 Jun 2006 15:28:56 -0600 (MDT) +Date: Wed, 21 Jun 2006 14:27:41 -0700 +From: Ron St-Pierre +Subject: Tuning New Server (slow function) +To: pgsql-performance@postgresql.org +Message-id: <4499B9CD.4000500@shaw.ca> +MIME-version: 1.0 +Content-type: text/plain; charset=ISO-8859-1; format=flowed +Content-transfer-encoding: 7bit +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/423 +X-Sequence-Number: 19780 + +We just purchased a new Dell PowerEdge 2800 (dual xeon, 8GB RAM, raid 4, +RHEL, postgres 8.1) and ported our old database over to it (single cpu, +2GB RAM, no raid, postgres 7.4). Our apps perform great on it, however +some queries are super slow. One function in particular, which used to +take 15-30 minutes on the old server, has been running now for over 12 +hours: + BEGIN + TRUNCATE stock.datacount; + FOR rec IN SELECT itemID, item, hexValue FROM stock.activeitem LOOP + histdate := (SELECT updatedate FROM stock.historical s WHERE +s.itemID=rec.itemID ORDER BY updatedate DESC LIMIT 1); + IF histdate IS NOT NULL THEN + funddate := (SELECT updatedate FROM stock.funddata s WHERE +s.itemID=rec.itemID); + techdate := (SELECT updatedate FROM stock.techsignals s +WHERE s.itemID=rec.itemID); + IF (histdate <> funddate) OR (histdate <> techdate) OR +(funddate IS NULL) OR (techdate IS NULL) THEN + counter := counter + 1; + outrec.itemID := rec.itemID; + outrec.item := rec.item; + outrec.hexvalue := rec.hexvalue; + RETURN NEXT outrec; + END IF; + END IF; + END LOOP; + INSERT INTO stock.datacount (itemcount) VALUES (counter); + COPY stock.datacount TO ''/tmp/datacount''; + RETURN; + END; + +note: stock.activeitem contains about 75000 rows + + +"top" shows: +CPU states: cpu user nice system irq softirq iowait idle + total 5.8% 0.6% 31.2% 0.0% 0.0% 0.5% 61.6% +Mem: 8152592k av, 8143012k used, 9580k free, 0k shrd, 179888k +buff + 6342296k actv, 1206340k in_d, 137916k in_c +Swap: 8385760k av, 259780k used, 8125980k free 7668624k +cached + +PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND +17027 postgres 25 0 566M 561M 560M R 24.9 7.0 924:34 1 +postmaster + +I've likely set some parameter(s) to the wrong values, but I don't know +which one(s). Here are my relevant postgresql.conf settings: +shared_buffers = 70000 +work_mem = 9192 +maintenance_work_mem = 131072 +max_fsm_pages = 70000 +fsync = off (temporarily, will be turned back on) +checkpoint_segments = 64 +checkpoint_timeout = 1800 +effective_cache_size = 70000 + +[root@new-server root]# cat /proc/sys/kernel/shmmax +660000000 + +We want to put this into production soon, but this is a showstopper. Can +anyone help me out with this? + + +Thanks + +Ron St.Pierre + + +From pgsql-performance-owner@postgresql.org Wed Jun 21 19:36:39 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 48E719FA3AF + for ; + Wed, 21 Jun 2006 19:36:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 60125-07 for + ; + Wed, 21 Jun 2006 19:36:33 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 9E17F9FA322 + for ; + Wed, 21 Jun 2006 19:36:31 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id CDAB7564A7; Wed, 21 Jun 2006 17:11:50 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Wed, 21 Jun 2006 17:11:50 -0500 +Date: Wed, 21 Jun 2006 17:11:50 -0500 +From: "Jim C. Nasby" +To: jody brownell +Cc: Csaba Nagy , + postgres performance list +Subject: Re: Help tuning autovacuum - seeing lots of relationbloat +Message-ID: <20060621221150.GN93655@pervasive.com> +References: <200606211052.43227.jody.brownell@q1labs.com> + <200606211321.06253.jody.brownell@q1labs.com> + <20060621193823.GI93655@pervasive.com> + <200606211641.45674.jody.brownell@q1labs.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <200606211641.45674.jody.brownell@q1labs.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060621:jody.brownell@q1labs.com::Xeo5abvkY8wc39Rd:0000000000000 + 0000000000000000000000001YCc +X-Hashcash: + 1:20:060621:nagy@ecircle-ag.com::wFFMsQfPv8COCNme:000000000000000000 + 0000000000000000000000002YkS +X-Hashcash: + 1:20:060621:pgsql-performance@postgresql.org::rCZlt/ICIpSisLIi:00000 + 0000000000000000000000000b2m +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/424 +X-Sequence-Number: 19781 + +On Wed, Jun 21, 2006 at 04:41:45PM -0300, jody brownell wrote: +> BTW, in production with a similar load - autovacuum with default out of the box +> settings seems to work quite well.... +> +> I double checked this earlier today. + +So what's different between production and the machine with the problem? + +The issue with autovac is that it will only vacuum one table at a time, +so if it's off vacuuming some other table for a long period of time it +won't be touching this table, which will be a problem. Now, if that's +actually what's happening... +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Wed Jun 21 19:36:51 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E4C4E9FA3AF + for ; + Wed, 21 Jun 2006 19:36:50 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 58998-06 for + ; + Wed, 21 Jun 2006 19:36:43 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id DA8E89FA322 + for ; + Wed, 21 Jun 2006 19:36:42 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 7BD8C566A9; Wed, 21 Jun 2006 17:21:44 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Wed, 21 Jun 2006 17:21:42 -0500 +Date: Wed, 21 Jun 2006 17:21:42 -0500 +From: "Jim C. Nasby" +To: Ron St-Pierre +Cc: pgsql-performance@postgresql.org +Subject: Re: Tuning New Server (slow function) +Message-ID: <20060621222142.GO93655@pervasive.com> +References: <4499B9CD.4000500@shaw.ca> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <4499B9CD.4000500@shaw.ca> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060621:ron.pgsql@shaw.ca::xQxsE+Ay0bs2R9wq:00000000000000000000 + 000000000000000000000000H4MT +X-Hashcash: + 1:20:060621:pgsql-performance@postgresql.org::CaXmGRCzuTv9pRUf:00000 + 00000000000000000000000034u6 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/425 +X-Sequence-Number: 19782 + +On Wed, Jun 21, 2006 at 02:27:41PM -0700, Ron St-Pierre wrote: +> We just purchased a new Dell PowerEdge 2800 (dual xeon, 8GB RAM, raid 4, +> RHEL, postgres 8.1) and ported our old database over to it (single cpu, + +RAID *4*? + +If you do any kind of updating at all, you're likely to be real unhappy +with that... + +> 2GB RAM, no raid, postgres 7.4). Our apps perform great on it, however +> some queries are super slow. One function in particular, which used to +> take 15-30 minutes on the old server, has been running now for over 12 +> hours: +> BEGIN +> TRUNCATE stock.datacount; +> FOR rec IN SELECT itemID, item, hexValue FROM stock.activeitem LOOP +> histdate := (SELECT updatedate FROM stock.historical s WHERE +> s.itemID=rec.itemID ORDER BY updatedate DESC LIMIT 1); +> IF histdate IS NOT NULL THEN +> funddate := (SELECT updatedate FROM stock.funddata s WHERE +> s.itemID=rec.itemID); +> techdate := (SELECT updatedate FROM stock.techsignals s +> WHERE s.itemID=rec.itemID); +> IF (histdate <> funddate) OR (histdate <> techdate) OR +> (funddate IS NULL) OR (techdate IS NULL) THEN +> counter := counter + 1; +> outrec.itemID := rec.itemID; +> outrec.item := rec.item; +> outrec.hexvalue := rec.hexvalue; +> RETURN NEXT outrec; +> END IF; +> END IF; +> END LOOP; +> INSERT INTO stock.datacount (itemcount) VALUES (counter); +> COPY stock.datacount TO ''/tmp/datacount''; +> RETURN; +> END; +> +> note: stock.activeitem contains about 75000 rows + +Getting EXPLAIN ANALYZE from the queries would be good. Adding debug +output via NOTICE to see how long each step is taking would be a good +idea, too. + +Of course, even better would be to do away with the cursor... + +> "top" shows: +> CPU states: cpu user nice system irq softirq iowait idle +> total 5.8% 0.6% 31.2% 0.0% 0.0% 0.5% 61.6% +> Mem: 8152592k av, 8143012k used, 9580k free, 0k shrd, 179888k +> buff + +The high system % (if I'm reading this correctly) makes me wonder if +this is some kind of locking issue. + +> 6342296k actv, 1206340k in_d, 137916k in_c +> Swap: 8385760k av, 259780k used, 8125980k free 7668624k +> cached +> +> PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND +> 17027 postgres 25 0 566M 561M 560M R 24.9 7.0 924:34 1 +> postmaster +> +> I've likely set some parameter(s) to the wrong values, but I don't know +> which one(s). Here are my relevant postgresql.conf settings: +> shared_buffers = 70000 +> work_mem = 9192 +> maintenance_work_mem = 131072 +> max_fsm_pages = 70000 +> fsync = off (temporarily, will be turned back on) +> checkpoint_segments = 64 +> checkpoint_timeout = 1800 +> effective_cache_size = 70000 +> +> [root@new-server root]# cat /proc/sys/kernel/shmmax +> 660000000 +> +> We want to put this into production soon, but this is a showstopper. Can +> anyone help me out with this? +> +> +> Thanks +> +> Ron St.Pierre +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 3: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq +> + +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Wed Jun 21 19:56:50 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C5BD29FA5FC + for ; + Wed, 21 Jun 2006 19:56:49 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 65479-01 for + ; + Wed, 21 Jun 2006 19:56:45 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from pd4mo1so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net + [24.71.223.10]) by postgresql.org (Postfix) with ESMTP id 2BE109FA3AF + for ; + Wed, 21 Jun 2006 19:56:45 -0300 (ADT) +Received: from pd3mr4so.prod.shaw.ca + (pd3mr4so-qfe3.prod.shaw.ca [10.0.141.180]) by l-daemon + (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 2004)) + with ESMTP id <0J1800020FMMZG30@l-daemon> for + pgsql-performance@postgresql.org; Wed, 21 Jun 2006 16:54:22 -0600 (MDT) +Received: from pn2ml5so.prod.shaw.ca ([10.0.121.149]) + by pd3mr4so.prod.shaw.ca (Sun ONE Messaging Server 6.0 HotFix 1.01 + (built Mar + 15 2004)) with ESMTP id <0J1800MDEFMM1D20@pd3mr4so.prod.shaw.ca> for + pgsql-performance@postgresql.org; Wed, 21 Jun 2006 16:54:22 -0600 (MDT) +Received: from [192.168.0.100] ([24.68.104.139]) + by l-daemon (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 + 2004)) with ESMTP id <0J18009ROFMKKPE0@l-daemon> for + pgsql-performance@postgresql.org; Wed, 21 Jun 2006 16:54:22 -0600 (MDT) +Date: Wed, 21 Jun 2006 15:53:06 -0700 +From: Ron St-Pierre +Subject: Re: Tuning New Server (slow function) +In-reply-to: <20060621222142.GO93655@pervasive.com> +To: "Jim C. Nasby" +Cc: pgsql-performance@postgresql.org +Message-id: <4499CDD2.2070900@shaw.ca> +MIME-version: 1.0 +Content-type: text/plain; charset=ISO-8859-1; format=flowed +Content-transfer-encoding: 7bit +References: <4499B9CD.4000500@shaw.ca> <20060621222142.GO93655@pervasive.com> +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/426 +X-Sequence-Number: 19783 + +Jim C. Nasby wrote: +> On Wed, Jun 21, 2006 at 02:27:41PM -0700, Ron St-Pierre wrote: +> +>> We just purchased a new Dell PowerEdge 2800 (dual xeon, 8GB RAM, raid 4, +>> RHEL, postgres 8.1) and ported our old database over to it (single cpu, +>> +> +> RAID *4*? +> +oops, raid 5 (but we are getting good io throughput...) +> If you do any kind of updating at all, you're likely to be real unhappy +> with that... +> +> +>> 2GB RAM, no raid, postgres 7.4). Our apps perform great on it, however +>> some queries are super slow. One function in particular, which used to +>> take 15-30 minutes on the old server, has been running now for over 12 +>> hours: +>> BEGIN +>> TRUNCATE stock.datacount; +>> FOR rec IN SELECT itemID, item, hexValue FROM stock.activeitem LOOP +>> histdate := (SELECT updatedate FROM stock.historical s WHERE +>> s.itemID=rec.itemID ORDER BY updatedate DESC LIMIT 1); +>> IF histdate IS NOT NULL THEN +>> funddate := (SELECT updatedate FROM stock.funddata s WHERE +>> s.itemID=rec.itemID); +>> techdate := (SELECT updatedate FROM stock.techsignals s +>> WHERE s.itemID=rec.itemID); +>> IF (histdate <> funddate) OR (histdate <> techdate) OR +>> (funddate IS NULL) OR (techdate IS NULL) THEN +>> counter := counter + 1; +>> outrec.itemID := rec.itemID; +>> outrec.item := rec.item; +>> outrec.hexvalue := rec.hexvalue; +>> RETURN NEXT outrec; +>> END IF; +>> END IF; +>> END LOOP; +>> INSERT INTO stock.datacount (itemcount) VALUES (counter); +>> COPY stock.datacount TO ''/tmp/datacount''; +>> RETURN; +>> END; +>> +>> note: stock.activeitem contains about 75000 rows +>> +> +> Getting EXPLAIN ANALYZE from the queries would be good. Adding debug +> output via NOTICE to see how long each step is taking would be a good +> idea, too. +> +> +I set client_min_messages = debug2, log_min_messages = debug2 and +log_statement = 'all' and am running the query with EXPLAIN ANALYZE. I +don't know how long it will take until something useful returns, but I +will let it run for a while. +> Of course, even better would be to do away with the cursor... +> +> +How would I rewrite it to do away with the cursor? +>> "top" shows: +>> CPU states: cpu user nice system irq softirq iowait idle +>> total 5.8% 0.6% 31.2% 0.0% 0.0% 0.5% 61.6% +>> Mem: 8152592k av, 8143012k used, 9580k free, 0k shrd, 179888k +>> buff +>> +> +> The high system % (if I'm reading this correctly) makes me wonder if +> this is some kind of locking issue. +> +> +But it's the only postgres process running. +>> 6342296k actv, 1206340k in_d, 137916k in_c +>> Swap: 8385760k av, 259780k used, 8125980k free 7668624k +>> cached +>> +>> PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND +>> 17027 postgres 25 0 566M 561M 560M R 24.9 7.0 924:34 1 +>> postmaster +>> +>> I've likely set some parameter(s) to the wrong values, but I don't know +>> which one(s). Here are my relevant postgresql.conf settings: +>> shared_buffers = 70000 +>> work_mem = 9192 +>> maintenance_work_mem = 131072 +>> max_fsm_pages = 70000 +>> fsync = off (temporarily, will be turned back on) +>> checkpoint_segments = 64 +>> checkpoint_timeout = 1800 +>> effective_cache_size = 70000 +>> +>> [root@new-server root]# cat /proc/sys/kernel/shmmax +>> 660000000 +>> +>> We want to put this into production soon, but this is a showstopper. Can +>> anyone help me out with this? +>> +>> +>> Thanks +>> +>> Ron St.Pierre +>> +>> +>> ---------------------------(end of broadcast)--------------------------- +>> TIP 3: Have you checked our extensive FAQ? +>> +>> http://www.postgresql.org/docs/faq +>> +>> +> +> + + +From pgsql-performance-owner@postgresql.org Thu Jun 22 03:06:54 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 341C19FA5FC + for ; + Wed, 21 Jun 2006 20:09:04 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 62156-08 for + ; + Wed, 21 Jun 2006 20:08:58 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id 0C7A09FA322 + for ; + Wed, 21 Jun 2006 20:08:57 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 8912C30926; Thu, 22 Jun 2006 01:08:56 +0200 (MET DST) +From: Peter Wilson +X-Newsgroups: pgsql.performance +Subject: Poor performance - fixed by restart +Date: Thu, 22 Jun 2006 00:08:53 +0100 +Organization: Hub.Org Networking Services +Lines: 50 +Message-ID: +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@news.hub.org +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +X-Antivirus: avast! (VPS 0625-5, 21/06/2006), Outbound message +X-Antivirus-Status: Clean +To: pgsql-performance@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/436 +X-Sequence-Number: 19793 + +I've recently configured a new high-performance database server: + 2xXeon 3.4G, 2G RAM, 4x15K SCSI disks in RAID 10, h/w RAID + +This has been live for a couple of weeks. + +The box is running Fedora Core 4. + +The only thing running on this box is PostgreSQL 8.1.4 and some stub +applications that handle the interface to Postgres (basically taking XML service +requests, translating into SQL and using libpq). The database is a backend for a +big web application. The web-server and processor intensive front-end run on a +separate server. + +Postgres has probably been running for 2 weeks now. + +I've just uploaded a CSV file that the web-application turns into the contents +into multiple requests to the database. Each row in the CSV file causes a few +transactions to fire. Bascially adding rows into a couple of table. The tables +at the moment aren't huge (20,000 rows in on, 150,000 in the other). + +Performance was appalling - taking 85 seconds to upload the CSV file and create +the records. A separate script to delete the rows took 45 seconds. While these +activities were taking place the Postgres process was using 97% CPU on the +server - nothing else much running. + +For comparison, my test machine (750M Athlon, RedHat 8, 256M RAM, single IDE +hard drive) created the records in 22 seconds and deleted them again in 17. + +I had autovacuum ON - but to make sure I did first a vacuum analyze (no +difference) then vacuum full (again no difference). + +I'd tweaked a couple of parameters in postgres.conf - the significant one I +thought being random_page_cost, so I changed this back to default and did a +'service postgresql reload' - no difference, but I wasn't sure whether this +could be changed via reload so I restarted Postgres. + +The restart fixed the problem. The 85 second insert time dropped back down to 5 +seconds!!! + +To check whether the random_page_cost was making the difference I restored the +old postgres.conf, restarted postgres and redid the upload. Rather suprisingly - + the upload time was still at 5 seconds. + +Any thoughts? I find it hard to believe that Postgres performance could degrade +over a couple of weeks. Read performance seemed to be fine. The postgres memory +size didn't seem to be huge. What else am I overlooking? What could I have +changed by simply restarting Postgres that could make such a drastic change in +performance? + +Pete + +From pgsql-performance-owner@postgresql.org Wed Jun 21 20:09:05 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 9A5CC9FA322 + for ; + Wed, 21 Jun 2006 20:09:04 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 63498-09 for + ; + Wed, 21 Jun 2006 20:09:00 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from q1exch01.Q1LABS.INC (Q1EXCH01.Q1Labs.com [205.174.165.4]) + by postgresql.org (Postfix) with ESMTP id E880D9FA3AF + for ; + Wed, 21 Jun 2006 20:08:59 -0300 (ADT) +Received: from q1exch02.Q1LABS.INC ([10.100.50.8]) by q1exch01.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 20:08:56 -0300 +X-PMWin-Version: 2.5.0e, Antispam-Engine: 2.3.0.1, Antivirus-Engine: 2.34.3 +thread-index: AcaVh6tppk5hP6meQOGJsnpT2etgGw== +Received: from [10.100.100.123] ([10.100.100.123]) by q1exch02.Q1LABS.INC with + Microsoft SMTPSVC(6.0.3790.1830); Wed, 21 Jun 2006 20:08:55 -0300 +From: "jody brownell" +To: "Jim C. Nasby" +Content-Class: urn:content-classes:message +Importance: normal +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2663 +Subject: Re: Help tuning autovacuum - seeing lots of relationbloat +Date: Wed, 21 Jun 2006 20:08:55 -0300 +User-Agent: KMail/1.8.3 +Cc: "Csaba Nagy" , + "postgres performance list" +References: <200606211052.43227.jody.brownell@q1labs.com> + <200606211641.45674.jody.brownell@q1labs.com> + <20060621221150.GN93655@pervasive.com> +In-Reply-To: <20060621221150.GN93655@pervasive.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-ID: <200606212008.56137.jody.brownell@q1labs.com> +X-OriginalArrivalTime: 21 Jun 2006 23:08:55.0559 (UTC) + FILETIME=[AB69A970:01C69587] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/427 +X-Sequence-Number: 19784 + +Well, for one we did introduce a TX leak which was preventing autovac from running. I guess that was _the_ issue. + +I have since fixed it and an now testing.... looks much better, nothing concerning.... +(fingers crossed until morning :)). debug logs are full of vac/anal of the tables... so, for now I am back +on track moving forward... Now that auto vac is actually running, the box is feeling slightly more sluggish. + +BTW - As soon as we deliver to QA, I will post the test case for the memory leak I was seeing the other day. +(I have not forgotten, I am just swamped) + +Thanks for the help all. Much appreciated. +Cheers. + +On Wednesday 21 June 2006 19:11, Jim C. Nasby wrote: +> On Wed, Jun 21, 2006 at 04:41:45PM -0300, jody brownell wrote: +> > BTW, in production with a similar load - autovacuum with default out of the box +> > settings seems to work quite well.... +> > +> > I double checked this earlier today. +> +> So what's different between production and the machine with the problem? +> +> The issue with autovac is that it will only vacuum one table at a time, +> so if it's off vacuuming some other table for a long period of time it +> won't be touching this table, which will be a problem. Now, if that's +> actually what's happening... + +From pgsql-performance-owner@postgresql.org Wed Jun 21 22:19:29 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D30C79FA3AF + for ; + Wed, 21 Jun 2006 22:19:28 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 04036-04 for + ; + Wed, 21 Jun 2006 22:19:22 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by postgresql.org (Postfix) with ESMTP id C01B69FA322 + for ; + Wed, 21 Jun 2006 22:19:21 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO [192.168.1.27]) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 9630009; Wed, 21 Jun 2006 18:22:34 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: Performance of DOMAINs +Date: Wed, 21 Jun 2006 18:19:07 -0700 +User-Agent: KMail/1.8 +Cc: David Wheeler +References: <54D833BE-A58F-47B8-B070-2AEDC0802468@kineticode.com> +In-Reply-To: <54D833BE-A58F-47B8-B070-2AEDC0802468@kineticode.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200606211819.08239.josh@agliodbs.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/428 +X-Sequence-Number: 19785 + +David, + +> But I'm also interested in how Elein made the email domain case- +> insensitive, since I'd like to have/create a truly case-insensitive +> text type (ITEXT anyone?). The functions for the operator class there +> were mainly written in SQL, and if it adds a significant overhead, +> I'm not sure it'd be a good idea to use that approach for a case- +> insensitive text type, since I use it quite a lot in my apps, and +> often do LIKE queries against text data. Thoughts? + +Well, current case-insensitivity hacks definitely aren't compatible with +LIKE as far as "begins with" indexes are concerned. Of course, floating +LIKEs (%value%) are going to suck no matter what data type you're using. + +I created an operator for CI equality ... =~ ... which performs well on +indexed columns. But it doesn't do "begins with". + +ITEXT is a TODO, but there are reasons why it's harder than it looks. + +-- +--Josh + +Josh Berkus +PostgreSQL @ Sun +San Francisco + +From pgsql-performance-owner@postgresql.org Wed Jun 21 23:24:33 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 1D3F09FA3AF + for ; + Wed, 21 Jun 2006 23:24:32 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 47529-04 for + ; + Wed, 21 Jun 2006 23:24:31 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from grzm.com (grzm.com [200.46.204.98]) + by postgresql.org (Postfix) with ESMTP id C074E9FA322 + for ; + Wed, 21 Jun 2006 23:24:31 -0300 (ADT) +Received: from localhost (unknown [200.46.208.251]) + by grzm.com (Postfix) with ESMTP id 6A201127D326 + for ; + Thu, 22 Jun 2006 03:24:25 +0100 (BST) +Received: from grzm.com ([200.46.204.98]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 61587-03; Wed, 21 Jun 2006 23:24:26 -0300 (ADT) +Received: from [172.16.1.204] (unknown [61.197.227.146]) + by grzm.com (Postfix) with ESMTP id 31931127C4FA; + Thu, 22 Jun 2006 03:24:19 +0100 (BST) +Mime-Version: 1.0 (Apple Message framework v750) +In-Reply-To: <200606211819.08239.josh@agliodbs.com> +References: <54D833BE-A58F-47B8-B070-2AEDC0802468@kineticode.com> + <200606211819.08239.josh@agliodbs.com> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: +Cc: pgsql-performance@postgresql.org, + David Wheeler +Content-Transfer-Encoding: 7bit +From: Michael Glaesemann +Subject: Re: Performance of DOMAINs +Date: Thu, 22 Jun 2006 11:24:22 +0900 +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/429 +X-Sequence-Number: 19786 + + +> since I'd like to have/create a truly case-insensitive +> text type (ITEXT anyone?). + +I haven't seen it mentioned in this thread yet, but have you looked +at citext? + +http://gborg.postgresql.org/project/citext/projdisplay.php + +I don't have any experience with it, but perhaps it can do what +you're looking for. + +Michael Glaesemann +grzm seespotcode net + + + + +From pgsql-performance-owner@postgresql.org Thu Jun 22 01:58:27 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8D1599FA430 + for ; + Thu, 22 Jun 2006 01:58:26 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 11412-07 for + ; + Thu, 22 Jun 2006 01:58:12 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from py-out-1112.google.com (py-out-1112.google.com + [64.233.166.178]) + by postgresql.org (Postfix) with ESMTP id 4AEF79F9ED6 + for ; + Thu, 22 Jun 2006 01:58:13 -0300 (ADT) +Received: by py-out-1112.google.com with SMTP id f28so194941pyf + for ; + Wed, 21 Jun 2006 21:58:11 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:mime-version:content-type; + b=BbjwjCifeWU6PGuTE2+SC9dY0+39mrwMS6Gfv+EsAPyvQsZJTWEFWajU/tH73KFC9q6itCQ09ysx6zvCKcDMiyH2qGxOlkS2HVhivqjcYOk4DsjkdzufxCdguQpJP+srhRn31eUbcLzVgWDIdiCc/V8B92LxHUeohGx9fulOkQU= +Received: by 10.35.101.9 with SMTP id d9mr643117pym; + Wed, 21 Jun 2006 21:58:11 -0700 (PDT) +Received: by 10.35.8.14 with HTTP; Wed, 21 Jun 2006 21:58:11 -0700 (PDT) +Message-ID: <9f2e40a90606212158p58652b2bg4d5f4500b3564641@mail.gmail.com> +Date: Thu, 22 Jun 2006 10:28:11 +0530 +From: "soni de" +To: pgsql-performance@postgresql.org +Subject: Regarding ERROR: fmgr_info: function 2720768: cache lookup failed +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_2642_19247636.1150952291370" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/430 +X-Sequence-Number: 19787 + +------=_Part_2642_19247636.1150952291370 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hello, + + + +I am getting following error while inserting a row into the "abc" table: + +*ERROR: fmgr_info: function 2720768: cache lookup failed* + +* * + +Table "abc" has one trigger called "abct" + +Definition is as follows: + + + +BEGIN; + + LOCK TABLE abc IN SHARE ROW EXCLUSIVE MODE; + + + + create TRIGGER abct + + AFTER INSERT OR DELETE on abc + + FOR EACH ROW EXECUTE PROCEDURE abc_function(); + + + +COMMIT; + + + +abc_function() updates entry from the "xyz" table for every insert and +delete operations on table "abc". + + + +"xyz" table maintains the count of total number of rows in table "abc" + + + +Currently "abc" table contains 1000090 rows. And same count is available in +table "xyz". + +But now I am not able to insert any records into the "abc" table because of +above mentioned error. + + + +Please provide me some help regarding this. + + + +Thanks, + +Soni + +------=_Part_2642_19247636.1150952291370 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +

Hello,

+

 

+

I am getting following error while inserting a row into the "abc" table:

+

ERROR:  fmgr_info: function 2720768: cache lookup failed +

+

 

+

Table "abc" has one trigger called "abct"

+

Definition is as follows:

+

 

+

BEGIN;

+

   LOCK TABLE abc IN SHARE ROW EXCLUSIVE MODE;

+

 

+

   create TRIGGER abct

+

      AFTER INSERT OR DELETE on abc

+

      FOR EACH ROW EXECUTE PROCEDURE abc_function();

+

 

+

COMMIT;

+

 

+

abc_function() updates entry from the "xyz" table for every insert and delete operations on table "abc".

+ +

 

+

"xyz" table maintains the count of total number of rows in table "abc"

+

 

+

Currently "abc" table contains 1000090 rows. And same count is available in table "xyz".

+

But now I am not able to insert any records into the "abc" table because of above mentioned error.

+

 

+

Please provide me some help regarding this.

+

 

+

Thanks,

+

Soni

+ +------=_Part_2642_19247636.1150952291370-- + +From pgsql-performance-owner@postgresql.org Thu Jun 22 06:49:00 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E10BB9FA430 + for ; + Thu, 22 Jun 2006 06:48:59 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 46931-04 for + ; + Thu, 22 Jun 2006 06:48:48 -0300 (ADT) +X-Greylist: delayed 20:01:26.37018 by SQLgrey- +Received: from smtp-vbr10.xs4all.nl (smtp-vbr10.xs4all.nl [194.109.24.30]) + by postgresql.org (Postfix) with ESMTP id DFF529F9ED6 + for ; + Thu, 22 Jun 2006 06:48:47 -0300 (ADT) +Received: from [10.0.0.12] (a80-126-182-198.adsl.xs4all.nl [80.126.182.198]) + (authenticated bits=0) + by smtp-vbr10.xs4all.nl (8.13.6/8.13.6) with ESMTP id k5M9miG3056884 + for ; + Thu, 22 Jun 2006 11:48:45 +0200 (CEST) + (envelope-from nicky@valuecare.nl) +Message-ID: <449A677D.4020504@valuecare.nl> +Date: Thu, 22 Jun 2006 11:48:45 +0200 +From: nicky +User-Agent: Thunderbird 1.5.0.4 (X11/20060621) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Speeding up query, Joining 55mil and 43mil records. +References: <44994DE7.5070801@valuecare.nl> + <20060621184803.GC93655@pervasive.com> +In-Reply-To: <20060621184803.GC93655@pervasive.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by XS4ALL Virus Scanner +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/439 +X-Sequence-Number: 19796 + +Hello again, + +thanks for all the quick replies. + +It seems i wasn't entirely correct on my previous post, i've mixed up +some times/numbers. + +Below the correct numbers + +MSSQL: SELECT COUNT(*) from JOIN (without insert) 17 minutes +PostgreSQL: SELECT COUNT(*) from JOIN (without insert) 33 minutes +PostgreSQL: complete query 55 minutes + +The part i'm really troubled with is the difference in performance for +the select part. Which takes twice as long on PostgreSQL even though it +has a better server then MSSQL. + +Changed i've made to postgressql.conf + +work_mem = 524288 (1GB, results in out of memory error) +checkpoints_segments = 256 +checkpoints_timeout = 3600 +checkpoints_warning = 0 + + +I've ran the complete 'explain analyse query' twice. First with +pgsql_tmp on the same disk, then again with pgsql_tmp on a seperate disk. + +**** (PostgreSQL) (*pgsql_tmp on same disk*): + +Hash Join (cost=1328360.12..6167462.76 rows=7197568 width=118) (actual +time=327982.425..1903423.769 rows=7551616 loops=1) + Hash Cond: (("outer".id)::text = ("inner".id)::text) + -> Seq Scan on src_faktuur_verrsec t0 (cost=0.00..2773789.90 +rows=40902852 width=52) (actual time=8.935..613455.204 rows=37368390 +loops=1) + Filter: ((substr((code)::text, 1, 2) <> '14'::text) AND +(substr((code)::text, 1, 2) <> '15'::text) AND (substr((code)::text, 1, +2) <> '16'::text) AND (substr((code)::text, 1, 2) <> '17'::text) AND +((substr((correctie)::text, 4, 1) <> '1'::text) OR (correctie IS NULL))) + -> Hash (cost=1188102.97..1188102.97 rows=8942863 width=80) (actual +time=327819.698..327819.698 rows=8761024 loops=1) + -> Bitmap Heap Scan on src_faktuur_verricht t1 +(cost=62392.02..1188102.97 rows=8942863 width=80) (actual +time=75911.336..295510.647 rows=8761024 loops=1) + Recheck Cond: (date_part('year'::text, datum) > +2004::double precision) + -> Bitmap Index Scan on src_faktuur_verricht_idx1 +(cost=0.00..62392.02 rows=8942863 width=0) (actual +time=75082.080..75082.080 rows=8761024 loops=1) + Index Cond: (date_part('year'::text, datum) > +2004::double precision) +Total runtime: 3355696.015 ms + + +**** (PostgreSQL) (*pgsql_tmp on seperate disk*) + +Hash Join (cost=1328360.12..6167462.76 rows=7197568 width=118) (actual +time=172797.736..919869.708 rows=7551616 loops=1) + Hash Cond: (("outer".id)::text = ("inner".id)::text) + -> Seq Scan on src_faktuur_verrsec t0 (cost=0.00..2773789.90 +rows=40902852 width=52) (actual time=0.015..362154.822 rows=37368390 +loops=1) + Filter: ((substr((code)::text, 1, 2) <> '14'::text) AND +(substr((code)::text, 1, 2) <> '15'::text) AND (substr((code)::text, 1, +2) <> '16'::text) AND (substr((code)::text, 1, 2) <> '17'::text) AND +((substr((correctie)::text, 4, 1) <> '1'::text) OR (correctie IS NULL))) + -> Hash (cost=1188102.97..1188102.97 rows=8942863 width=80) (actual +time=172759.255..172759.255 rows=8761024 loops=1) + -> Bitmap Heap Scan on src_faktuur_verricht t1 +(cost=62392.02..1188102.97 rows=8942863 width=80) (actual +time=4244.840..142144.606 rows=8761024 loops=1) + Recheck Cond: (date_part('year'::text, datum) > +2004::double precision) + -> Bitmap Index Scan on src_faktuur_verricht_idx1 +(cost=0.00..62392.02 rows=8942863 width=0) (actual +time=3431.361..3431.361 rows=8761024 loops=1) + Index Cond: (date_part('year'::text, datum) > +2004::double precision) +Total runtime: 2608316.714 ms + +A lot of difference in performance. 55 minutes to 42 minutes. + + +I've ran the 'select count(*) from JOIN' to see the difference on that +part. + +**** (PostgreSQL) Explain analyse from SELECT COUNT(*) from the JOIN. +(*pgsql_tmp on seperate disk*) + +Aggregate (cost=5632244.93..5632244.94 rows=1 width=0) (actual +time=631993.425..631993.427 rows=1 loops=1) + -> Hash Join (cost=1258493.12..5614251.00 rows=7197568 width=0) +(actual time=237999.277..620018.706 rows=7551616 loops=1) + Hash Cond: (("outer".id)::text = ("inner".id)::text) + -> Seq Scan on src_faktuur_verrsec t0 (cost=0.00..2773789.90 +rows=40902852 width=14) (actual time=23.449..200532.422 rows=37368390 +loops=1) + Filter: ((substr((code)::text, 1, 2) <> '14'::text) AND +(substr((code)::text, 1, 2) <> '15'::text) AND (substr((code)::text, 1, +2) <> '16'::text) AND (substr((code)::text, 1, 2) <> '17'::text) AND +((substr((correctie)::text, 4, 1) <> '1'::tex (..) + -> Hash (cost=1188102.97..1188102.97 rows=8942863 width=14) +(actual time=237939.262..237939.262 rows=8761024 loops=1) + -> Bitmap Heap Scan on src_faktuur_verricht t1 +(cost=62392.02..1188102.97 rows=8942863 width=14) (actual +time=74713.092..216206.478 rows=8761024 loops=1) + Recheck Cond: (date_part('year'::text, datum) > +2004::double precision) + -> Bitmap Index Scan on src_faktuur_verricht_idx1 +(cost=0.00..62392.02 rows=8942863 width=0) (actual +time=73892.153..73892.153 rows=8761024 loops=1) + Index Cond: (date_part('year'::text, datum) > +2004::double precision) +Total runtime: 631994.172 ms + +A lot of improvement also in the select count: 33 minutes vs 10 minutes. + + +To us, the speeds are good. Very happy with the performance increase on +that select with join, since 90% of the queries are SELECT based. + +The query results in 7551616 records, so that's about 4500 inserts per +second. I'm not sure if that is fast or not. Any further tips would be +welcome. + +Thanks everyone. +Nicky + +From pgsql-performance-owner@postgresql.org Thu Jun 22 08:29:56 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 274B29F9FE3 + for ; + Thu, 22 Jun 2006 08:29:56 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 61960-04 for + ; + Thu, 22 Jun 2006 08:29:45 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.aeccom.com (port-83-236-156-26.static.qsc.de + [83.236.156.26]) + by postgresql.org (Postfix) with ESMTP id C17999F9ED6 + for ; + Thu, 22 Jun 2006 08:29:46 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mail.aeccom.com (Postfix) with ESMTP id 6431E1C72C; + Thu, 22 Jun 2006 13:29:44 +0200 (CEST) +Received: from mail.aeccom.com ([127.0.0.1]) + by localhost (gate6.aeccom.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 29464-03-8; Thu, 22 Jun 2006 13:29:43 +0200 (CEST) +Received: from [192.168.2.140] (unknown [192.168.2.140]) + by mail.aeccom.com (Postfix) with ESMTP id 818CF1C71E; + Thu, 22 Jun 2006 13:29:43 +0200 (CEST) +Message-ID: <449A7F25.3040607@aeccom.com> +Date: Thu, 22 Jun 2006 13:29:41 +0200 +From: Sven Geisler +Organization: AEC/communications GmbH +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: nicky +CC: pgsql-performance@postgresql.org +Subject: Re: Speeding up query, Joining 55mil and 43mil records. +References: <44994DE7.5070801@valuecare.nl> + <20060621184803.GC93655@pervasive.com> + <449A677D.4020504@valuecare.nl> +In-Reply-To: <449A677D.4020504@valuecare.nl> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: amavisd-new at aeccom.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/440 +X-Sequence-Number: 19797 + +Hi Nicky, + +Did you tried to create an index to avoid the sequential scans? + +Seq Scan on src_faktuur_verrsec t0... + +I think, you should try + +CREATE INDEX src.src_faktuur_verrsec_codesubstr ON +src.src_faktuur_verrsec (substr(src.src_faktuur_verrsec.code,1,2)) + +Cheers +Sven. + +nicky schrieb: +> Hello again, +> +> thanks for all the quick replies. +> +> It seems i wasn't entirely correct on my previous post, i've mixed up +> some times/numbers. +> +> Below the correct numbers +> +> MSSQL: SELECT COUNT(*) from JOIN (without insert) 17 minutes +> PostgreSQL: SELECT COUNT(*) from JOIN (without insert) 33 minutes +> PostgreSQL: complete query 55 minutes + + +> +> A lot of improvement also in the select count: 33 minutes vs 10 minutes. +> +> +> To us, the speeds are good. Very happy with the performance increase on +> that select with join, since 90% of the queries are SELECT based. +> +> The query results in 7551616 records, so that's about 4500 inserts per +> second. I'm not sure if that is fast or not. Any further tips would be +> welcome. + +From pgsql-performance-owner@postgresql.org Thu Jun 22 09:11:06 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 028B99F9FE3 + for ; + Thu, 22 Jun 2006 09:11:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 66503-06 for + ; + Thu, 22 Jun 2006 09:10:54 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from smtp-vbr3.xs4all.nl (smtp-vbr3.xs4all.nl [194.109.24.23]) + by postgresql.org (Postfix) with ESMTP id 93D449F9ED6 + for ; + Thu, 22 Jun 2006 09:10:55 -0300 (ADT) +Received: from [10.0.0.12] (a80-126-182-198.adsl.xs4all.nl [80.126.182.198]) + (authenticated bits=0) + by smtp-vbr3.xs4all.nl (8.13.6/8.13.6) with ESMTP id k5MCAnY2091972; + Thu, 22 Jun 2006 14:10:49 +0200 (CEST) + (envelope-from nicky@valuecare.nl) +Message-ID: <449A88CA.3000108@valuecare.nl> +Date: Thu, 22 Jun 2006 14:10:50 +0200 +From: nicky +User-Agent: Thunderbird 1.5.0.4 (X11/20060621) +MIME-Version: 1.0 +To: Sven Geisler +CC: pgsql-performance@postgresql.org +Subject: Re: Speeding up query, Joining 55mil and 43mil records. +References: <44994DE7.5070801@valuecare.nl> + <20060621184803.GC93655@pervasive.com> + <449A677D.4020504@valuecare.nl> <449A7F25.3040607@aeccom.com> +In-Reply-To: <449A7F25.3040607@aeccom.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by XS4ALL Virus Scanner +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/441 +X-Sequence-Number: 19798 + +Hello Sven, + +We have the following indexes on src_faktuur_verrsec +/ + CREATE INDEX src_faktuur_verrsec_idx0 + ON src.src_faktuur_verrsec + USING btree + (id); + + CREATE INDEX src_faktuur_verrsec_idx1 + ON src.src_faktuur_verrsec + USING btree + (substr(code::text, 1, 2)); + + CREATE INDEX src_faktuur_verrsec_idx2 + ON src.src_faktuur_verrsec + USING btree + (substr(correctie::text, 4, 1));/ + +and another two on src_faktuur_verricht + +/ CREATE INDEX src_faktuur_verricht_idx0 + ON src.src_faktuur_verricht + USING btree + (id); + + CREATE INDEX src_faktuur_verricht_idx1 + ON src.src_faktuur_verricht + USING btree + (date_part('year'::text, datum)) + TABLESPACE src_index;/ + +PostgreSQL elects not to use them. I assume, because it most likely +needs to traverse the entire table anyway. + +if i change: / substr(t0.code,1,2) not in +('14','15','16','17')/ +to (removing the NOT): / substr(t0.code,1,2) in ('14','15','16','17')/ + +it uses the index, but it's not the query that needs to be run anymore. + +Greetings, +Nick + + + + +Sven Geisler wrote: +> Hi Nicky, +> +> Did you tried to create an index to avoid the sequential scans? +> +> Seq Scan on src_faktuur_verrsec t0... +> +> I think, you should try +> +> CREATE INDEX src.src_faktuur_verrsec_codesubstr ON +> src.src_faktuur_verrsec (substr(src.src_faktuur_verrsec.code,1,2)) +> +> Cheers +> Sven. +> +> nicky schrieb: +>> Hello again, +>> +>> thanks for all the quick replies. +>> +>> It seems i wasn't entirely correct on my previous post, i've mixed up +>> some times/numbers. +>> +>> Below the correct numbers +>> +>> MSSQL: SELECT COUNT(*) from JOIN (without insert) 17 minutes +>> PostgreSQL: SELECT COUNT(*) from JOIN (without insert) 33 minutes +>> PostgreSQL: complete query 55 minutes +> +> +>> +>> A lot of improvement also in the select count: 33 minutes vs 10 minutes. +>> +>> +>> To us, the speeds are good. Very happy with the performance increase +>> on that select with join, since 90% of the queries are SELECT based. +>> +>> The query results in 7551616 records, so that's about 4500 inserts +>> per second. I'm not sure if that is fast or not. Any further tips +>> would be welcome. +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: In versions below 8.0, the planner will ignore your desire to +> choose an index scan if your joining column's datatypes do not +> match +> +> + +From pgsql-performance-owner@postgresql.org Thu Jun 22 09:17:39 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 654469F9FE3 + for ; + Thu, 22 Jun 2006 09:17:38 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 69485-06 for + ; + Thu, 22 Jun 2006 09:17:32 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) + by postgresql.org (Postfix) with ESMTP id F05E29F9ED6 + for ; + Thu, 22 Jun 2006 09:17:32 -0300 (ADT) +Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) + by mx-2.sollentuna.net (Postfix) with ESMTP + id 894D8F408D; Thu, 22 Jun 2006 14:17:30 +0200 (CEST) +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Subject: Re: Speeding up query, Joining 55mil and 43mil records. +Date: Thu, 22 Jun 2006 14:17:29 +0200 +Message-ID: <6BCB9D8A16AC4241919521715F4D8BCEA0FA74@algol.sollentuna.se> +In-Reply-To: <449A88CA.3000108@valuecare.nl> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Speeding up query, Joining 55mil and 43mil records. +thread-index: AcaV9SwaoXtbC12mTUmrLoWjTTzdeAAABQOw +From: "Magnus Hagander" +To: "nicky" , + "Sven Geisler" +Cc: +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/442 +X-Sequence-Number: 19799 + +> PostgreSQL elects not to use them. I assume, because it most=20 +> likely needs to traverse the entire table anyway. +>=20 +> if i change: / substr(t0.code,1,2) not in=20 +> ('14','15','16','17')/ +> to (removing the NOT): / substr(t0.code,1,2) in=20 +> ('14','15','16','17')/ +>=20 +> it uses the index, but it's not the query that needs to be=20 +> run anymore. + +If this is the only query that you're having problems with, you might be +helped with a partial index - depending on how much 14-17 really +filters. Try something like: + +CREATE INDEX foo ON src.src_faktuur_verrsec (id) WHERE +substr(t0.code,1,2) not in ('14','15','16','17') AND +(substr(t0.correctie,4,1) <> '1' OR t0.correctie is null) + +That index shuold be usable for the JOIN while filtering out all the +unnecessary rows before you even get tehre. +In the same way, if it filters a lot of rows, you might want to try +CREATE INDEX foo ON src.src_faktuur_verricht (id) WHERE EXTRACT(YEAR +from t1.datum) > 2004 + + +But this kind of requires that the partial indexes actually drop +significant amounts of the table. If not, then they'll be of no help. + +//Magnus + +From pgsql-performance-owner@postgresql.org Thu Jun 22 09:20:13 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 765469FA606 + for ; + Thu, 22 Jun 2006 09:20:13 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 70731-02 for + ; + Thu, 22 Jun 2006 09:20:02 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.aeccom.com (port-83-236-156-26.static.qsc.de + [83.236.156.26]) + by postgresql.org (Postfix) with ESMTP id AB2709F9ED6 + for ; + Thu, 22 Jun 2006 09:20:03 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mail.aeccom.com (Postfix) with ESMTP id CF1BF1C72C; + Thu, 22 Jun 2006 14:20:01 +0200 (CEST) +Received: from mail.aeccom.com ([127.0.0.1]) + by localhost (gate6.aeccom.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 29787-01-61; Thu, 22 Jun 2006 14:20:00 +0200 (CEST) +Received: from [192.168.2.140] (unknown [192.168.2.140]) + by mail.aeccom.com (Postfix) with ESMTP id ED1041C71E; + Thu, 22 Jun 2006 14:20:00 +0200 (CEST) +Message-ID: <449A8AEE.50701@aeccom.com> +Date: Thu, 22 Jun 2006 14:19:58 +0200 +From: Sven Geisler +Organization: AEC/communications GmbH +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: nicky +CC: pgsql-performance@postgresql.org +Subject: Re: Speeding up query, Joining 55mil and 43mil records. +References: <44994DE7.5070801@valuecare.nl> + <20060621184803.GC93655@pervasive.com> + <449A677D.4020504@valuecare.nl> <449A7F25.3040607@aeccom.com> + <449A88CA.3000108@valuecare.nl> +In-Reply-To: <449A88CA.3000108@valuecare.nl> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: amavisd-new at aeccom.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/443 +X-Sequence-Number: 19800 + +Hi Nick, + +I'm not that good to advice how to get PostgreSQL to use an index to get +your results faster. + +Did you try "not (substr(t0.code,1,2) in ('14','15','16','17'))"? + +Cheers +Sven. + +nicky schrieb: +> Hello Sven, +> +> We have the following indexes on src_faktuur_verrsec +> / +> CREATE INDEX src_faktuur_verrsec_idx0 +> ON src.src_faktuur_verrsec +> USING btree +> (id); +> +> CREATE INDEX src_faktuur_verrsec_idx1 +> ON src.src_faktuur_verrsec +> USING btree +> (substr(code::text, 1, 2)); +> +> CREATE INDEX src_faktuur_verrsec_idx2 +> ON src.src_faktuur_verrsec +> USING btree +> (substr(correctie::text, 4, 1));/ +> +> and another two on src_faktuur_verricht +> +> / CREATE INDEX src_faktuur_verricht_idx0 +> ON src.src_faktuur_verricht +> USING btree +> (id); +> +> CREATE INDEX src_faktuur_verricht_idx1 +> ON src.src_faktuur_verricht +> USING btree +> (date_part('year'::text, datum)) +> TABLESPACE src_index;/ +> +> PostgreSQL elects not to use them. I assume, because it most likely +> needs to traverse the entire table anyway. +> +> if i change: / substr(t0.code,1,2) not in +> ('14','15','16','17')/ +> to (removing the NOT): / substr(t0.code,1,2) in ('14','15','16','17')/ +> +> it uses the index, but it's not the query that needs to be run anymore. +> + +From pgsql-performance-owner@postgresql.org Thu Jun 22 10:22:58 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3964C9F9ED6; + Thu, 22 Jun 2006 10:22:58 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 75521-06; Thu, 22 Jun 2006 10:22:47 -0300 (ADT) +X-Greylist: delayed 00:18:51.797169 by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id A21089FA621; + Thu, 22 Jun 2006 10:22:44 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from out3.smtp.messagingengine.com (out3.smtp.messagingengine.com + [66.111.4.27]) + by svr4.postgresql.org (Postfix) with ESMTP id D48F95AF04F; + Thu, 22 Jun 2006 13:03:50 +0000 (GMT) +Received: from frontend3.internal (frontend3.internal [10.202.2.152]) + by frontend1.messagingengine.com (Postfix) with ESMTP id 8FCCBD85F49; + Thu, 22 Jun 2006 09:03:48 -0400 (EDT) +Received: from heartbeat1.messagingengine.com ([10.202.2.160]) + by frontend3.internal (MEProxy); Thu, 22 Jun 2006 09:03:49 -0400 +X-Sasl-enc: vS8IU6LgCSrQi69DZvJzV9+8ptwBt29BDLmRH+tcVoKL 1150981428 +Received: from [149.191.9.25] (unknown [129.230.248.1]) + by mail.messagingengine.com (Postfix) with ESMTP id 7EAE15043; + Thu, 22 Jun 2006 09:03:48 -0400 (EDT) +Message-ID: <449A9533.1030103@diroussel.xsmail.com> +Date: Thu, 22 Jun 2006 14:03:47 +0100 +From: David Roussel +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +Cc: pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org +Subject: Re: [HACKERS] Sun Donated a Sun Fire T2000 to the PostgreSQL +References: <4492CBE2.3090509@sun.com> <449331EC.10207@tweakers.net> + <200606161624.17081.josh@agliodbs.com> + <44951A42.6060007@tweakers.net> +In-Reply-To: <44951A42.6060007@tweakers.net> +Content-Type: multipart/alternative; + boundary="------------090200070504010008060904" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/444 +X-Sequence-Number: 19801 + +This is a multi-part message in MIME format. +--------------090200070504010008060904 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + + Arjen van der Meijden wrote: +> +> Here is a graph of our performance measured on PostgreSQL: +> http://achelois.tweakers.net/~acm/pgsql-t2000/T2000-schaling-postgresql.png +> +> +... +> +> The "perfect" line is based on the "Max" value for 1 core and then +> just multiplied by the amount of cores to have a linear reference. The +> "Bij 50" and the "perfect" line don't differ too much in color, but +> the top-one is the "perfect" line. + +Sureky the 'perfect' line ought to be linear? If the performance was +perfectly linear, then the 'pages generated' ought to be G times the +number (virtual) processors, where G is the gradient of the graph. In +such a case the graph will go through the origin (o,o), but you graph +does not show this. + +I'm a bit confused, what is the 'perfect' supposed to be? + +Thanks + +David + +--------------090200070504010008060904 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + + + + + + + +
Arjen van der Meijden +wrote: +

+Here is a graph of our performance measured on PostgreSQL:
+ http://achelois.tweakers.net/~acm/pgsql-t2000/T2000-schaling-postgresql.png +
+
+
+...
+

+The "perfect" line is based on the "Max" value for 1 core and then just +multiplied by the amount of cores to have a linear reference. The "Bij +50" and the "perfect" line don't differ too much in color, but the +top-one is the "perfect" line.
+
+
+Sureky the 'perfect' line ought to be linear?  If the performance was +perfectly linear, then the 'pages generated' ought to be G times the +number (virtual) processors, where G is the gradient of the graph.  In +such a case the graph will go through the origin (o,o), but you graph +does not show this. 
+
+I'm a bit confused, what is the 'perfect' supposed to be?
+
+Thanks
+
+David
+
+ + + +--------------090200070504010008060904-- + +From pgsql-performance-owner@postgresql.org Thu Jun 22 12:04:47 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 9ABCE9FA60A + for ; + Thu, 22 Jun 2006 12:04:47 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 95285-03 for + ; + Thu, 22 Jun 2006 12:04:36 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moonunit2.moonview.localnet (wsip-70-167-125-69.sd.sd.cox.net + [70.167.125.69]) + by postgresql.org (Postfix) with ESMTP id B5E3E9F9FE3 + for ; + Thu, 22 Jun 2006 12:04:35 -0300 (ADT) +Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) + by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id + k5MFHZ7e025215; Thu, 22 Jun 2006 08:17:35 -0700 +Message-ID: <449AA32D.1010502@modgraph-usa.com> +Date: Thu, 22 Jun 2006 07:03:25 -0700 +From: "Craig A. James" +User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Arjen van der Meijden , + pgsql-performance@postgresql.org +Subject: Re: [HACKERS] Sun Donated a Sun Fire T2000 to the PostgreSQL +References: <4492CBE2.3090509@sun.com> <449331EC.10207@tweakers.net> + <200606161624.17081.josh@agliodbs.com> + <44951A42.6060007@tweakers.net> + <449A9533.1030103@diroussel.xsmail.com> + <449AA6E9.9050804@tweakers.net> +In-Reply-To: <449AA6E9.9050804@tweakers.net> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/447 +X-Sequence-Number: 19804 + +Arjen van der Meijden wrote: +> First of all, this graph has no origin. Its a bit difficult to test with +> less than one cpu. + +Sure it does. I ran all the tests. They all took infinite time, and I got zero results. And my results are 100% accurate and reliable. It's perfectly valid data. :-) + +Craig + +From pgsql-performance-owner@postgresql.org Thu Jun 22 11:19:40 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5638B9F9ED6; + Thu, 22 Jun 2006 11:19:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 84339-03; Thu, 22 Jun 2006 11:19:30 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 55DBC9F9FE3; + Thu, 22 Jun 2006 11:19:29 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from olive.qinip.net (olive.qinip.net [62.100.30.40]) + by svr4.postgresql.org (Postfix) with ESMTP id 38EAE5AF025; + Thu, 22 Jun 2006 14:19:27 +0000 (GMT) +Received: from [127.0.0.1] (h8441139206.dsl.speedlinq.nl [84.41.139.206]) + by olive.qinip.net (Postfix) with ESMTP id B00191814E; + Thu, 22 Jun 2006 16:19:16 +0200 (MEST) +Message-ID: <449AA6E9.9050804@tweakers.net> +Date: Thu, 22 Jun 2006 16:19:21 +0200 +From: Arjen van der Meijden +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: David Roussel +Cc: pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org +Subject: Re: [HACKERS] Sun Donated a Sun Fire T2000 to the PostgreSQL +References: <4492CBE2.3090509@sun.com> <449331EC.10207@tweakers.net> + <200606161624.17081.josh@agliodbs.com> + <44951A42.6060007@tweakers.net> + <449A9533.1030103@diroussel.xsmail.com> +In-Reply-To: <449A9533.1030103@diroussel.xsmail.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Antivirus: avast! (VPS 0625-5, 21-06-2006), Outbound message +X-Antivirus-Status: Clean +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/445 +X-Sequence-Number: 19802 + +On 22-6-2006 15:03, David Roussel wrote: +> Sureky the 'perfect' line ought to be linear? If the performance was +> perfectly linear, then the 'pages generated' ought to be G times the +> number (virtual) processors, where G is the gradient of the graph. In +> such a case the graph will go through the origin (o,o), but you graph +> does not show this. +> +> I'm a bit confused, what is the 'perfect' supposed to be? + +First of all, this graph has no origin. Its a bit difficult to test with +less than one cpu. + +Anyway, the line actually is linear and would've gone through the +origin, if there was one. What I did was take the level of the +'max'-line at 1 and then multiply it by 2, 4, 6 and 8. So if at 1 the +level would've been 22000, the 2 would be 44000 and the 8 176000. + +Please do notice the distance between 1 and 2 on the x-axis is the same +as between 2 and 4, which makes the graph a bit harder to read. + +Best regards, + +Arjen + +From pgsql-performance-owner@postgresql.org Thu Jun 22 11:47:43 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 873919FA60A + for ; + Thu, 22 Jun 2006 11:47:42 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 86772-06 for + ; + Thu, 22 Jun 2006 11:47:31 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 6964C9F9ED6 + for ; + Thu, 22 Jun 2006 11:47:31 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5MElRRu029674; + Thu, 22 Jun 2006 10:47:27 -0400 (EDT) +To: "soni de" +cc: pgsql-performance@postgresql.org +Subject: Re: Regarding ERROR: fmgr_info: function 2720768: cache lookup failed +In-reply-to: <9f2e40a90606212158p58652b2bg4d5f4500b3564641@mail.gmail.com> +References: <9f2e40a90606212158p58652b2bg4d5f4500b3564641@mail.gmail.com> +Comments: In-reply-to "soni de" + message dated "Thu, 22 Jun 2006 10:28:11 +0530" +Date: Thu, 22 Jun 2006 10:47:27 -0400 +Message-ID: <29673.1150987647@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/446 +X-Sequence-Number: 19803 + +"soni de" writes: +> I am getting following error while inserting a row into the "abc" table: +> *ERROR: fmgr_info: function 2720768: cache lookup failed* + +What PG version is this? (I can tell from the spelling of the error +message that it's older than 7.4.) If it's pre-7.3 then the answer is +probably that you dropped and re-created the function, and now need to +drop and re-create the trigger to match. 7.3 shouldn't have let you +drop a function that has a trigger depending on it, though. + +BTW this seems a bit off-topic for pgsql-performance. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jun 22 13:05:06 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 24A249FA92E + for ; + Thu, 22 Jun 2006 13:05:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 03334-03 for + ; + Thu, 22 Jun 2006 13:05:00 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 9BD029FA7BA + for ; + Thu, 22 Jun 2006 13:04:59 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5MG4vHD000512; + Thu, 22 Jun 2006 12:04:58 -0400 (EDT) +To: Richard Frith-Macdonald +cc: pgsql-performance@postgresql.org +Subject: Re: Why is my (empty) partial index query slow? +In-reply-to: <5510ED72-8266-438B-A4DF-9591ED26BA38@tiptree.demon.co.uk> +References: <5510ED72-8266-438B-A4DF-9591ED26BA38@tiptree.demon.co.uk> +Comments: In-reply-to Richard Frith-Macdonald + message dated "Fri, 16 Jun 2006 08:17:14 +0100" +Date: Thu, 22 Jun 2006 12:04:57 -0400 +Message-ID: <511.1150992297@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/448 +X-Sequence-Number: 19805 + +Richard Frith-Macdonald writes: +> I have a producer/consumer setup where various producer processes +> insert new records into a table and consumer processes mark those +> records as having been handled when they have dealt with them, but +> leave the records in the table so that we can generate reports later. + +Have you tried EXPLAIN ANALYZE on the problem queries? + +If you want help here, you really need to show us the table and index +definitions, the exact queries, and the EXPLAIN ANALYZE results. Oh, +and mention the exact Postgres version you're using, too. Otherwise +we're just guessing at what's going on. + +> I guess that the fact that records are constantly (and rapidly) added +> to and removed from the index may have caused the index to become +> inefficient somehow ... + +How often are you vacuuming the table? A heavily-updated table needs a +lot of vacuuming to avoid becoming bloated. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jun 22 13:20:01 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7BDFB9FA5BA + for ; + Thu, 22 Jun 2006 13:19:59 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 02447-09 for + ; + Thu, 22 Jun 2006 13:19:54 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 4D0A49FA2F0 + for ; + Thu, 22 Jun 2006 13:19:54 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5MGJrrC000694; + Thu, 22 Jun 2006 12:19:53 -0400 (EDT) +To: Ron St-Pierre +cc: pgsql-performance@postgresql.org +Subject: Re: Tuning New Server (slow function) +In-reply-to: <44996C83.5040302@shaw.ca> +References: <44996C83.5040302@shaw.ca> +Comments: In-reply-to Ron St-Pierre + message dated "Wed, 21 Jun 2006 08:57:55 -0700" +Date: Thu, 22 Jun 2006 12:19:52 -0400 +Message-ID: <693.1150993192@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/449 +X-Sequence-Number: 19806 + +Ron St-Pierre writes: +> We just purchased a new Dell PowerEdge 2800 (dual xeon, 8GB RAM, raid 4, +> RHEL, postgres 8.1) and ported our old database over to it (single cpu, +> 2GB RAM, no raid, postgres 7.4). Our apps perform great on it, however +> some queries are super slow. One function in particular, which used to +> take 15-30 minutes on the old server, has been running now for over 12 +> hours: + +A fairly common gotcha in updating is to forget to ANALYZE all your +tables after loading the data into the new server. My bet is that some +of the queries in the function are using bad plans for lack of +up-to-date statistics. + +If ANALYZEing and then starting a fresh session (to get rid of the +function's cached plans) doesn't help, you'll need to do some comparison +of EXPLAIN plans between old and new server to try to figure out where +the problem is. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jun 22 13:24:52 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 92DC59FA5BA + for ; + Thu, 22 Jun 2006 13:24:51 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 06304-02 for + ; + Thu, 22 Jun 2006 13:24:47 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 656F29FA2F0 + for ; + Thu, 22 Jun 2006 13:24:46 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5MGOi6s000767; + Thu, 22 Jun 2006 12:24:44 -0400 (EDT) +To: Peter Wilson +cc: pgsql-performance@postgresql.org +Subject: Re: Poor performance - fixed by restart +In-reply-to: +References: +Comments: In-reply-to Peter Wilson + message dated "Thu, 22 Jun 2006 00:08:53 +0100" +Date: Thu, 22 Jun 2006 12:24:44 -0400 +Message-ID: <766.1150993484@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/450 +X-Sequence-Number: 19807 + +Peter Wilson writes: +> I'd tweaked a couple of parameters in postgres.conf - the significant one I +> thought being random_page_cost, so I changed this back to default and did a +> 'service postgresql reload' - no difference, but I wasn't sure whether this +> could be changed via reload so I restarted Postgres. + +> The restart fixed the problem. The 85 second insert time dropped back down to 5 +> seconds!!! + +Um, which parameters did you change *exactly*? + +Also, depending on how you were submitting the queries, it's possible +that Postgres was using cached plans already made based on the old +settings. In that case the restart would've cleared the bad plans +(but starting a fresh connection would've been sufficient for that). + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jun 22 15:11:52 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 376C19FAC76 + for ; + Thu, 22 Jun 2006 15:11:52 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 19160-09 for + ; + Thu, 22 Jun 2006 15:11:43 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail3.sea5.speakeasy.net (mail3.sea5.speakeasy.net + [69.17.117.5]) by postgresql.org (Postfix) with ESMTP id B41E39FA68D + for ; + Thu, 22 Jun 2006 15:11:40 -0300 (ADT) +Received: (qmail 2587 invoked from network); 22 Jun 2006 18:11:39 -0000 +Received: from dsl093-038-250.pdx1.dsl.speakeasy.net (HELO [192.168.1.21]) + (davidw@[66.93.38.250]) (envelope-sender ) + by mail3.sea5.speakeasy.net (qmail-ldap-1.03) with RC4-SHA encrypted + SMTP + for ; 22 Jun 2006 18:11:39 -0000 +In-Reply-To: <15919.1150920496@sss.pgh.pa.us> +References: <54D833BE-A58F-47B8-B070-2AEDC0802468@kineticode.com> + <15919.1150920496@sss.pgh.pa.us> +Mime-Version: 1.0 (Apple Message framework v750) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <0878A4AB-925F-4CB8-BB75-53340599825D@kineticode.com> +Cc: PostgreSQL Performance List +Content-Transfer-Encoding: 7bit +From: David Wheeler +Subject: Re: Performance of DOMAINs +Date: Thu, 22 Jun 2006 11:11:36 -0700 +To: Tom Lane +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/451 +X-Sequence-Number: 19808 + +On Jun 21, 2006, at 13:08, Tom Lane wrote: + +> There are some reports in the archives of particular usage patterns +> where they pretty much suck, because GetDomainConstraints() searches +> pg_constraint every time it's called. We do what we can to avoid +> calling that multiple times per query, but for something like a simple +> INSERT ... VALUES into a domain column, the setup overhead is still +> bad. + +I assume that there's no domain thingy that you already have that +could cache it, eh? + +Sorry, I ask this as someone who knows no C and less about +PostgreSQL's internals. + +Best, + +David + + +From pgsql-performance-owner@postgresql.org Thu Jun 22 15:18:22 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3F8079FB0D1 + for ; + Thu, 22 Jun 2006 15:18:22 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 22474-03 for + ; + Thu, 22 Jun 2006 15:18:17 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail6.sea5.speakeasy.net (mail6.sea5.speakeasy.net + [69.17.117.8]) by postgresql.org (Postfix) with ESMTP id 616409FA68D + for ; + Thu, 22 Jun 2006 15:18:16 -0300 (ADT) +Received: (qmail 17972 invoked from network); 22 Jun 2006 18:18:14 -0000 +Received: from dsl093-038-250.pdx1.dsl.speakeasy.net (HELO [192.168.1.21]) + (davidw@[66.93.38.250]) (envelope-sender ) + by mail6.sea5.speakeasy.net (qmail-ldap-1.03) with RC4-SHA encrypted + SMTP + for ; 22 Jun 2006 18:18:14 -0000 +In-Reply-To: <200606211819.08239.josh@agliodbs.com> +References: <54D833BE-A58F-47B8-B070-2AEDC0802468@kineticode.com> + <200606211819.08239.josh@agliodbs.com> +Mime-Version: 1.0 (Apple Message framework v750) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: +Cc: pgsql-performance@postgresql.org +Content-Transfer-Encoding: 7bit +From: David Wheeler +Subject: Re: Performance of DOMAINs +Date: Thu, 22 Jun 2006 11:18:12 -0700 +To: josh@agliodbs.com +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/452 +X-Sequence-Number: 19809 + +On Jun 21, 2006, at 18:19, Josh Berkus wrote: + +> Well, current case-insensitivity hacks definitely aren't compatible +> with +> LIKE as far as "begins with" indexes are concerned. + +Yes, currently I use LOWER() for my indexes and for all LIKE, =, etc. +queries. This works well, but ORDER by of course isn't what I'd like. +That's one of the things that Elein's email domain addresses, albeit +with a USING keyword, which is unfortunate. + +> Of course, floating +> LIKEs (%value%) are going to suck no matter what data type you're +> using. + +Yes, I know that. :-) I avoid that. + +> I created an operator for CI equality ... =~ ... which performs +> well on +> indexed columns. But it doesn't do "begins with". + +Oops. So how could it perform well on indexed columns? + +> ITEXT is a TODO, but there are reasons why it's harder than it looks. + +I'm sure. I should bug potential future SoC students about it. ;-) + +Best, + +David + +From pgsql-performance-owner@postgresql.org Thu Jun 22 15:18:58 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D476B9FAC76 + for ; + Thu, 22 Jun 2006 15:18:57 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 22833-03 for + ; + Thu, 22 Jun 2006 15:18:52 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail6.sea5.speakeasy.net (mail6.sea5.speakeasy.net + [69.17.117.8]) by postgresql.org (Postfix) with ESMTP id 98D5E9FA68D + for ; + Thu, 22 Jun 2006 15:18:51 -0300 (ADT) +Received: (qmail 19714 invoked from network); 22 Jun 2006 18:18:50 -0000 +Received: from dsl093-038-250.pdx1.dsl.speakeasy.net (HELO [192.168.1.21]) + (davidw@[66.93.38.250]) (envelope-sender ) + by mail6.sea5.speakeasy.net (qmail-ldap-1.03) with RC4-SHA encrypted + SMTP + for ; 22 Jun 2006 18:18:50 -0000 +In-Reply-To: +References: <54D833BE-A58F-47B8-B070-2AEDC0802468@kineticode.com> + <200606211819.08239.josh@agliodbs.com> + +Mime-Version: 1.0 (Apple Message framework v750) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <8AE61194-31F1-4B47-AA64-FF902AD4BEBB@kineticode.com> +Cc: pgsql-performance@postgresql.org +Content-Transfer-Encoding: 7bit +From: David Wheeler +Subject: Re: Performance of DOMAINs +Date: Thu, 22 Jun 2006 11:18:48 -0700 +To: Michael Glaesemann +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/453 +X-Sequence-Number: 19810 + +On Jun 21, 2006, at 19:24, Michael Glaesemann wrote: + +> I haven't seen it mentioned in this thread yet, but have you looked +> at citext? +> +> http://gborg.postgresql.org/project/citext/projdisplay.php +> +> I don't have any experience with it, but perhaps it can do what +> you're looking for. + +Yes, I've seen it. I haven't tried it, either. It'd be nice if it had +a compatible license with PostgreSQL, though. + +Best, + +David + +From pgsql-performance-owner@postgresql.org Thu Jun 22 15:23:09 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5681B9FAC76 + for ; + Thu, 22 Jun 2006 15:23:09 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 20684-07 for + ; + Thu, 22 Jun 2006 15:22:57 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id 85CFD9FA68D + for ; + Thu, 22 Jun 2006 15:22:56 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id BF0E830BE1; Thu, 22 Jun 2006 20:22:55 +0200 (MET DST) +From: "Andrus" +X-Newsgroups: pgsql.performance +Subject: why group expressions cause query to run forever +Date: Thu, 22 Jun 2006 21:22:44 +0300 +Organization: Hub.Org Networking Services +Lines: 138 +Message-ID: +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +X-RFC2646: Format=Flowed; Original +To: pgsql-performance@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/454 +X-Sequence-Number: 19811 + +How to speed the following query? It seems to run forever. + +explain SELECT +bilkaib.DB, +CASE WHEN dbkonto.objekt1='+' THEN bilkaib.DBOBJEKT ELSE '' END AS dbobjekt, +CASE WHEN dbkonto.objekt2='+' THEN bilkaib.DB2OBJEKT ELSE '' END AS +db2objekt, +CASE WHEN dbkonto.objekt3='+' THEN bilkaib.DB3OBJEKT ELSE '' END AS +db3objekt, +CASE WHEN dbkonto.objekt4='+' THEN bilkaib.DB4OBJEKT ELSE '' END AS +db4objekt, +CASE WHEN dbkonto.objekt5='+' THEN bilkaib.DB5OBJEKT ELSE '' END AS +db5objekt, +CASE WHEN dbkonto.objekt6='+' THEN bilkaib.DB6OBJEKT ELSE '' END AS +db6objekt, +CASE WHEN dbkonto.objekt7='+' THEN bilkaib.DB7OBJEKT ELSE '' END AS +db7objekt, +CASE WHEN dbkonto.objekt8='+' THEN bilkaib.DB8OBJEKT ELSE '' END AS +db8objekt, +CASE WHEN dbkonto.objekt9='+' THEN bilkaib.DB9OBJEKT ELSE '' END AS +db9objekt, +bilkaib.CR, +CASE WHEN crkonto.objekt1='+' THEN bilkaib.crOBJEKT ELSE '' END AS crobjekt, +CASE WHEN crkonto.objekt2='+' THEN bilkaib.cr2OBJEKT ELSE '' END AS +cr2objekt, +CASE WHEN crkonto.objekt3='+' THEN bilkaib.cr3OBJEKT ELSE '' END AS +cr3objekt, +CASE WHEN crkonto.objekt4='+' THEN bilkaib.cr4OBJEKT ELSE '' END AS +cr4objekt, +CASE WHEN crkonto.objekt5='+' THEN bilkaib.cr5OBJEKT ELSE '' END AS +cr5objekt, +CASE WHEN crkonto.objekt6='+' THEN bilkaib.cr6OBJEKT ELSE '' END AS +cr6objekt, +CASE WHEN crkonto.objekt7='+' THEN bilkaib.cr7OBJEKT ELSE '' END AS +cr7objekt, +CASE WHEN crkonto.objekt8='+' THEN bilkaib.cr8OBJEKT ELSE '' END AS +cr8objekt, +CASE WHEN crkonto.objekt9='+' THEN bilkaib.cr9OBJEKT ELSE '' END AS +cr9objekt, +bilkaib.RAHA, +CASE WHEN crkonto.klienkaupa OR dbkonto.klienkaupa + OR crkonto.tyyp IN ('K','I') OR dbkonto.tyyp IN ('K','I') +THEN + bilkaib.KLIENT ELSE '' END AS klient, + +bilkaib.EXCHRATE, + +CASE WHEN crkonto.klienkaupa OR dbkonto.klienkaupa + OR crkonto.tyyp IN ('K','I') OR dbkonto.tyyp IN ('K','I') +THEN + '' ELSE '' END AS kliendinim, -- 24. + +CASE WHEN crkonto.arvekaupa OR dbkonto.arvekaupa + OR (bilkaib.cr<>'00' AND crkonto.tyyp='K') + OR (bilkaib.db<>'00' AND dbkonto.tyyp='K') +THEN bilkaib.doknr ELSE CAST('' AS CHAR(25) ) END AS doknr + +,CASE WHEN bilkaib.raha='EEK' THEN CAST('20060101' AS DATE) ELSE +bilkaib.kuupaev END AS kuupaev +,SUM(bilkaib.summa) AS summa +,CAST( 0 as numeric(12,2)) as rhsumma + from BILKAIB join KONTO CRKONTO ON bilkaib.cr=crkonto.kontonr AND + crkonto.iseloom='A' + join KONTO DBKONTO ON bilkaib.db=dbkonto.kontonr AND + dbkonto.iseloom='A' + where + bilkaib.kuupaev BETWEEN '2006-01-01' AND '2006-12-31' + GROUP BY +1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26 + +"GroupAggregate (cost=83038.02..103020.42 rows=124890 width=759)" +" -> Sort (cost=83038.02..83350.25 rows=124890 width=759)" +" Sort Key: bilkaib.db, CASE WHEN (dbkonto.objekt1 = '+'::bpchar) +THEN bilkaib.dbobjekt ELSE ''::bpchar END, CASE WHEN (dbkonto.objekt2 = +'+'::bpchar) THEN bilkaib.db2objekt ELSE ''::bpchar END, CASE WHEN +(dbkonto.objekt3 = '+'::bpchar) THEN bilkaib. (..)" +" -> Hash Join (cost=41.71..23348.23 rows=124890 width=759)" +" Hash Cond: ("outer".cr = "inner".kontonr)" +" -> Hash Join (cost=20.86..11676.02 rows=144696 width=707)" +" Hash Cond: ("outer".db = "inner".kontonr)" +" -> Seq Scan on bilkaib (cost=0.00..9369.99 +rows=167643 width=655)" +" Filter: ((kuupaev >= '2006-01-01'::date) AND +(kuupaev <= '2006-12-31'::date))" +" -> Hash (cost=20.29..20.29 rows=227 width=66)" +" -> Seq Scan on konto dbkonto (cost=0.00..20.29 +rows=227 width=66)" +" Filter: (iseloom = 'A'::bpchar)" +" -> Hash (cost=20.29..20.29 rows=227 width=66)" +" -> Seq Scan on konto crkonto (cost=0.00..20.29 +rows=227 width=66)" +" Filter: (iseloom = 'A'::bpchar)" + + +If I only replace column expressions with constant numbers, it runs fast: + +explain analyze SELECT 1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6 +,SUM(bilkaib.summa) AS summa +,CAST( 0 as numeric(12,2)) as rhsumma + from BILKAIB join KONTO CRKONTO ON bilkaib.cr=crkonto.kontonr AND + crkonto.iseloom='A' + join KONTO DBKONTO ON bilkaib.db=dbkonto.kontonr AND + dbkonto.iseloom='A' + where + bilkaib.kuupaev BETWEEN '2006-01-01' AND '2006-12-31' + GROUP BY +1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26 + + +"HashAggregate (cost=22099.33..22099.34 rows=1 width=11) (actual +time=4518.820..4518.824 rows=1 loops=1)" +" -> Hash Join (cost=41.71..13669.25 rows=124890 width=11) (actual +time=4.347..3445.650 rows=167349 loops=1)" +" Hash Cond: ("outer".cr = "inner".kontonr)" +" -> Hash Join (cost=20.86..11676.02 rows=144696 width=25) (actual +time=2.165..2076.951 rows=167349 loops=1)" +" Hash Cond: ("outer".db = "inner".kontonr)" +" -> Seq Scan on bilkaib (cost=0.00..9369.99 rows=167643 +width=39) (actual time=0.012..725.813 rows=167349 loops=1)" +" Filter: ((kuupaev >= '2006-01-01'::date) AND (kuupaev +<= '2006-12-31'::date))" +" -> Hash (cost=20.29..20.29 rows=227 width=14) (actual +time=2.112..2.112 rows=227 loops=1)" +" -> Seq Scan on konto dbkonto (cost=0.00..20.29 +rows=227 width=14) (actual time=0.011..1.126 rows=227 loops=1)" +" Filter: (iseloom = 'A'::bpchar)" +" -> Hash (cost=20.29..20.29 rows=227 width=14) (actual +time=2.149..2.149 rows=227 loops=1)" +" -> Seq Scan on konto crkonto (cost=0.00..20.29 rows=227 +width=14) (actual time=0.022..1.152 rows=227 loops=1)" +" Filter: (iseloom = 'A'::bpchar)" +"Total runtime: 4519.063 ms" + +Postgres 8.1 on Gentoo Linux. + +Andrus. + + + +From pgsql-performance-owner@postgresql.org Thu Jun 22 16:30:40 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 566C29FA5BA + for ; + Thu, 22 Jun 2006 16:30:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 30881-09 for + ; + Thu, 22 Jun 2006 16:30:30 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 8EAB99FA2F0 + for ; + Thu, 22 Jun 2006 16:30:29 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5MJUOIg002852; + Thu, 22 Jun 2006 15:30:24 -0400 (EDT) +To: "Andrus" +cc: pgsql-performance@postgresql.org +Subject: Re: why group expressions cause query to run forever +In-reply-to: +References: +Comments: In-reply-to "Andrus" + message dated "Thu, 22 Jun 2006 21:22:44 +0300" +Date: Thu, 22 Jun 2006 15:30:24 -0400 +Message-ID: <2851.1151004624@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/455 +X-Sequence-Number: 19812 + +"Andrus" writes: +> How to speed the following query? It seems to run forever. +> explain SELECT +> bilkaib.DB, +> CASE WHEN dbkonto.objekt1='+' THEN bilkaib.DBOBJEKT ELSE '' END AS dbobjekt, +> CASE WHEN dbkonto.objekt2='+' THEN bilkaib.DB2OBJEKT ELSE '' END AS +> db2objekt, +> CASE WHEN dbkonto.objekt3='+' THEN bilkaib.DB3OBJEKT ELSE '' END AS +> db3objekt, +> ... +> GROUP BY +> 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26 + +I think the problem is probably that you're sorting two dozen CHAR +columns, and that in many of the rows all these entries are '' forcing +the sort code to compare all two dozen columns (not so)? So the sort +ends up doing lots and lots and lots of CHAR comparisons. Which can +be slow, especially in non-C locales. What's your locale setting? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jun 22 18:15:45 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6674D9FA5FC + for ; + Thu, 22 Jun 2006 18:15:45 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 50181-08 for + ; + Thu, 22 Jun 2006 18:15:26 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 313DC9FA2F0 + for ; + Thu, 22 Jun 2006 18:15:25 -0300 (ADT) +Received: from [10.82.1.60] (docboy.decibel.org [65.86.67.34]) + (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by noel.decibel.org (Postfix) with ESMTP id 0F08C56431; + Thu, 22 Jun 2006 16:15:14 -0500 (CDT) +In-Reply-To: <4499CDD2.2070900@shaw.ca> +References: <4499B9CD.4000500@shaw.ca> <20060621222142.GO93655@pervasive.com> + <4499CDD2.2070900@shaw.ca> +Mime-Version: 1.0 (Apple Message framework v750) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: +Cc: pgsql-performance@postgresql.org +Content-Transfer-Encoding: 7bit +From: Jim Nasby +Subject: Re: Tuning New Server (slow function) +Date: Thu, 22 Jun 2006 16:15:13 -0500 +To: Ron St-Pierre +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/456 +X-Sequence-Number: 19813 + +On Jun 21, 2006, at 5:53 PM, Ron St-Pierre wrote: +> Jim C. Nasby wrote: +>> On Wed, Jun 21, 2006 at 02:27:41PM -0700, Ron St-Pierre wrote: +>> +>>> We just purchased a new Dell PowerEdge 2800 (dual xeon, 8GB RAM, +>>> raid 4, RHEL, postgres 8.1) and ported our old database over to +>>> it (single cpu, +>> +>> RAID *4*? +>> +> oops, raid 5 (but we are getting good io throughput...) + +Just remember that unless you have a really good battery-backed +controller, writes to RAID5 pretty much suck. + +>>> BEGIN +>>> TRUNCATE stock.datacount; +>>> FOR rec IN SELECT itemID, item, hexValue FROM +>>> stock.activeitem LOOP +>>> histdate := (SELECT updatedate FROM stock.historical s +>>> WHERE s.itemID=rec.itemID ORDER BY updatedate DESC LIMIT 1); +>>> IF histdate IS NOT NULL THEN +>>> funddate := (SELECT updatedate FROM stock.funddata s +>>> WHERE s.itemID=rec.itemID); +>>> techdate := (SELECT updatedate FROM +>>> stock.techsignals s WHERE s.itemID=rec.itemID); +>>> IF (histdate <> funddate) OR (histdate <> techdate) +>>> OR (funddate IS NULL) OR (techdate IS NULL) THEN +>>> counter := counter + 1; +>>> outrec.itemID := rec.itemID; +>>> outrec.item := rec.item; +>>> outrec.hexvalue := rec.hexvalue; +>>> RETURN NEXT outrec; +>>> END IF; +>>> END IF; +>>> END LOOP; +>>> INSERT INTO stock.datacount (itemcount) VALUES (counter); +>>> COPY stock.datacount TO ''/tmp/datacount''; +>>> RETURN; +>>> END; +> How would I rewrite it to do away with the cursor? + +Something like... + +SELECT ... + FROM (SELECT a...., f.updatedate AS funddate, t.updatedate AS +techdate, max(updatedate) hist_date + FROM activeitem a + JOIN historical h USING itemid + GROUP BY a...., f.updatedate, t.updatedate) AS a + LEFT JOIN funddate f USING itemid + LEFT JOIN techsignals USING itemid + WHERE f.updatedate <> hist_date OR t.updatedate <> hist_date OR +f.updatedate IS NULL OR t.updatedate IS NULL +; + +BTW, there's some trick that would let you include the NULL tests +with the other tests in the WHERE, but I can't remember it off the +top of my head... + +>>> "top" shows: +>>> CPU states: cpu user nice system irq softirq +>>> iowait idle +>>> total 5.8% 0.6% 31.2% 0.0% 0.0% 0.5% +>>> 61.6% +>>> Mem: 8152592k av, 8143012k used, 9580k free, 0k shrd, +>>> 179888k buff +>>> +>> +>> The high system % (if I'm reading this correctly) makes me wonder if +>> this is some kind of locking issue. +>> +>> +> But it's the only postgres process running. + +Sure, but PostgreSQL still acquires internal locks. +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + + + +From pgsql-performance-owner@postgresql.org Thu Jun 22 21:31:29 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7924F9FA2F4 + for ; + Thu, 22 Jun 2006 21:31:28 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 73991-09 for + ; + Thu, 22 Jun 2006 21:31:18 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 318749FABE7 + for ; + Thu, 22 Jun 2006 21:31:17 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5N0VA7i009337; + Thu, 22 Jun 2006 20:31:10 -0400 (EDT) +To: meetesh.karia@alumni.duke.edu +cc: "Craig A. James" , + pgsql-performance@postgresql.org, "Jean-David Dahan" +Subject: Re: Query hanging/not finishing inconsistently +In-reply-to: +References: + <447207C3.8000104@modgraph-usa.com> + + +Comments: In-reply-to "Meetesh Karia" + message dated "Tue, 20 Jun 2006 12:25:19 -0500" +Date: Thu, 22 Jun 2006 20:31:10 -0400 +Message-ID: <9336.1151022670@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/457 +X-Sequence-Number: 19814 + +"Meetesh Karia" writes: +> ... But, once again we ran into the same +> situation where a query that normally executes in ~15ms wouldn't finish. As +> before, there were no ungranted locks and threads weren't waiting on a +> lock. I attached gdb to one of the stuck postgres processes and got the +> following stack trace: + +> #0 0x008967a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2 +> #1 0x00977e5b in semop () from /lib/tls/libc.so.6 +> #2 0x08167298 in PGSemaphoreLock () +> #3 0x0818bcb5 in LWLockAcquire () +> #4 0x080a47f5 in SimpleLruWritePage () +> #5 0x080a48ad in SimpleLruReadPage () +> #6 0x080a519a in SubTransGetParent () +> #7 0x080a51f2 in SubTransGetTopmostTransaction () +> #8 0x0821371c in HeapTupleSatisfiesSnapshot () + +What I'm wondering about is possible deadlock conditions inside slru.c. +There's no deadlock detection for LWLocks, so if it happened, the +processes involved would just freeze up. + +If this happens again, would you collect stack traces from all the stuck +processes, not just one? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jun 22 21:44:03 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DD0C59FA5E6 + for ; + Thu, 22 Jun 2006 21:44:02 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 77339-06 for + ; + Thu, 22 Jun 2006 21:43:54 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id E356C9FA2F4 + for ; + Thu, 22 Jun 2006 21:43:54 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5N0hql8009443; + Thu, 22 Jun 2006 20:43:52 -0400 (EDT) +To: Richard Frith-Macdonald +cc: pgsql-performance@postgresql.org +Subject: Re: Why is my (empty) partial index query slow? +In-reply-to: +References: <5510ED72-8266-438B-A4DF-9591ED26BA38@tiptree.demon.co.uk> + <511.1150992297@sss.pgh.pa.us> + +Comments: In-reply-to Richard Frith-Macdonald + message dated "Thu, 22 Jun 2006 17:28:11 +0100" +Date: Thu, 22 Jun 2006 20:43:52 -0400 +Message-ID: <9442.1151023432@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/458 +X-Sequence-Number: 19815 + +Richard Frith-Macdonald writes: +> What has confused me is why a query using an empty index should be +> slow, irrespective of the state of the table that the index applies to. + +Is it actually empty, or have you just deleted-and-not-yet-vacuumed +all the rows in the index? + +I had hoped to see comparative EXPLAIN ANALYZE output for the fast and +slow cases. Maybe when it gets slow again you could redo the explain. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Jun 23 07:29:24 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 76FF29FA6B3 + for ; + Fri, 23 Jun 2006 07:29:24 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 90076-01 for + ; + Fri, 23 Jun 2006 07:29:19 -0300 (ADT) +X-Greylist: delayed 00:17:12.043957 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id D44009FA65C + for ; + Fri, 23 Jun 2006 07:29:19 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from smtp1.voila.fr (smtp1.voila.fr [193.252.22.174]) + by svr4.postgresql.org (Postfix) with ESMTP id 0CF975AF093 + for ; + Fri, 23 Jun 2006 10:12:06 +0000 (GMT) +Received: from me-wanadoo.net (localhost [127.0.0.1]) + by mwinf4009.voila.fr (SMTP Server) with ESMTP id 26D0E6800147 + for ; + Fri, 23 Jun 2006 12:12:03 +0200 (CEST) +Received: from wwinf4002 (wwinf4002 [172.22.157.29]) + by mwinf4009.voila.fr (SMTP Server) with ESMTP id 1C1B06800145 + for ; + Fri, 23 Jun 2006 12:12:03 +0200 (CEST) +X-ME-UUID: 20060623101203115.1C1B06800145@mwinf4009.voila.fr +Message-ID: <258525.1151057523099.JavaMail.www@wwinf4002> +From: luchot +Reply-To: luchot@voila.fr +To: pgsql-performance@postgresql.org +Subject: Occupation bloc in pages of table +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: quoted-printable +X-Originating-IP: [129.184.84.11] +X-Wum-Nature: EMAIL-NATURE +X-WUM-FROM: |~| +X-WUM-TO: |~| +X-WUM-REPLYTO: |~| +Date: Fri, 23 Jun 2006 12:12:03 +0200 (CEST) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/459 +X-Sequence-Number: 19816 + +Hello, + + +I see in the documentation that we can obtain the number of pages for a ta= +ble with the view named pg_class. + +I would want if it is possible for each pages of a table to have the occupa= +tion of blocs in percentage in order to see if the page is good full or not= +. + +I don=E2=80=99t find anything in the doc and the archive. + +Best regards, + + +Sorry for my english + + + +From pgsql-performance-owner@postgresql.org Fri Jun 23 08:56:19 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DFBC59FA634 + for ; + Fri, 23 Jun 2006 08:56:18 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 97418-07 for + ; + Fri, 23 Jun 2006 08:56:12 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) + by postgresql.org (Postfix) with ESMTP id 0A91B9FA5DD + for ; + Fri, 23 Jun 2006 08:56:12 -0300 (ADT) +Received: from kingfisher.intern.logix-tt.com (Tb02f.t.pppool.de + [89.55.176.47]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.logix-tt.com (Postfix) with ESMTP id 184A865876; + Fri, 23 Jun 2006 13:57:41 +0200 (CEST) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 712611852EF72; + Fri, 23 Jun 2006 13:56:16 +0200 (CEST) +Message-ID: <449BD6E0.10305@logix-tt.com> +Date: Fri, 23 Jun 2006 13:56:16 +0200 +From: Markus Schaber +Organization: Logical Tracking and Tracing International AG, Switzerland +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: Tim Allen +Cc: pgsql-performance@postgresql.org +Subject: Re: SAN performance mystery +References: <4491D61B.9040507@proximity.com.au> +In-Reply-To: <4491D61B.9040507@proximity.com.au> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/460 +X-Sequence-Number: 19817 + +Hi, Tim, + +Tim Allen wrote: +> One thing that has been +> apparent is that autovacuum has not been able to keep the database +> sufficiently tamed. A pg_dump/pg_restore cycle reduced the total +> database size from 81G to 36G. + +Two first shots: + +- Increase your free_space_map settings, until (auto)vacuum does not +warn about a too small FSM setting any more + +- Tune autovacuum to run more often, possibly with a higher delay +setting to lower the load. + +If you still have the original database around, + +> Performing the restore took about 23 hours. + +Try to put the WAL on another spindle, and increase the WAL size / +checkpoint segments. + +When most of the restore time was spent in index creation, increase the +sort mem / maintainance work mem settings. + + +HTH, +Markus + +-- +Markus Schaber | Logical Tracking&Tracing International AG +Dipl. Inf. | Software Development GIS + +Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org + +From pgsql-performance-owner@postgresql.org Fri Jun 23 09:02:24 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C07EC9FA634 + for ; + Fri, 23 Jun 2006 09:02:23 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 95908-09 for + ; + Fri, 23 Jun 2006 09:02:17 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) + by postgresql.org (Postfix) with ESMTP id A33EA9FA5DD + for ; + Fri, 23 Jun 2006 09:02:17 -0300 (ADT) +Received: from kingfisher.intern.logix-tt.com (Tb02f.t.pppool.de + [89.55.176.47]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.logix-tt.com (Postfix) with ESMTP id 3014265876; + Fri, 23 Jun 2006 14:03:51 +0200 (CEST) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 4B3431852EF72; + Fri, 23 Jun 2006 14:02:27 +0200 (CEST) +Message-ID: <449BD853.7050908@logix-tt.com> +Date: Fri, 23 Jun 2006 14:02:27 +0200 +From: Markus Schaber +Organization: Logical Tracking and Tracing International AG, Switzerland +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Cc: Tim Allen +Subject: Re: SAN performance mystery +References: <4491D61B.9040507@proximity.com.au> <449BD6E0.10305@logix-tt.com> +In-Reply-To: <449BD6E0.10305@logix-tt.com> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/461 +X-Sequence-Number: 19818 + +Hi, Tim, + +Seems I sent my message to fast, cut in middle of a sencence: + +Markus Schaber wrote: +>> A pg_dump/pg_restore cycle reduced the total +>> database size from 81G to 36G. + +> If you still have the original database around, + +... can you check wether VACUUM FULL and REINDEX achieve the same effect? + +Thanks, +Markus + + +-- +Markus Schaber | Logical Tracking&Tracing International AG +Dipl. Inf. | Software Development GIS + +Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org + +From pgsql-performance-owner@postgresql.org Fri Jun 23 09:32:30 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 786309FA634 + for ; + Fri, 23 Jun 2006 09:32:29 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 01611-08 for + ; + Fri, 23 Jun 2006 09:32:19 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) + by postgresql.org (Postfix) with ESMTP id 90AB69FA182 + for ; + Fri, 23 Jun 2006 09:32:19 -0300 (ADT) +Received: from kingfisher.intern.logix-tt.com (Tb02f.t.pppool.de + [89.55.176.47]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.logix-tt.com (Postfix) with ESMTP id F003065876 + for ; + Fri, 23 Jun 2006 14:33:52 +0200 (CEST) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 485D91852EF72 + for ; + Fri, 23 Jun 2006 14:32:29 +0200 (CEST) +Message-ID: <449BDF5D.3060109@logix-tt.com> +Date: Fri, 23 Jun 2006 14:32:29 +0200 +From: Markus Schaber +Organization: Logical Tracking and Tracing International AG, Switzerland +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: postgres performance list +Subject: Re: Help tuning autovacuum - seeing lots of relationbloat +References: <200606211052.43227.jody.brownell@q1labs.com> + <1150898912.3309.23.camel@coppola.muc.ecircle.de> + <200606211227.06618.jody.brownell@q1labs.com> + <1150904541.3309.38.camel@coppola.muc.ecircle.de> +In-Reply-To: <1150904541.3309.38.camel@coppola.muc.ecircle.de> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/462 +X-Sequence-Number: 19819 + +Hi, Csaba, + +Csaba Nagy wrote: + +> Well, your application might be completely well behaved and still your +> DBA (or your favorite DB access tool for that matter) can leave open +> transactions in an interactive session. It never hurts to check if you +> actually have "idle in transaction" sessions. It happened a few times to +> us, some of those were bad coding on ad-hoc tools written by us, others +> were badly behaved DB access tools opening a transaction immediately +> after connect and after each successful command, effectively leaving an +> open transaction when leaving it open while having lunch... + +Some older JDBC driver versions had the bug that they always had an open +transaction, thus an application server having some pooled connections +lingering around could block vacuum forever. + +Markus +-- +Markus Schaber | Logical Tracking&Tracing International AG +Dipl. Inf. | Software Development GIS + +Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org + +From pgsql-performance-owner@postgresql.org Fri Jun 23 09:40:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E2F949FA5DD + for ; + Fri, 23 Jun 2006 09:40:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 03260-08 for + ; + Fri, 23 Jun 2006 09:40:38 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) + by postgresql.org (Postfix) with ESMTP id 370799FA182 + for ; + Fri, 23 Jun 2006 09:40:38 -0300 (ADT) +Received: from kingfisher.intern.logix-tt.com (Tb02f.t.pppool.de + [89.55.176.47]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.logix-tt.com (Postfix) with ESMTP id DF98265876 + for ; + Fri, 23 Jun 2006 14:42:11 +0200 (CEST) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 050DA1852EF72 + for ; + Fri, 23 Jun 2006 14:40:48 +0200 (CEST) +Message-ID: <449BE14F.3060601@logix-tt.com> +Date: Fri, 23 Jun 2006 14:40:47 +0200 +From: Markus Schaber +Organization: Logical Tracking and Tracing International AG, Switzerland +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: postgres performance list +Subject: Re: Help tuning autovacuum - seeing lots of relationbloat +References: <200606211052.43227.jody.brownell@q1labs.com> + <200606211227.06618.jody.brownell@q1labs.com> + <1150904541.3309.38.camel@coppola.muc.ecircle.de> + <200606211321.06253.jody.brownell@q1labs.com> + <20060621193823.GI93655@pervasive.com> +In-Reply-To: <20060621193823.GI93655@pervasive.com> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/463 +X-Sequence-Number: 19820 + +Jim C. Nasby wrote: +> On Wed, Jun 21, 2006 at 01:21:05PM -0300, jody brownell wrote: +>> Jun 21 13:04:04 vanquish postgres[3311]: [19-1] DEBUG: "target": removed 5645231 row versions in 106508 pages +>> Jun 21 13:04:04 vanquish postgres[3311]: [19-2] DETAIL: CPU 3.37s/1.23u sec elapsed 40.63 sec. +>> Jun 21 13:04:04 vanquish postgres[3311]: [20-1] DEBUG: "target": found 5645231 removable, 1296817 nonremovable row versions in 114701 pages +>> Jun 21 13:04:04 vanquish postgres[3311]: [20-2] DETAIL: 0 dead row versions cannot be removed yet. +> +> So the table contained 5.6M dead rows and 1.3M live rows. +> +> I think you should forget about having autovacuum keep this table +> in-check and add manual vacuum commands to your code. Autovac is +> intended to deal with 99% of use cases; this is pretty clearly in the 1% +> it can't handle. + +Maybe your free space map is configured to small, can you watch out for +log messages telling to increase it? + + +HTH, +Markus + +-- +Markus Schaber | Logical Tracking&Tracing International AG +Dipl. Inf. | Software Development GIS + +Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org + +From pgsql-performance-owner@postgresql.org Fri Jun 23 13:09:51 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 294359FA999 + for ; + Fri, 23 Jun 2006 13:09:51 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 37019-04 for + ; + Fri, 23 Jun 2006 13:09:45 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 641709FA92E + for ; + Fri, 23 Jun 2006 13:09:45 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5NG9fRf016265; + Fri, 23 Jun 2006 12:09:42 -0400 (EDT) +To: luchot@voila.fr +cc: pgsql-performance@postgresql.org +Subject: Re: Occupation bloc in pages of table +In-reply-to: <258525.1151057523099.JavaMail.www@wwinf4002> +References: <258525.1151057523099.JavaMail.www@wwinf4002> +Comments: In-reply-to luchot + message dated "Fri, 23 Jun 2006 12:12:03 +0200" +Date: Fri, 23 Jun 2006 12:09:41 -0400 +Message-ID: <16264.1151078981@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/464 +X-Sequence-Number: 19821 + +luchot writes: +> I would want if it is possible for each pages of a table to have the occupation of blocs in percentage in order to see if the page is good full or not. + +There is not any magic way of getting that information, but you could +modify contrib/pgstattuple to produce such a report. + + regards, tom lane + +From pgsql-admin-owner@postgresql.org Fri Jun 23 15:39:25 2006 +X-Original-To: pgsql-admin-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id CC9BB9FB1B7 + for ; + Fri, 23 Jun 2006 15:39:24 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 95030-03 for ; + Fri, 23 Jun 2006 15:39:17 -0300 (ADT) +X-Greylist: delayed 00:06:37.340821 by SQLgrey- +Received: from web52407.mail.yahoo.com (web52407.mail.yahoo.com + [206.190.48.170]) + by postgresql.org (Postfix) with SMTP id DAA599FA64B + for ; Fri, 23 Jun 2006 15:39:17 -0300 (ADT) +Received: (qmail 49410 invoked by uid 60001); 23 Jun 2006 18:32:35 -0000 +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; + h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; + b=x3x6t4nUj8Lcj2NjtG1nW/vup9Z5s4WoO2JA6X/5eOKojsB86fs6SlRIasHSDnRp9qYwOMXVlWfQdg3VTf01PnjBDu1+VSC6UIUzHC4XddKmMbqsvE1DYPf+skkx7gbgi9M5rWm30DArbF+ry5Wxx8rPDcPxXXQzkq4oYse3mXU= + ; +Message-ID: <20060623183235.49408.qmail@web52407.mail.yahoo.com> +Received: from [201.79.100.24] by web52407.mail.yahoo.com via HTTP; + Fri, 23 Jun 2006 15:32:35 ART +Date: Fri, 23 Jun 2006 15:32:35 -0300 (ART) +From: Daniel Xavier de Sousa +Subject: Buffers to Nest Loop Join +To: pgsql-admin@postgresql.org, pgsql-performance@postgresql.org +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-1427742670-1151087555=:48936" +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/215 +X-Sequence-Number: 22177 + +--0-1427742670-1151087555=:48936 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit + +Hi for all, + + Please, + Normaly when some SGBD exec the algoritm Nest-Loop Join, there are diferences about the space(buffer) for outer table and inner table. So, I want know where Postgres define the number for this spaces (buffers)? And can I change it? + + This is very important to me. + + Thanks, + I hope that somebody can help me. + By + Daniel + + + +--------------------------------- + Abra sua conta no Yahoo! Mail - 1GB de espa�o, alertas de e-mail no celular e anti-spam realmente eficaz. +--0-1427742670-1151087555=:48936 +Content-Type: text/html; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit + +Hi for all,

Please,
Normaly when some SGBD exec the algoritm Nest-Loop Join, there are diferences about the space(buffer)  for  outer table  and  inner  table. So, I want know where Postgres define the number for this spaces (buffers)? And can I change it?

This is very important to me.

Thanks,
I hope that somebody can help me.
By
Daniel

+


+Abra sua conta no Yahoo! Mail - 1GB de espa�o, alertas de e-mail no celular e anti-spam realmente eficaz. +--0-1427742670-1151087555=:48936-- + +From pgsql-performance-owner@postgresql.org Fri Jun 23 18:52:27 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 742579FB0D1 + for ; + Fri, 23 Jun 2006 18:52:26 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 20439-02 for + ; + Fri, 23 Jun 2006 18:52:19 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from wx-out-0102.google.com (wx-out-0102.google.com [66.249.82.203]) + by postgresql.org (Postfix) with ESMTP id BA3509FA60B + for ; + Fri, 23 Jun 2006 18:52:20 -0300 (ADT) +Received: by wx-out-0102.google.com with SMTP id i31so564396wxd + for ; + Fri, 23 Jun 2006 14:52:18 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:from:to:subject:date:message-id:mime-version:content-type:content-transfer-encoding:x-mailer:thread-index:x-mimeole; + b=fJjBY9uo6cPvvb2JRRxWk5j0m8ZNBZuTZ9pEQLRRqsvMv4+Un2oL3tiam9je7OPp3dz0Ap5obtigWJVrGV5FU5Moe3y3meIZaADUj7g8PlLaZWJ8vYRKPpPjW4u5Ho47YuJLapLdNiNIV+H1O8JMViMG7MovBjnrOchJ+M+JMxw= +Received: by 10.70.44.11 with SMTP id r11mr5363542wxr; + Fri, 23 Jun 2006 14:52:18 -0700 (PDT) +Received: from franklin ( [201.2.219.138]) + by mx.gmail.com with ESMTP id h34sm3028600wxd.2006.06.23.14.52.15; + Fri, 23 Jun 2006 14:52:17 -0700 (PDT) +From: "Franklin Haut" +To: +Subject: Temporary table +Date: Fri, 23 Jun 2006 18:58:22 -0300 +Message-ID: <000001c69710$264fe940$8adb02c9@franklin> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +X-Mailer: Microsoft Office Outlook 11 +Thread-Index: AcaWJ6kB91I7F+1CQfamxokjjD/fiQAycwtQAAeoJXA= +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.504 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/466 +X-Sequence-Number: 19823 + + +Hello, + +I=B4m have some problems with a temporary table, i need create a table, = +insert +some values, make a select and at end of transaction the table must = +droped, +but after i created a table there not more exist, is this normal ? + +How to reproduce : + + + CREATE TEMP TABLE cademp ( + codemp INTEGER, + codfil INTEGER, + nomemp varchar(50) + ) ON COMMIT DROP; + + INSERT INTO cademp (codemp, codfil, nomemp) values (1,1,'TESTE'); + INSERT INTO cademp (codemp, codfil, nomemp) values (1,2,'TESTE1'); +=09 + Select * from cademp; + + + +In this case, the table cademp doesn=B4t exist at the first insert, in = +the +same transaction. + + + + +Tks, + +Franklin + + +From pgsql-performance-owner@postgresql.org Fri Jun 23 19:04:43 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DBA659FA60C + for ; + Fri, 23 Jun 2006 19:04:41 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 20400-06 for + ; + Fri, 23 Jun 2006 19:04:31 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id DDEFC9F9AD3 + for ; + Fri, 23 Jun 2006 19:04:31 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5NM4SGY029400; + Fri, 23 Jun 2006 18:04:28 -0400 (EDT) +To: "Franklin Haut" +cc: pgsql-performance@postgresql.org +Subject: Re: Temporary table +In-reply-to: <000001c69710$264fe940$8adb02c9@franklin> +References: <000001c69710$264fe940$8adb02c9@franklin> +Comments: In-reply-to "Franklin Haut" + message dated "Fri, 23 Jun 2006 18:58:22 -0300" +Date: Fri, 23 Jun 2006 18:04:28 -0400 +Message-ID: <29399.1151100268@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/467 +X-Sequence-Number: 19824 + +"Franklin Haut" writes: +> How to reproduce : + +> CREATE TEMP TABLE cademp ( +> codemp INTEGER, +> codfil INTEGER, +> nomemp varchar(50) +> ) ON COMMIT DROP; + +> INSERT INTO cademp (codemp, codfil, nomemp) values (1,1,'TESTE'); +> INSERT INTO cademp (codemp, codfil, nomemp) values (1,2,'TESTE1'); + +> Select * from cademp; + +You need a BEGIN/COMMIT around that, or else rethink using ON COMMIT DROP. +As is, the temp table goes away instantly when the CREATE commits. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Jun 23 19:08:25 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B6C5F9FA30D + for ; + Fri, 23 Jun 2006 19:08:24 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 20972-05 for + ; + Fri, 23 Jun 2006 19:08:10 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from thebighonker.lerctr.org (thebighonker.lerctr.org + [192.147.25.65]) + by postgresql.org (Postfix) with ESMTP id C87DA9F9AD3 + for ; + Fri, 23 Jun 2006 19:08:11 -0300 (ADT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=lerami; d=lerctr.org; + b=SIYrbhWl4xhSaNYjUPtsxg1ZIEQ/oE5j5f9qoyr327tU1Ugx/VDZnAgH1IJc0lzrrucKmqS1thinSfpZPK+00T/SVIsCUFrRxJhESuyb1fFqMyypldB0ZF+L0LZsNDZ35+oIlSOal9lxDy9X7NpI3Yd6kDHRmCNUO85alFgAxfE=; +Received: from 64-132-13-2.static.twtelecom.net ([64.132.13.2]:53786 + helo=LROSENMAC8010P) + by thebighonker.lerctr.org with esmtpsa (TLSv1:RC4-MD5:128) + (Exim 4.62 (FreeBSD)) (envelope-from ) + id 1Fttos-000F4t-4V; Fri, 23 Jun 2006 17:08:08 -0500 +From: "Larry Rosenman" +To: "'Franklin Haut'" , + +Subject: Re: Temporary table +Date: Fri, 23 Jun 2006 17:08:05 -0500 +Message-ID: <039001c69711$81058a60$0202fea9@aus.pervasive.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +X-Mailer: Microsoft Office Outlook 11 +In-Reply-To: <000001c69710$264fe940$8adb02c9@franklin> +Thread-Index: AcaWJ6kB91I7F+1CQfamxokjjD/fiQAycwtQAAeoJXAAAFL0AA== +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +X-LERCTR-Spam-Score: -4.4 (----) +X-LERCTR-Spam-Report: (-4.4 points, 5.0 required) + ALL_TRUSTED=-1.8 BAYES_00=-2.599 +DomainKey-Status: no signature +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/468 +X-Sequence-Number: 19825 + +Franklin Haut wrote: +> Hello, +>=20 +> I=B4m have some problems with a temporary table, i need create a = +table, +> insert some values, make a select and at end of transaction the table +> must droped, but after i created a table there not more exist, is +> this normal ?=20 +>=20 +> How to reproduce : +>=20 +>=20 +> CREATE TEMP TABLE cademp ( +> codemp INTEGER, +> codfil INTEGER, +> nomemp varchar(50) +> ) ON COMMIT DROP; +>=20 +> INSERT INTO cademp (codemp, codfil, nomemp) values (1,1,'TESTE'); +> INSERT INTO cademp (codemp, codfil, nomemp) values (1,2,'TESTE1'); +>=20 +> Select * from cademp; +>=20 +>=20 +>=20 +> In this case, the table cademp doesn=B4t exist at the first insert, in +> the same transaction. +>=20 + +It is NOT the same transaction. By default, each STATEMENT is it's own +transaction. + +Stick a BEGIN; before the create table, and a commit; after the select. + +Larry Rosenman +>=20 +>=20 +>=20 +> Tks, +>=20 +> Franklin +>=20 +>=20 +> ---------------------------(end of +> broadcast)--------------------------- TIP 6: explain analyze is your +> friend=20 + + + +--=20 +Larry Rosenman http://www.lerctr.org/~ler +Phone: +1 512-248-2683 E-Mail: ler@lerctr.org +US Mail: 430 Valona Loop, Round Rock, TX 78681-3893 + + +From pgsql-performance-owner@postgresql.org Fri Jun 23 21:22:05 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C59D99FA30D + for ; + Fri, 23 Jun 2006 21:22:04 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 36414-07 for + ; + Fri, 23 Jun 2006 21:21:56 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from wx-out-0102.google.com (wx-out-0102.google.com [66.249.82.199]) + by postgresql.org (Postfix) with ESMTP id 318709F9AD3 + for ; + Fri, 23 Jun 2006 21:21:56 -0300 (ADT) +Received: by wx-out-0102.google.com with SMTP id s13so626338wxc + for ; + Fri, 23 Jun 2006 17:21:55 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:from:to:subject:date:message-id:mime-version:content-type:content-transfer-encoding:x-mailer:in-reply-to:thread-index:x-mimeole; + b=TqnDYNQWUO3cAzfbI/JHvIQtY7Q5loiBUyoLmQ3q+ajtxH68SoAIc9BNmtqceaKAUDl1IjQsmGWmFXQbA2ljEeLaE3itnAZgJeKG7m5KV2kbkt3ZL8QWrS18k800OUVjzNP1scyRbDmSez5rnriVmP4utpLEllalTV2ANYShlpI= +Received: by 10.70.68.16 with SMTP id q16mr5540878wxa; + Fri, 23 Jun 2006 17:21:51 -0700 (PDT) +Received: from franklin ( [201.2.219.138]) + by mx.gmail.com with ESMTP id h8sm2932600wxd.2006.06.23.17.21.50; + Fri, 23 Jun 2006 17:21:51 -0700 (PDT) +From: "Franklin Haut" +To: +Subject: RES: Temporary table +Date: Fri, 23 Jun 2006 21:27:40 -0300 +Message-ID: <000001c69725$01fc3d90$8adb02c9@franklin> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +X-Mailer: Microsoft Office Outlook 11 +In-reply-to: <039001c69711$81058a60$0202fea9@aus.pervasive.com> +Thread-Index: AcaWJ6kB91I7F+1CQfamxokjjD/fiQAycwtQAAeoJXAAAFL0AAAE3cJQ +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.504 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/469 +X-Sequence-Number: 19826 + +Ok, it works. + + +Thanks + +Franklin=20 + +-----Mensagem original----- +De: Larry Rosenman [mailto:ler@lerctr.org]=20 +Enviada em: sexta-feira, 23 de junho de 2006 19:08 +Para: 'Franklin Haut'; pgsql-performance@postgresql.org +Assunto: RE: [PERFORM] Temporary table + +Franklin Haut wrote: +> Hello, +>=20 +> I=B4m have some problems with a temporary table, i need create a = +table,=20 +> insert some values, make a select and at end of transaction the table=20 +> must droped, but after i created a table there not more exist, is this = + +> normal ? +>=20 +> How to reproduce : +>=20 +>=20 +> CREATE TEMP TABLE cademp ( +> codemp INTEGER, +> codfil INTEGER, +> nomemp varchar(50) +> ) ON COMMIT DROP; +>=20 +> INSERT INTO cademp (codemp, codfil, nomemp) values (1,1,'TESTE'); +> INSERT INTO cademp (codemp, codfil, nomemp) values (1,2,'TESTE1'); +>=20 +> Select * from cademp; +>=20 +>=20 +>=20 +> In this case, the table cademp doesn=B4t exist at the first insert, in = + +> the same transaction. +>=20 + +It is NOT the same transaction. By default, each STATEMENT is it's own +transaction. + +Stick a BEGIN; before the create table, and a commit; after the select. + +Larry Rosenman +>=20 +>=20 +>=20 +> Tks, +>=20 +> Franklin +>=20 +>=20 +> ---------------------------(end of +> broadcast)--------------------------- TIP 6: explain analyze is your=20 +> friend + + + +--=20 +Larry Rosenman http://www.lerctr.org/~ler +Phone: +1 512-248-2683 E-Mail: ler@lerctr.org +US Mail: 430 Valona Loop, Round Rock, TX 78681-3893 + + +From pgsql-performance-owner@postgresql.org Sat Jun 24 01:28:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0381D9F9FE3 + for ; + Sat, 24 Jun 2006 01:28:44 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 73732-10 for + ; + Sat, 24 Jun 2006 01:28:38 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from wolff.to (wolff.to [66.93.197.194]) + by postgresql.org (Postfix) with SMTP id 08C729F9AD3 + for ; + Sat, 24 Jun 2006 01:28:37 -0300 (ADT) +Received: (qmail 14494 invoked by uid 500); 24 Jun 2006 04:32:27 -0000 +Date: Fri, 23 Jun 2006 23:32:27 -0500 +From: Bruno Wolff III +To: John Vincent +Cc: Mark Lewis , + PGSQL Performance +Subject: Re: Optimizer internals +Message-ID: <20060624043227.GA13888@wolff.to> +Mail-Followup-To: Bruno Wolff III , + John Vincent , + Mark Lewis , + PGSQL Performance +References: + <1150396425.31200.66.camel@archimedes> + + <1150398064.31200.76.camel@archimedes> + + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +User-Agent: Mutt/1.4.2.1i +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/470 +X-Sequence-Number: 19827 + +On Thu, Jun 15, 2006 at 15:38:32 -0400, + John Vincent wrote: +> Any suggestions? FYI the original question wasn't meant as a poke at +> >comparing PG to MySQL to DB2. I'm not making an yvalue judgements either +> >way. I'm just trying to understand how we can use it the best way possible. +> > +> +> Actually we just thought about something. With PG, we can create an index +> that is a SUM of the column where indexing, no? We're going to test this in +> a few hours. Would that be able to be satisfied by an index scan? + +No, that won't work. While you can make indexes on functions of a row, you +can't make indexes on aggregate functions. + +You might find making a materialized view of the information you want can +help with performance. The issues with "sum" are pretty much the same ones +as with "count". You can find a couple different ways of doing materialized +views for "count" in the archives. There is a simple way of doing it that +doesn't work well with lots of concurrent updates and a more complicated +method that does work well with lots of concurrent updates. + +From pgsql-performance-owner@postgresql.org Sun Jul 2 23:02:05 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 891499F931A + for ; + Sun, 25 Jun 2006 15:36:14 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 37123-06-2 + for ; + Sun, 25 Jun 2006 15:36:10 -0300 (ADT) +X-Greylist: delayed 00:20:50.57189 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 69A769FA68D + for ; + Sun, 25 Jun 2006 15:36:03 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from moonunit2.moonview.localnet (wsip-70-167-125-69.sd.sd.cox.net + [70.167.125.69]) + by svr4.postgresql.org (Postfix) with ESMTP id DEBC05AF176 + for ; + Sun, 25 Jun 2006 18:15:06 +0000 (GMT) +Received: from [127.0.0.1] (moonunit2.moonview.localnet [192.168.0.2]) + by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id + k5PISLiH018689 + for ; Sun, 25 Jun 2006 11:28:24 -0700 +Message-ID: <449ED2A6.4090107@emolecules.com> +Date: Sun, 25 Jun 2006 11:15:02 -0700 +From: "Craig A. James" +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Sort order in sub-select +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/4 +X-Sequence-Number: 19864 + +Here is a subtle question about SQL. I have a one-to-many pair of tables (call them "P" and "C" for parent and child). For each row of P, there are many rows in C with data, and I want to sort P on the min(c.data). The basic query is simple: + + select p_id, min(data) as m from c group by p_id order by m; + +Now the problem: I also want to store this, in sorted order, as a "hitlist", so I have a table like this: + + create table hitlist(p_id integer, sortorder integer); + +and a sequence to go with it. The first thing I tried doesn't work: + + insert into hitlist(p_id, sortorder) + (select p_id, nextval('hitlist_seq') from + (select p_id, min(data) as m from c group by p_id order by m); + +Apparently, the sort order returned by the innermost select is NOT maintained as you go through the next select statement -- the rows seem to come out in random order. This surprised me. But in thinking about the definition of SQL itself, I guess there's no guarantee that sort order is maintained across sub-selects. I was caught by this because in Oracle, this same query works "correctly" (i.e. the hitlist ends up in sorted order), but I suspect that was just the luck of their implementation. + +Can anyone confirm this, that the sort order is NOT guaranteed to be maintained through layers of SELECT statements? + +The obvious solution is to make the hitlist.sortorder column have the nextval() as its default and eliminate the first sub-select. But I thought the two would be equivalent. + +Thanks, +Craig + +From pgsql-performance-owner@postgresql.org Mon Jun 26 09:16:40 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0ABCA9FB1E3 + for ; + Mon, 26 Jun 2006 09:16:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 50513-01-2 + for ; + Mon, 26 Jun 2006 09:16:34 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 2E0E09FB31A + for ; + Mon, 26 Jun 2006 04:52:22 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from smtp1.voila.fr (smtp1.voila.fr [193.252.22.174]) + by svr4.postgresql.org (Postfix) with ESMTP id 5C3755AF080 + for ; + Mon, 26 Jun 2006 07:52:21 +0000 (GMT) +Received: from me-wanadoo.net (localhost [127.0.0.1]) + by mwinf4003.voila.fr (SMTP Server) with ESMTP id CE43524001E3; + Mon, 26 Jun 2006 09:52:16 +0200 (CEST) +Received: from wwinf4005 (wwinf4005 [172.22.157.32]) + by mwinf4003.voila.fr (SMTP Server) with ESMTP id C2BC324001E1; + Mon, 26 Jun 2006 09:52:16 +0200 (CEST) +X-ME-UUID: 20060626075216797.C2BC324001E1@mwinf4003.voila.fr +Message-ID: <27580197.1151308336784.JavaMail.www@wwinf4005> +From: luchot +Reply-To: luchot@voila.fr +To: Tom Lane +Subject: Re: Occupation bloc in pages of table +Cc: pgsql-performance@postgresql.org +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: quoted-printable +X-Originating-IP: [129.184.84.11] +X-Wum-Nature: EMAIL-NATURE +X-WUM-FROM: |~| +X-WUM-TO: |~| +X-WUM-CC: |~| +X-WUM-REPLYTO: |~| +Date: Mon, 26 Jun 2006 09:52:16 +0200 (CEST) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/471 +X-Sequence-Number: 19828 + +Thank you for you quick answer i will try to see what i can do whith the fi= +le contrib/pgstattuple + +Best regards, + +> Message du 23/06/06 =C3=A0 18h11 +> De : "Tom Lane" +> A : luchot@voila.fr +> Copie =C3=A0 : pgsql-performance@postgresql.org +> Objet : Re: [PERFORM] Occupation bloc in pages of table=20 +>=20 +> luchot writes: +> > I would want if it is possible for each pages of a table to have the oc= +cupation of blocs in percentage in order to see if the page is good full or= + not. +>=20 +> There is not any magic way of getting that information, but you could +> modify contrib/pgstattuple to produce such a report. +>=20 +> =09=09=09regards, tom lane +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: explain analyze is your friend +>=20 +> + + +From pgsql-performance-owner@postgresql.org Mon Jun 26 09:34:42 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DE3069FADD1 + for ; + Mon, 26 Jun 2006 09:34:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 54689-02-7 + for ; + Mon, 26 Jun 2006 09:34:35 -0300 (ADT) +X-Greylist: delayed 00:11:31.407503 by SQLgrey- +Received: from smtp1.voila.fr (smtp1.voila.fr [193.252.22.174]) + by postgresql.org (Postfix) with ESMTP id 8BC329FB344 + for ; + Mon, 26 Jun 2006 05:03:50 -0300 (ADT) +Received: from me-wanadoo.net (localhost [127.0.0.1]) + by mwinf4001.voila.fr (SMTP Server) with ESMTP id CFF845800267; + Mon, 26 Jun 2006 10:03:48 +0200 (CEST) +Received: from wwinf4005 (wwinf4005 [172.22.157.32]) + by mwinf4001.voila.fr (SMTP Server) with ESMTP id C3F685800262; + Mon, 26 Jun 2006 10:03:48 +0200 (CEST) +X-ME-UUID: 20060626080348802.C3F685800262@mwinf4001.voila.fr +Message-ID: <18424432.1151309028782.JavaMail.www@wwinf4005> +From: luchot +Reply-To: luchot@voila.fr +To: pgsql-performance@postgresql.org, tgl@sss.pgh.pa.us +Subject: Re: Occupation bloc in pages of table +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: quoted-printable +X-Originating-IP: [129.184.84.11] +X-Wum-Nature: EMAIL-NATURE +X-WUM-FROM: |~| +X-WUM-TO: |~||~| +X-WUM-REPLYTO: |~| +Date: Mon, 26 Jun 2006 10:03:48 +0200 (CEST) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/474 +X-Sequence-Number: 19831 + +Thank you for you quick answer i will try to see what i can do whith the fi= +le contrib/pgstattuple + +Best regards, + + +> Message du 23/06/06 =C3=A0 18h11 +> De : "Tom Lane" +> A : luchot@voila.fr +> Copie =C3=A0 : pgsql-performance@postgresql.org +> Objet : Re: [PERFORM] Occupation bloc in pages of table=20 +>=20 +> luchot writes: +> > I would want if it is possible for each pages of a table to have the oc= +cupation of blocs in percentage in order to see if the page is good full or= + not. +>=20 +> There is not any magic way of getting that information, but you could +> modify contrib/pgstattuple to produce such a report. +>=20 +> =09=09=09regards, tom lane +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: explain analyze is your friend +>=20 +> + + +From pgsql-performance-owner@postgresql.org Mon Jun 26 09:34:36 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 13D8E9FABE7 + for ; + Mon, 26 Jun 2006 09:34:36 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 54057-03-7 + for ; + Mon, 26 Jun 2006 09:34:26 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from smtp1.voila.fr (smtp1.voila.fr [193.252.22.174]) + by postgresql.org (Postfix) with ESMTP id 7ECBB9FB347 + for ; + Mon, 26 Jun 2006 05:07:07 -0300 (ADT) +Received: from me-wanadoo.net (localhost [127.0.0.1]) + by mwinf4006.voila.fr (SMTP Server) with ESMTP id 121161C013A5 + for ; + Mon, 26 Jun 2006 10:07:06 +0200 (CEST) +Received: from wwinf4005 (wwinf4005 [172.22.157.32]) + by mwinf4006.voila.fr (SMTP Server) with ESMTP id E90521C013A3 + for ; + Mon, 26 Jun 2006 10:07:05 +0200 (CEST) +X-ME-UUID: 20060626080705954.E90521C013A3@mwinf4006.voila.fr +Message-ID: <23226092.1151309225937.JavaMail.www@wwinf4005> +From: luchot +Reply-To: luchot@voila.fr +To: pgsql-performance@postgresql.org +Subject: Re: Occupation bloc in pages of table +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 7bit +X-Originating-IP: [129.184.84.11] +X-Wum-Nature: EMAIL-NATURE +X-WUM-FROM: |~| +X-WUM-TO: |~| +X-WUM-REPLYTO: |~| +Date: Mon, 26 Jun 2006 10:07:05 +0200 (CEST) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/473 +X-Sequence-Number: 19830 + + +> De : "Tom Lane" +> There is not any magic way of getting that information, but you could +> modify contrib/pgstattuple to produce such a report. + +Thank you for you speed answer , i will try to see what i can do in contrib/pgstattuple + +Best regards, + +Luc + + +From pgsql-performance-owner@postgresql.org Mon Jun 26 09:20:50 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2BB419FB324 + for ; + Mon, 26 Jun 2006 09:20:50 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 52088-01 for + ; + Mon, 26 Jun 2006 09:20:46 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id B37059FB4F7 + for ; + Mon, 26 Jun 2006 05:49:04 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 8414D30920; Mon, 26 Jun 2006 10:49:03 +0200 (MET DST) +From: "Andrus" +X-Newsgroups: pgsql.performance +Subject: Re: why group expressions cause query to run forever +Date: Mon, 26 Jun 2006 11:48:47 +0300 +Organization: Hub.Org Networking Services +Lines: 27 +Message-ID: +References: <2851.1151004624@sss.pgh.pa.us> +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +X-RFC2646: Format=Flowed; Original +To: pgsql-performance@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/472 +X-Sequence-Number: 19829 + +Tom, + +thank you. + +> I think the problem is probably that you're sorting two dozen CHAR +> columns, and that in many of the rows all these entries are '' forcing +> the sort code to compare all two dozen columns (not so)? So the sort +> ends up doing lots and lots and lots of CHAR comparisons. Which can +> be slow, especially in non-C locales. What's your locale setting? + +show all returns + +"lc_collate";"en_US.UTF-8" +"lc_ctype";"en_US.UTF-8" +"lc_messages";"C" +"lc_monetary";"et_EE.utf-8" +"lc_numeric";"et_EE.utf-8" +"lc_time";"et_EE.utf-8" + +How to speed up this query ? +Is it possible to force the binary comparison for grouping ? +Should I concatenate all the char columns into single column ? + +Andrus. + + + + +From pgsql-performance-owner@postgresql.org Mon Jun 26 16:41:20 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D68419FA6B3 + for ; + Mon, 26 Jun 2006 16:34:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 83074-07 for + ; + Mon, 26 Jun 2006 16:33:48 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moutng.kundenserver.de (moutng.kundenserver.de + [212.227.126.171]) + by postgresql.org (Postfix) with ESMTP id A2E9E9FA7BA + for ; + Mon, 26 Jun 2006 16:33:47 -0300 (ADT) +Received: from [84.12.170.54] (helo=[192.168.0.2]) + by mrelayeu.kundenserver.de (node=mrelayeu5) with ESMTP (Nemesis), + id 0ML25U-1Fuwq61eQt-0004BJ; Mon, 26 Jun 2006 21:33:43 +0200 +Subject: Re: Some performance numbers, with thoughts +From: Simon Riggs +To: Brian Hurt +Cc: pgsql-performance@postgresql.org +In-Reply-To: <44973CC6.20309@janestcapital.com> +References: <44973CC6.20309@janestcapital.com> +Content-Type: text/plain +Date: Mon, 26 Jun 2006 20:33:34 +0100 +Message-Id: <1151350415.2479.66.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.6.1 (2.6.1-1.fc5.2) +Content-Transfer-Encoding: 7bit +X-Provags-ID: kundenserver.de abuse@kundenserver.de + login:726643fe08f41a451f0fe7fa43bce239 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/475 +X-Sequence-Number: 19832 + +On Mon, 2006-06-19 at 20:09 -0400, Brian Hurt wrote: + +> 5) The performance of Postgres, at least on inserts, depends critically +> on how you program it. One the same hardware, performance for me varied +> over a factor of over 300-fold, 2.5 orders of magnitude. Programs which +> are unaware of transactions and are designed to be highly portable are +> likely to hit the abysmal side of performance, where the transaction +> overhead kills performance. + +I'm quite interested in this comment. Transactions have always been part +of the SQL standard, so being unaware of them when using SQL is strange +to me. Can you talk more about what your expectations of what +performance "should have been" - I don't want to flame you, just to +understand that viewpoint. + +What are you implicitly comparing against? With which options enabled? + +How are you submitting these SQL statements? Through what API? + +> I'm not sure there is a fix for this (let +> alone an easy fix)- simply dropping transactions is obviously not it. + +I'd like to see what other "fixes" we might think of. + +Perhaps we might consider a session-level mode that groups together +atomic INSERTs into the same table into a single larger transaction. +That might be something we can do at the client level, for example. + +> Programs that are transaction aware and willing to use +> PostgreSQL-specific features can get surprisingly excellent +> performance. Simply being transaction-aware and doing multiple inserts +> per transaction greatly increases performance, giving an easy order of +> magnitude increase (wrapping 10 inserts in a transaction gives a 10x +> performance boost). + +This is exactly the same as most other transactional-RDBMS. + +-- + Simon Riggs + EnterpriseDB http://www.enterprisedb.com + + +From pgsql-performance-owner@postgresql.org Mon Jun 26 18:22:26 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0B4549FA7B6 + for ; + Mon, 26 Jun 2006 18:22:25 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 26937-01 for + ; + Mon, 26 Jun 2006 18:22:10 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) + by postgresql.org (Postfix) with ESMTP id 604C89FA6B3 + for ; + Mon, 26 Jun 2006 18:22:08 -0300 (ADT) +Received: from osgiliath.mathom.us ([71.246.250.238]) + by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 + (built Sep + 9 2005)) with ESMTPA id <0J1H0071BKLV2DQ6@vms046.mailsrvcs.net> for + pgsql-performance@postgresql.org; Mon, 26 Jun 2006 16:20:20 -0500 (CDT) +Received: from localhost (localhost [127.0.0.1]) + by osgiliath.mathom.us (Postfix) with ESMTP id 19DC86E917 for + ; + Mon, 26 Jun 2006 17:20:16 -0400 (EDT) +Received: from osgiliath.mathom.us ([127.0.0.1]) + by localhost (osgiliath.home.mathom.us [127.0.0.1]) (amavisd-new, + port 10024) + with LMTP id BMBRlvi9CbDn for ; Mon, + 26 Jun 2006 17:20:15 -0400 (EDT) +Received: by osgiliath.mathom.us (Postfix, from userid 1000) + id 2A3416E8FC; Mon, 26 Jun 2006 17:20:15 -0400 (EDT) +Date: Mon, 26 Jun 2006 17:20:14 -0400 +From: Michael Stone +Subject: Re: Some performance numbers, with thoughts +In-reply-to: <1151350415.2479.66.camel@localhost.localdomain> +To: pgsql-performance@postgresql.org +Mail-followup-to: pgsql-performance@postgresql.org +Message-id: <20060626212013.GD9742@mathom.us> +MIME-version: 1.0 +Content-type: text/plain; charset=us-ascii; format=flowed +Content-disposition: inline +X-Virus-Scanned: Debian amavisd-new at mathom.us +X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 +References: <44973CC6.20309@janestcapital.com> + <1151350415.2479.66.camel@localhost.localdomain> +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/476 +X-Sequence-Number: 19833 + +On Mon, Jun 26, 2006 at 08:33:34PM +0100, Simon Riggs wrote: +>of the SQL standard, so being unaware of them when using SQL is strange +>to me. + +Welcome to the world of programs designed for mysql. You'll almost never +see them batch inserts, take advantage of referential integrity, etc. +You end up with lots of selects & inserts in loops that expect +autocommit-like behavior because it doesn't matter in that world. + +Mike Stone + +From pgsql-performance-owner@postgresql.org Mon Jun 26 19:45:10 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5237C9FA5FC + for ; + Mon, 26 Jun 2006 19:45:10 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 38044-08 for + ; + Mon, 26 Jun 2006 19:45:07 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.198]) + by postgresql.org (Postfix) with ESMTP id 81ED49FA2F7 + for ; + Mon, 26 Jun 2006 19:45:07 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id l8so640149nzf + for ; + Mon, 26 Jun 2006 15:44:57 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:mime-version:content-type; + b=sbND3he+zsn0WPB/f3jUwn1fz3RLUpVzIi+RduSomQyTTOfSPzognaPnhUq9b8zY1bjTgHAKpI7PItmonMqI52TCywIXacnT5N7jWG75rWd2YgCojpqU87/RsV0jdciRC2rMJDPHpf7Lkf7ZodtiU+1MDwgRYgrXOZK6pmjdekk= +Received: by 10.65.155.4 with SMTP id h4mr6806233qbo; + Mon, 26 Jun 2006 15:44:57 -0700 (PDT) +Received: by 10.65.132.18 with HTTP; Mon, 26 Jun 2006 15:44:57 -0700 (PDT) +Message-ID: +Date: Mon, 26 Jun 2006 19:44:57 -0300 +From: "Diego Gaviola" +To: pgsql-performance@postgresql.org +Subject: unsubscribe +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_42285_20201298.1151361897106" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/477 +X-Sequence-Number: 19834 + +------=_Part_42285_20201298.1151361897106 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +unsubscribe + +------=_Part_42285_20201298.1151361897106 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +unsubscribe + +------=_Part_42285_20201298.1151361897106-- + +From pgsql-performance-owner@postgresql.org Tue Jun 27 04:13:12 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 608479FA5CD + for ; + Tue, 27 Jun 2006 04:13:12 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 21389-05 for + ; + Tue, 27 Jun 2006 04:13:01 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moutng.kundenserver.de (moutng.kundenserver.de + [212.227.126.177]) + by postgresql.org (Postfix) with ESMTP id BC0C79FA395 + for ; + Tue, 27 Jun 2006 04:13:01 -0300 (ADT) +Received: from [84.12.170.54] (helo=[192.168.0.2]) + by mrelayeu.kundenserver.de (node=mrelayeu3) with ESMTP (Nemesis), + id 0MKxQS-1Fv7kp1exs-00005t; Tue, 27 Jun 2006 09:13:00 +0200 +Subject: Re: Some performance numbers, with thoughts +From: Simon Riggs +To: Michael Stone +Cc: pgsql-performance@postgresql.org +In-Reply-To: <20060626212013.GD9742@mathom.us> +References: <44973CC6.20309@janestcapital.com> + <1151350415.2479.66.camel@localhost.localdomain> + <20060626212013.GD9742@mathom.us> +Content-Type: text/plain +Date: Tue, 27 Jun 2006 08:12:50 +0100 +Message-Id: <1151392370.2479.150.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.6.1 (2.6.1-1.fc5.2) +Content-Transfer-Encoding: 7bit +X-Provags-ID: kundenserver.de abuse@kundenserver.de + login:726643fe08f41a451f0fe7fa43bce239 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/478 +X-Sequence-Number: 19835 + +On Mon, 2006-06-26 at 17:20 -0400, Michael Stone wrote: +> On Mon, Jun 26, 2006 at 08:33:34PM +0100, Simon Riggs wrote: +> >of the SQL standard, so being unaware of them when using SQL is strange +> >to me. +> +> Welcome to the world of programs designed for mysql. You'll almost never +> see them batch inserts, take advantage of referential integrity, etc. +> You end up with lots of selects & inserts in loops that expect +> autocommit-like behavior because it doesn't matter in that world. + +Yes, I suspected that was the case. I was interested in understanding +why anybody thought it was acceptable, and in what conditions that might +be the case. Brian's open approach has helped explain things for me. + +-- + Simon Riggs + EnterpriseDB http://www.enterprisedb.com + + +From pgsql-performance-owner@postgresql.org Tue Jun 27 09:23:06 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DAC3D9FA50D + for ; + Tue, 27 Jun 2006 09:23:05 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 88038-05 for + ; + Tue, 27 Jun 2006 09:22:50 -0300 (ADT) +X-Greylist: delayed 00:06:04.065707 by SQLgrey- +Received: from smtp1.yandex.ru (smtp1.yandex.ru [213.180.223.87]) + by postgresql.org (Postfix) with ESMTP id 12F8D9FA10A + for ; + Tue, 27 Jun 2006 09:22:49 -0300 (ADT) +Received: from proxy2.upr.belsvyaz.ru ([82.151.104.10]:59715 "EHLO + server42.gts.gptus.com" smtp-auth: "andrews42" TLS-CIPHER: + TLS-PEER-CN1: ) by mail.yandex.ru with ESMTP id S2077676AbWF0MQj + (ORCPT ); + Tue, 27 Jun 2006 16:16:39 +0400 +X-Comment: RFC 2476 MSA function at smtp1.yandex.ru logged sender identity as: + andrews42 +Date: Tue, 27 Jun 2006 16:14:08 +0400 +From: Andrew Sagulin +X-Mailer: The Bat! (v3.62.14) Professional +Reply-To: Andrew Sagulin +Organization: gPTUS +X-Priority: 3 (Normal) +Message-ID: <463024718.20060627161408@yandex.ru> +To: pgsql-performance@postgresql.org +Subject: Large index scan perfomance and indexCorrelation (PG 8.1.4 Win32) +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/479 +X-Sequence-Number: 19836 + +Hello all + +I have a big amount of phone calls data (280M records, 25 Gbytes).The best decision +for this task is partitioning and I use it now. But at first I tried put all +data in a single table indexed by call date&time. Because of nature of the +data the records clustered by date and near ordered by time. + +The table definition: + +CREATE DOMAIN datetime AS timestamp NOT NULL; +CREATE DOMAIN cause AS int2 DEFAULT 16 NOT NULL; +CREATE DOMAIN conn_num AS varchar(34); +CREATE DOMAIN dur AS int4 NOT NULL; +CREATE DOMAIN lno AS int2; +CREATE DOMAIN tgrp AS char(6); + +CREATE TABLE conn +( + datetime datetime, + anum conn_num, + bnum conn_num, + dur dur, + itgrp tgrp, + ilno lno, + otgrp tgrp, + olno lno, + cause cause +) +WITHOUT OIDS; + +CREATE INDEX conn_dt + ON conn + USING btree + (datetime); + +Usual tasks on the table are export and search calls on one or more days. This +cause the scan of 400K or more records, selected by 'conn_dt' index. The best data +access path is a bitmap heap scan. Tests I've made showed incredible bitmap scan +perfomance almost equal to a seq scan. But PG always prefered simple index scan +which is 20 times slower. Digging in the PG internals brought me to +indexCorrelation. For the 'datetime' column it was about 0,999999. But why despite +of this the index scan was so slow? In the next step I ran + +select ctid from conn where ... order by datetime; + +Result showed up that there were no page seq scan at all - true random access +only. +The simple model which can explain the situation: the sequence of numbers 2, 1, +4, 3, 6, 5, ..., 100, 99 has correlation about 0,9994. Let's imagine it's the page +order of an index scan. H'm, bad choice, isn't it? + +I think indexCorrelation can help to estimate page count but not page +fetch cost. Why not to use formula + +min_IO_cost = ceil(indexSelectivity * T) * random_page_cost + +instead of + +min_IO_cost = ceil(indexSelectivity * T) ? + + + + + +From pgsql-performance-owner@postgresql.org Tue Jun 27 11:04:58 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 027489FA50D + for ; + Tue, 27 Jun 2006 11:04:58 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 60395-04 for + ; + Tue, 27 Jun 2006 11:04:53 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from hu-out-0102.google.com (hu-out-0102.google.com [72.14.214.192]) + by postgresql.org (Postfix) with ESMTP id E09079FA10A + for ; + Tue, 27 Jun 2006 11:04:53 -0300 (ADT) +Received: by hu-out-0102.google.com with SMTP id 23so950243huc + for ; + Tue, 27 Jun 2006 07:04:52 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:mime-version:content-type; + b=uUODr29apuHqU6xlRLUFk45/4u7kUYCBLopV/Hnyf0nHGNCaX2L6/tkGghcXsyukkmVsf4bNXQzlMzX8fstKlFdCLibFoxHaOwV5INCnRW+fqe1S9giJ+Z5KS9qM2ZPbHoURJPkJKgZVRE4OuU9kpVEm5a+7Wjz+MNNH3QRp6c0= +Received: by 10.67.93.7 with SMTP id v7mr6074288ugl; + Tue, 27 Jun 2006 07:04:52 -0700 (PDT) +Received: by 10.66.222.12 with HTTP; Tue, 27 Jun 2006 07:04:51 -0700 (PDT) +Message-ID: <674d1f8a0606270704q55e0ae60m94dbe6cee3e6a133@mail.gmail.com> +Date: Tue, 27 Jun 2006 19:34:51 +0530 +From: "Gourish Singbal" +To: pgsql-performance@postgresql.org +Subject: unregister +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_1072_13228443.1151417091965" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/480 +X-Sequence-Number: 19837 + +------=_Part_1072_13228443.1151417091965 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +-- +Best, +Gourish Singbal + +------=_Part_1072_13228443.1151417091965 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +

--
Best,
Gourish Singbal + +------=_Part_1072_13228443.1151417091965-- + +From pgsql-performance-owner@postgresql.org Tue Jun 27 14:16:12 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0C8509FA437 + for ; + Tue, 27 Jun 2006 14:16:12 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 69817-06 for + ; + Tue, 27 Jun 2006 14:16:06 -0300 (ADT) +X-Greylist: delayed 00:28:56.618727 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id C915D9FA65C + for ; + Tue, 27 Jun 2006 14:16:04 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from smtp.contax.com.br (smtp.mycontax.com.br [200.165.165.164]) + by svr4.postgresql.org (Postfix) with ESMTP id C71835AF034 + for ; + Tue, 27 Jun 2006 16:47:05 +0000 (GMT) +Received: from mesctx03mtzvp.contax-br.contax.root (unknown [10.22.152.15]) + by smtp.contax.com.br (Symantec Mail Security) with ESMTP id + 8C2F110C004 for ; + Tue, 27 Jun 2006 13:46:28 -0300 (BRT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----_=_NextPart_001_01C69A09.4CEB7D0B" +Subject: unregister +Date: Tue, 27 Jun 2006 13:46:56 -0300 +Message-ID: + +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: unregister +Thread-Index: AcaZ8uux9kgcNfooTzi8M89tdb5gzQAFlMCA +X-Priority: 1 +Importance: high +From: =?iso-8859-1?Q?Leandro_Guimar=E3es_dos_Santos?= +To: +X-Brightmail-Tracker: AAAAAA== +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=2.591 tagged_above=0 required=5 tests=BAYES_50, + DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO, HTML_90_100, + HTML_MESSAGE, X_PRIORITY_HIGH +X-Spam-Level: ** +X-Archive-Number: 200606/481 +X-Sequence-Number: 19838 + + +This is a multi-part message in MIME format. + +------_=_NextPart_001_01C69A09.4CEB7D0B +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + +unregister + +------_=_NextPart_001_01C69A09.4CEB7D0B +Content-Type: text/html; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + + + + + + +
unregister
+ +------_=_NextPart_001_01C69A09.4CEB7D0B-- + +From pgsql-performance-owner@postgresql.org Tue Jun 27 15:02:10 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B661E9FA437 + for ; + Tue, 27 Jun 2006 15:02:09 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 85765-10 for + ; + Tue, 27 Jun 2006 15:02:04 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id 016239FA10A + for ; + Tue, 27 Jun 2006 15:02:03 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id C844930925; Tue, 27 Jun 2006 20:02:02 +0200 (MET DST) +From: "Andrus" +X-Newsgroups: pgsql.performance +Subject: Re: why group expressions cause query to run forever +Date: Tue, 27 Jun 2006 20:50:23 +0300 +Organization: Hub.Org Networking Services +Lines: 41 +Message-ID: +References: <2851.1151004624@sss.pgh.pa.us> +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +X-RFC2646: Format=Flowed; Original +To: pgsql-performance@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/482 +X-Sequence-Number: 19839 + +> I think the problem is probably that you're sorting two dozen CHAR +> columns, and that in many of the rows all these entries are '' forcing +> the sort code to compare all two dozen columns (not so)? + +Yes, most of columns return empty strings. + +I changed empty strings to null, casted to varchar and simplyfied the +statment. +However, this select statement runs forever. + +Any idea how to speed it up ? + +Andrus. + +SELECT +bilkaib.DB, +CASE WHEN dbkonto.objekt1='+' THEN bilkaib.DBOBJEKT ELSE null +END::VARCHAR(10) AS dbobjekt, +CASE WHEN dbkonto.objekt2='+' THEN bilkaib.DB2OBJEKT ELSE null +END::VARCHAR(10) AS db2objekt, +CASE WHEN dbkonto.objekt3='+' THEN bilkaib.DB3OBJEKT ELSE null +END::VARCHAR(10) AS db3objekt, +CASE WHEN dbkonto.objekt4='+' THEN bilkaib.DB4OBJEKT ELSE null +END::VARCHAR(10) AS db4objekt, +CASE WHEN dbkonto.objekt5='+' THEN bilkaib.DB5OBJEKT ELSE null +END::VARCHAR(10) AS db5objekt, +CASE WHEN dbkonto.objekt6='+' THEN bilkaib.DB6OBJEKT ELSE null +END::VARCHAR(10) AS db6objekt, +CASE WHEN dbkonto.objekt7='+' THEN bilkaib.DB7OBJEKT ELSE null +END::VARCHAR(10) AS db7objekt, +CASE WHEN dbkonto.objekt8='+' THEN bilkaib.DB8OBJEKT ELSE null +END::VARCHAR(10) AS db8objekt, +CASE WHEN dbkonto.objekt9='+' THEN bilkaib.DB9OBJEKT ELSE null +END::VARCHAR(10) AS db9objekt + from BILKAIB join KONTO CRKONTO ON bilkaib.cr=crkonto.kontonr + join KONTO DBKONTO ON bilkaib.db=dbkonto.kontonr + where + bilkaib.kuupaev BETWEEN '2006-01-01' AND '2006-12-31' + GROUP BY 1,2,3,4,5,6,7,8,9,10 + + + +From pgsql-performance-owner@postgresql.org Tue Jun 27 19:04:36 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3B9FD9FA999 + for ; + Tue, 27 Jun 2006 19:04:35 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 09512-08 for + ; + Tue, 27 Jun 2006 19:04:28 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moutng.kundenserver.de (moutng.kundenserver.de + [212.227.126.188]) + by postgresql.org (Postfix) with ESMTP id C129E9FA6B5 + for ; + Tue, 27 Jun 2006 19:04:28 -0300 (ADT) +Received: from [84.12.170.54] (helo=[192.168.0.2]) + by mrelayeu.kundenserver.de (node=mrelayeu4) with ESMTP (Nemesis), + id 0ML21M-1FvLfW3jfB-0005Be; Wed, 28 Jun 2006 00:04:27 +0200 +Subject: Re: Large index scan perfomance and indexCorrelation (PG +From: Simon Riggs +To: Andrew Sagulin +Cc: pgsql-performance@postgresql.org +In-Reply-To: <463024718.20060627161408@yandex.ru> +References: <463024718.20060627161408@yandex.ru> +Content-Type: text/plain +Date: Tue, 27 Jun 2006 23:04:17 +0100 +Message-Id: <1151445858.2479.170.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.6.1 (2.6.1-1.fc5.2) +Content-Transfer-Encoding: 7bit +X-Provags-ID: kundenserver.de abuse@kundenserver.de + login:726643fe08f41a451f0fe7fa43bce239 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/483 +X-Sequence-Number: 19840 + +On Tue, 2006-06-27 at 16:14 +0400, Andrew Sagulin wrote: + +> Result showed up that there were no page seq scan at all - true random access +> only. +> The simple model which can explain the situation: the sequence of numbers 2, 1, +> 4, 3, 6, 5, ..., 100, 99 has correlation about 0,9994. Let's imagine it's the page +> order of an index scan. H'm, bad choice, isn't it? + +Your example is only possible if whole blocks of data were out of order, +which I guess is possible within a multi-million row table. Slightly out +of order values would be ignored, since I/O works at the block rather +than the tuple level. + +ANALYZE doesn't cope well with tables as large as you have. It doesn't +sample enough rows, nor does it look within single blocks/groups to +discover anomalies such as yours. As a result, the data that is sampled +looks almost perfectly ordered, though the main bulk is not. + +I think what you are also pointing out is that the assumption of the +effects of correlation doesn't match the current readahead logic of +filesystems. If we were to actively force a readahead stride of 2 for +this scan (somehow), then the lack of correlation would disappear +completely. IIRC the current filesystem readahead logic would find that +such a sequence would be seen as random, and so no readahead would be +performed at all - even though the data is highly correlated. That isn't +PostgreSQL's fault directly, since the readahead ought to work better +than it does, but we fail indirectly by relying upon it in this case. + +> I think indexCorrelation can help to estimate page count but not page +> fetch cost. Why not to use formula +> +> min_IO_cost = ceil(indexSelectivity * T) * random_page_cost +> +> instead of +> +> min_IO_cost = ceil(indexSelectivity * T) ? + +That part is sensible. The min_IO_cost is when the access is sequential, +which by definition has a cost of 1.0. + +The bit you might have issue with is how we extrapolate from the +min_IO_cost and correlation to arrive at a cost. + +-- + Simon Riggs + EnterpriseDB http://www.enterprisedb.com + + +From pgsql-performance-owner@postgresql.org Wed Jun 28 06:34:14 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0F9E39FA5F0 + for ; + Wed, 28 Jun 2006 06:34:14 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 19903-10 for + ; + Wed, 28 Jun 2006 06:34:08 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from smtp1.yandex.ru (smtp1.yandex.ru [213.180.223.87]) + by postgresql.org (Postfix) with ESMTP id 4E2719FA2F0 + for ; + Wed, 28 Jun 2006 06:34:07 -0300 (ADT) +Received: from proxy2.upr.belsvyaz.ru ([82.151.104.10]:35903 "EHLO + server42.gts.gptus.com" smtp-auth: "andrews42" TLS-CIPHER: + TLS-PEER-CN1: ) by mail.yandex.ru with ESMTP id S2078029AbWF1Jd5 + (ORCPT ); + Wed, 28 Jun 2006 13:33:57 +0400 +X-Comment: RFC 2476 MSA function at smtp1.yandex.ru logged sender identity as: + andrews42 +Date: Wed, 28 Jun 2006 13:33:55 +0400 +From: Andrew Sagulin +X-Mailer: The Bat! (v3.62.14) Professional +Reply-To: Andrew Sagulin +Organization: gPTUS +X-Priority: 3 (Normal) +Message-ID: <624168784.20060628133355@yandex.ru> +To: pgsql-performance@postgresql.org +Subject: Large index scan perfomance and indexCorrelation (PG 8.1.4 Win32) +In-Reply-To: <1151445858.2479.170.camel@localhost.localdomain> +References: <463024718.20060627161408@yandex.ru> + <1151445858.2479.170.camel@localhost.localdomain> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/484 +X-Sequence-Number: 19841 + +Wednesday, June 28, 2006, 2:04:17 Simon Riggs, you wrote: + +> That part is sensible. The min_IO_cost is when the access is sequential, +> which by definition has a cost of 1.0. + +In general - yes. But we talk about the min_IO_cost of the index scan which is +barely sequential. Correct me if I'm wrong: index scan algorithm is something +like this: 'read couple of index pages, read some data pages, index pages, data +pages, ...'. So, the current assumption of min_IO_cost is too optimistic even in +a case of ideal tuple ordering. + +> The bit you might have issue with is how we extrapolate from the +> min_IO_cost and correlation to arrive at a cost. + +Now index scan cost calculation use indexCorrelation as measure of a tuple +clustering and a degree of their sequentiality (physical ordering). As far +as I know there are cases when this approach is wrong, for example, my issue or +any other case with high clustering without ordering, where bitmap heap scan is +the best way but PostgreSQL prefer index scan or even sequential scan. + +Does PostgreSQL's development team plan to revise the index scan +cost algorithm or issues like mine is too rare for taking into account? + + + + +From pgsql-performance-owner@postgresql.org Wed Jun 28 11:37:32 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D9BE59FA5BA + for ; + Wed, 28 Jun 2006 11:37:31 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 77323-07 for + ; + Wed, 28 Jun 2006 11:37:26 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 8456C9F9DCC + for ; + Wed, 28 Jun 2006 11:37:26 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5SEbOwc015073; + Wed, 28 Jun 2006 10:37:24 -0400 (EDT) +To: Andrew Sagulin +cc: pgsql-performance@postgresql.org +Subject: Re: Large index scan perfomance and indexCorrelation (PG 8.1.4 Win32) +In-reply-to: <624168784.20060628133355@yandex.ru> +References: <463024718.20060627161408@yandex.ru> + <1151445858.2479.170.camel@localhost.localdomain> + <624168784.20060628133355@yandex.ru> +Comments: In-reply-to Andrew Sagulin + message dated "Wed, 28 Jun 2006 13:33:55 +0400" +Date: Wed, 28 Jun 2006 10:37:24 -0400 +Message-ID: <15072.1151505444@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/485 +X-Sequence-Number: 19842 + +Andrew Sagulin writes: +> Does PostgreSQL's development team plan to revise the index scan +> cost algorithm or issues like mine is too rare for taking into account? + +The algorithm is certainly open for discussion, but we're not changing +it on the basis of just a single report ... + +You're mistaken to be fingering min_IO_cost as the source of the issue, +because there is also a correction for near-sequential access in +cost_bitmap_heap_scan. If we were to bias the system as heavily against +the consideration as you propose, we would logically have to put a +similar bias into cost_bitmap_heap_scan, and you'd probably still end up +with a plain indexscan. What you need to do is compare the two +functions and figure out what part of the cost models are out of line +with reality. I tend to agree with the upthread comment that the +nonlinear interpolation between min_IO_cost and max_IO_cost is suspect +... but that may or may not have anything truly to do with your problem. +It might be that cost_index is fine and cost_bitmap_heap_scan is +overcharging. + +BTW there are already some changes in HEAD relating to this, please see +the pghackers archives from beginning of June (thread "More thoughts +about planner's cost estimates"). + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Jun 28 12:08:32 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 9CFDE9FA5C9 + for ; + Wed, 28 Jun 2006 12:08:31 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 77309-10 for + ; + Wed, 28 Jun 2006 12:08:19 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 8CB5A9FA5CD + for ; + Wed, 28 Jun 2006 12:08:17 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id B6E9B56488; Wed, 28 Jun 2006 10:08:16 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Wed, 28 Jun 2006 10:08:15 -0500 +Date: Wed, 28 Jun 2006 10:08:15 -0500 +From: "Jim C. Nasby" +To: Tom Lane +Cc: Andrew Sagulin , pgsql-performance@postgresql.org +Subject: Re: Large index scan perfomance and indexCorrelation (PG 8.1.4 Win32) +Message-ID: <20060628150815.GT44573@pervasive.com> +References: <463024718.20060627161408@yandex.ru> + <1151445858.2479.170.camel@localhost.localdomain> + <624168784.20060628133355@yandex.ru> + <15072.1151505444@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <15072.1151505444@sss.pgh.pa.us> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060628:tgl@sss.pgh.pa.us::aSUN4H66MQxuIapM:00000000000000000000 + 0000000000000000000000003JZ3 +X-Hashcash: + 1:20:060628:andrews42@yandex.ru::+zD9TjbOqKUfBKxe:000000000000000000 + 00000000000000000000000092GV +X-Hashcash: + 1:20:060628:pgsql-performance@postgresql.org::2W7lm9Qv5ZmQ4ZcA:00000 + 00000000000000000000000019wo +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/486 +X-Sequence-Number: 19843 + +On Wed, Jun 28, 2006 at 10:37:24AM -0400, Tom Lane wrote: +> with a plain indexscan. What you need to do is compare the two +> functions and figure out what part of the cost models are out of line +> with reality. I tend to agree with the upthread comment that the +> nonlinear interpolation between min_IO_cost and max_IO_cost is suspect + +If you're going to make such a comparison (which is badly needed, imho), +http://stats.distributed.net/~decibel/ might be of use to you. It shows +that the nonlinear interpolation between the correlated and uncorrelated +index scans is way off base, at least for this example. + +BTW, you'll have a hard time convincing people to increase the cost +estimates of index scans, because experience has shown that they're +already too high (all the discussions about dropping random_page_cost, +for example). +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Wed Jun 28 12:41:52 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 754A89FA5BA + for ; + Wed, 28 Jun 2006 12:41:52 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 87605-03 for + ; + Wed, 28 Jun 2006 12:41:47 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id 128EF9F9DCC + for ; + Wed, 28 Jun 2006 12:41:46 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id B84E33093C; Wed, 28 Jun 2006 17:41:45 +0200 (MET DST) +From: Ron Mayer +X-Newsgroups: pgsql.performance +Subject: Re: Some performance numbers, with thoughts +Date: Wed, 28 Jun 2006 08:41:41 -0700 +Organization: Hub.Org Networking Services +Lines: 27 +Message-ID: <44A2A335.50601@cheapcomplexdevices.com> +References: <44973CC6.20309@janestcapital.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@news.hub.org +To: Brian Hurt +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +In-Reply-To: <44973CC6.20309@janestcapital.com> +To: pgsql-performance@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/487 +X-Sequence-Number: 19844 + +Combining the "insert" statements in a big concatenated string +joined by semicolons - rather than sending each individually +can drastically speed up your inserts; making them much closer +to the speed of copy. + +For example, instead of sending them separately, it's much faster +to send a single string like this + "insert into tbl (c1,c2) values (v1,v2);insert into tbl (c1,c2) values (v3,v4);..." +presumably due to the round-trip packets sending each insert takes. + +Brian Hurt wrote: +> +> Inserts, 1,000 per transaction ~5,400 inserts/second +> Copy, 1,000 element blocks ~20,000 inserts/second +> + +When I last measured it it was about a factor of 4 speedup +(3 seconds vs 0.7 seconds) by concatenating the inserts with +sample code shown her [1]. + +If the same ratio holds for your test case, these concatenated +inserts would be almost the exact same speed as a copy. + + Ron M + +[1] http://archives.postgresql.org/pgsql-performance/2005-09/msg00327.php + + +From pgsql-performance-owner@postgresql.org Sun Jul 2 23:02:14 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2E1C29FA31F + for ; + Thu, 29 Jun 2006 14:00:52 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 20461-04 for + ; + Thu, 29 Jun 2006 14:00:43 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id 0AD069FA081 + for ; + Thu, 29 Jun 2006 14:00:42 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 6B36F30920; Thu, 29 Jun 2006 19:00:41 +0200 (MET DST) +From: satishchandra999@gmail.com +X-Newsgroups: pgsql.performance +Subject: Calling a SP from Curosor loop +Date: 29 Jun 2006 10:00:35 -0700 +Organization: http://groups.google.com +Lines: 38 +Message-ID: <1151600435.709010.253120@j72g2000cwa.googlegroups.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset="iso-8859-1" +X-Complaints-To: groups-abuse@google.com +User-Agent: G2/0.2 +X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; + .NET CLR 1.1.4322; .NET CLR 2.0.50727),gzip(gfe),gzip(gfe) +Complaints-To: groups-abuse@google.com +Injection-Info: j72g2000cwa.googlegroups.com; posting-host=68.114.93.188; + posting-account=armG6w0AAADy3k9hQbRs0Nrb4eOCYes4 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/5 +X-Sequence-Number: 19865 + +I have SP, which has a cursor iterations. Need to call another SP for +every loop iteration of the cursor. The pseudo code is as follows.. + +Create proc1 as +Begin + +Variable declrations... + +declare EffectiveDate_Cursor cursor for +select field1,fld2 from tab1,tab2 where tab1.effectivedate; + Fri, 30 Jun 2006 02:54:14 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 36782-10 for + ; + Fri, 30 Jun 2006 02:54:07 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moonunit2.moonview.localnet (wsip-70-167-125-69.sd.sd.cox.net + [70.167.125.69]) + by postgresql.org (Postfix) with ESMTP id 339839FA0EC + for ; + Fri, 30 Jun 2006 02:54:06 -0300 (ADT) +Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) + by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id + k5U68380027650 + for ; Thu, 29 Jun 2006 23:08:04 -0700 +Message-ID: <44A4AE1A.4070308@modgraph-usa.com> +Date: Thu, 29 Jun 2006 21:52:42 -0700 +From: "Craig A. James" +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: explain analyze reports 20x more time than actual +References: <448C505C.2080504@modgraph-usa.com> + <87ac8jfu7t.fsf@stark.xeocode.com> + <448E5A92.9050206@modgraph-usa.com> + <22609.1150209419@sss.pgh.pa.us> +In-Reply-To: <22609.1150209419@sss.pgh.pa.us> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/488 +X-Sequence-Number: 19845 + +I have a query that needs to run faster, with the obvious solution being to add an index. But to confirm this, I ran explain analyze. When I run the actual query, it consistently takes 6-7 seconds by the wall clock. My application with a "verbose" mode enabled reports 6.6 seconds consistently. However, when I run EXPLAIN ANALYZE, it takes 120 seconds! This is 20x longer, and it leads me to distrust the plan that it claims to be executing. How can the actual run time be so much faster than that claimed by EXPLAIN ANALYZE? How can I find out the actual plan it's using? + +Thanks, +Craig + + +Details: + Postgres 8.0.3 + shared_buffers = 20000 + work_mem = 500000 + effective_cache_size = 430000 + Dell w/ Xeon + Linux kernel 2.6.9-1.667smp + 4 GB memory + +=> explain analyze select SAMPLE.SAMPLE_ID, SAMPLE.VERSION_ID,SAMPLE.SUPPLIER_ID,SAMPLE.CATALOGUE_ID,SAMPLE.PREP_ID from HITLIST_ROWS_281430 join SAMPLE on (HITLIST_ROWS_281430.OBJECTID = SAMPLE.SAMPLE_ID) where SAMPLE.VERSION_ID in (7513672,7513650,7513634,7513620,7513592,7513590,7513582,7513576,7513562,7513560) order by HITLIST_ROWS_281430.SortOrder; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + Sort (cost=234964.38..234964.52 rows=58 width=24) (actual time=120510.842..120510.889 rows=10 loops=1) + Sort Key: hitlist_rows_281430.sortorder + -> Hash Join (cost=353.68..234962.68 rows=58 width=24) (actual time=81433.194..120510.753 rows=10 loops=1) + Hash Cond: ("outer".objectid = "inner".sample_id) + -> Seq Scan on hitlist_rows_281430 (cost=0.00..177121.61 rows=11497361 width=8) (actual time=0.008..64434.110 rows=11497361 loops=1) + -> Hash (cost=353.48..353.48 rows=82 width=20) (actual time=0.293..0.293 rows=0 loops=1) + -> Index Scan using i_sample_version_id, i_sample_version_id, i_sample_version_id, i_sample_version_id, i_sample_version_id, i_sample_version_id, i_sample_version_id, i_sample_version_id, i_sample_version_id, i_sample_version_id on sample (cost=0.00..353.48 rows=82 width=20) (actual time=0.042..0.201 rows=12 loops=1) + Index Cond: ((version_id = 7513672) OR (version_id = 7513650) OR (version_id = 7513634) OR (version_id = 7513620) OR (version_id = 7513592) OR (version_id = 7513590) OR (version_id = 7513582) OR (version_id = 7513576) OR (version_id = 7513562) OR (version_id = 7513560)) + Total runtime: 120511.485 ms +(9 rows) + +From pgsql-performance-owner@postgresql.org Fri Jun 30 02:56:38 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2C2EF9FA5FC + for ; + Fri, 30 Jun 2006 02:56:38 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 38752-07 for + ; + Fri, 30 Jun 2006 02:56:34 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moonunit2.moonview.localnet (wsip-70-167-125-69.sd.sd.cox.net + [70.167.125.69]) + by postgresql.org (Postfix) with ESMTP id D24579FA0EC + for ; + Fri, 30 Jun 2006 02:56:33 -0300 (ADT) +Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) + by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id + k5U6AVsh027696 + for ; Thu, 29 Jun 2006 23:10:31 -0700 +Message-ID: <44A4AEAE.8070809@modgraph-usa.com> +Date: Thu, 29 Jun 2006 21:55:10 -0700 +From: "Craig A. James" +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Sort order in sub-select +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/489 +X-Sequence-Number: 19846 + +Here is a question about SQL. I have a one-to-many pair of tables (call them "P" and "C" for parent and child). For each row of P, there are many rows in C with data, and I want to sort P on the min(c.data). The basic query is simple: + + select p_id, min(data) as m from c group by p_id order by m; + +Now the problem: I also want to store this, in sorted order, as a "hitlist", so I have a table like this: + + create table hitlist(p_id integer, sortorder integer); + +and a sequence to go with it. The first thing I tried doesn't work: + + insert into hitlist(p_id, sortorder) + (select p_id, nextval('hitlist_seq') from + (select p_id, min(data) as m from c group by p_id order by m); + +Apparently, the sort order returned by the innermost select is NOT maintained as you go through the next select statement -- the rows seem to come out in random order. This surprised me. But in thinking about the definition of SQL itself, I guess there's no guarantee that sort order is maintained across sub-selects. I was caught by this because in Oracle, this same query works "correctly" (i.e. the hitlist ends up in sorted order), but I suspect that was just the luck of their implementation. + +Can anyone confirm this, that the sort order is NOT guaranteed to be maintained through layers of SELECT statements? + +The apparent solution is to make the hitlist.sortorder column have nextval() as its default and eliminate the first sub-select. But I thought the two would be equivalent. + +Thanks, +Craig + + +From pgsql-performance-owner@postgresql.org Fri Jun 30 03:05:08 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 68E819FA5FC + for ; + Fri, 30 Jun 2006 03:05:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 40045-09 for + ; + Fri, 30 Jun 2006 03:04:53 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id E11A09FA0EC + for ; + Fri, 30 Jun 2006 03:04:52 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5U64nTR020525; + Fri, 30 Jun 2006 02:04:49 -0400 (EDT) +To: "Craig A. James" +cc: pgsql-performance@postgresql.org +Subject: Re: explain analyze reports 20x more time than actual +In-reply-to: <44A4AE1A.4070308@modgraph-usa.com> +References: <448C505C.2080504@modgraph-usa.com> + <87ac8jfu7t.fsf@stark.xeocode.com> + <448E5A92.9050206@modgraph-usa.com> + <22609.1150209419@sss.pgh.pa.us> + <44A4AE1A.4070308@modgraph-usa.com> +Comments: In-reply-to "Craig A. James" + message dated "Thu, 29 Jun 2006 21:52:42 -0700" +Date: Fri, 30 Jun 2006 02:04:49 -0400 +Message-ID: <20524.1151647489@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/490 +X-Sequence-Number: 19847 + +"Craig A. James" writes: +> I have a query that needs to run faster, with the obvious solution +> being to add an index. But to confirm this, I ran explain analyze. +> When I run the actual query, it consistently takes 6-7 seconds by the +> wall clock. My application with a "verbose" mode enabled reports 6.6 +> seconds consistently. However, when I run EXPLAIN ANALYZE, it takes +> 120 seconds! + +See recent discussions --- if you've got duff PC hardware, it seems that +reading the clock takes forever :-(. In this case I'd assume that the +cost of the seqscan (11497361 rows returned) is being overstated because +of the 2*11497361 gettimeofday calls involved. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Jun 30 03:21:20 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D1EBE9FA5FC + for ; + Fri, 30 Jun 2006 03:21:19 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 56718-01 for + ; + Fri, 30 Jun 2006 03:21:09 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 096079FA0EC + for ; + Fri, 30 Jun 2006 03:21:08 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5U6L6Tn020651; + Fri, 30 Jun 2006 02:21:06 -0400 (EDT) +To: "Craig A. James" +cc: pgsql-performance@postgresql.org +Subject: Re: Sort order in sub-select +In-reply-to: <44A4AEAE.8070809@modgraph-usa.com> +References: <44A4AEAE.8070809@modgraph-usa.com> +Comments: In-reply-to "Craig A. James" + message dated "Thu, 29 Jun 2006 21:55:10 -0700" +Date: Fri, 30 Jun 2006 02:21:06 -0400 +Message-ID: <20650.1151648466@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/491 +X-Sequence-Number: 19848 + +"Craig A. James" writes: +> insert into hitlist(p_id, sortorder) +> (select p_id, nextval('hitlist_seq') from +> (select p_id, min(data) as m from c group by p_id order by m); + +> Apparently, the sort order returned by the innermost select is NOT +> maintained as you go through the next select statement -- the rows seem +> to come out in random order. This surprised me. + +It surprises me too. This is outside the SQL spec, because the spec +doesn't allow ORDER BY in subselects, but Postgres definitely does and +we expect it to be honored. Can you provide a complete example and the +EXPLAIN plan that you're getting? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Jun 30 03:33:10 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 218809FA60B + for ; + Fri, 30 Jun 2006 03:33:10 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 42377-10 for + ; + Fri, 30 Jun 2006 03:33:03 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from outmail128161.authsmtp.co.uk (outmail128161.authsmtp.co.uk + [62.13.128.161]) + by postgresql.org (Postfix) with ESMTP id 5AABD9FA0EC + for ; + Fri, 30 Jun 2006 03:33:03 -0300 (ADT) +Received: from [192.168.2.3] (adsl-70-132-44-181.dsl.snfc21.sbcglobal.net + [70.132.44.181]) (authenticated bits=0) + by squirrel.dmpriest.net.uk (8.13.6/8.13.6/Kp) with ESMTP id + k5U6X0aP075936 for ; + Fri, 30 Jun 2006 07:33:01 +0100 (BST) +Message-ID: <44A4C5B0.2090303@agliodbs.com> +Date: Thu, 29 Jun 2006 23:33:20 -0700 +From: Josh Berkus +User-Agent: Mozilla Thunderbird 1.0.6 (Macintosh/20050716) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: FWD: Update touches unrelated indexes? +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Server-Quench: 479e648f-0802-11db-b770-001185d377ca +X-AuthRoute: OCdyZgscClZXSx8a IioLCC5HRQ8+YBZL BAkbIhBDJB8RWB5f + NVxfJ1xYPXUEQkpF VCReGBUITgIzDi12 axUrKFtCYEpOWRVq + V0JKQVhSFktvAQIA BRwAVh1sdg1HZ3x1 Z0N9Xj4AWSF8HUYs + Ik5TEGQFYylnbGca HkRfflZSdAscYx9N alJiVXJZM3hVYX1g + WldrZmlhYDkEd3te SxcjEn5ACXsTEjcg SlgeGigkHUAeDzg1 + NREiI0IREA4QNEk/ IVY6Djpz +X-Authentic-SMTP: 61633136333939.squirrel.dmpriest.net.uk:1.55/Kp +X-Report-SPAM: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse +X-Virus-Status: No virus detected - but ensure you scan with your own + anti-virus system! +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/492 +X-Sequence-Number: 19849 + +Folks, + +Jozsef is having trouble posting to the list, but he's receiving +messages fine. So reply to the list and not to me. Message follows: + + +-------- Original Message ------- +The original post: + +Title: Update touches unrelated indexes!? + +Hi Everyone, + +I hope someone can explain what I'm seeing on our system. I've got a +table with about four million rows in it (see schema below). Almost +every column has one or two indexes. What I've found is that when I +issue an update statement to zero out the content of a particular +column, the pg_locks table indicates that every other, seemingly +unrelated index is locked/changed. The statement is this: + +UPDATE schema_1.test_table SET col_27 = 0; + +I expect the idx_test_table_col_27 index to have write locks during this +operation but seeing RowExclusiveLock entries on every other index +puzzles me. Interestingly enough these locks are not present if the +table is smaller. + +I see these "extra" locks even if I drop the idx_test_table_col_27 index +before the update. The performance of this update is extremely slow. I'm +much better off if I drop all indexes before the update and recreate +them after the update. However, deleting these indexes has a negative +impact on the performance of other queries that are concurrently being +executed. + +Is there a way to limit the impact of the update to the actual column +and index it is executed on? + +Any help is greatly appreciated! + +Regards, +Jozsef + + dfdata=# \d test_table + + Table "schema_1.test_table" + Column | Type | Modifiers +-----------------+-----------------------------+-------------------- + col_1 | character varying | not null + col_2 | character varying | + col_3 | integer | not null + col_4 | integer | not null + col_5 | character varying | not null + col_6 | character varying | not null + col_7 | character(1) | not null + col_8 | character varying | not null + col_9 | character varying | not null + col_10 | character varying | + col_11 | bigint | not null + col_12 | integer | not null + col_13 | character varying | + col_14 | integer | not null + col_15 | character(38) | not null + col_16 | character varying | not null + col_17 | bigint | not null + col_18 | character varying | + col_19 | character varying | + col_20 | integer | not null + col_21 | integer | not null + col_22 | integer | not null + col_23 | integer | not null + col_24 | timestamp without time zone | not null + col_25 | timestamp without time zone | not null + col_26 | timestamp without time zone | not null + col_27 | integer | not null default 0 + col_28 | integer | not null default 0 + col_29 | integer | not null default 0 + +Indexes: + + "idx_test_table_col_1" UNIQUE, btree (col_1) + "idx_test_table_col_27" btree (col_27) + "idx_test_table_col_14" btree (col_14) + "idx_test_table_col_12" btree (col_12) + "idx_test_table_col_24" btree (date_trunc('day'::text, col_24)) + "idx_test_table_col_25" btree (date_trunc('day'::text, col_25)) + "idx_test_table_col_26" btree (date_trunc('day'::text, col_26)) + "idx_test_table_col_29" btree (col_29) + "idx_test_table_col_6" btree (col_6) + "idx_test_table_col_10" btree (lower(col_10::text)) + "idx_test_table_col_10_2" btree (lower(col_10::text) +varchar_pattern_ops) + "idx_test_table_col_9" btree (lower(col_9::text)) + "idx_test_table_col_9_2" btree (lower(col_9::text) +varchar_pattern_ops) + "idx_test_table_col_8" btree (lower(col_8::text)) + "idx_test_table_col_8_2" btree (lower(col_8::text) +varchar_pattern_ops) + "idx_test_table_col_5" btree (col_5) + "idx_test_table_col_17" btree (col_17) + "idx_test_table_col_28" btree (col_28) + + + + +locktype | relation | mode | transaction | pid | granted | +nspname | relname + +----------+----------+------------------+-------------+------+---------+ +------------+----------------------------------------------------- + + relation | 1259 | AccessShareLock | 73112 | 7923 | t | +pg_catalog | pg_class + relation | 10342 | AccessShareLock | 73112 | 7923 | t | +pg_catalog | pg_locks + relation | 2615 | AccessShareLock | 73112 | 7923 | t | +pg_catalog | pg_namespace + relation | 28344 | RowExclusiveLock | 73109 | 7914 | t | +schema_1 | idx_test_table_col_27 + relation | 28354 | RowExclusiveLock | 73109 | 7914 | t | +schema_1 | idx_test_table_col_14 + relation | 28353 | RowExclusiveLock | 73109 | 7914 | t | +schema_1 | idx_test_table_col_12 + relation | 28356 | RowExclusiveLock | 73109 | 7914 | t | +schema_1 | idx_test_table_col_24 + relation | 28357 | RowExclusiveLock | 73109 | 7914 | t | +schema_1 | idx_test_table_col_25 + relation | 28358 | RowExclusiveLock | 73109 | 7914 | t | +schema_1 | idx_test_table_col_26 + relation | 28346 | RowExclusiveLock | 73109 | 7914 | t | +schema_1 | idx_test_table_col_29 + relation | 28343 | RowExclusiveLock | 73109 | 7914 | t | +schema_1 | idx_test_table_col_6 + relation | 28351 | RowExclusiveLock | 73109 | 7914 | t | +schema_1 | idx_test_table_col_10 + relation | 28352 | RowExclusiveLock | 73109 | 7914 | t | +schema_1 | idx_test_table_col_10_2 + relation | 28349 | RowExclusiveLock | 73109 | 7914 | t | +schema_1 | idx_test_table_col_9 + relation | 28350 | RowExclusiveLock | 73109 | 7914 | t | +schema_1 | idx_test_table_col_9_2 + relation | 28347 | RowExclusiveLock | 73109 | 7914 | t | +schema_1 | idx_test_table_col_8 + relation | 28348 | RowExclusiveLock | 73109 | 7914 | t | +schema_1 | idx_test_table_col_8_2 + relation | 28341 | RowExclusiveLock | 73109 | 7914 | t | +schema_1 | idx_test_table_col_1 + relation | 28342 | RowExclusiveLock | 73109 | 7914 | t | +schema_1 | idx_test_table_col_5 + relation | 28355 | RowExclusiveLock | 73109 | 7914 | t | +schema_1 | idx_test_table_col_17 + relation | 28345 | RowExclusiveLock | 73109 | 7914 | t | +schema_1 | idx_test_table_col_28 + relation | 27657 | AccessShareLock | 73109 | 7914 | t | +schema_1 | test_table + relation | 27657 | RowExclusiveLock | 73109 | 7914 | t | +schema_1 | test_table + + + +From pgsql-performance-owner@postgresql.org Fri Jun 30 03:44:08 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6CA769FA5FC + for ; + Fri, 30 Jun 2006 03:44:07 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 57497-06 for + ; + Fri, 30 Jun 2006 03:43:57 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 9C2B19FA0EC + for ; + Fri, 30 Jun 2006 03:43:57 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5U6hsaN020926; + Fri, 30 Jun 2006 02:43:54 -0400 (EDT) +To: Josh Berkus +cc: pgsql-performance@postgresql.org +Subject: Re: FWD: Update touches unrelated indexes? +In-reply-to: <44A4C5B0.2090303@agliodbs.com> +References: <44A4C5B0.2090303@agliodbs.com> +Comments: In-reply-to Josh Berkus + message dated "Thu, 29 Jun 2006 23:33:20 -0700" +Date: Fri, 30 Jun 2006 02:43:54 -0400 +Message-ID: <20925.1151649834@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/493 +X-Sequence-Number: 19850 + +Josh Berkus forwards: +> I hope someone can explain what I'm seeing on our system. I've got a +> table with about four million rows in it (see schema below). Almost +> every column has one or two indexes. What I've found is that when I +> issue an update statement to zero out the content of a particular +> column, the pg_locks table indicates that every other, seemingly +> unrelated index is locked/changed. + +This surprises you why? + +> I expect the idx_test_table_col_27 index to have write locks during this +> operation but seeing RowExclusiveLock entries on every other index +> puzzles me. Interestingly enough these locks are not present if the +> table is smaller. + +That last I don't believe at all --- PG updates every index on every row +update. Most likely the OP is just not querying pg_locks fast enough to +see the locks. If he's really concerned about update performance then +he probably needs to think harder about whether every one of those +indexes is really carrying its weight. + + regards, tom lane + +From pgadmin-support-owner@postgresql.org Fri Jun 30 04:42:14 2006 +X-Original-To: pgadmin-support-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2676B9FA5FC + for ; + Fri, 30 Jun 2006 04:39:31 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 61035-05 for + ; + Fri, 30 Jun 2006 04:39:23 -0300 (ADT) +X-Greylist: delayed 00:06:38.731233 by SQLgrey- +Received: from nicol.ioppublishing.com (nicol.ioppublishing.com + [193.131.119.58]) + by postgresql.org (Postfix) with SMTP id 642819FA0EC + for ; + Fri, 30 Jun 2006 04:39:21 -0300 (ADT) +Received: (qmail 13587 invoked from network); 30 Jun 2006 07:32:41 -0000 +Received: from aitken.ioppublishing.com (HELO aitken.ioppublishing.com) + (193.128.223.28) + by nicol.ioppublishing.com (qpsmtpd/0.28) with ESMTP; + Fri, 30 Jun 2006 08:32:41 +0100 +Received: from dawkins.ioppublishing.com (dawkins.ioppublishing.com) by + aitken.ioppublishing.com (Clearswift SMTPRS 5.1.7) with ESMTP id + for + ; Fri, 30 Jun 2006 08:35:39 +0100 +To: pgadmin-support@postgresql.org +Subject: 100% CPU +MIME-Version: 1.0 +X-Mailer: Lotus Notes Release 6.5.5 November 30, 2005 +Message-ID: + +From: Peter Newman +Date: Fri, 30 Jun 2006 08:32:39 +0100 +X-MIMETrack: Serialize by Router on + dawkins/IOPP(Release 6.5.4|March 27, 2005) at 30/06/2006 08:32:39 AM, + Serialize complete at 30/06/2006 08:32:39 AM +Content-Type: multipart/alternative; + boundary="=_alternative 002986DF8025719D_=" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/88 +X-Sequence-Number: 5570 + +This is a multipart message in MIME format. + +--=_alternative 002986DF8025719D_= +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7bit + +Good Morning + +I am new to postgres and have been asked to look at a server where we +truncate a table then load data. + +The CPU has started to hit 100% usage during this process. + +Can you please describe what steps I could take to investigate and solve +this issue? + So far all I have done is run a Vacuum Analyze command using PGAdmin +III.....which appears to have made little difference. + + +Thank you + + +Pete Newman +Information Systems +Institute of Physics +Tel No 0117 9301249 +Fax No 0117 9301183 +Peter.Newman@iop.org +http://www.iop.org +

+************************************************************************

+ +This email (and attachments) are confidential and intended for the addressee(s) only. If you are not the intended recipient please notify the sender, delete any copies and do not take action in reliance on it. Any views expressed are the author's and do not represent those of IOP, except where specifically stated. IOP takes reasonable precautions to protect against viruses but accepts no responsibility for loss or damage arising from virus infection. For the protection of IOP's systems and staff emails are scanned automatically.

+ +IOP Publishing Limited Registered in England under Registration No 467514. Registered Office: Dirac House, Temple Back, Bristol BS1 6BE England + + +--=_alternative 002986DF8025719D_= +Content-Type: text/html; charset="us-ascii" +Content-Transfer-Encoding: 7bit + + +
Good Morning +
+
I am new to postgres and have been asked +to look at a server where we truncate a table then load data. +
+
The CPU has started to hit 100% usage +during this process. +
+
Can you please describe what steps I +could take to investigate and solve this issue? +
 So far all I have done is run +a Vacuum Analyze command using PGAdmin III.....which appears to have made +little difference. +
+
+
Thank you
+
+
+Pete Newman
+Information Systems
+Institute of Physics
+Tel No 0117 9301249
+Fax No 0117 9301183
+Peter.Newman@iop.org
+http://www.iop.org
+

+************************************************************************

+ +This email (and attachments) are confidential and intended for the addressee(s) only. If you are not the intended recipient please notify the sender, delete any copies and do not take action in reliance on it. Any views expressed are the author's and do not represent those of IOP, except where specifically stated. IOP takes reasonable precautions to protect against viruses but accepts no responsibility for loss or damage arising from virus infection. For the protection of IOP's systems and staff emails are scanned automatically.

+ +IOP Publishing Limited Registered in England under Registration No 467514. Registered Office: Dirac House, Temple Back, Bristol BS1 6BE England + + +--=_alternative 002986DF8025719D_=-- + +From pgsql-performance-owner@postgresql.org Fri Jun 30 11:05:01 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 67B0D9FA163 + for ; + Fri, 30 Jun 2006 11:05:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 85229-08 for + ; + Fri, 30 Jun 2006 11:04:44 -0300 (ADT) +X-Greylist: delayed 00:34:09.013379 by SQLgrey- +Received: from qm.sweetwater.com (qmail.sweetwater.com [66.242.228.12]) + by postgresql.org (Postfix) with ESMTP id C54699FA4A7 + for ; + Fri, 30 Jun 2006 11:04:43 -0300 (ADT) +Received: from [172.21.22.155] (helo=[172.21.22.155]) by [0.0.0.0] + with SMTP (QuickMail Pro Server for Mac 3.5.2 build 50328); + Fri, 30 Jun 2006 09:30:28 -0400 +Mime-Version: 1.0 (Apple Message framework v750) +To: pgsql-performance@postgresql.org +Message-Id: +Content-Type: multipart/alternative; boundary=Apple-Mail-6--579062499 +From: Joe Lester +Subject: Index Being Ignored? +Date: Fri, 30 Jun 2006 09:31:52 -0400 +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/494 +X-Sequence-Number: 19851 + + +--Apple-Mail-6--579062499 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=US-ASCII; + delsp=yes; + format=flowed + +I have a index question. My table has 800K rows and I a doing a basic +query on an indexed integer field which takes over 2 seconds to +complete because it's ignoring the index for some reason. Any ideas +as to why it's ignoring the index? I'm using postgres 8.0.2. + +SELECT count(*) FROM purchase_order_items WHERE expected_quantity > '0' + +EXPLAIN ANALYZE reveals that it's not using the index... + +Aggregate (cost=22695.28..22695.28 rows=1 width=0) (actual +time=2205.688..2205.724 rows=1 loops=1) + -> Seq Scan on purchase_order_items (cost=0.00..21978.08 +rows=286882 width=0) (actual time=0.535..2184.405 rows=7458 loops=1) + Filter: (expected_quantity > 0) +Total runtime: 2207.203 ms + +However, if I use the "SET ENABLE_SEQSCAN TO OFF" trick, then it does +use the index and is much faster. + +SET ENABLE_SEQSCAN TO OFF; +EXPLAIN ANALYZE SELECT count(*) FROM purchase_order_items WHERE +expected_quantity > '0' + +Aggregate (cost=1050659.46..1050659.46 rows=1 width=0) (actual +time=137.393..137.441 rows=1 loops=1) + -> Index Scan using purchase_order_items_expected_quantity_idx on +purchase_order_items (cost=0.00..1049942.25 rows=286882 width=0) +(actual time=0.756..119.990 rows=7458 loops=1) + Index Cond: (expected_quantity > 0) +Total runtime: 139.185 ms + +I could understand if this was a really complex query and the planner +got confused... but this is such a simple query. Is it OK to use "SET +ENABLE_SEQSCAN TO OFF;" in production code? Is there another solution? + +Thanks! + +------------------------------ + +-- Table Definition -- + +CREATE TABLE purchase_order_items ( + id serial NOT NULL, + purchase_order_id integer, + manufacturer_id integer, + quantity integer, + product_name character varying(16), + short_description character varying(60), + expected_quantity integer, + received_quantity integer, + "position" real, + created_at timestamp without time zone DEFAULT now(), + updated_at timestamp without time zone +); + +-- Index -- + +CREATE INDEX purchase_order_items_expected_quantity_idx ON +purchase_order_items USING btree (expected_quantity); + + + +--Apple-Mail-6--579062499 +Content-Transfer-Encoding: quoted-printable +Content-Type: text/html; + charset=ISO-8859-1 + +

I have a = +index question. My table has 800K rows and I a doing a basic query on an = +indexed integer field which takes over 2 seconds to complete because = +it's ignoring the index for some reason. Any ideas as to why it's = +ignoring the index? I'm using postgres 8.0.2.

SELECT = +count(*) FROM purchase_order_items WHERE expected_quantity > = +'0'=A0

EXPLAIN ANALYZE reveals that it's not using the = +index...

Aggregate=A0 (cost=3D22695.28..22695.28 rows=3D1 width=3D0) (actual = +time=3D2205.688..2205.724 rows=3D1 loops=3D1)
=A0= + ->=A0= + Seq Scan on purchase_order_items=A0 = +(cost=3D0.00..21978.08 rows=3D286882 width=3D0) (actual = +time=3D0.535..2184.405 rows=3D7458 loops=3D1)
=A0= + =A0 =A0 =A0 Filter: (expected_quantity > 0)
Total runtime: 2207.203 ms

However, if I = +use the "SET ENABLE_SEQSCAN TO OFF" trick, then it does use the index = +and is much faster.

SET ENABLE_SEQSCAN TO OFF;
EXPLAIN ANALYZE SELECT count(*) FROM = +purchase_order_items WHERE expected_quantity > '0'=A0

Aggregate=A0 = +(cost=3D1050659.46..1050659.46 rows=3D1 width=3D0) (actual = +time=3D137.393..137.441 rows=3D1 loops=3D1)
=A0= + ->=A0= + Index Scan using purchase_order_items_expected_quantity_idx on = +purchase_order_items=A0 (cost=3D0.00..1049942.25 rows=3D286882 width=3D0) (actual = +time=3D0.756..119.990 rows=3D7458 loops=3D1)
=A0= + =A0 =A0 =A0 Index Cond: (expected_quantity > 0)
Total runtime: 139.185 ms

I could = +understand if this was a really complex query and the planner got = +confused... but this is such a simple query. Is it OK to use "SET = +ENABLE_SEQSCAN TO OFF;" in production code? Is there another = +solution?

Thanks!

------------------------------

-- Table = +Definition --

CREATE TABLE purchase_order_items (
=A0 =A0 id serial NOT NULL,
=A0 =A0 purchase_order_id integer,
=A0 =A0 manufacturer_id integer,
=A0 =A0 quantity integer,
=A0 =A0 product_name character = +varying(16),
=A0 =A0 short_description = +character varying(60),
=A0 =A0 expected_quantity = +integer,
=A0 =A0 received_quantity = +integer,
=A0 =A0 "position" = +real,
=A0 =A0 created_at timestamp = +without time zone DEFAULT now(),
=A0 =A0 = +updated_at timestamp without time zone
);

-- Index --

CREATE INDEX = +purchase_order_items_expected_quantity_idx ON purchase_order_items USING = +btree (expected_quantity);


= + +--Apple-Mail-6--579062499-- + + +From pgsql-performance-owner@postgresql.org Fri Jun 30 11:14:02 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 391E89FA163 + for ; + Fri, 30 Jun 2006 11:14:02 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 04707-04-2 + for ; + Fri, 30 Jun 2006 11:13:54 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.196]) + by postgresql.org (Postfix) with ESMTP id 6E9CF9FA5E9 + for ; + Fri, 30 Jun 2006 11:13:54 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id i11so324614nzh + for ; + Fri, 30 Jun 2006 07:13:52 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; + b=UqaoyxuasgJUlSTaaSkl+VCm9DfdA+kKXQFDXp0MtTKJjbUOt7A+MxYlg5oHkiidiTK4ikp6UpHr9dWqSIEFthT1CkO4UHrG5VZKpiAX/Ahstoza0gPqLgibMB0KSAzymWJecvnCI1HkWxDIyUk+HJjk5EJ0S1OqbIS4UiEJcFE= +Received: by 10.36.47.6 with SMTP id u6mr807023nzu; + Fri, 30 Jun 2006 07:13:52 -0700 (PDT) +Received: by 10.36.12.16 with HTTP; Fri, 30 Jun 2006 07:13:52 -0700 (PDT) +Message-ID: <130df1930606300713y55496692l3ee844f055305aa8@mail.gmail.com> +Date: Fri, 30 Jun 2006 16:13:52 +0200 +From: "Ksenia Marasanova" +To: pgsql-performance@postgresql.org +Subject: newly created database makes queries run 300% faster +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/495 +X-Sequence-Number: 19852 + +Hi, + +Alfter hours of adjusting performance of the queries in my Postgres +7.3 database - reprogramming the queries, VACUUMing, changing value of +enable_seqscan - I gived it up, recreated the database and transferred +the dump of the old database into it. +The queries went from 15 sec to 50 msec!! Wow. +Now I would really love to know how the old database got that slow, +and how can I avoid it in the future. Any tips are greatly +appreciated! + +Thanks! +Ksenia. + +From pgsql-performance-owner@postgresql.org Fri Jun 30 15:21:35 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 65A8A9FA0EC + for ; + Fri, 30 Jun 2006 15:21:35 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 93349-02 for + ; + Fri, 30 Jun 2006 15:21:30 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mx2.surnet.cl (mx2.surnet.cl [216.155.73.181]) + by postgresql.org (Postfix) with ESMTP id 8A2FE9FA192 + for ; + Fri, 30 Jun 2006 15:21:29 -0300 (ADT) +Received: from unknown (HELO alvh.no-ip.org) ([201.221.201.100]) + by mx2.surnet.cl with ESMTP; 30 Jun 2006 10:14:54 -0400 +X-IronPort-AV: i="4.06,193,1149480000"; + d="scan'208"; a="62782738:sNHT18989024" +Received: by alvh.no-ip.org (Postfix, from userid 1000) + id 5118DC22E96; Fri, 30 Jun 2006 10:14:55 -0400 (CLT) +Date: Fri, 30 Jun 2006 10:14:55 -0400 +From: Alvaro Herrera +To: Joe Lester +Cc: pgsql-performance@postgresql.org +Subject: Re: Index Being Ignored? +Message-ID: <20060630141455.GC21718@surnet.cl> +Mail-Followup-To: Joe Lester , + pgsql-performance@postgresql.org +References: +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/503 +X-Sequence-Number: 19860 + +Joe Lester wrote: +> I have a index question. My table has 800K rows and I a doing a basic +> query on an indexed integer field which takes over 2 seconds to +> complete because it's ignoring the index for some reason. Any ideas +> as to why it's ignoring the index? I'm using postgres 8.0.2. +> +> SELECT count(*) FROM purchase_order_items WHERE expected_quantity > '0' +> +> EXPLAIN ANALYZE reveals that it's not using the index... +> +> Aggregate (cost=22695.28..22695.28 rows=1 width=0) (actual +> time=2205.688..2205.724 rows=1 loops=1) +> -> Seq Scan on purchase_order_items (cost=0.00..21978.08 +> rows=286882 width=0) (actual time=0.535..2184.405 rows=7458 loops=1) +> Filter: (expected_quantity > 0) +> Total runtime: 2207.203 ms + +The estimated rowcount is far off. When did you last run ANALYZE on +this table? + +BTW, you should upgrade (to 8.0.8) unless you want known bugs to destroy +your data. + +-- +Alvaro Herrera http://www.CommandPrompt.com/ +PostgreSQL Replication, Consulting, Custom Development, 24x7 support + +From pgsql-performance-owner@postgresql.org Fri Jun 30 11:29:09 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C1F409FA4A7 + for ; + Fri, 30 Jun 2006 11:29:08 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 01654-10 for + ; + Fri, 30 Jun 2006 11:28:56 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) + by postgresql.org (Postfix) with ESMTP id C302F9FA163 + for ; + Fri, 30 Jun 2006 11:28:56 -0300 (ADT) +Received: from kingfisher.intern.logix-tt.com (T916d.t.pppool.de + [89.55.145.109]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.logix-tt.com (Postfix) with ESMTP id 147F065874 + for ; + Fri, 30 Jun 2006 16:30:33 +0200 (CEST) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 9B62B181C1C6E + for ; + Fri, 30 Jun 2006 16:29:06 +0200 (CEST) +Message-ID: <44A53532.50402@logix-tt.com> +Date: Fri, 30 Jun 2006 16:29:06 +0200 +From: Markus Schaber +Organization: Logical Tracking and Tracing International AG, Switzerland +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Index Being Ignored? +References: +In-Reply-To: +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/496 +X-Sequence-Number: 19853 + +Hi, Joe, + +Joe Lester wrote: +> Aggregate (cost=22695.28..22695.28 rows=1 width=0) (actual +> time=2205.688..2205.724 rows=1 loops=1) +> -> Seq Scan on purchase_order_items (cost=0.00..21978.08 rows=286882 +> width=0) (actual time=0.535..2184.405 rows=7458 loops=1) +> Filter: (expected_quantity > 0) + +The query planner estimates that your filter will hit 286882 rows, while +in reality it hits only 7458 rows. That's why the query planer chooses a +sequential scan. + +It seems that the statistics for the column expected_quantity are off. + +My suggestions: + +- make shure that the statistics are current by analyzing the table +appropriately (e. G. by using the autovacuum daemon from contrib). + +- increase the statistics target for this column. + +- if you run this query very often, an conditional index might make sense: + +CREATE INDEX purchase_order_having_quantity_idx ON purchase_order_items +(expected_quantity) WHERE expected_quantity > 0; + + +HTH, +Markus + +-- +Markus Schaber | Logical Tracking&Tracing International AG +Dipl. Inf. | Software Development GIS + +Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org + +From pgsql-performance-owner@postgresql.org Fri Jun 30 11:36:20 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 728059FA163 + for ; + Fri, 30 Jun 2006 11:36:20 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 11521-09 for + ; + Fri, 30 Jun 2006 11:36:06 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.libertyrms.com (vgateway.libertyrms.info [207.219.45.62]) + by postgresql.org (Postfix) with ESMTP id 3394B9FA5E9 + for ; + Fri, 30 Jun 2006 11:36:06 -0300 (ADT) +Received: from dba5.int.libertyrms.com ([10.1.3.44]) + by mail.libertyrms.com with esmtp (Exim 4.22) + id 1FwK6G-0005D3-Gj; Fri, 30 Jun 2006 10:36:04 -0400 +Message-ID: <44A536D3.10601@ca.afilias.info> +Date: Fri, 30 Jun 2006 10:36:03 -0400 +From: Brad Nicholson +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: Ksenia Marasanova +CC: pgsql-performance@postgresql.org +Subject: Re: newly created database makes queries run 300% faster +References: <130df1930606300713y55496692l3ee844f055305aa8@mail.gmail.com> +In-Reply-To: <130df1930606300713y55496692l3ee844f055305aa8@mail.gmail.com> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-SA-Exim-Mail-From: bnichols@ca.afilias.info +X-SA-Exim-Scanned: No; SAEximRunCond expanded to false +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/497 +X-Sequence-Number: 19854 + +Ksenia Marasanova wrote: +> Hi, +> +> Alfter hours of adjusting performance of the queries in my Postgres +> 7.3 database - reprogramming the queries, VACUUMing, changing value of +> enable_seqscan - I gived it up, recreated the database and transferred +> the dump of the old database into it. +> The queries went from 15 sec to 50 msec!! Wow. +> Now I would really love to know how the old database got that slow, +> and how can I avoid it in the future. Any tips are greatly +> appreciated! + +If memory servers me (and it might not in this case), vacuum in 7.3 had +issues with indexes. Reindexing or clustering your tables might have +helped. Both are blocking operations. + +How to avoid it in the future is simple. Upgrade to a modern version of +Postgres and vacuum your database properly. People work on this thing +for a reason :-) + + +-- +Brad Nicholson 416-673-4106 +Database Administrator, Afilias Canada Corp. + + +From pgsql-performance-owner@postgresql.org Fri Jun 30 11:41:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 1DBB79FA4A7 + for ; + Fri, 30 Jun 2006 11:41:55 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 04707-10 for + ; + Fri, 30 Jun 2006 11:41:47 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 1C9BB9FA163 + for ; + Fri, 30 Jun 2006 11:41:46 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5UEfj34023731; + Fri, 30 Jun 2006 10:41:45 -0400 (EDT) +To: Joe Lester +cc: pgsql-performance@postgresql.org +Subject: Re: Index Being Ignored? +In-reply-to: +References: +Comments: In-reply-to Joe Lester + message dated "Fri, 30 Jun 2006 09:31:52 -0400" +Date: Fri, 30 Jun 2006 10:41:45 -0400 +Message-ID: <23730.1151678505@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/498 +X-Sequence-Number: 19855 + +Joe Lester writes: +> SELECT count(*) FROM purchase_order_items WHERE expected_quantity > '0' + +> Aggregate (cost=22695.28..22695.28 rows=1 width=0) (actual +> time=2205.688..2205.724 rows=1 loops=1) +> -> Seq Scan on purchase_order_items (cost=0.00..21978.08 +> rows=286882 width=0) (actual time=0.535..2184.405 rows=7458 loops=1) +> Filter: (expected_quantity > 0) +> Total runtime: 2207.203 ms + +Why is the expected row count so far off --- have you analyzed the table +lately? For such a simple WHERE condition the estimate should be pretty +accurate, if the stats are sufficient. If this table is very large you +might need to increase the statistics targets, but more likely you just +haven't got up-to-date stats at all. + +The planner *never* "ignores" an index. It may deliberately decide not +to use it, if it thinks the seqscan plan will be faster, as it does in +this case --- note the much higher cost estimate for the indexscan: + +> SET ENABLE_SEQSCAN TO OFF; +> EXPLAIN ANALYZE SELECT count(*) FROM purchase_order_items WHERE +> expected_quantity > '0' + +> Aggregate (cost=1050659.46..1050659.46 rows=1 width=0) (actual +> time=137.393..137.441 rows=1 loops=1) +> -> Index Scan using purchase_order_items_expected_quantity_idx on +> purchase_order_items (cost=0.00..1049942.25 rows=286882 width=0) +> (actual time=0.756..119.990 rows=7458 loops=1) +> Index Cond: (expected_quantity > 0) +> Total runtime: 139.185 ms + +The reason the cost estimate is out of line with reality is mainly that +the rows estimate is out of line with reality. There may be some index +order correlation it's not aware of too. + +BTW you might want to think about updating to PG 8.1. Its "bitmap" +index scans are much better suited for queries that are using a +relatively unselective index condition. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Jun 30 12:26:25 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D03789FA4A7 + for ; + Fri, 30 Jun 2006 12:26:24 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 39803-09 for + ; + Fri, 30 Jun 2006 12:26:10 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from dc1.storediq.com (66-194-80-196.static.twtelecom.net + [66.194.80.196]) + by postgresql.org (Postfix) with ESMTP id 696279FA163 + for ; + Fri, 30 Jun 2006 12:26:08 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: FWD: Update touches unrelated indexes? +Date: Fri, 30 Jun 2006 10:26:04 -0500 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] FWD: Update touches unrelated indexes? +Thread-Index: AcacELdXQGWgdzX6RVq2+s61ZZfbdAARksGw +From: "Jozsef Szalay" +To: "Tom Lane" +Cc: +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/499 +X-Sequence-Number: 19856 + +Hi Tom, + +>This surprises you why? + +I don't know anything about how PG stores keys along with their +references to the actual rows but my assumption was that that reference +is some sort of an index into a table that maps the reference to an +actual disk/file address. So even if the row or the page with the row on +it is physically moved to a different location in the disk file, the +unrelated indexes would not have to be changed because only the +disk/file address changes but the reference does not. If PG does not +work in a similar fashion then I understand the locks.=20 + +> That last I don't believe at all --- PG updates every index on every +row +>update. Most likely the OP is just not querying pg_locks fast enough +to +>see the locks. + +I'm sure you are right, but I was doing the update in a transaction and +I did not see those looks after the update was done but before the +changes were committed.=20 + +>he probably needs to think harder about whether every one of those +>indexes is really carrying its weight. + +Unfortunately all of those indexes are required by the application. It +appears that the only viable option I have is to drop the indexes and +recreate them after the update. + + +Thanks for the help! +Jozsef +=20 + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Tom Lane +Sent: Friday, June 30, 2006 1:44 AM +To: Josh Berkus +Cc: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] FWD: Update touches unrelated indexes?=20 + +Josh Berkus forwards: +> I hope someone can explain what I'm seeing on our system. I've got a +> table with about four million rows in it (see schema below). Almost +> every column has one or two indexes. What I've found is that when I +> issue an update statement to zero out the content of a particular +> column, the pg_locks table indicates that every other, seemingly +> unrelated index is locked/changed. + +This surprises you why? + +> I expect the idx_test_table_col_27 index to have write locks during +this +> operation but seeing RowExclusiveLock entries on every other index +> puzzles me. Interestingly enough these locks are not present if the +> table is smaller. + +That last I don't believe at all --- PG updates every index on every row +update. Most likely the OP is just not querying pg_locks fast enough to +see the locks. If he's really concerned about update performance then +he probably needs to think harder about whether every one of those +indexes is really carrying its weight. + + regards, tom lane + +---------------------------(end of broadcast)--------------------------- +TIP 2: Don't 'kill -9' the postmaster + + +From pgsql-performance-owner@postgresql.org Fri Jun 30 13:31:12 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A2FB79FA2A9 + for ; + Fri, 30 Jun 2006 13:31:11 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 76623-07 for + ; + Fri, 30 Jun 2006 13:31:01 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from qm.sweetwater.com (qmail.sweetwater.com [66.242.228.12]) + by postgresql.org (Postfix) with ESMTP id 2ACC49FA0EC + for ; + Fri, 30 Jun 2006 13:30:58 -0300 (ADT) +Received: from [172.21.22.155] (helo=[172.21.22.155]) by [0.0.0.0] + with SMTP (QuickMail Pro Server for Mac 3.5.2 build 50328); + Fri, 30 Jun 2006 12:30:43 -0400 +Mime-Version: 1.0 (Apple Message framework v750) +In-Reply-To: <44A53532.50402@logix-tt.com> +References: + <44A53532.50402@logix-tt.com> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <80C3C5C3-5835-42F0-9F99-3AE87DBD1E37@sweetwater.com> +Content-Transfer-Encoding: 7bit +From: Joe Lester +Subject: Re: Index Being Ignored? +Date: Fri, 30 Jun 2006 12:32:07 -0400 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.750) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/500 +X-Sequence-Number: 19857 + +great! + +Thanks Markus and Tom! + +On Jun 30, 2006, at 10:29 AM, Markus Schaber wrote: + +> Hi, Joe, +> +> Joe Lester wrote: +>> Aggregate (cost=22695.28..22695.28 rows=1 width=0) (actual +>> time=2205.688..2205.724 rows=1 loops=1) +>> -> Seq Scan on purchase_order_items (cost=0.00..21978.08 +>> rows=286882 +>> width=0) (actual time=0.535..2184.405 rows=7458 loops=1) +>> Filter: (expected_quantity > 0) +> +> The query planner estimates that your filter will hit 286882 rows, +> while +> in reality it hits only 7458 rows. That's why the query planer +> chooses a +> sequential scan. +> +> It seems that the statistics for the column expected_quantity are off. +> +> My suggestions: +> +> - make shure that the statistics are current by analyzing the table +> appropriately (e. G. by using the autovacuum daemon from contrib). +> +> - increase the statistics target for this column. +> +> - if you run this query very often, an conditional index might make +> sense: +> +> CREATE INDEX purchase_order_having_quantity_idx ON +> purchase_order_items +> (expected_quantity) WHERE expected_quantity > 0; +> +> +> HTH, +> Markus +> +> -- +> Markus Schaber | Logical Tracking&Tracing International AG +> Dipl. Inf. | Software Development GIS +> +> Fight against software patents in EU! www.ffii.org +> www.nosoftwarepatents.org +> +> ---------------------------(end of +> broadcast)--------------------------- +> TIP 3: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq +> +> + + + +From pgsql-performance-owner@postgresql.org Fri Jun 30 14:28:04 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 42ACB9FA192 + for ; + Fri, 30 Jun 2006 14:28:04 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 84410-03 for + ; + Fri, 30 Jun 2006 14:27:53 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from alvh.no-ip.org (201-221-201-100.bk11-dsl.surnet.cl + [201.221.201.100]) + by postgresql.org (Postfix) with ESMTP id D78269FA0EC + for ; + Fri, 30 Jun 2006 14:27:52 -0300 (ADT) +Received: by alvh.no-ip.org (Postfix, from userid 1000) + id 8426CC22E96; Fri, 30 Jun 2006 13:27:49 -0400 (CLT) +Date: Fri, 30 Jun 2006 13:27:49 -0400 +From: Alvaro Herrera +To: Jozsef Szalay +Cc: Tom Lane , pgsql-performance@postgresql.org +Subject: Re: FWD: Update touches unrelated indexes? +Message-ID: <20060630172749.GA25181@surnet.cl> +Mail-Followup-To: Jozsef Szalay , + Tom Lane , pgsql-performance@postgresql.org +References: +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/501 +X-Sequence-Number: 19858 + +Jozsef Szalay wrote: + +> >he probably needs to think harder about whether every one of those +> >indexes is really carrying its weight. +> +> Unfortunately all of those indexes are required by the application. It +> appears that the only viable option I have is to drop the indexes and +> recreate them after the update. + +Not at all -- the option is just continue to operate normally after the +update, because all the indexes are always updated. If you see an index +not being updated, it's a bug and by all means report it, preferably +with a test case other people can reproduce. + +-- +Alvaro Herrera http://www.CommandPrompt.com/ +The PostgreSQL Company - Command Prompt, Inc. + +From pgadmin-support-owner@postgresql.org Fri Jun 30 14:58:44 2006 +X-Original-To: pgadmin-support-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DEC259FA2A9 + for ; + Fri, 30 Jun 2006 14:58:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 89766-02 for + ; + Fri, 30 Jun 2006 14:58:37 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 639F49FA192 + for ; + Fri, 30 Jun 2006 14:58:36 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id 5A2F056437; Fri, 30 Jun 2006 12:58:35 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Fri, 30 Jun 2006 12:58:35 -0500 +Date: Fri, 30 Jun 2006 12:58:35 -0500 +From: "Jim C. Nasby" +To: Peter Newman +Cc: pgsql-performance@postgresql.org +Subject: Re: 100% CPU +Message-ID: <20060630175834.GH17241@pervasive.com> +References: + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: + +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060630:pgadmin-support@postgresql.org::dCSWDFXjzWx1qFLa:0000000 + 0000000000000000000000000ftF +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200606/91 +X-Sequence-Number: 5573 + +moving to -performance + +On Fri, Jun 30, 2006 at 08:32:39AM +0100, Peter Newman wrote: +> Good Morning +> +> I am new to postgres and have been asked to look at a server where we +> truncate a table then load data. +> +> The CPU has started to hit 100% usage during this process. +> +> Can you please describe what steps I could take to investigate and solve +> this issue? +> So far all I have done is run a Vacuum Analyze command using PGAdmin +> III.....which appears to have made little difference. + +How many indexes do you have on the table? How exactly are you loading +the data? What hardware is this? What version of the database? +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 +