diff --git "a/pgsql-performance.200309" "b/pgsql-performance.200309" new file mode 100644--- /dev/null +++ "b/pgsql-performance.200309" @@ -0,0 +1,33678 @@ +From pgsql-performance-owner@postgresql.org Sun Aug 31 22:53:48 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP + id 2ACDAD1B93D; Mon, 1 Sep 2003 01:53:14 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) + with ESMTP id 85820-05; Sun, 31 Aug 2003 22:53:06 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP + id 0B0ACD1B8EF; Sun, 31 Aug 2003 22:53:03 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h811r2em092533; + Mon, 1 Sep 2003 01:53:02 GMT (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h811jeo8091508; + Mon, 1 Sep 2003 01:45:40 GMT +From: "F Brown" +X-Newsgroups: comp.databases.postgresql.patches, + comp.databases.postgresql.performance, + comp.databases.postgresql.ports, + comp.databases.postgresql.ports.cygwin +Subject: Mail Test +Lines: 11 +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +Message-ID: +Date: Mon, 01 Sep 2003 01:45:29 GMT +To: "pgsql-patches@postgresql.org.pgsql-performance"@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=1.3 tagged_above=0.0 required=5.0 + tests=PRIORITY_NO_NAME, RCVD_IN_OSIRUSOFT_COM +X-Spam-Level: * +X-Archive-Number: 200308/550 +X-Sequence-Number: 3366 + +------------ +------------ +------------ +------------ +------------ +fred.brown@maps.lss.bc.ca +wilf.tannenbaum@maps.lss.bc.ca +david.mathews@maps.lss.bc.ca + + + + +From pgsql-performance-owner@postgresql.org Mon Sep 1 09:12:05 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id BEACED1B8B3 + for ; + Mon, 1 Sep 2003 12:11:57 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 37020-02 + for ; + Mon, 1 Sep 2003 09:11:50 -0300 (ADT) +Received: from mailer.acaso.net (209.Red-213-97-17.pooles.rima-tde.net + [213.97.17.209]) + by svr1.postgresql.org (Postfix) with ESMTP id DE131D1B8AE + for ; + Mon, 1 Sep 2003 09:11:45 -0300 (ADT) +Received: from 6-allhosts (unknown [192.168.0.4]) + by mailer.acaso.net (Postfix) with ESMTP + id EFFD41015D; Mon, 1 Sep 2003 14:11:40 +0200 (CEST) +Subject: Re: SQL performance problems +From: Alberto Caso +To: Rhaoni Chiu Pereira +Cc: PostgreSQL Performance +In-Reply-To: <1062368198.1052.34.camel@localhost> +References: <1062190759.3f4fbea7aae8c@sistemica.info> + <1062368198.1052.34.camel@localhost> +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="=-YE2S/jCV08aArwkGM1gr" +Organization: Adaptia Soluciones Integrales +Message-Id: <1062418299.1052.246.camel@localhost> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Mon, 01 Sep 2003 14:11:40 +0200 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/1 +X-Sequence-Number: 3367 + +--=-YE2S/jCV08aArwkGM1gr +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +On Mon, 01-09-2003 at 13:42, Rhaoni Chiu Pereira wrote:=20 +> I've done that but it didn't make much difference. +> Do you know some documentation on explain ? I don't understand the result= +s.. +>=20 + +http://developer.postgresql.org/docs/postgres/sql-explain.html +http://developer.postgresql.org/docs/postgres/performance-tips.html + +Also this list's archives (which can be found at +http://archives.postgresql.org/pgsql-performance/ ) are a good source +of info on the subject. + +Best Regards, + +--=20 +Alberto Caso Palomino +Adaptia Soluciones Integrales +http://www.adaptia.net +alberto.caso@adaptia.net + + + +--=-YE2S/jCV08aArwkGM1gr +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada + digitalmente + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.2 (GNU/Linux) + +iD8DBQA/Uzd6/tUyzpgV/S0RAlvpAJ4m2ySz1sew8Kf3PBfzvKmBPtkOCACfbk3D +w1q7hJ2Sxe3G36/NkQjdpYY= +=abfm +-----END PGP SIGNATURE----- + +--=-YE2S/jCV08aArwkGM1gr-- + + +From pgsql-performance-owner@postgresql.org Mon Sep 1 12:23:05 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 919B3D1B8BD + for ; + Mon, 1 Sep 2003 15:23:03 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 49863-03 + for ; + Mon, 1 Sep 2003 12:22:52 -0300 (ADT) +Received: from lakemtao03.cox.net (lakemtao03.cox.net [68.1.17.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 5854DD1B8B4 + for ; + Mon, 1 Sep 2003 12:22:52 -0300 (ADT) +Received: from lhosts ([68.11.66.83]) by lakemtao03.cox.net + (InterMail vM.5.01.06.04 201-253-122-130-104-20030726) with ESMTP + id <20030901152249.WRRA10977.lakemtao03.cox.net@lhosts> + for ; + Mon, 1 Sep 2003 11:22:49 -0400 +Subject: Re: How to force Nested Loop plan? +From: Ron Johnson +To: PgSQL Performance ML +In-Reply-To: <29706.1062371570@sss.pgh.pa.us> +References: <16208.41885.960000.12706@gargle.gargle.HOWL> + <24637.1062255721@sss.pgh.pa.us> + <16208.50934.351000.90704@gargle.gargle.HOWL> + <2074.1062260382@sss.pgh.pa.us> + <16209.3105.94000.204936@gargle.gargle.HOWL> + <4040.1062281441@sss.pgh.pa.us> + <16209.15488.141000.729032@gargle.gargle.HOWL> + <29706.1062371570@sss.pgh.pa.us> +Content-Type: text/plain +Message-Id: <1062429767.7340.92.camel@haggis> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Mon, 01 Sep 2003 10:22:47 -0500 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/2 +X-Sequence-Number: 3368 + +On Sun, 2003-08-31 at 18:12, Tom Lane wrote: +> Rob Nagler writes: +> > Are there plans for explicit hints to the planner? +> +> Personally, I'm philosophically opposed to planner hints; see previous +> discussions in the archives. + +How about (if you don't already do it) ranked (or approximately +ranked) b-tree indexes, where each node also stores the (approximate) +count of tuple pointers under it? + +This way, the planner would know whether or how skewed a tree is, +and (approximately) how many tuples a given WHERE predicate resolves +to. + +-- +----------------------------------------------------------------- +Ron Johnson, Jr. ron.l.johnson@cox.net +Jefferson, LA USA + +"Fair is where you take your cows to be judged." +Unknown + + +From pgsql-performance-owner@postgresql.org Mon Sep 1 18:03:31 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id BDE4AD1B4F0 + for ; + Mon, 1 Sep 2003 21:03:28 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 78004-05 + for ; + Mon, 1 Sep 2003 18:03:20 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 9FCB4D1B8B2 + for ; + Mon, 1 Sep 2003 18:03:17 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h81L3IjX010676; + Mon, 1 Sep 2003 17:03:18 -0400 (EDT) +To: Ron Johnson +Cc: PgSQL Performance ML +Subject: Re: How to force Nested Loop plan? +In-reply-to: <1062429767.7340.92.camel@haggis> +References: <16208.41885.960000.12706@gargle.gargle.HOWL> + <24637.1062255721@sss.pgh.pa.us> + <16208.50934.351000.90704@gargle.gargle.HOWL> + <2074.1062260382@sss.pgh.pa.us> + <16209.3105.94000.204936@gargle.gargle.HOWL> + <4040.1062281441@sss.pgh.pa.us> + <16209.15488.141000.729032@gargle.gargle.HOWL> + <29706.1062371570@sss.pgh.pa.us> <1062429767.7340.92.camel@haggis> +Comments: In-reply-to Ron Johnson + message dated "Mon, 01 Sep 2003 10:22:47 -0500" +Date: Mon, 01 Sep 2003 17:03:17 -0400 +Message-ID: <10675.1062450197@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/3 +X-Sequence-Number: 3369 + +Ron Johnson writes: +> How about (if you don't already do it) ranked (or approximately +> ranked) b-tree indexes, where each node also stores the (approximate) +> count of tuple pointers under it? +> This way, the planner would know whether or how skewed a tree is, +> and (approximately) how many tuples a given WHERE predicate resolves +> to. + +Why is that better than our existing implementation of column statistics? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Sep 2 13:01:59 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id D7C5DD1B53A + for ; + Tue, 2 Sep 2003 16:01:57 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 76875-06 + for ; + Tue, 2 Sep 2003 13:01:27 -0300 (ADT) +Received: from lorax.kciLink.com (lorax.kciLink.com [206.112.95.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 063B1D1B8A9 + for ; + Tue, 2 Sep 2003 13:01:27 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id 01C953ECA + for ; + Tue, 2 Sep 2003 12:01:27 -0400 (EDT) +Received: from lorax.kciLink.com ([127.0.0.1]) + by localhost (lorax.kciLink.com [127.0.0.1]) (amavisd-new, port 10024) + with SMTP id 72262-01 for ; + Tue, 2 Sep 2003 12:01:16 -0400 (EDT) +Received: from lorax.kciLink.com (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id 73B713EC4 + for ; + Tue, 2 Sep 2003 12:01:16 -0400 (EDT) +Received: (from news@localhost) + by lorax.kciLink.com (8.12.8p1/8.12.8/Submit) id h82G1GHc056157 + for pgsql-performance@postgresql.org; + Tue, 2 Sep 2003 12:01:16 -0400 (EDT) +To: pgsql-performance@postgresql.org +Path: not-for-mail +From: Vivek Khera +Newsgroups: ml.postgres.performance +Subject: Re: Hardware recommendations to scale to silly load +Date: Tue, 02 Sep 2003 12:01:16 -0400 +Organization: Khera Communications, Inc., Rockville, MD +Lines: 32 +Message-ID: +References: <1061953146.18108.291.camel@haggis> + <3F4E5DA9.6396.5C8916@localhost> + <20030829140503.GA19388@libertyrms.info> +NNTP-Posting-Host: yertle.kcilink.com +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Trace: lorax.kciLink.com 1062518476 55279 216.194.193.105 (2 Sep 2003 + 16:01:16 GMT) +X-Complaints-To: daemon@kciLink.com +NNTP-Posting-Date: Tue, 2 Sep 2003 16:01:16 +0000 (UTC) +User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Portable Code, + berkeley-unix) +Cancel-Lock: sha1:TAOnzxFs7fZr5XIPt/lpX/VZU2w= +X-Virus-Scanned: by amavisd-new at kciLink.com +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/4 +X-Sequence-Number: 3370 + +>>>>> "AS" == Andrew Sullivan writes: + +AS> On Fri, Aug 29, 2003 at 12:05:03AM -0700, William Yu wrote: +>> We should see a boost when we move to 64-bit Linux and hopefully another +>> one when NUMA for Linux is production-stable. + +AS> According to the people who've worked with SGIs, NUMA actually seems +AS> to make things worse. It has something to do with how the shared +AS> memory is handled. You'll want to dig through the -general or +AS> -hackers archives from somewhere between 9 and 14 months ago, IIRC. + +I knew my PhD research would one day be good for *something* ... + +The basic premise of NUMA is that you can isolate which data belongs +to which processor and put that on memory pages that are local/closer +to it. In practice, this is harder than it sounds as it requires very +detailed knowledge of the application's data access patterns, and how +memory is allocated by the OS and standard libraries. Often you end +up with pages that have data that should be local to two different +processors, and that data keeps being migrated (if your NUMA OS +supports page migration) between the two processors or one of them +just gets slow access. + +I can't imagine it benefiting postgres given its globally shared +buffers. + + +-- +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Vivek Khera, Ph.D. Khera Communications, Inc. +Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 +AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ + +From pgsql-performance-owner@postgresql.org Tue Sep 2 13:09:00 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A6882D1B53A + for ; + Tue, 2 Sep 2003 16:08:57 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 79262-01 + for ; + Tue, 2 Sep 2003 13:08:27 -0300 (ADT) +Received: from lorax.kciLink.com (lorax.kciLink.com [206.112.95.1]) + by svr1.postgresql.org (Postfix) with ESMTP id B0381D1B52C + for ; + Tue, 2 Sep 2003 13:08:26 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id B832F3E3D + for ; + Tue, 2 Sep 2003 12:08:26 -0400 (EDT) +Received: from lorax.kciLink.com ([127.0.0.1]) + by localhost (lorax.kciLink.com [127.0.0.1]) (amavisd-new, port 10024) + with SMTP id 72262-03 for ; + Tue, 2 Sep 2003 12:08:16 -0400 (EDT) +Received: from lorax.kciLink.com (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id 454AA3E3B + for ; + Tue, 2 Sep 2003 12:08:16 -0400 (EDT) +Received: (from news@localhost) + by lorax.kciLink.com (8.12.8p1/8.12.8/Submit) id h82G8G2Z064997 + for pgsql-performance@postgresql.org; + Tue, 2 Sep 2003 12:08:16 -0400 (EDT) +To: pgsql-performance@postgresql.org +Path: not-for-mail +From: Vivek Khera +Newsgroups: ml.postgres.performance +Subject: Re: Hardware recommendations to scale to silly load +Date: Tue, 02 Sep 2003 12:08:15 -0400 +Organization: Khera Communications, Inc., Rockville, MD +Lines: 26 +Message-ID: +References: +NNTP-Posting-Host: yertle.kcilink.com +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Trace: lorax.kciLink.com 1062518896 55279 216.194.193.105 (2 Sep 2003 + 16:08:16 GMT) +X-Complaints-To: daemon@kciLink.com +NNTP-Posting-Date: Tue, 2 Sep 2003 16:08:16 +0000 (UTC) +User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Portable Code, + berkeley-unix) +Cancel-Lock: sha1:eIaNbryKH4oNpzHoyNnr/8aCP3U= +X-Virus-Scanned: by amavisd-new at kciLink.com +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/5 +X-Sequence-Number: 3371 + +>>>>> "MC" == Matt Clark writes: + +MC> And concurrency is very high, because it's a web app, and each +MC> httpd has one connection to PG, and there can be hundreds of +MC> active httpd processes. Some kind of connection pooling scheme +MC> might be in order when there are that many active clients. Any + +One thing you really should do (don't know if you already do it...) is +have your web split into a front-end proxy and a back-end application +server. There are lots of docs on how to do this for mod_perl, but it +can apply to just about any backend technology that is pooling the +connections. + +With a setup like this, my front-end web server typically has about +100 to 150 connections, and the backend doing the dynamic work (and +accessing the database) has peaked at 60 or so. Usually the backend +numbers at about 25. + +The front-end small processes get to deal with your dialup customers +trickling down the data since it buffers your backend for you. + +-- +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Vivek Khera, Ph.D. Khera Communications, Inc. +Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 +AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ + +From pgsql-performance-owner@postgresql.org Tue Sep 2 13:14:47 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 1AA22D1B8B2 + for ; + Tue, 2 Sep 2003 16:14:46 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 77726-06 + for ; + Tue, 2 Sep 2003 13:14:35 -0300 (ADT) +Received: from mail.libertyrms.com (unknown [209.167.124.227]) + by svr1.postgresql.org (Postfix) with ESMTP id F3CD2D1B52C + for ; + Tue, 2 Sep 2003 13:14:34 -0300 (ADT) +Received: from [10.1.2.130] (helo=dba2) + by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) + id 19uDnf-0001wR-00 + for ; Tue, 02 Sep 2003 12:14:35 -0400 +Received: by dba2 (Postfix, from userid 1019) + id EE549D0B6; Tue, 2 Sep 2003 12:14:34 -0400 (EDT) +Date: Tue, 2 Sep 2003 12:14:34 -0400 +From: Andrew Sullivan +To: pgsql-performance@postgresql.org +Subject: Re: opinion on RAID choice +Message-ID: <20030902161434.GI27530@libertyrms.info> +Mail-Followup-To: Andrew Sullivan , + pgsql-performance@postgresql.org +References: <20030828211641.22C1921792@yertle.kcilink.com> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +User-Agent: Mutt/1.5.4i +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/6 +X-Sequence-Number: 3372 + +On Thu, Aug 28, 2003 at 03:26:14PM -0600, scott.marlowe wrote: +> +> My experience has been that once you get past 6 disks, RAID5 is faster +> than RAID1+0. + +Also depends on your filesystem and volume manager. As near as I can +tell, you do _not_ want to use RAID 5 with Veritas. + +A + +-- +---- +Andrew Sullivan 204-4141 Yonge Street +Liberty RMS Toronto, Ontario Canada + M2P 2A8 + +1 416 646 3304 x110 + + +From pgsql-performance-owner@postgresql.org Tue Sep 2 13:24:33 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id D4674D1B8C0 + for ; + Tue, 2 Sep 2003 16:24:31 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 79877-04 + for ; + Tue, 2 Sep 2003 13:24:21 -0300 (ADT) +Received: from lerami.lerctr.org (lerami.lerctr.org [207.158.72.11]) + by svr1.postgresql.org (Postfix) with ESMTP id A2F64D1B8B1 + for ; + Tue, 2 Sep 2003 13:24:20 -0300 (ADT) +Received: from lerlaptop.iadfw.net (lerlaptop.iadfw.net [206.66.13.21]) + (authenticated bits=0) + by lerami.lerctr.org (8.12.9/8.12.9/20030515) with ESMTP id + h82GOGGK013352; Tue, 2 Sep 2003 11:24:17 -0500 (CDT) +Date: Tue, 02 Sep 2003 11:24:16 -0500 +From: Larry Rosenman +To: Andrew Sullivan , pgsql-performance@postgresql.org +Subject: Re: opinion on RAID choice +Message-ID: <143620000.1062519856@lerlaptop.iadfw.net> +In-Reply-To: <20030902161434.GI27530@libertyrms.info> +References: <20030828211641.22C1921792@yertle.kcilink.com> + + <20030902161434.GI27530@libertyrms.info> +X-Mailer: Mulberry/3.1.0b6 (Linux/x86) +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +X-Virus-Scanned: by amavisd-milter (http://amavis.org/) +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/7 +X-Sequence-Number: 3373 + + + +--On Tuesday, September 02, 2003 12:14:34 -0400 Andrew Sullivan + wrote: + +> On Thu, Aug 28, 2003 at 03:26:14PM -0600, scott.marlowe wrote: +>> +>> My experience has been that once you get past 6 disks, RAID5 is faster +>> than RAID1+0. +> +> Also depends on your filesystem and volume manager. As near as I can +> tell, you do _not_ want to use RAID 5 with Veritas. +Out of curiosity, why? + +I have Veritas Doc up (since UnixWare has it) at: + +http://www.lerctr.org:8458/en/Navpages/FShome.html + +if anyone wants to read. + +LER + +> +> A + + + +-- +Larry Rosenman http://www.lerctr.org/~ler +Phone: +1 972-414-9812 E-Mail: ler@lerctr.org +US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749 + + +From pgsql-performance-owner@postgresql.org Tue Sep 2 13:34:17 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 59C33D1B52C + for ; + Tue, 2 Sep 2003 16:34:17 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 77875-07 + for ; + Tue, 2 Sep 2003 13:33:46 -0300 (ADT) +Received: from lakemtao02.cox.net (lakemtao02.cox.net [68.1.17.243]) + by svr1.postgresql.org (Postfix) with ESMTP id 386D1D1B574 + for ; + Tue, 2 Sep 2003 13:33:45 -0300 (ADT) +Received: from lhosts ([68.11.66.83]) by lakemtao02.cox.net + (InterMail vM.5.01.06.04 201-253-122-130-104-20030726) with ESMTP + id <20030902163345.TCFB11854.lakemtao02.cox.net@lhosts> + for ; + Tue, 2 Sep 2003 12:33:45 -0400 +Subject: Re: opinion on RAID choice +From: Ron Johnson +To: PgSQL Performance ML +In-Reply-To: <20030902161434.GI27530@libertyrms.info> +References: <20030828211641.22C1921792@yertle.kcilink.com> + + <20030902161434.GI27530@libertyrms.info> +Content-Type: text/plain +Message-Id: <1062520424.7340.218.camel@haggis> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Tue, 02 Sep 2003 11:33:44 -0500 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/8 +X-Sequence-Number: 3374 + +On Tue, 2003-09-02 at 11:14, Andrew Sullivan wrote: +> On Thu, Aug 28, 2003 at 03:26:14PM -0600, scott.marlowe wrote: +> > +> > My experience has been that once you get past 6 disks, RAID5 is faster +> > than RAID1+0. +> +> Also depends on your filesystem and volume manager. As near as I can +> tell, you do _not_ want to use RAID 5 with Veritas. + +Why should Veritas care? Or is it that Veritas has a high overhead +of small block writes? + +-- +----------------------------------------------------------------- +Ron Johnson, Jr. ron.l.johnson@cox.net +Jefferson, LA USA + +"Millions of Chinese speak Chinese, and it's not hereditary..." +Dr. Dean Edell + + +From pgsql-performance-owner@postgresql.org Tue Sep 2 13:36:42 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 56623D1B8B2 + for ; + Tue, 2 Sep 2003 16:36:40 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 77530-08 + for ; + Tue, 2 Sep 2003 13:36:30 -0300 (ADT) +Received: from mail.libertyrms.com (unknown [209.167.124.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 3FC55D1B52C + for ; + Tue, 2 Sep 2003 13:36:29 -0300 (ADT) +Received: from [10.1.2.130] (helo=dba2) + by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) + id 19uE8r-0002JO-00 + for ; Tue, 02 Sep 2003 12:36:29 -0400 +Received: by dba2 (Postfix, from userid 1019) + id 35DD7D0B6; Tue, 2 Sep 2003 12:36:29 -0400 (EDT) +Date: Tue, 2 Sep 2003 12:36:29 -0400 +From: Andrew Sullivan +To: pgsql-performance@postgresql.org +Subject: Re: opinion on RAID choice +Message-ID: <20030902163629.GJ27530@libertyrms.info> +Mail-Followup-To: Andrew Sullivan , + pgsql-performance@postgresql.org +References: <20030828211641.22C1921792@yertle.kcilink.com> + + <20030902161434.GI27530@libertyrms.info> + <143620000.1062519856@lerlaptop.iadfw.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <143620000.1062519856@lerlaptop.iadfw.net> +User-Agent: Mutt/1.5.4i +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/9 +X-Sequence-Number: 3375 + +On Tue, Sep 02, 2003 at 11:24:16AM -0500, Larry Rosenman wrote: +> >tell, you do _not_ want to use RAID 5 with Veritas. +> Out of curiosity, why? + +What I keep hearing through various back channels is that, if you pay +folks from Veritas to look at your installation, and they see RAID 5, +they suggest you move it to 1+0. I haven't any idea why. It could +be just a matter of preference; it could be prejudice; it could be +baseless faith in the inefficiency of RAID5; it could be they have +stock in a drive company; or it could be they know about some strange +bug that they haven't an idea how to fix. Nobody's ever been +able/willing to tell me. + +A + +---- +Andrew Sullivan 204-4141 Yonge Street +Liberty RMS Toronto, Ontario Canada + M2P 2A8 + +1 416 646 3304 x110 + + +From pgsql-performance-owner@postgresql.org Tue Sep 2 13:47:53 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 08A48D1B8D6 + for ; + Tue, 2 Sep 2003 16:47:53 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 81004-02 + for ; + Tue, 2 Sep 2003 13:47:43 -0300 (ADT) +Received: from colsweeper.cranel.com (newmail.cranel.com [12.32.71.147]) + by svr1.postgresql.org (Postfix) with ESMTP id E49DED1B53A + for ; + Tue, 2 Sep 2003 13:47:41 -0300 (ADT) +Received: from colmail01.cranel.com (colmail01.cranel.com) by + colsweeper.cranel.com + (Content Technologies SMTPRS 4.2.5) with ESMTP id + for + ; Tue, 2 Sep 2003 12:50:16 -0400 +Received: from cranel.com (192.168.11.134 [192.168.11.134]) by + colmail01.cranel.com with SMTP (Microsoft Exchange Internet + Mail Service Version 5.5.2653.13) + id SDYSTBNA; Tue, 2 Sep 2003 12:50:11 -0400 +Message-ID: <3F54C99E.6030605@cranel.com> +Date: Tue, 02 Sep 2003 12:47:26 -0400 +From: Greg Spiegelberg +Organization: Cranel, Inc. +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020408 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: PgSQL Performance ML +Subject: Re: opinion on RAID choice +References: <20030828211641.22C1921792@yertle.kcilink.com> + + <20030902161434.GI27530@libertyrms.info> + <1062520424.7340.218.camel@haggis> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/10 +X-Sequence-Number: 3376 + +Ron Johnson wrote: +> On Tue, 2003-09-02 at 11:14, Andrew Sullivan wrote: +> +>>On Thu, Aug 28, 2003 at 03:26:14PM -0600, scott.marlowe wrote: +>> +>>>My experience has been that once you get past 6 disks, RAID5 is faster +>>>than RAID1+0. +>> +>>Also depends on your filesystem and volume manager. As near as I can +>>tell, you do _not_ want to use RAID 5 with Veritas. +> +> +> Why should Veritas care? Or is it that Veritas has a high overhead +> of small block writes? +> + + +I agree with Scott however only when it's hardware RAID 5 and only +certain hardware implementations of it. A Sun A1000 RAID 5 is not +equal to a Sun T3. Putting disk technologies aside, the A1000 array +XOR function is in software whereas the T3 is implemented in hardware. +Additionally, most external hardware based RAID systems have some +form of battery backup to ensure all data is written. + +Veritas Volume Manager and even Linux, HP-UX and AIX LVM works just +fine when slicing & dicing but not for stitching LUN's together. IMHO, +if you have the $$ for VxVM buy a hardware based RAID solution as well +and let it do the work. + +Greg + +-- +Greg Spiegelberg + Sr. Product Development Engineer + Cranel, Incorporated. + Phone: 614.318.4314 + Fax: 614.431.8388 + Email: gspiegelberg@Cranel.com +Cranel. Technology. Integrity. Focus. + + + +From pgsql-performance-owner@postgresql.org Tue Sep 2 14:33:00 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E04C7D1B8D0 + for ; + Tue, 2 Sep 2003 17:32:58 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 80187-07 + for ; + Tue, 2 Sep 2003 14:32:48 -0300 (ADT) +Received: from smtp.istop.com (dci.doncaster.on.ca [66.11.168.194]) + by svr1.postgresql.org (Postfix) with ESMTP id B974AD1B89A + for ; + Tue, 2 Sep 2003 14:32:47 -0300 (ADT) +Received: from stark.dyndns.tv (gsstark.mtl.istop.com [66.11.160.162]) + by smtp.istop.com (Postfix) with ESMTP + id 07BA836AA1; Tue, 2 Sep 2003 13:32:44 -0400 (EDT) +Received: from localhost ([127.0.0.1] helo=stark.dyndns.tv ident=foobar) + by stark.dyndns.tv with smtp (Exim 3.36 #1 (Debian)) + id 19uF1F-0001BZ-00; Tue, 02 Sep 2003 13:32:41 -0400 +To: Vivek Khera +Cc: pgsql-performance@postgresql.org +Subject: Re: Hardware recommendations to scale to silly load +References: + +In-Reply-To: +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 02 Sep 2003 13:32:41 -0400 +Message-ID: <871xuzf64m.fsf@stark.dyndns.tv> +Lines: 29 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/11 +X-Sequence-Number: 3377 + + +Vivek Khera writes: + +> The front-end small processes get to deal with your dialup customers +> trickling down the data since it buffers your backend for you. + +Huh. Well, I used to think this. But I think I was wrong. I used to have +apache proxy servers running in front of the mod_perl apache servers. The +proxy servers handled image and static html requests, and proxied any dynamic +content to the mod_perl servers. + +In fact most web pages are only a few kilobytes, and you can easily configure +the kernel buffers on the sockets to be 32kb or more. So the proxies would +only come into play when there was a really large dynamic document, something +that should probably never happen on a high volume web site anyways. + +I think the main source of the benefit people see from this setup is the +static content. For that you get a bigger kick out of separating the static +content onto entirely separate servers, preferably something slim like thttpd +and just exposing the mod_perl/php/whatever servers directly. + +The one thing I worry about exposing the dynamic servers directly is +susceptibility to dos or ddos attacks. Since all someone has to do to tie up +your precious heavyweight apache slot is make a connection, one machine could +easily tie up your whole web site. That would be a bit harder if you had +hundreds of slots available. Of course even so it's not hard. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Tue Sep 2 14:33:21 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 25F10D1B8D0 + for ; + Tue, 2 Sep 2003 17:33:20 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 83728-05 + for ; + Tue, 2 Sep 2003 14:33:10 -0300 (ADT) +Received: from lakemtao04.cox.net (lakemtao04.cox.net [68.1.17.241]) + by svr1.postgresql.org (Postfix) with ESMTP id 1813ED1B550 + for ; + Tue, 2 Sep 2003 14:33:09 -0300 (ADT) +Received: from lhosts ([68.11.66.83]) by lakemtao04.cox.net + (InterMail vM.5.01.06.04 201-253-122-130-104-20030726) with ESMTP + id <20030902173310.RDPA419.lakemtao04.cox.net@lhosts> + for ; + Tue, 2 Sep 2003 13:33:10 -0400 +Subject: Re: opinion on RAID choice +From: Ron Johnson +To: PgSQL Performance ML +In-Reply-To: <3F54C99E.6030605@cranel.com> +References: <20030828211641.22C1921792@yertle.kcilink.com> + + <20030902161434.GI27530@libertyrms.info> + <1062520424.7340.218.camel@haggis> <3F54C99E.6030605@cranel.com> +Content-Type: text/plain +Message-Id: <1062523986.7342.224.camel@haggis> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Tue, 02 Sep 2003 12:33:06 -0500 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/12 +X-Sequence-Number: 3378 + +On Tue, 2003-09-02 at 11:47, Greg Spiegelberg wrote: +> Ron Johnson wrote: +> > On Tue, 2003-09-02 at 11:14, Andrew Sullivan wrote: +> > +> >>On Thu, Aug 28, 2003 at 03:26:14PM -0600, scott.marlowe wrote: +> >> +> >>>My experience has been that once you get past 6 disks, RAID5 is faster +> >>>than RAID1+0. +> >> +> >>Also depends on your filesystem and volume manager. As near as I can +> >>tell, you do _not_ want to use RAID 5 with Veritas. +> > +> > +> > Why should Veritas care? Or is it that Veritas has a high overhead +> > of small block writes? +> > +> +> +> I agree with Scott however only when it's hardware RAID 5 and only +> certain hardware implementations of it. A Sun A1000 RAID 5 is not +> equal to a Sun T3. Putting disk technologies aside, the A1000 array +> XOR function is in software whereas the T3 is implemented in hardware. +> Additionally, most external hardware based RAID systems have some +> form of battery backup to ensure all data is written. +> +> Veritas Volume Manager and even Linux, HP-UX and AIX LVM works just +> fine when slicing & dicing but not for stitching LUN's together. IMHO, +> if you have the $$ for VxVM buy a hardware based RAID solution as well +> and let it do the work. + +Ah, shows how isolated, or behind the times, I am. I thought that +Veritas just handled backups. Never cared about looking at it to +do anything, else we always use h/w RAID storage controllers. + +-- +----------------------------------------------------------------- +Ron Johnson, Jr. ron.l.johnson@cox.net +Jefferson, LA USA + +After listening to many White House, Pentagon & CENTCOM +briefings in both Gulf Wars, it is my firm belief that most +"senior correspondents" either have serious agendas that don't +get shaken by facts, or are dumb as dog feces. + + +From pgsql-performance-owner@postgresql.org Tue Sep 2 14:45:30 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C5C04D1B8A4 + for ; + Tue, 2 Sep 2003 17:45:29 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 87190-02 + for ; + Tue, 2 Sep 2003 14:45:20 -0300 (ADT) +Received: from lakemtao04.cox.net (lakemtao04.cox.net [68.1.17.241]) + by svr1.postgresql.org (Postfix) with ESMTP id D4A51D1B53A + for ; + Tue, 2 Sep 2003 14:45:18 -0300 (ADT) +Received: from lhosts ([68.11.66.83]) by lakemtao04.cox.net + (InterMail vM.5.01.06.04 201-253-122-130-104-20030726) with ESMTP + id <20030902174520.RHVJ419.lakemtao04.cox.net@lhosts> + for ; + Tue, 2 Sep 2003 13:45:20 -0400 +Subject: Re: Hardware recommendations to scale to silly load +From: Ron Johnson +To: PgSQL Performance ML +In-Reply-To: +References: <1061953146.18108.291.camel@haggis> + <3F4E5DA9.6396.5C8916@localhost> + <20030829140503.GA19388@libertyrms.info> + +Content-Type: text/plain +Message-Id: <1062524718.7341.235.camel@haggis> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Tue, 02 Sep 2003 12:45:19 -0500 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/13 +X-Sequence-Number: 3379 + +On Tue, 2003-09-02 at 11:01, Vivek Khera wrote: +> >>>>> "AS" == Andrew Sullivan writes: +> +> AS> On Fri, Aug 29, 2003 at 12:05:03AM -0700, William Yu wrote: +> >> We should see a boost when we move to 64-bit Linux and hopefully another +> >> one when NUMA for Linux is production-stable. +> +> AS> According to the people who've worked with SGIs, NUMA actually seems +> AS> to make things worse. It has something to do with how the shared +> AS> memory is handled. You'll want to dig through the -general or +> AS> -hackers archives from somewhere between 9 and 14 months ago, IIRC. +> +> I knew my PhD research would one day be good for *something* ... +> +> The basic premise of NUMA is that you can isolate which data belongs +> to which processor and put that on memory pages that are local/closer +> to it. In practice, this is harder than it sounds as it requires very +> detailed knowledge of the application's data access patterns, and how +> memory is allocated by the OS and standard libraries. Often you end +> up with pages that have data that should be local to two different +> processors, and that data keeps being migrated (if your NUMA OS +> supports page migration) between the two processors or one of them +> just gets slow access. +> +> I can't imagine it benefiting postgres given its globally shared +> buffers. + +Opteron is supposed to have screaming fast inter-CPU memory xfer +(HyperTransport does inter-CPU as well as well as CPU-RAM transport). + +That's supposed to help with scaling, and PostgreSQL really may take +advantage of that, with, say 16-32 processors? + +-- +----------------------------------------------------------------- +Ron Johnson, Jr. ron.l.johnson@cox.net +Jefferson, LA USA + +"Knowledge should be free for all." +Harcourt Fenton Mudd, Star Trek:TOS, "I, Mudd" + + +From pgsql-performance-owner@postgresql.org Tue Sep 2 14:51:05 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 663EDD1B8BA + for ; + Tue, 2 Sep 2003 17:51:04 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 87924-02 + for ; + Tue, 2 Sep 2003 14:50:33 -0300 (ADT) +Received: from postal.ellacoya.com (postalmail.ellacoya.com [64.223.136.42]) + by svr1.postgresql.org (Postfix) with ESMTP id 9EDA6D1B550 + for ; + Tue, 2 Sep 2003 14:50:31 -0300 (ADT) +Received: by postal.ellacoya.com with Internet Mail Service (5.5.2656.59) + id ; Tue, 2 Sep 2003 13:50:14 -0400 +Message-ID: +From: "Zaremba, Don" +To: pgsql-performance@postgresql.org +Subject: Use of to_timestamp causes full scan +Date: Tue, 2 Sep 2003 13:50:14 -0400 +MIME-Version: 1.0 +X-Mailer: Internet Mail Service (5.5.2656.59) +Content-Type: text/plain; + charset="iso-8859-1" +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=1.6 tagged_above=0.0 required=5.0 tests=RCVD_IN_NJABL, + X_NJABL_OPEN_PROXY +X-Spam-Level: * +X-Archive-Number: 200309/14 +X-Sequence-Number: 3380 + + +Has anyone seen any performace problems with the use to to_timestamp? + +When I use it in a where clause I get a full file scan, when I don't it +uses the index +for the query. The begin_time column is of type timestamp. + +This does a full sequential scan + select id from details where begin_time > to_timestamp('03/08/25 +18:30'); + + +This uses the index + select id from details where begin_time > '03/08/25 18:30'; + +Don + + +From pgsql-performance-owner@postgresql.org Tue Sep 2 15:07:14 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 4D60AD1B8BA + for ; + Tue, 2 Sep 2003 18:07:13 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 86965-07 + for ; + Tue, 2 Sep 2003 15:07:03 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 6930BD1B53A + for ; + Tue, 2 Sep 2003 15:07:02 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h82I6ujX023507; + Tue, 2 Sep 2003 14:06:56 -0400 (EDT) +To: "Zaremba, Don" +Cc: pgsql-performance@postgresql.org +Subject: Re: Use of to_timestamp causes full scan +In-reply-to: +References: +Comments: In-reply-to "Zaremba, Don" + message dated "Tue, 02 Sep 2003 13:50:14 -0400" +Date: Tue, 02 Sep 2003 14:06:56 -0400 +Message-ID: <23506.1062526016@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/15 +X-Sequence-Number: 3381 + +"Zaremba, Don" writes: +> This does a full sequential scan +> select id from details where begin_time > to_timestamp('03/08/25 +> 18:30'); + +to_timestamp('foo') is not a constant, so the planner doesn't know how +much of the table this is going to select. In the absence of that +knowledge, its default guess favors a seqscan. + +> This uses the index +> select id from details where begin_time > '03/08/25 18:30'; + +Here the planner can consult pg_stats to get a pretty good idea how +much of the table will be scanned; if the percentage is small enough +it will pick an indexscan. + +There are various ways to deal with this --- one thing you might +consider is making a wrapper function for to_timestamp that is +marked "immutable", so that it will be constant-folded on sight. +That has potential gotchas if you want to put the query in a function +though. Another tack is to make the query into a range query: + where begin_time > ... AND begin_time < 'infinity'; +See the archives for more discussion. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Sep 3 10:10:55 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 7C431D1B8B3 + for ; + Wed, 3 Sep 2003 13:09:26 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 97409-05 + for ; + Wed, 3 Sep 2003 10:08:58 -0300 (ADT) +Received: from web40401.mail.yahoo.com (web40401.mail.yahoo.com + [66.218.78.98]) + by svr1.postgresql.org (Postfix) with SMTP id 1437ED1B89A + for ; + Wed, 3 Sep 2003 10:08:54 -0300 (ADT) +Message-ID: <20030903130857.5986.qmail@web40401.mail.yahoo.com> +Received: from [219.95.23.81] by web40401.mail.yahoo.com via HTTP; + Wed, 03 Sep 2003 06:08:57 PDT +Date: Wed, 3 Sep 2003 06:08:57 -0700 (PDT) +From: Azlin Ghazali +Subject: PostgreSQL is slow...HELP +To: pgsql-performance@postgresql.org +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/16 +X-Sequence-Number: 3382 + +Hi, + +I'm working on a project to make an application run on MySQL and PostgreSQL. +I find that PostgreSQL runs up to 10 times slower than MySQL. For small records +it is not much problems. But as the records grew (up to 12,000 records) the +difference is quite significant. We are talking about 15s (MySQL) vs 111s +(PostgreSQL). Someone suggest that my way of implementing PostgreSQL is not +efficient and someone out there might be able to help. + +FYI, I running the application on ASP, XP Professional and Pentium 4 machine. + +Below is the exact statement I used: + + strSQL = "CREATE TABLE temp1 SELECT accposd.item,items.name,Sum(accposd.qty) +as Quantity " & _ + ",accposd.loose,AVG(accposd.price) as price, Sum(accposd.amount) as +sum_amount " & _ + ",Sum(accposd.cost) as sum_cost FROM " & _ + "accposd left join items on accposd.item = items.fcc " & _ + "where accposd.date between '" & varStartDate & "' AND '" & +varStopDate & "'" & _ + " GROUP by accposd.item,items.name,accposd.loose ORDER by items.name" + +Below is the information about the fields: + +CREATE TABLE accposd ( + fcc double precision default NULL, + date date default NULL, + recvbch double precision default NULL, + type int default NULL, + item double precision default NULL, + qty double precision default NULL, + price double precision default NULL, + amount double precision default NULL, + discamt double precision default NULL, + cost double precision default NULL, + loose varchar(10) default NULL, + discflg varchar(10) default NULL, + hour smallint default NULL, + min smallint default NULL, + sec smallint default NULL, + who varchar(50) default NULL, + promoter varchar(50) default NULL, + userID double precision default '0', + batchno double precision default '0' +); + + +CREATE TABLE items ( + fcc serial, + code varchar(20) default NULL, + name varchar(40) default NULL, + description varchar(255) default NULL, + barcode varchar(15) default NULL, + brand varchar(30) default NULL, + sub_category double precision default NULL, + schedule char(1) default NULL, + price double precision default NULL, + lprice double precision default NULL, + avgcost double precision default NULL, + gname varchar(40) default NULL, + strength varchar(10) default NULL, + packsize double precision default NULL, + whspack varchar(15) default NULL, + packing varchar(10) default NULL, + lowstock double precision default NULL, + lstockls double precision default NULL, + orderqty double precision default NULL, + creation date default NULL, + shelfno varchar(8) default NULL, + status char(1) default NULL, + q_cust double precision default NULL, + ql_cust double precision default NULL, + qoh double precision default NULL, + qohl double precision default NULL, + poison double precision default NULL, + candisc double precision default NULL, + maxdisc double precision default NULL, + chkdate date default NULL, + chkby varchar(5) default NULL, + isstock double precision default NULL, + wprice double precision default '0', + wlprice double precision default '0', + PRIMARY KEY (fcc) +); + + +I appreciate your advice. Thank you. + +Regards, +AZLIN. + +__________________________________ +Do you Yahoo!? +Yahoo! SiteBuilder - Free, easy-to-use web site design software +http://sitebuilder.yahoo.com + +From pgsql-performance-owner@postgresql.org Wed Sep 3 10:15:32 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 10FF8D1B8B1 + for ; + Wed, 3 Sep 2003 13:15:24 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 98791-05 + for ; + Wed, 3 Sep 2003 10:14:55 -0300 (ADT) +Received: from mail.libertyrms.com (unknown [209.167.124.227]) + by svr1.postgresql.org (Postfix) with ESMTP id E02A2D1B53A + for ; + Wed, 3 Sep 2003 10:14:51 -0300 (ADT) +Received: from [10.1.2.130] (helo=dba2) + by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) + id 19uXTM-0003kj-00 + for ; Wed, 03 Sep 2003 09:14:56 -0400 +Received: by dba2 (Postfix, from userid 1019) + id C035FD0B8; Wed, 3 Sep 2003 09:14:55 -0400 (EDT) +Date: Wed, 3 Sep 2003 09:14:55 -0400 +From: Andrew Sullivan +To: pgsql-performance@postgresql.org +Subject: Re: PostgreSQL is slow...HELP +Message-ID: <20030903131455.GA30812@libertyrms.info> +Mail-Followup-To: Andrew Sullivan , + pgsql-performance@postgresql.org +References: <20030903130857.5986.qmail@web40401.mail.yahoo.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20030903130857.5986.qmail@web40401.mail.yahoo.com> +User-Agent: Mutt/1.5.4i +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/17 +X-Sequence-Number: 3383 + +On Wed, Sep 03, 2003 at 06:08:57AM -0700, Azlin Ghazali wrote: +> I find that PostgreSQL runs up to 10 times slower than MySQL. For small records + +Have you done any tuning on PostgreSQL? Have you vacuumed, &c.? All +the usual questions. + +A + +-- +---- +Andrew Sullivan 204-4141 Yonge Street +Liberty RMS Toronto, Ontario Canada + M2P 2A8 + +1 416 646 3304 x110 + + +From pgsql-performance-owner@postgresql.org Wed Sep 3 11:00:24 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 60617D1B56B + for ; + Wed, 3 Sep 2003 14:00:01 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 98490-08 + for ; + Wed, 3 Sep 2003 10:59:33 -0300 (ADT) +Received: from mail.iinet.net.au (mail-04.iinet.net.au [203.59.3.36]) + by svr1.postgresql.org (Postfix) with SMTP id 9A4F2D1B8BA + for ; + Wed, 3 Sep 2003 10:59:28 -0300 (ADT) +Received: (qmail 5530 invoked from network); 3 Sep 2003 13:59:26 -0000 +Received: from unknown (HELO postgresql.org) (203.59.116.51) + by mail.iinet.net.au with SMTP; 3 Sep 2003 13:59:26 -0000 +Message-ID: <3F55F3A8.9030202@postgresql.org> +Date: Wed, 03 Sep 2003 21:59:04 +0800 +From: Justin Clift +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; + rv:1.4) Gecko/20030624 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Cc: Jenny Zhang +Subject: " ... though the pgsql version performance is not very great." +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/18 +X-Sequence-Number: 3384 + +Hi everyone, + +Saw this earlier on today, on the mailing list of the Open Source +Development Labs people who are porting their database testing suite +from SAP to PostgreSQL. + +The comment near the end by Jenny Zhang (one of the porters), saying +that "I will put a tar ball on SourceForge today, though the pgsql +version performance is not very great." doesn't sound very nifty. + +Personally, I don't have the time to analyse why the performance isn't +very good and take it forward, so I'm mentioning it here as a heads up +in case someone want's something useful to sink their teeth into. + +:-) + +Regards and best wishes, + +Justin Clift + + +-------- Original Message -------- +Subject: Re: [osdldbt-general] DBT1 and dynamic cache +Date: 02 Sep 2003 09:46:29 -0700 +From: Jenny Zhang +To: Wenguang.Wang@usask.ca +CC: osdldbt-general@lists.sourceforge.net +References: <200309021543.h82Fh0o26886@mail.osdl.org> + +Mark is right. DBT1 is designed to be run in several modes: +dbdriver + database: each user opens a database connection, and all the +transaction go to the database + +dbdriver + cache + database: each user opens a database connection, +three transactions (bestsellers, newprodicts, and search results by +subject) go to the cache, the others go to the database + +dbdriver + transaction manager + database: each user opens a connection +to the transaction manager, which manages the transaction queue and +database connection. All the transaction go to the database. + +dbdriver + transaction manager + database + cache: each user opens a +connection to the transaction manager, which manages the transaction +queue and database connection. Three transactions (bestsellers, +newprodicts, and search results by subject) go to the cache, the others +go to the database + +The pgsql version is available at bk://developer.osdl.org/dbt1. + +I will put a tar ball on SourceForge today, though the pgsql version +performance is not very great. + +Jenny +On Tue, 2003-09-02 at 08:42, markw@osdl.org wrote: +> We do have something that simulates some of the caching effects of web +> servers. It's under the 'cache' directory. If I remember correctly, it +> doesn't have to be used, but we do have it working. +> +> Mark +> +> On 31 Aug, Wenguang Wang wrote: +> > Hi, dbt1 designers and developers, +> > +> > I like the idea of eliminating the web servers in dbt1 to focus on the +> > performance of DBMS. However, I have a question about whether the +> > current dbt1 can really represent e-commerce workloads. +> > +> > TPC-W encourages the use of web caches to reduce the load on DBMS. Since +> > web caches are not used in dbt1, all cachable queries have to be +> > procesed by the DBMS in dbt1. This could increase the load to the +> > backend DBMS by several times at least. These queries make dbt1 more +> > like a TPC-H throughput test instead of an e-commerce test. Is this +> > design of dbt1 intentional or is it planned to be fixed later? +> > +> > Thanks. +> > +> +> +> +> ------------------------------------------------------- +> This sf.net email is sponsored by:ThinkGeek +> Welcome to geek heaven. +> http://thinkgeek.com/sf +> _______________________________________________ +> osdldbt-general mailing list +> osdldbt-general@lists.sourceforge.net +> https://lists.sourceforge.net/lists/listinfo/osdldbt-general + + + + +------------------------------------------------------- +This sf.net email is sponsored by:ThinkGeek +Welcome to geek heaven. +http://thinkgeek.com/sf +_______________________________________________ +osdldbt-general mailing list +osdldbt-general@lists.sourceforge.net +https://lists.sourceforge.net/lists/listinfo/osdldbt-general + + + +From pgsql-performance-owner@postgresql.org Wed Sep 3 11:12:28 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 92EF0D1B8B0 + for ; + Wed, 3 Sep 2003 14:12:26 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 01108-09 + for ; + Wed, 3 Sep 2003 11:11:59 -0300 (ADT) +Received: from shire.ontko.com (shire.ontko.com [199.164.165.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 24F75D1B8B1 + for ; + Wed, 3 Sep 2003 11:11:55 -0300 (ADT) +Received: from nick (bilbo.ontko.com [199.164.165.101]) + by shire.ontko.com (8.12.3/8.12.3/Debian-6.4) with SMTP id + h83EBv0Q004920; Wed, 3 Sep 2003 09:11:59 -0500 +Reply-To: +From: "Nick Fankhauser" +To: "Azlin Ghazali" , + +Subject: Re: PostgreSQL is slow...HELP +Date: Wed, 3 Sep 2003 09:10:59 -0500 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) +In-Reply-To: <20030903130857.5986.qmail@web40401.mail.yahoo.com> +Importance: Normal +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/19 +X-Sequence-Number: 3385 + + +> For small records +> it is not much problems. But as the records grew (up to 12,000 +> records) the +> difference is quite significant. + +Although there are many tuning options, I'd suggest starting by making sure +you have an index (unique in cases where appropriate) on accposd.date +accposd.item, items.name, accposd.loose and items.name. Then do an +"analyze;" on the DB to make sure the database takes advantage of the +indexes where appropriate. + +If this doesn't help, there are other options to pursue, but this is where I +would start. + +-Nick + + + +From pgsql-performance-owner@postgresql.org Wed Sep 3 12:40:14 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A6CAD1BA56 + for ; + Wed, 3 Sep 2003 14:36:40 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 07831-08 + for ; + Wed, 3 Sep 2003 11:36:33 -0300 (ADT) +Received: from smtp.pspl.co.in (unknown [202.54.11.65]) + by svr1.postgresql.org (Postfix) with ESMTP id E0100D1B991 + for ; + Wed, 3 Sep 2003 11:36:28 -0300 (ADT) +Received: (from root@localhost) + by smtp.pspl.co.in (8.12.9/8.12.9) id h83Egmk1017269 + for ; Wed, 3 Sep 2003 20:12:48 +0530 +Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) + (authenticated bits=0) + by persistent.co.in (8.12.9/8.12.9) with ESMTP id h83EglCO017244 + for ; Wed, 3 Sep 2003 20:12:47 +0530 +From: "Shridhar Daithankar" +To: pgsql-performance@postgresql.org +Date: Wed, 03 Sep 2003 20:08:32 +0530 +MIME-Version: 1.0 +Subject: Re: PostgreSQL is slow...HELP +Reply-To: shridhar_daithankar@persistent.co.in +Message-ID: <3F564A40.3974.6561CEC@localhost> +In-reply-to: <20030903130857.5986.qmail@web40401.mail.yahoo.com> +X-mailer: Pegasus Mail for Windows (v4.12a) +Content-type: text/plain; charset=US-ASCII +Content-transfer-encoding: 7BIT +Content-description: Mail message body +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/21 +X-Sequence-Number: 3387 + +On 3 Sep 2003 at 6:08, Azlin Ghazali wrote: + +> Hi, +> +> I'm working on a project to make an application run on MySQL and PostgreSQL. +> I find that PostgreSQL runs up to 10 times slower than MySQL. For small records +> it is not much problems. But as the records grew (up to 12,000 records) the +> difference is quite significant. We are talking about 15s (MySQL) vs 111s +> (PostgreSQL). Someone suggest that my way of implementing PostgreSQL is not +> efficient and someone out there might be able to help. +> +> FYI, I running the application on ASP, XP Professional and Pentium 4 machine. + +Are you running postgresql on windows? That's not an performance monster +exactly? Is it under cygwin? + +BTW, did you do any performance tuning to postgresql? + +HTH + +Bye + Shridhar + +-- +Vulcans do not approve of violence. -- Spock, "Journey to Babel", stardate +3842.4 + + +From pgsql-performance-owner@postgresql.org Wed Sep 3 12:15:57 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 55B2CD1B52C + for ; + Wed, 3 Sep 2003 14:39:42 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 08440-01 + for ; + Wed, 3 Sep 2003 11:39:35 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 5FBFAD1BA5E + for ; + Wed, 3 Sep 2003 11:39:31 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h83EdZjX014503; + Wed, 3 Sep 2003 10:39:35 -0400 (EDT) +To: Azlin Ghazali +Cc: pgsql-performance@postgresql.org +Subject: Re: PostgreSQL is slow...HELP +In-reply-to: <20030903130857.5986.qmail@web40401.mail.yahoo.com> +References: <20030903130857.5986.qmail@web40401.mail.yahoo.com> +Comments: In-reply-to Azlin Ghazali + message dated "Wed, 03 Sep 2003 06:08:57 -0700" +Date: Wed, 03 Sep 2003 10:39:35 -0400 +Message-ID: <14502.1062599975@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/20 +X-Sequence-Number: 3386 + +Azlin Ghazali writes: +> Below is the exact statement I used: + +That's not very informative. Could we see the results of EXPLAIN ANALYZE +on that SELECT? Also, what PG version are you running? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Sep 3 13:15:13 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 340C2D1BAAA + for ; + Wed, 3 Sep 2003 15:48:49 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 16068-05 + for ; + Wed, 3 Sep 2003 12:48:35 -0300 (ADT) +Received: from lorax.kciLink.com (lorax.kciLink.com [206.112.95.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 8324CD1BA09 + for ; + Wed, 3 Sep 2003 12:48:33 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id 613143E24 + for ; + Wed, 3 Sep 2003 11:48:33 -0400 (EDT) +Received: from lorax.kciLink.com ([127.0.0.1]) + by localhost (lorax.kciLink.com [127.0.0.1]) (amavisd-new, port 10024) + with SMTP id 24678-01 for ; + Wed, 3 Sep 2003 11:48:23 -0400 (EDT) +Received: from lorax.kciLink.com (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id DC8E73E1F + for ; + Wed, 3 Sep 2003 11:48:22 -0400 (EDT) +Received: (from news@localhost) + by lorax.kciLink.com (8.12.8p1/8.12.8/Submit) id h83FmMvY046137 + for pgsql-performance@postgresql.org; + Wed, 3 Sep 2003 11:48:22 -0400 (EDT) +To: pgsql-performance@postgresql.org +Path: not-for-mail +From: Vivek Khera +Newsgroups: ml.postgres.performance +Subject: FreeBSD page size (was Re: The results of my PostgreSQL/filesystem + performance tests) +Date: Wed, 03 Sep 2003 11:48:22 -0400 +Organization: Khera Communications, Inc., Rockville, MD +Lines: 22 +Message-ID: +References: <3F4C0DC4.8070105@potentialtech.com> + <001201c36d24$3c572460$0500a8c0@MOBILE01> + + <20030828161233.GB83759@perrin.nxad.com> + <3F4E54FB.3020408@potentialtech.com> + <20030828193123.GI83317@perrin.nxad.com> +NNTP-Posting-Host: yertle.kcilink.com +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Trace: lorax.kciLink.com 1062604102 13347 216.194.193.105 (3 Sep 2003 + 15:48:22 GMT) +X-Complaints-To: daemon@kciLink.com +NNTP-Posting-Date: Wed, 3 Sep 2003 15:48:22 +0000 (UTC) +User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Portable Code, + berkeley-unix) +Cancel-Lock: sha1:PBraxAGE5Tg4Vw32V6hU7iA6YXE= +X-Virus-Scanned: by amavisd-new at kciLink.com +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/22 +X-Sequence-Number: 3388 + +>>>>> "SC" == Sean Chittenden writes: + +>> I need to step in and do 2 things: +SC> Thanks for posting that. Let me know if you have any questions while +SC> doing your testing. I've found that using 16K blocks on FreeBSD +SC> results in about an 8% speedup in writes to the database, fwiw. + +Just double checking: if I do this, then I need to halve the +parameters in postgresql.conf that involve buffers, specifically, +max_fsm_pages and shared_buffers. I think max_fsm_pages should be +adjusted since the number of pages in the system overall has been +halved. + +Anything else that should be re-tuned for this? + +My tests are still running so I don't have numbers yet. + +-- +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Vivek Khera, Ph.D. Khera Communications, Inc. +Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 +AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ + +From pgsql-admin-owner@postgresql.org Wed Sep 3 16:17:01 2003 +X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP + id 1E5CFD1B8C0; Wed, 3 Sep 2003 19:16:59 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) + with ESMTP id 33066-07; Wed, 3 Sep 2003 16:16:28 -0300 (ADT) +Received: from host2.hostseguro.com (unknown [200.198.188.133]) + by svr1.postgresql.org (Postfix) with ESMTP + id B9D50D1B89D; Wed, 3 Sep 2003 16:16:25 -0300 (ADT) +Received: from cpanel by host2.hostseguro.com with local (Exim 4.20) + id 19ud6k-000816-Dr; Wed, 03 Sep 2003 16:15:58 -0300 +Received: from 200.203.32.16 ([200.203.32.16]) + by sistemica.info (IMP) with HTTP + for ; Wed, 3 Sep 2003 16:15:58 -0300 +Message-ID: <1062616558.3f563dee5ccd4@sistemica.info> +Date: Wed, 3 Sep 2003 16:15:58 -0300 +From: Rhaoni Chiu Pereira +To: PostgreSQL Performance , + Lista PostgreSQL +Subject: SQL slower when running for the second time +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.2.1 +X-Originating-IP: 200.203.32.16 +X-MailScanner-Information: Verificado pelo McAfee VirusScan / Scanned by + McAfee VirusScan +X-MailScanner: Nao infectado / Found to be clean +X-AntiAbuse: This header was added to track abuse, + please include it with any abuse report +X-AntiAbuse: Primary Hostname - host2.hostseguro.com +X-AntiAbuse: Original Domain - postgresql.org +X-AntiAbuse: Originator/Caller UID/GID - [32001 32001] / [47 12] +X-AntiAbuse: Sender Address Domain - sistemica.info +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/39 +X-Sequence-Number: 10127 + +Hi List, + + I trying to increase performance in my PostgreSQL but there is something +wrong. when I run this SQL for the first time it takes 1 min. 40 seconds to +return, but when I run it for the second time it takes more than 2 minutes, and +I should retunr faster than the first time. + +Does anyone have a advice ? + +Atenciosamente, + +Rhaoni Chiu Pereira +Sist�mica Computadores + +Visite-nos na Web: http://sistemica.info +Fone/Fax : +55 51 3328 1122 + + + + + + +From pgsql-performance-owner@postgresql.org Wed Sep 3 16:17:20 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B643ED1B8B0 + for ; + Wed, 3 Sep 2003 19:17:16 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 33723-06 + for ; + Wed, 3 Sep 2003 16:16:47 -0300 (ADT) +Received: from lorax.kciLink.com (lorax.kciLink.com [206.112.95.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 79AD4D1B8BB + for ; + Wed, 3 Sep 2003 16:16:45 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id 95E503E1F + for ; + Wed, 3 Sep 2003 15:16:41 -0400 (EDT) +Received: from lorax.kciLink.com ([127.0.0.1]) + by localhost (lorax.kciLink.com [127.0.0.1]) (amavisd-new, port 10024) + with SMTP id 04094-09 for ; + Wed, 3 Sep 2003 15:16:31 -0400 (EDT) +Received: from lorax.kciLink.com (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id E43B13E0F + for ; + Wed, 3 Sep 2003 15:16:30 -0400 (EDT) +Received: (from news@localhost) + by lorax.kciLink.com (8.12.8p1/8.12.8/Submit) id h83JGUwo043830 + for pgsql-performance@postgresql.org; + Wed, 3 Sep 2003 15:16:30 -0400 (EDT) +To: pgsql-performance@postgresql.org +Path: not-for-mail +From: Vivek Khera +Newsgroups: ml.postgres.performance +Subject: Re: FreeBSD page size +Date: Wed, 03 Sep 2003 15:16:30 -0400 +Organization: Khera Communications, Inc., Rockville, MD +Lines: 89 +Message-ID: +References: <3F4C0DC4.8070105@potentialtech.com> + <001201c36d24$3c572460$0500a8c0@MOBILE01> + + <20030828161233.GB83759@perrin.nxad.com> + <3F4E54FB.3020408@potentialtech.com> + <20030828193123.GI83317@perrin.nxad.com> + +NNTP-Posting-Host: yertle.kcilink.com +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Trace: lorax.kciLink.com 1062616590 42707 216.194.193.105 (3 Sep 2003 + 19:16:30 GMT) +X-Complaints-To: daemon@kciLink.com +NNTP-Posting-Date: Wed, 3 Sep 2003 19:16:30 +0000 (UTC) +User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Portable Code, + berkeley-unix) +Cancel-Lock: sha1:G6d1P/Zod/EcLIYLHTj6s013ors= +X-Virus-Scanned: by amavisd-new at kciLink.com +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/24 +X-Sequence-Number: 3390 + +Ok... simple tests have completed. Here are some numbers. + +FreeBSD 4.8 +PG 7.4b2 +4GB Ram +Dual Xeon 2.4GHz processors +14 U320 SCSI disks attached to Dell PERC3/DC RAID controller in RAID 5 + config with 32k stripe size + +Dump file: +-rw-r--r-- 1 vivek wheel 1646633745 Aug 28 11:01 19-Aug-2003.dump + +When restored (after deleting one index that took up ~1Gb -- turned +out it was redundant to another multi-column index): + +% df -k /u/d02 +Filesystem 1K-blocks Used Avail Capacity Mounted on +/dev/amrd1s1e 226408360 18067260 190228432 9% /u/d02 + + + +postgresql.conf alterations from standard: +shared_buffers = 60000 +sort_mem = 8192 +vacuum_mem=131702 +max_fsm_pages=1000000 +effective_cache_size=25600 +random_page-cost = 2 + + +restore time: 14777 seconds +vacuum analyze time: 30 minutes +select count(*) from user_list where owner_id=315; 50388.64 ms + + +the restore complained often about checkpoints occurring every few +seconds: + +Sep 2 11:57:14 d02 postgres[49721]: [5-1] LOG: checkpoints are occurring too frequently (15 seconds apart) +Sep 2 11:57:14 d02 postgres[49721]: [5-2] HINT: Consider increasing CHECKPOINT_SEGMENTS. + +The HINT threw me off since I had to set checkpoint_segments in +postgresql.conf, where as CHECKPOINT_SEGMENTS implied to me a +compile-time constant. + +Anyhow, so I deleted the PG data directory, and made these two +changes: + +checkpoint_segments=50 +sort_mem = 131702 + +This *really* improved the time for the restore: + +restore time: 11594 seconds + +then I reset the checkpoint_segments and sort_mem back to old +values... + +vacuum analyze time is still 30 minutes +select count(*) from user_list where owner_id=315; 51363.98 ms + +so the select appears a bit slower but it is hard to say why. the +system is otherwise idle as it is not in production yet. + + +Then I took the suggestion to update PG's page size to 16k and did the +same increase on sort_mem and checkpoint_segments as above. I also +halved the shared_buffers and max_fsm_pages (probably should have +halved the effective_cache_size too...) + +restore time: 11322 seconds +vacuum analyze time: 27 minutes +select count(*) from user_list where owner_id=315; 48267.66 ms + + +Granted, given this simple test it is hard to say whether the 16k +blocks will make an improvement under live load, but I'm gonna give it +a shot. The 16k block size shows me roughly 2-6% improvement on these +tests. + +So throw in my vote for 16k blocks on FreeBSD (and annotate the docs +to tell which parameters need to be halved to account for it). + + +-- +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Vivek Khera, Ph.D. Khera Communications, Inc. +Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 +AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ + +From pgsql-performance-owner@postgresql.org Wed Sep 3 16:33:17 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 39170D1B4E2 + for ; + Wed, 3 Sep 2003 19:33:15 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 35578-07 + for ; + Wed, 3 Sep 2003 16:32:44 -0300 (ADT) +Received: from tnt.isi.edu (tnt.isi.edu [128.9.128.128]) + by svr1.postgresql.org (Postfix) with ESMTP id A0061D1B8C0 + for ; + Wed, 3 Sep 2003 16:32:42 -0300 (ADT) +Received: from usc1mk75s5t1b6 (calypso.isi.edu [128.9.72.28]) + by tnt.isi.edu (8.11.6p2/8.11.2) with SMTP id h83JWhp28829 + for ; + Wed, 3 Sep 2003 12:32:43 -0700 (PDT) +Message-ID: <001a01c37252$24f69390$8000000a@usc1mk75s5t1b6> +From: "Naveen Palavalli" +To: +Subject: Query on Postgresql performance +Date: Wed, 3 Sep 2003 12:32:42 -0700 +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_NextPart_000_0017_01C37217.7878C1E0" +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 6.00.2800.1158 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=0.6 tagged_above=0.0 required=5.0 tests=BAYES_30, + HTML_20_30 +X-Spam-Level: +X-Archive-Number: 200309/25 +X-Sequence-Number: 3391 + +This is a multi-part message in MIME format. + +------=_NextPart_000_0017_01C37217.7878C1E0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + +Hi , + +I am currently using Postgresql for a Research project . I observed some pe= +rformance results of Postgresql which I would like to discuss . + +I have a server which accepts requests from clients. It spawns a new thread= + for each client. The clients are trying to add entries to a relation in P= +ostgresql database . The server ( a C/C++ program running on Linux ) access= +es Postgresql using psqlodbc . +My server spawns a new connection to Postgresql foreach client. My postgres= +ql.conf has the following additional settings . I am also running Postmaste= +r with "-o -F" option . + +tcpip_socket =3D true +max_connections =3D 100 +shared_buffers =3D 200 +vacuum_mem =3D 16384 + +My clients are adding strings of length approximately 20 bytes . The databa= +se size is 1 Million entries . + +I observed the following results :- + +1) Effects related to Vaccum :- I performed 10 trials of adding and deletin= +g entries . In each trial , 1 client adds 10,000 entries and then deletes = +them . During the course of these 10 trials , the Add Rates (rate at which= + my server can add entries to the Postgresql database ) drops from around = +200 Adds/second in the 1st trial to around 100 Adds/second in the 10th tri= +al . But when I do a Vaccuum , Immediately I get back the Add Rates to aro= +und 200 Adds/Second .=20 + This effect is more pronounced if there are more than 1 client. As the = +number of clients increases , the Add Rate drops more steeply requiring me = +to perform Vaccum more frequently between the trials . So if I draw a graph= + of the Add Rates in the Y- Axis and the number of Add Operations in the X-= +axis , I get a saw toothed graph . + +2) In the second Experiment , I had a multi threaded client . In the sense = +, it spawns threads as specified by a command line argument . The server in= + turn spawns new connections for each Thread of each client ( even the numb= +er of client increases) .=20 +I fixed the number of threads per client at 4 . and I increased the number = +of clients from 1 to 10 . I observed :- + + a) As the number of clients are increased , the Add Rate decreases from= + around 200 Adds/ Second for 1 client to around 130 Adds/Second for 10 clie= +nts . + b) suppose I run a trial with 3 clients and 4 threads per client . and = +I get a Add Rate of 180 Adds/Second the first time .This Add Rate decrease= +s the scond time I repeat the same trial with everything being the same .= +=20 + During each trial , each thread of each client adds 3000 entries an= +d deletes them and I perform vaccuum after each trial . + + +Postgresql version :- 7.2.4 +Psqlodbc version :- 7.03.0100 + +I was using Postgresql 7.3.3 earlier but it kept crashing the database afte= +r a Vaccum . So I switched to a older and stabler version 7.2.4 + +Any comments on these observations will be very welcome . Additional detail= +s will be provided if needed . + +Thanking you in Advance, +Naveen. +=20=20=20=20=20=20=20=20 + +------=_NextPart_000_0017_01C37217.7878C1E0 +Content-Type: text/html; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + + + + + + + + +
Hi ,
+
 
+
I am currently using Postgresql for a Rese= +arch=20 +project . I observed some performance results of Postgresql which I would l= +ike=20 +to discuss .
+
 
+
I have a server which accepts requests fro= +m=20 +clients. It spawns a new thread for each client. The clients are trying to = +add=20 +entries  to a relation in Postgresql database . The server ( a C/C++= +=20 +program running on Linux ) accesses Postgresql using psqlodbc=20 +.
+
My server spawns a new connection to Postg= +resql=20 +foreach client. My postgresql.conf has the following additional settings . = +I am=20 +also running Postmaster with "-o -F" option .
+
 
+
tcpip_socket =3D true
max_connections = +=3D=20 +100
shared_buffers =3D 200
vacuum_mem =3D 16384
+
My clients are adding strings of length=20 +approximately 20 bytes . The database size is 1 Million entries . +
= + 
+
I observed the following results :-= +
+
 
+
1) Effects related to Vaccum :- I performe= +d 10=20 +trials of adding and deleting entries . In each trial , 1 client  = +;adds=20 +10,000 entries and then deletes them . During the course of these 10 t= +rials=20 +,  the Add Rates (rate at which my server can add entries to the Postg= +resql=20 +database ) drops from  around 200 Adds/second in the 1st trial  t= +o=20 +around 100 Adds/second in the 10th trial . But when I do a Vaccuum , Immedi= +ately=20 +I get back the Add Rates to  around 200 Adds/Second .
+
    This effect is more pro= +nounced=20 +if there are more than 1 client. As the number of clients increases , the A= +dd=20 +Rate drops more steeply requiring me to perform Vaccum more frequently betw= +een=20 +the trials . So if I draw a graph of the Add Rates in the Y- Axis and the n= +umber=20 +of Add Operations in the X-axis , I get a saw toothed graph .
+
 
+
2) In the second Experiment , I had a mult= +i=20 +threaded client . In the sense , it spawns threads as specified by a comman= +d=20 +line argument . The server in turn spawns new connections for each Thread o= +f=20 +each client ( even the number of client increases) .
+
I fixed the number of threads per client a= +t 4 . and=20 +I increased the number of clients from 1 to 10 .  I observed=20 +:-
+
 
+
    a) As the number of cli= +ents are=20 +increased , the Add Rate decreases from around 200 Adds/ Second for 1 clien= +t to=20 +around 130 Adds/Second for 10 clients .
+
    b) suppose I run a tria= +l with 3=20 +clients and 4 threads per client . and I get a Add Rate of 180 Adds/Second = +the=20 +first  time .This Add Rate decreases the scond time I repeat the same = +trial=20 +with everything being the same .
+
       = +During=20 +each trial , each thread of each client  adds 3000 entries and de= +letes=20 + them and I perform vaccuum after each trial .
+
 
+
 
+
Postgresql version    =20 +:-        7.2.4
+
Psqlodbc=20 +version       :-    = +   =20 +7.03.0100
+
 
+
I was using Postgresql 7.3.3 earlier but i= +t kept=20 +crashing the database after a Vaccum . So I switched to a older and stabler= +=20 +version  7.2.4
+
 
+
Any comments on these observations will be= + very=20 +welcome . Additional details will be provided if needed .
+
 
+
Thanking you in Advance,
+
Naveen.
+
        +
 
+ +------=_NextPart_000_0017_01C37217.7878C1E0-- + + +From pgsql-performance-owner@postgresql.org Wed Sep 3 16:36:38 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id CC014D1B8BC + for ; + Wed, 3 Sep 2003 19:36:37 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 36463-05 + for ; + Wed, 3 Sep 2003 16:36:08 -0300 (ADT) +Received: from perrin.nxad.com (internal.nxad.com [69.1.70.251]) + by svr1.postgresql.org (Postfix) with ESMTP id 483D6D1B8BD + for ; + Wed, 3 Sep 2003 16:36:06 -0300 (ADT) +Received: by perrin.nxad.com (Postfix, from userid 1001) + id E4A2F2105A; Wed, 3 Sep 2003 12:35:51 -0700 (PDT) +Date: Wed, 3 Sep 2003 12:35:51 -0700 +From: Sean Chittenden +To: Vivek Khera +Cc: pgsql-performance@postgresql.org +Subject: Re: FreeBSD page size +Message-ID: <20030903193551.GA72167@perrin.nxad.com> +References: <3F4C0DC4.8070105@potentialtech.com> + <001201c36d24$3c572460$0500a8c0@MOBILE01> + + <20030828161233.GB83759@perrin.nxad.com> + <3F4E54FB.3020408@potentialtech.com> + <20030828193123.GI83317@perrin.nxad.com> + + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +X-PGP-Key: finger seanc@FreeBSD.org +X-PGP-Fingerprint: 3849 3760 1AFE 7B17 11A0 83A6 DD99 E31F BC84 B341 +X-Web-Homepage: http://sean.chittenden.org/ +User-Agent: Mutt/1.5.4i +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/26 +X-Sequence-Number: 3392 + +> Ok... simple tests have completed. Here are some numbers. +> +> FreeBSD 4.8 +> PG 7.4b2 +> 4GB Ram +> Dual Xeon 2.4GHz processors +> 14 U320 SCSI disks attached to Dell PERC3/DC RAID controller in RAID 5 +> config with 32k stripe size +[snip] +> Then I took the suggestion to update PG's page size to 16k and did the +> same increase on sort_mem and checkpoint_segments as above. I also +> halved the shared_buffers and max_fsm_pages (probably should have +> halved the effective_cache_size too...) +> +> restore time: 11322 seconds +> vacuum analyze time: 27 minutes +> select count(*) from user_list where owner_id=315; 48267.66 ms +> +> +> Granted, given this simple test it is hard to say whether the 16k +> blocks will make an improvement under live load, but I'm gonna give it +> a shot. The 16k block size shows me roughly 2-6% improvement on these +> tests. +> +> So throw in my vote for 16k blocks on FreeBSD (and annotate the docs +> to tell which parameters need to be halved to account for it). + +I haven't had a chance to run any tests yet (ELIFE), but there was a +suggestion that 32K blocks was a better performer than 16K blocks +(!!??!!??). I'm not sure why this is and my only guess is that it +relies more heavily on the disk cache to ease IO. Since you have the +hardware setup, Vivek, would it be possible for you to run a test with +32K blocks? + +I've started writing a threaded benchmarking program called pg_crush +that I hope to post here in a few days that'll time connection startup +times, INSERTs, DELETEs, UPDATEs, and both sequential scans as well as +index scans for random and sequentially ordered tuples. It's similar +to pgbench, except it generates its own data, uses pthreads (chears on +KSE!), and returns more fine grained timing information for the +various activities. + +-sc + +-- +Sean Chittenden + +From pgsql-performance-owner@postgresql.org Wed Sep 3 16:41:38 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 1FCD1D1B89E + for ; + Wed, 3 Sep 2003 19:41:36 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 38764-02 + for ; + Wed, 3 Sep 2003 16:41:27 -0300 (ADT) +Received: from yertle.kcilink.com (yertle.kcilink.com [216.194.193.105]) + by svr1.postgresql.org (Postfix) with ESMTP id 5F105D1B89A + for ; + Wed, 3 Sep 2003 16:41:25 -0300 (ADT) +Received: by yertle.kcilink.com (Postfix, from userid 100) + id DA59F2178A; Wed, 3 Sep 2003 15:41:25 -0400 (EDT) +From: Vivek Khera +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +Message-ID: <16214.17381.783990.600532@yertle.int.kciLink.com> +Date: Wed, 3 Sep 2003 15:41:25 -0400 +To: pgsql-performance@postgresql.org +Subject: Re: FreeBSD page size +In-Reply-To: <20030903193551.GA72167@perrin.nxad.com> +References: <3F4C0DC4.8070105@potentialtech.com> + <001201c36d24$3c572460$0500a8c0@MOBILE01> + + <20030828161233.GB83759@perrin.nxad.com> + <3F4E54FB.3020408@potentialtech.com> + <20030828193123.GI83317@perrin.nxad.com> + + + <20030903193551.GA72167@perrin.nxad.com> +X-Mailer: VM 7.14 under 21.4 (patch 12) "Portable Code" XEmacs Lucid +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/27 +X-Sequence-Number: 3393 + +>>>>> "SC" == Sean Chittenden writes: + +SC> hardware setup, Vivek, would it be possible for you to run a test with +SC> 32K blocks? + +Will do. What's another 4 hours... ;-) + +I guess I'll halve the buffer size parameters again... + +SC> I've started writing a threaded benchmarking program called pg_crush +SC> that I hope to post here in a few days that'll time connection startup + +Ok. Please post it when it is ready. I've decided to wait until 7.4 +is final before going to production so I've got this very expensive +very fast box doing not much of anything for a little while... + +From pgsql-admin-owner@postgresql.org Wed Sep 3 17:16:57 2003 +X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 5F1D8D1B8B4 + for ; + Wed, 3 Sep 2003 20:03:22 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 39389-05 + for ; + Wed, 3 Sep 2003 17:03:13 -0300 (ADT) +Received: from mail.gmx.net (pop.gmx.de [213.165.64.20]) + by svr1.postgresql.org (Postfix) with SMTP id DA963D1B97C + for ; Wed, 3 Sep 2003 17:03:10 -0300 (ADT) +Received: (qmail 20710 invoked by uid 65534); 3 Sep 2003 20:03:12 -0000 +Received: from dsl-082-082-165-215.arcor-ip.net (EHLO + dsl-082-082-165-215.arcor-ip.net) (82.82.165.215) + by mail.gmx.net (mp009) with SMTP; 03 Sep 2003 22:03:12 +0200 +Date: Wed, 3 Sep 2003 22:03:11 +0200 (CEST) +From: Peter Eisentraut +X-X-Sender: peter@peter.localdomain +To: Rhaoni Chiu Pereira +Cc: PostgreSQL Performance , + Lista PostgreSQL +Subject: Re: SQL slower when running for the second time +In-Reply-To: <1062616558.3f563dee5ccd4@sistemica.info> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/41 +X-Sequence-Number: 10129 + +Rhaoni Chiu Pereira writes: + +> I trying to increase performance in my PostgreSQL but there is something +> wrong. when I run this SQL for the first time + +Which SQL? + +> it takes 1 min. 40 seconds to +> return, but when I run it for the second time it takes more than 2 minutes, and +> I should retunr faster than the first time. + +What happens the third time? + +-- +Peter Eisentraut peter_e@gmx.net + + +From pgsql-performance-owner@postgresql.org Wed Sep 3 19:37:17 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 0DD62D1B8C6 + for ; + Wed, 3 Sep 2003 20:33:20 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 42821-06 + for ; + Wed, 3 Sep 2003 17:32:49 -0300 (ADT) +Received: from ganymede.hub.org (u173n10.eastlink.ca [24.224.173.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 9A78FD1B8C5 + for ; + Wed, 3 Sep 2003 17:32:47 -0300 (ADT) +Received: by ganymede.hub.org (Postfix, from userid 1000) + id 60BB8344B6; Wed, 3 Sep 2003 17:32:37 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by ganymede.hub.org (Postfix) with ESMTP + id 572BF34067; Wed, 3 Sep 2003 17:32:37 -0300 (ADT) +Date: Wed, 3 Sep 2003 17:32:37 -0300 (ADT) +From: "Marc G. Fournier" +To: Vivek Khera +Cc: pgsql-performance@postgresql.org +Subject: Re: FreeBSD page size +In-Reply-To: +Message-ID: <20030903173214.I803@ganymede.hub.org> +References: <3F4C0DC4.8070105@potentialtech.com> + <001201c36d24$3c572460$0500a8c0@MOBILE01> + + <20030828161233.GB83759@perrin.nxad.com> + <3F4E54FB.3020408@potentialtech.com> + <20030828193123.GI83317@perrin.nxad.com> + + +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/31 +X-Sequence-Number: 3397 + + + +Just curious, but Bruce(?) mentioned that apparently a 32k block size was +found to show a 15% improvement ... care to run one more test? :) + +On Wed, 3 Sep 2003, Vivek Khera wrote: + +> Ok... simple tests have completed. Here are some numbers. +> +> FreeBSD 4.8 +> PG 7.4b2 +> 4GB Ram +> Dual Xeon 2.4GHz processors +> 14 U320 SCSI disks attached to Dell PERC3/DC RAID controller in RAID 5 +> config with 32k stripe size +> +> Dump file: +> -rw-r--r-- 1 vivek wheel 1646633745 Aug 28 11:01 19-Aug-2003.dump +> +> When restored (after deleting one index that took up ~1Gb -- turned +> out it was redundant to another multi-column index): +> +> % df -k /u/d02 +> Filesystem 1K-blocks Used Avail Capacity Mounted on +> /dev/amrd1s1e 226408360 18067260 190228432 9% /u/d02 +> +> +> +> postgresql.conf alterations from standard: +> shared_buffers = 60000 +> sort_mem = 8192 +> vacuum_mem=131702 +> max_fsm_pages=1000000 +> effective_cache_size=25600 +> random_page-cost = 2 +> +> +> restore time: 14777 seconds +> vacuum analyze time: 30 minutes +> select count(*) from user_list where owner_id=315; 50388.64 ms +> +> +> the restore complained often about checkpoints occurring every few +> seconds: +> +> Sep 2 11:57:14 d02 postgres[49721]: [5-1] LOG: checkpoints are occurring too frequently (15 seconds apart) +> Sep 2 11:57:14 d02 postgres[49721]: [5-2] HINT: Consider increasing CHECKPOINT_SEGMENTS. +> +> The HINT threw me off since I had to set checkpoint_segments in +> postgresql.conf, where as CHECKPOINT_SEGMENTS implied to me a +> compile-time constant. +> +> Anyhow, so I deleted the PG data directory, and made these two +> changes: +> +> checkpoint_segments=50 +> sort_mem = 131702 +> +> This *really* improved the time for the restore: +> +> restore time: 11594 seconds +> +> then I reset the checkpoint_segments and sort_mem back to old +> values... +> +> vacuum analyze time is still 30 minutes +> select count(*) from user_list where owner_id=315; 51363.98 ms +> +> so the select appears a bit slower but it is hard to say why. the +> system is otherwise idle as it is not in production yet. +> +> +> Then I took the suggestion to update PG's page size to 16k and did the +> same increase on sort_mem and checkpoint_segments as above. I also +> halved the shared_buffers and max_fsm_pages (probably should have +> halved the effective_cache_size too...) +> +> restore time: 11322 seconds +> vacuum analyze time: 27 minutes +> select count(*) from user_list where owner_id=315; 48267.66 ms +> +> +> Granted, given this simple test it is hard to say whether the 16k +> blocks will make an improvement under live load, but I'm gonna give it +> a shot. The 16k block size shows me roughly 2-6% improvement on these +> tests. +> +> So throw in my vote for 16k blocks on FreeBSD (and annotate the docs +> to tell which parameters need to be halved to account for it). +> +> +> -- +> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +> Vivek Khera, Ph.D. Khera Communications, Inc. +> Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 +> AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: you can get off all lists at once with the unregister command +> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) +> + +From pgsql-performance-owner@postgresql.org Wed Sep 3 19:30:27 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 1C44FD1B8E3 + for ; + Wed, 3 Sep 2003 20:44:52 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 42262-10 + for ; + Wed, 3 Sep 2003 17:44:23 -0300 (ADT) +Received: from host2.hostseguro.com (unknown [200.198.188.133]) + by svr1.postgresql.org (Postfix) with ESMTP id 557A1D1B8BE + for ; + Wed, 3 Sep 2003 17:44:20 -0300 (ADT) +Received: from cpanel by host2.hostseguro.com with local (Exim 4.20) + id 19ueU8-0004Yn-4s; Wed, 03 Sep 2003 17:44:12 -0300 +Received: from 200.203.32.16 ([200.203.32.16]) + by sistemica.info (IMP) with HTTP + for ; Wed, 3 Sep 2003 17:44:12 -0300 +Message-ID: <1062621852.3f56529c186db@sistemica.info> +Date: Wed, 3 Sep 2003 17:44:12 -0300 +From: Rhaoni Chiu Pereira +To: creid +Cc: PostgreSQL Performance +Subject: Re: [ADMIN] SQL slower when running for the second time +References: +In-Reply-To: +MIME-Version: 1.0 +Content-Type: multipart/mixed; + boundary="-MOQ1062621852172764d69df60a690f4a054550b71562" +User-Agent: Internet Messaging Program (IMP) 3.2.1 +X-Originating-IP: 200.203.32.16 +X-MailScanner-Information: Verificado pelo McAfee VirusScan / Scanned by + McAfee VirusScan +X-MailScanner: Nao infectado / Found to be clean +X-AntiAbuse: This header was added to track abuse, + please include it with any abuse report +X-AntiAbuse: Primary Hostname - host2.hostseguro.com +X-AntiAbuse: Original Domain - postgresql.org +X-AntiAbuse: Originator/Caller UID/GID - [32001 32001] / [47 12] +X-AntiAbuse: Sender Address Domain - sistemica.info +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/30 +X-Sequence-Number: 3396 + +This message is in MIME format. + +---MOQ1062621852172764d69df60a690f4a054550b71562 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit + + +<> Version of PostgreSQL? + + 7.3.2-3 on RedHat 9 +<> +<> Standard server configuration? + + Follow atached + +<> Hardware configuration? + + P4 1.7 Ghz + 512 MB RAM DDR + HD 20 GB 7200 RPM + +<> -----Original Message----- +<> From: pgsql-admin-owner@postgresql.org +<> [mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Rhaoni Chiu +<> Pereira +<> Sent: Wednesday, September 03, 2003 3:16 PM +<> To: PostgreSQL Performance; Lista PostgreSQL +<> Subject: [ADMIN] SQL slower when running for the second time +<> +<> +<> Hi List, +<> +<> I trying to increase performance in my PostgreSQL but there is something +<> wrong. when I run this SQL for the first time it takes 1 min. 40 seconds +<> to +<> return, but when I run it for the second time it takes more than 2 minutes, +<> and +<> I should retunr faster than the first time. +<> +<> Does anyone have a advice ? +<> +<> Atenciosamente, +<> +<> Rhaoni Chiu Pereira +<> Sist�mica Computadores +<> +<> Visite-nos na Web: http://sistemica.info +<> Fone/Fax : +55 51 3328 1122 +<> +<> +<> +<> +<> +<> +<> ---------------------------(end of broadcast)--------------------------- +<> TIP 6: Have you searched our list archives? +<> +<> http://archives.postgresql.org +<> +<> + + +---MOQ1062621852172764d69df60a690f4a054550b71562 +Content-Type: application/octet-stream; name="postgresql.conf" +Content-Transfer-Encoding: base64 +Content-Disposition: attachment; filename="postgresql.conf" + +IwojIFBvc3RncmVTUUwgY29uZmlndXJhdGlvbiBmaWxlCiMgLS0tLS0tLS0t +LS0tLS0tLS0tLS0tLS0tLS0tLS0KIwojIFRoaXMgZmlsZSBjb25zaXN0cyBv +ZiBsaW5lcyBvZiB0aGUgZm9ybToKIwojICAgbmFtZSA9IHZhbHVlCiMKIyAo +VGhlICc9JyBpcyBvcHRpb25hbC4pIFdoaXRlIHNwYWNlIG1heSBiZSB1c2Vk +LiBDb21tZW50cyBhcmUgaW50cm9kdWNlZAojIHdpdGggJyMnIGFueXdoZXJl +IG9uIGEgbGluZS4gVGhlIGNvbXBsZXRlIGxpc3Qgb2Ygb3B0aW9uIG5hbWVz +IGFuZAojIGFsbG93ZWQgdmFsdWVzIGNhbiBiZSBmb3VuZCBpbiB0aGUgUG9z +dGdyZVNRTCBkb2N1bWVudGF0aW9uLiBUaGUKIyBjb21tZW50ZWQtb3V0IHNl +dHRpbmdzIHNob3duIGluIHRoaXMgZmlsZSByZXByZXNlbnQgdGhlIGRlZmF1 +bHQgdmFsdWVzLgojCiMgQW55IG9wdGlvbiBjYW4gYWxzbyBiZSBnaXZlbiBh +cyBhIGNvbW1hbmQgbGluZSBzd2l0Y2ggdG8gdGhlCiMgcG9zdG1hc3Rlciwg +ZS5nLiAncG9zdG1hc3RlciAtYyBsb2dfY29ubmVjdGlvbnM9b24nLiBTb21l +IG9wdGlvbnMKIyBjYW4gYmUgY2hhbmdlZCBhdCBydW4tdGltZSB3aXRoIHRo +ZSAnU0VUJyBTUUwgY29tbWFuZC4KIwojIFRoaXMgZmlsZSBpcyByZWFkIG9u +IHBvc3RtYXN0ZXIgc3RhcnR1cCBhbmQgd2hlbiB0aGUgcG9zdG1hc3Rlcgoj +IHJlY2VpdmVzIGEgU0lHSFVQLiBJZiB5b3UgZWRpdCB0aGUgZmlsZSBvbiBh +IHJ1bm5pbmcgc3lzdGVtLCB5b3UgaGF2ZSAKIyB0byBTSUdIVVAgdGhlIHBv +c3RtYXN0ZXIgZm9yIHRoZSBjaGFuZ2VzIHRvIHRha2UgZWZmZWN0LCBvciB1 +c2UgCiMgInBnX2N0bCByZWxvYWQiLgoKCiM9PT09PT09PT09PT09PT09PT09 +PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 +PT09PT09PT0KCgojCiMJQ29ubmVjdGlvbiBQYXJhbWV0ZXJzCiMKdGNwaXBf +c29ja2V0ID0gdHJ1ZQojc3NsID0gZmFsc2UKCm1heF9jb25uZWN0aW9ucyA9 +IDMyCiNzdXBlcnVzZXJfcmVzZXJ2ZWRfY29ubmVjdGlvbnMgPSAyCgpwb3J0 +ID0gNTQzMiAKI2hvc3RuYW1lX2xvb2t1cCA9IGZhbHNlCiNzaG93X3NvdXJj +ZV9wb3J0ID0gZmFsc2UKCiN1bml4X3NvY2tldF9kaXJlY3RvcnkgPSAnJwoj +dW5peF9zb2NrZXRfZ3JvdXAgPSAnJwojdW5peF9zb2NrZXRfcGVybWlzc2lv +bnMgPSAwNzc3CSMgb2N0YWwKCiN2aXJ0dWFsX2hvc3QgPSAnJwoKI2tyYl9z +ZXJ2ZXJfa2V5ZmlsZSA9ICcnCgoKIwojCVNoYXJlZCBNZW1vcnkgU2l6ZQoj +CnNoYXJlZF9idWZmZXJzID0gODAwMAkJIyBtaW4gbWF4X2Nvbm5lY3Rpb25z +KjIgb3IgMTYsIDhLQiBlYWNoCiNtYXhfZnNtX3JlbGF0aW9ucyA9IDEwMDAJ +IyBtaW4gMTAsIGZzbSBpcyBmcmVlIHNwYWNlIG1hcCwgfjQwIGJ5dGVzCiNt +YXhfZnNtX3BhZ2VzID0gMTAwMDAJCSMgbWluIDEwMDAsIGZzbSBpcyBmcmVl +IHNwYWNlIG1hcCwgfjYgYnl0ZXMKI21heF9sb2Nrc19wZXJfdHJhbnNhY3Rp +b24gPSA2NAkjIG1pbiAxMAojd2FsX2J1ZmZlcnMgPSA4CQkjIG1pbiA0LCB0 +eXBpY2FsbHkgOEtCIGVhY2gKCiMKIwlOb24tc2hhcmVkIE1lbW9yeSBTaXpl +cwojCnNvcnRfbWVtID0gODAwMCAgCQkjIG1pbiA2NCwgc2l6ZSBpbiBLQgoj +dmFjdXVtX21lbSA9IDgxOTIJCSMgbWluIDEwMjQsIHNpemUgaW4gS0IKCgoj +CiMJV3JpdGUtYWhlYWQgbG9nIChXQUwpCiMKY2hlY2twb2ludF9zZWdtZW50 +cyA9IDkgCSMgaW4gbG9nZmlsZSBzZWdtZW50cywgbWluIDEsIDE2TUIgZWFj +aAojY2hlY2twb2ludF90aW1lb3V0ID0gMzAwCSMgcmFuZ2UgMzAtMzYwMCwg +aW4gc2Vjb25kcwojCiNjb21taXRfZGVsYXkgPSAwCQkjIHJhbmdlIDAtMTAw +MDAwLCBpbiBtaWNyb3NlY29uZHMKI2NvbW1pdF9zaWJsaW5ncyA9IDUJCSMg +cmFuZ2UgMS0xMDAwCiMKI2ZzeW5jID0gZmFsc2UKI3dhbF9zeW5jX21ldGhv +ZCA9IGZzeW5jCSMgdGhlIGRlZmF1bHQgdmFyaWVzIGFjcm9zcyBwbGF0Zm9y +bXM6CiMJCQkJIyBmc3luYywgZmRhdGFzeW5jLCBvcGVuX3N5bmMsIG9yIG9w +ZW5fZGF0YXN5bmMKI3dhbF9kZWJ1ZyA9IDAJCQkjIHJhbmdlIDAtMTYKCgoj +CiMJT3B0aW1pemVyIFBhcmFtZXRlcnMKIwplbmFibGVfc2Vxc2NhbiA9IGZh +bHNlCmVuYWJsZV9pbmRleHNjYW4gPSB0cnVlCmVuYWJsZV90aWRzY2FuID0g +dHJ1ZQplbmFibGVfc29ydCA9IHRydWUKZW5hYmxlX25lc3Rsb29wID0gdHJ1 +ZQplbmFibGVfbWVyZ2Vqb2luID0gdHJ1ZQplbmFibGVfaGFzaGpvaW4gPSB0 +cnVlCgplZmZlY3RpdmVfY2FjaGVfc2l6ZSA9IDE2MDAwCSMgdHlwaWNhbGx5 +IDhLQiBlYWNoCiNyYW5kb21fcGFnZV9jb3N0ID0gNAkJIyB1bml0cyBhcmUg +b25lIHNlcXVlbnRpYWwgcGFnZSBmZXRjaCBjb3N0CiNjcHVfdHVwbGVfY29z +dCA9IDAuMDEJCSMgKHNhbWUpCiNjcHVfaW5kZXhfdHVwbGVfY29zdCA9IDAu +MDAxCSMgKHNhbWUpCiNjcHVfb3BlcmF0b3JfY29zdCA9IDAuMDAyNQkjIChz +YW1lKQoKZGVmYXVsdF9zdGF0aXN0aWNzX3RhcmdldCA9IDc1MAkjIHJhbmdl +IDEtMTAwMAoKIwojCUdFUU8gT3B0aW1pemVyIFBhcmFtZXRlcnMKIwojZ2Vx +byA9IHRydWUKI2dlcW9fc2VsZWN0aW9uX2JpYXMgPSAyLjAJIyByYW5nZSAx +LjUtMi4wCiNnZXFvX3RocmVzaG9sZCA9IDExCiNnZXFvX3Bvb2xfc2l6ZSA9 +IDAJCSMgZGVmYXVsdCBiYXNlZCBvbiB0YWJsZXMgaW4gc3RhdGVtZW50LCAK +CQkJCSMgcmFuZ2UgMTI4LTEwMjQKI2dlcW9fZWZmb3J0ID0gMQojZ2Vxb19n +ZW5lcmF0aW9ucyA9IDAKI2dlcW9fcmFuZG9tX3NlZWQgPSAtMQkJIyBhdXRv +LWNvbXB1dGUgc2VlZAoKCiMKIwlNZXNzYWdlIGRpc3BsYXkKIwojc2VydmVy +X21pbl9tZXNzYWdlcyA9IG5vdGljZQkjIFZhbHVlcywgaW4gb3JkZXIgb2Yg +ZGVjcmVhc2luZyBkZXRhaWw6CgkJCQkjICAgZGVidWc1LCBkZWJ1ZzQsIGRl +YnVnMywgZGVidWcyLCBkZWJ1ZzEsCgkJCQkjICAgaW5mbywgbm90aWNlLCB3 +YXJuaW5nLCBlcnJvciwgbG9nLCBmYXRhbCwKCQkJCSMgICBwYW5pYwojY2xp +ZW50X21pbl9tZXNzYWdlcyA9IG5vdGljZQkjIFZhbHVlcywgaW4gb3JkZXIg +b2YgZGVjcmVhc2luZyBkZXRhaWw6CgkJCQkjICAgZGVidWc1LCBkZWJ1ZzQs +IGRlYnVnMywgZGVidWcyLCBkZWJ1ZzEsCgkJCQkjICAgbG9nLCBpbmZvLCBu +b3RpY2UsIHdhcm5pbmcsIGVycm9yCiNzaWxlbnRfbW9kZSA9IGZhbHNlCgoj +bG9nX2Nvbm5lY3Rpb25zID0gZmFsc2UKI2xvZ19waWQgPSBmYWxzZQojbG9n +X3N0YXRlbWVudCA9IGZhbHNlCiNsb2dfZHVyYXRpb24gPSBmYWxzZQpsb2df +dGltZXN0YW1wID0gdHJ1ZQoKI2xvZ19taW5fZXJyb3Jfc3RhdGVtZW50ID0g +ZXJyb3IgIyBWYWx1ZXMgaW4gb3JkZXIgb2YgaW5jcmVhc2luZyBzZXZlcml0 +eToKCQkJCSAjICAgZGVidWc1LCBkZWJ1ZzQsIGRlYnVnMywgZGVidWcyLCBk +ZWJ1ZzEsCgkJCQkgIyAgIGluZm8sIG5vdGljZSwgd2FybmluZywgZXJyb3Is +IHBhbmljKG9mZikKCiNkZWJ1Z19wcmludF9wYXJzZSA9IGZhbHNlCiNkZWJ1 +Z19wcmludF9yZXdyaXR0ZW4gPSBmYWxzZQojZGVidWdfcHJpbnRfcGxhbiA9 +IGZhbHNlCiNkZWJ1Z19wcmV0dHlfcHJpbnQgPSBmYWxzZQoKI2V4cGxhaW5f +cHJldHR5X3ByaW50ID0gdHJ1ZQoKIyByZXF1aXJlcyBVU0VfQVNTRVJUX0NI +RUNLSU5HCiNkZWJ1Z19hc3NlcnRpb25zID0gdHJ1ZQoKCiMKIwlTeXNsb2cK +Iwojc3lzbG9nID0gMAkJCSMgcmFuZ2UgMC0yCiNzeXNsb2dfZmFjaWxpdHkg +PSAnTE9DQUwwJwojc3lzbG9nX2lkZW50ID0gJ3Bvc3RncmVzJwoKCiMKIwlT +dGF0aXN0aWNzCiMKI3Nob3dfcGFyc2VyX3N0YXRzID0gZmFsc2UKI3Nob3df +cGxhbm5lcl9zdGF0cyA9IGZhbHNlCiNzaG93X2V4ZWN1dG9yX3N0YXRzID0g +ZmFsc2UKI3Nob3dfc3RhdGVtZW50X3N0YXRzID0gZmFsc2UKCiMgcmVxdWly +ZXMgQlRSRUVfQlVJTERfU1RBVFMKI3Nob3dfYnRyZWVfYnVpbGRfc3RhdHMg +PSBmYWxzZQoKCiMKIwlBY2Nlc3Mgc3RhdGlzdGljcyBjb2xsZWN0aW9uCiMK +I3N0YXRzX3N0YXJ0X2NvbGxlY3RvciA9IHRydWUKI3N0YXRzX3Jlc2V0X29u +X3NlcnZlcl9zdGFydCA9IHRydWUKI3N0YXRzX2NvbW1hbmRfc3RyaW5nID0g +ZmFsc2UKI3N0YXRzX3Jvd19sZXZlbCA9IGZhbHNlCiNzdGF0c19ibG9ja19s +ZXZlbCA9IGZhbHNlCgoKIwojCUxvY2sgVHJhY2luZwojCiN0cmFjZV9ub3Rp +ZnkgPSBmYWxzZQoKIyByZXF1aXJlcyBMT0NLX0RFQlVHCiN0cmFjZV9sb2Nr +cyA9IGZhbHNlCiN0cmFjZV91c2VybG9ja3MgPSBmYWxzZQojdHJhY2VfbHds +b2NrcyA9IGZhbHNlCiNkZWJ1Z19kZWFkbG9ja3MgPSBmYWxzZQojdHJhY2Vf +bG9ja19vaWRtaW4gPSAxNjM4NAojdHJhY2VfbG9ja190YWJsZSA9IDAKCgoj +CiMJTWlzYwojCiNhdXRvY29tbWl0ID0gdHJ1ZQojZHluYW1pY19saWJyYXJ5 +X3BhdGggPSAnJGxpYmRpcicKc2VhcmNoX3BhdGggPSAndmVuZGFzJwojZGF0 +ZXN0eWxlID0gJ2lzbywgdXMnCiN0aW1lem9uZSA9IHVua25vd24JCSMgYWN0 +dWFsbHksIGRlZmF1bHRzIHRvIFRaIGVudmlyb25tZW50IHNldHRpbmcKI2F1 +c3RyYWxpYW5fdGltZXpvbmVzID0gZmFsc2UKI2NsaWVudF9lbmNvZGluZyA9 +IHNxbF9hc2NpaQkjIGFjdHVhbGx5LCBkZWZhdWx0cyB0byBkYXRhYmFzZSBl +bmNvZGluZwojYXV0aGVudGljYXRpb25fdGltZW91dCA9IDYwCSMgMS02MDAs +IGluIHNlY29uZHMKI2RlYWRsb2NrX3RpbWVvdXQgPSAxMDAwCSMgaW4gbWls +bGlzZWNvbmRzCiNkZWZhdWx0X3RyYW5zYWN0aW9uX2lzb2xhdGlvbiA9ICdy +ZWFkIGNvbW1pdHRlZCcKI21heF9leHByX2RlcHRoID0gMTAwMDAJCSMgbWlu +IDEwCiNtYXhfZmlsZXNfcGVyX3Byb2Nlc3MgPSAxMDAwCSMgbWluIDI1CiNw +YXNzd29yZF9lbmNyeXB0aW9uID0gdHJ1ZQojc3FsX2luaGVyaXRhbmNlID0g +dHJ1ZQojdHJhbnNmb3JtX251bGxfZXF1YWxzID0gZmFsc2UKI3N0YXRlbWVu +dF90aW1lb3V0ID0gMAkJIyAwIGlzIGRpc2FibGVkLCBpbiBtaWxsaXNlY29u +ZHMKI2RiX3VzZXJfbmFtZXNwYWNlID0gZmFsc2UKIAoKCiMKIwlMb2NhbGUg +c2V0dGluZ3MKIwojIChpbml0aWFsaXplZCBieSBpbml0ZGIgLS0gbWF5IGJl +IGNoYW5nZWQpCkxDX01FU1NBR0VTID0gJ2VuX1VTLlVURi04JwpMQ19NT05F +VEFSWSA9ICdlbl9VUy5VVEYtOCcKTENfTlVNRVJJQyA9ICdlbl9VUy5VVEYt +OCcKTENfVElNRSA9ICdlbl9VUy5VVEYtOCcK + +---MOQ1062621852172764d69df60a690f4a054550b71562-- + +From pgsql-performance-owner@postgresql.org Wed Sep 3 19:27:12 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C4519D1B8C5 + for ; + Wed, 3 Sep 2003 20:49:39 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 42294-10 + for ; + Wed, 3 Sep 2003 17:49:09 -0300 (ADT) +Received: from lakemtao04.cox.net (lakemtao04.cox.net [68.1.17.241]) + by svr1.postgresql.org (Postfix) with ESMTP id 96F64D1B97B + for ; + Wed, 3 Sep 2003 17:49:07 -0300 (ADT) +Received: from lhosts ([68.11.66.83]) by lakemtao04.cox.net + (InterMail vM.5.01.06.04 201-253-122-130-104-20030726) with ESMTP + id <20030903204910.PUTY29613.lakemtao04.cox.net@lhosts> + for ; + Wed, 3 Sep 2003 16:49:10 -0400 +Subject: Re: SQL slower when running for the second time +From: Ron Johnson +To: PgSQL Performance ML +In-Reply-To: <1062616558.3f563dee5ccd4@sistemica.info> +References: <1062616558.3f563dee5ccd4@sistemica.info> +Content-Type: text/plain +Message-Id: <1062622143.7341.388.camel@haggis> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Wed, 03 Sep 2003 15:49:03 -0500 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/29 +X-Sequence-Number: 3395 + +On Wed, 2003-09-03 at 14:15, Rhaoni Chiu Pereira wrote: +> Hi List, +> +> I trying to increase performance in my PostgreSQL but there is something +> wrong. when I run this SQL for the first time it takes 1 min. 40 seconds to +> return, but when I run it for the second time it takes more than 2 minutes, and +> I should retunr faster than the first time. +> +> Does anyone have a advice ? + +Is it a query or insert/update? + +-- +----------------------------------------------------------------- +Ron Johnson, Jr. ron.l.johnson@cox.net +Jefferson, LA USA + +"Vanity, my favorite sin." + Larry/John/Satan, "The Devil's Advocate" + + +From pgsql-performance-owner@postgresql.org Wed Sep 3 20:44:42 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 0634DD1B8CD + for ; + Wed, 3 Sep 2003 23:29:37 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 59298-07 + for ; + Wed, 3 Sep 2003 20:29:29 -0300 (ADT) +Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) + by svr1.postgresql.org (Postfix) with ESMTP id 1C281D1B8AE + for ; + Wed, 3 Sep 2003 20:29:25 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id h83NTOm14572; + Wed, 3 Sep 2003 19:29:24 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200309032329.h83NTOm14572@candle.pha.pa.us> +Subject: Re: FreeBSD page size +In-Reply-To: +To: Vivek Khera +Date: Wed, 3 Sep 2003 19:29:24 -0400 (EDT) +Cc: pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL106 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/32 +X-Sequence-Number: 3398 + +Vivek Khera wrote: +> the restore complained often about checkpoints occurring every few +> seconds: +> +> Sep 2 11:57:14 d02 postgres[49721]: [5-1] LOG: checkpoints are occurring too frequently (15 seconds apart) +> Sep 2 11:57:14 d02 postgres[49721]: [5-2] HINT: Consider increasing CHECKPOINT_SEGMENTS. +> +> The HINT threw me off since I had to set checkpoint_segments in +> postgresql.conf, where as CHECKPOINT_SEGMENTS implied to me a +> compile-time constant. + +Woo hoo, my warning worked. Great. + +I uppercased it because config parameters are uppercased in the +documentation. Do we mention config parameters in any other error +messages? Should it be lowercased? + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Wed Sep 3 20:51:08 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id ACD61D1B89A + for ; + Wed, 3 Sep 2003 23:50:01 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 62151-03 + for ; + Wed, 3 Sep 2003 20:49:32 -0300 (ADT) +Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) + by svr1.postgresql.org (Postfix) with ESMTP id BF4C6D1B89E + for ; + Wed, 3 Sep 2003 20:49:29 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by mailav.tor1.inquent.com (Postfix) with ESMTP + id BD8801024D; Wed, 3 Sep 2003 19:41:27 -0400 (EDT) +Received: from [192.168.1.200] (dyn-133-83.tor.dsl.tht.net [134.22.133.83]) + by mailav.tor1.inquent.com (Postfix) with ESMTP + id 8CB6910248; Wed, 3 Sep 2003 19:41:25 -0400 (EDT) +Subject: Re: FreeBSD page size +From: Rod Taylor +To: Bruce Momjian +Cc: Vivek Khera , + Postgresql Performance +In-Reply-To: <200309032329.h83NTOm14572@candle.pha.pa.us> +References: <200309032329.h83NTOm14572@candle.pha.pa.us> +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="=-G1vG0hF1+8CqVWbZrUJU" +Message-Id: <1062632994.84923.0.camel@jester> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Wed, 03 Sep 2003 19:49:55 -0400 +X-Virus-Scanned: by AMaViS perl-11 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/33 +X-Sequence-Number: 3399 + +--=-G1vG0hF1+8CqVWbZrUJU +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +> I uppercased it because config parameters are uppercased in the +> documentation. Do we mention config parameters in any other error +> messages? Should it be lowercased? + +How about changing the hint? + +Consider increasing CHECKPOINT_SEGMENTS in your postgresql.conf + +--=-G1vG0hF1+8CqVWbZrUJU +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: This is a digitally signed message part + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.3 (FreeBSD) + +iD8DBQA/Vn4h6DETLow6vwwRAm9nAJ0c1ws2N3BeZ+bpXCwosgb1ybH5zQCcCxiX ++89zCAfj4gAgpzg1GnrcAIk= +=thM0 +-----END PGP SIGNATURE----- + +--=-G1vG0hF1+8CqVWbZrUJU-- + + +From pgsql-performance-owner@postgresql.org Wed Sep 3 21:06:04 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 610D2D1B8A5 + for ; + Thu, 4 Sep 2003 00:05:38 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 63078-05 + for ; + Wed, 3 Sep 2003 21:05:09 -0300 (ADT) +Received: from ganymede.hub.org (u173n10.eastlink.ca [24.224.173.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 7773DD1B91B + for ; + Wed, 3 Sep 2003 21:05:06 -0300 (ADT) +Received: by ganymede.hub.org (Postfix, from userid 1000) + id A08E03405A; Wed, 3 Sep 2003 21:04:58 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by ganymede.hub.org (Postfix) with ESMTP + id 900F033C8A; Wed, 3 Sep 2003 21:04:58 -0300 (ADT) +Date: Wed, 3 Sep 2003 21:04:58 -0300 (ADT) +From: "Marc G. Fournier" +To: Bruce Momjian +Cc: Vivek Khera , pgsql-performance@postgresql.org +Subject: Re: FreeBSD page size +In-Reply-To: <200309032329.h83NTOm14572@candle.pha.pa.us> +Message-ID: <20030903210400.U803@ganymede.hub.org> +References: <200309032329.h83NTOm14572@candle.pha.pa.us> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/34 +X-Sequence-Number: 3400 + + + +On Wed, 3 Sep 2003, Bruce Momjian wrote: + +> Vivek Khera wrote: +> > the restore complained often about checkpoints occurring every few +> > seconds: +> > +> > Sep 2 11:57:14 d02 postgres[49721]: [5-1] LOG: checkpoints are occurring too frequently (15 seconds apart) +> > Sep 2 11:57:14 d02 postgres[49721]: [5-2] HINT: Consider increasing CHECKPOINT_SEGMENTS. +> > +> > The HINT threw me off since I had to set checkpoint_segments in +> > postgresql.conf, where as CHECKPOINT_SEGMENTS implied to me a +> > compile-time constant. +> +> Woo hoo, my warning worked. Great. +> +> I uppercased it because config parameters are uppercased in the +> documentation. Do we mention config parameters in any other error +> messages? Should it be lowercased? + +k, to me upper case denotes a compiler #define, so I would have been +confused ... I'd go with lower case and single quotes around it to denote +its a variable to be changed ... + +From pgsql-performance-owner@postgresql.org Wed Sep 3 21:13:44 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B96ABD1B8A5 + for ; + Thu, 4 Sep 2003 00:12:47 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 62782-07 + for ; + Wed, 3 Sep 2003 21:12:19 -0300 (ADT) +Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) + by svr1.postgresql.org (Postfix) with ESMTP id D8CDFD1B8B3 + for ; + Wed, 3 Sep 2003 21:12:12 -0300 (ADT) +Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) + by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h840B4p5012443; + Wed, 3 Sep 2003 18:11:04 -0600 (MDT) +Date: Wed, 3 Sep 2003 18:09:14 -0600 (MDT) +From: "scott.marlowe" +To: Russell Garrett +Cc: PgSQL Performance ML +Subject: Re: Selecting random rows efficiently +In-Reply-To: +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-IHS-MailScanner: Found to be clean +X-IHS-MailScanner-SpamCheck: +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/35 +X-Sequence-Number: 3401 + +Can you just create an extra serial column and make sure that one is +always in order and no holes in it? (i.e. a nightly process, etc...)??? + +If so, then something like this truly flies: + +select * from accounts where aid = (select cast(floor(random()*100000)+1 as int)); + +My times on it on a 100,000 row table are < 1 millisecond. + +Note that you have to have a hole free sequence AND know how many rows +there are, but if you can meet those needs, this is screamingly fast. + +On Sat, 30 Aug 2003, Russell Garrett wrote: + +> Considering that we'd have to index the random field too, it'd be neater in +> the long term to re-number the primary key. Although, being a primary key, +> that's foreign-keyed from absolutely everywhere, so that'd probably take an +> amusingly long time. +> +> ...and no we're not from Micronesia, we're from ever so slightly less exotic +> London. Though Micronesia might be nice... +> +> Russ (also from last.fm but without the fancy address) +> +> pgsql-performance-owner@postgresql.org wrote: +> > On Sat, 2003-08-30 at 09:01, Rod Taylor wrote: +> >>> i was hoping there was some trickery with sequences that would +> >>> allow me to easily pick a random valid sequence number..? +> >> +> >> I would suggest renumbering the data. +> >> +> >> ALTER SEQUENCE ... RESTART WITH 1; +> >> UPDATE table SET pkey = DEFAULT; +> >> +> >> Of course, PostgreSQL may have trouble with that update due to +> >> evaluation of the unique constraint immediately -- so drop the +> >> primary key first, and add it back after. +> > +> > And if there are child tables, they'd all have to be updated, too. +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 8: explain analyze is your friend +> + + +From pgsql-performance-owner@postgresql.org Wed Sep 3 21:54:56 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 1A4DBD1B8A5 + for ; + Thu, 4 Sep 2003 00:54:55 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 64562-09 + for ; + Wed, 3 Sep 2003 21:54:47 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 51FD3D1B89D + for ; + Wed, 3 Sep 2003 21:54:44 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h840sgDf062430 + for ; Thu, 4 Sep 2003 00:54:42 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h840Tos3057427 + for pgsql-performance@postgresql.org; Thu, 4 Sep 2003 00:29:50 GMT +From: "Relaxin" +X-Newsgroups: comp.databases.postgresql.performance +Subject: SELECT's take a long time compared to other DBMS +Date: Wed, 3 Sep 2003 17:28:26 -0700 +Organization: Hub.Org Networking Services +Lines: 25 +Message-ID: +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/37 +X-Sequence-Number: 3403 + +I have a table with 102,384 records in it, each record is 934 bytes. + +Using the follow select statement: + SELECT * from + +PG Info: version 7.3.4 under cygwin on Windows 2000 +ODBC: version 7.3.100 + +Machine: 500 Mhz/ 512MB RAM / IDE HDD + + +Under PG: Data is returned in 26 secs!! +Under SQL Server: Data is returned in 5 secs. +Under SQLBase: Data is returned in 6 secs. +Under SAPDB: Data is returned in 7 secs. + +This is the ONLY table in the database and only 1 user. + +And yes I did a vacuum. + +Is this normal behavior for PG? + +Thanks + + + +From pgsql-performance-owner@postgresql.org Wed Sep 3 21:38:08 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 51C95D1B8B7 + for ; + Thu, 4 Sep 2003 00:37:54 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 66823-01 + for ; + Wed, 3 Sep 2003 21:37:47 -0300 (ADT) +Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) + by svr1.postgresql.org (Postfix) with ESMTP id D55B8D1B8A5 + for ; + Wed, 3 Sep 2003 21:37:41 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id h840aqQ21643; + Wed, 3 Sep 2003 20:36:52 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200309040036.h840aqQ21643@candle.pha.pa.us> +Subject: Re: FreeBSD page size +In-Reply-To: <20030903210400.U803@ganymede.hub.org> +To: "Marc G. Fournier" +Date: Wed, 3 Sep 2003 20:36:52 -0400 (EDT) +Cc: Vivek Khera , pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL106 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/36 +X-Sequence-Number: 3402 + +Marc G. Fournier wrote: +> On Wed, 3 Sep 2003, Bruce Momjian wrote: +> +> > Vivek Khera wrote: +> > > the restore complained often about checkpoints occurring every few +> > > seconds: +> > > +> > > Sep 2 11:57:14 d02 postgres[49721]: [5-1] LOG: checkpoints are occurring too frequently (15 seconds apart) +> > > Sep 2 11:57:14 d02 postgres[49721]: [5-2] HINT: Consider increasing CHECKPOINT_SEGMENTS. +> > > +> > > The HINT threw me off since I had to set checkpoint_segments in +> > > postgresql.conf, where as CHECKPOINT_SEGMENTS implied to me a +> > > compile-time constant. +> > +> > Woo hoo, my warning worked. Great. +> > +> > I uppercased it because config parameters are uppercased in the +> > documentation. Do we mention config parameters in any other error +> > messages? Should it be lowercased? +> +> k, to me upper case denotes a compiler #define, so I would have been +> confused ... I'd go with lower case and single quotes around it to denote +> its a variable to be changed ... + +Done. + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Wed Sep 3 22:05:02 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 40A75D1B94F + for ; + Thu, 4 Sep 2003 01:04:53 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 65959-09 + for ; + Wed, 3 Sep 2003 22:04:44 -0300 (ADT) +Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) + by svr1.postgresql.org (Postfix) with ESMTP id 610BBD1B8F5 + for ; + Wed, 3 Sep 2003 22:04:40 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by mailav.tor1.inquent.com (Postfix) with ESMTP + id DBDD61024D; Wed, 3 Sep 2003 20:56:38 -0400 (EDT) +Received: from [192.168.1.200] (dyn-133-83.tor.dsl.tht.net [134.22.133.83]) + by mailav.tor1.inquent.com (Postfix) with ESMTP + id ADF5010248; Wed, 3 Sep 2003 20:56:36 -0400 (EDT) +Subject: Re: SELECT's take a long time compared to other DBMS +From: Rod Taylor +To: Relaxin +Cc: Postgresql Performance +In-Reply-To: +References: +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="=-THlmMwF3Wvrr12QDRv6C" +Message-Id: <1062637505.84923.7.camel@jester> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Wed, 03 Sep 2003 21:05:06 -0400 +X-Virus-Scanned: by AMaViS perl-11 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/39 +X-Sequence-Number: 3405 + +--=-THlmMwF3Wvrr12QDRv6C +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +> Under PG: Data is returned in 26 secs!! +> Under SQL Server: Data is returned in 5 secs. +> Under SQLBase: Data is returned in 6 secs. +> Under SAPDB: Data is returned in 7 secs. + +What did you use as the client? Do those times include ALL resulting +data or simply the first few lines? + +PostgreSQL performance on windows (via Cygwin) is known to be poor. +Do you receive similar results with 7.4 beta 2? + +--=-THlmMwF3Wvrr12QDRv6C +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: This is a digitally signed message part + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.3 (FreeBSD) + +iD8DBQA/Vo/B6DETLow6vwwRApdeAJ9TuX1iudKEA4ZEhN39x5efP3S7DgCfdT7j +b9iC6UYXwuKNmrGDOwEG3Ss= +=EhzH +-----END PGP SIGNATURE----- + +--=-THlmMwF3Wvrr12QDRv6C-- + + +From pgsql-performance-owner@postgresql.org Wed Sep 3 22:03:37 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 2F04AD1B8B4 + for ; + Thu, 4 Sep 2003 01:03:35 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 65565-09 + for ; + Wed, 3 Sep 2003 22:03:06 -0300 (ADT) +Received: from water.oasis.net.au (water.oasis.net.au [210.8.139.2]) + by svr1.postgresql.org (Postfix) with ESMTP id C0717D1B89E + for ; + Wed, 3 Sep 2003 22:02:59 -0300 (ADT) +Received: from oasis.net.au (guardian [210.8.139.5]) + by water.oasis.net.au (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id + LAA14495; Thu, 4 Sep 2003 11:31:29 +1000 +X-Authentication-Warning: water.oasis.net.au: Host guardian [210.8.139.5] + claimed to be oasis.net.au +Message-ID: <3F569012.3090209@oasis.net.au> +Date: Thu, 04 Sep 2003 11:06:26 +1000 +From: Rudi Starcevic +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; + rv:1.4) Gecko/20030624 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Relaxin +Cc: pgsql-performance@postgresql.org +Subject: Re: SELECT's take a long time compared to other DBMS +References: +In-Reply-To: +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/38 +X-Sequence-Number: 3404 + +Hi, + + +>And yes I did a vacuum. +> + +Did you 'Analyze' too ? + +Cheers +Rudi. + + +From pgsql-performance-owner@postgresql.org Wed Sep 3 22:25:16 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id CAC70D1B93F + for ; + Thu, 4 Sep 2003 01:24:55 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 66823-06 + for ; + Wed, 3 Sep 2003 22:24:48 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 2A7EBD1B52C + for ; + Wed, 3 Sep 2003 22:24:45 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h841OgDj068889 + for ; Thu, 4 Sep 2003 01:24:42 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h841NvkD068765 + for pgsql-performance@postgresql.org; Thu, 4 Sep 2003 01:23:57 GMT +From: "Relaxin" +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: SELECT's take a long time compared to other DBMS +Date: Wed, 3 Sep 2003 18:22:33 -0700 +Organization: Hub.Org Networking Services +Lines: 24 +Message-ID: +References: <3F569012.3090209@oasis.net.au> +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/40 +X-Sequence-Number: 3406 + +Yes I Analyze also, but there was no need to because it was a fresh brand +new database. + +"Rudi Starcevic" wrote in message +news:3F569012.3090209@oasis.net.au... +> Hi, +> +> +> >And yes I did a vacuum. +> > +> +> Did you 'Analyze' too ? +> +> Cheers +> Rudi. +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 5: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faqs/FAQ.html +> + + + +From pgsql-performance-owner@postgresql.org Wed Sep 3 22:54:57 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 248A4D1B8A3 + for ; + Thu, 4 Sep 2003 01:54:55 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 67009-10 + for ; + Wed, 3 Sep 2003 22:54:48 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 65071D1B550 + for ; + Wed, 3 Sep 2003 22:54:44 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h841sgDf074539 + for ; Thu, 4 Sep 2003 01:54:42 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h841PsU3069357 + for pgsql-performance@postgresql.org; Thu, 4 Sep 2003 01:25:54 GMT +From: "Relaxin" +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: SELECT's take a long time compared to other DBMS +Date: Wed, 3 Sep 2003 18:24:31 -0700 +Organization: Hub.Org Networking Services +Lines: 9 +Message-ID: +References: <1062637505.84923.7.camel@jester> +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=0.4 tagged_above=0.0 required=5.0 tests=BAYES_30, + PRIORITY_NO_NAME, RCVD_IN_OSIRUSOFT_COM, REFERENCES +X-Spam-Level: +X-Archive-Number: 200309/42 +X-Sequence-Number: 3408 + +All queries were ran on the SERVER for all of the databases I tested. + +This is all resulting data for all of the databases that I tested. + + +"Rod Taylor" wrote in message +news:1062637505.84923.7.camel@jester... + + + +From pgsql-performance-owner@postgresql.org Wed Sep 3 22:29:57 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 99E70D1B52C + for ; + Thu, 4 Sep 2003 01:29:54 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 66489-07 + for ; + Wed, 3 Sep 2003 22:29:27 -0300 (ADT) +Received: from water.oasis.net.au (water.oasis.net.au [210.8.139.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 759A2D1B93F + for ; + Wed, 3 Sep 2003 22:29:22 -0300 (ADT) +Received: from oasis.net.au (guardian [210.8.139.5]) + by water.oasis.net.au (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id + LAA15066; Thu, 4 Sep 2003 11:57:58 +1000 +X-Authentication-Warning: water.oasis.net.au: Host guardian [210.8.139.5] + claimed to be oasis.net.au +Message-ID: <3F569636.4090809@oasis.net.au> +Date: Thu, 04 Sep 2003 11:32:38 +1000 +From: Rudi Starcevic +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; + rv:1.4) Gecko/20030624 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Relaxin +Cc: pgsql-performance@postgresql.org +Subject: Re: SELECT's take a long time compared to other DBMS +References: <3F569012.3090209@oasis.net.au> + +In-Reply-To: +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/41 +X-Sequence-Number: 3407 + +Hi, + +>Yes I Analyze also, but there was no need to because it was a fresh brand +>new database. +> + +Hmm ... Sorry I'm not sure then. I only use Linux with PG. +Even though it's 'brand new' you still need to Analyze so that any +Indexes etc. are built. + +I'll keep an eye on this thread - Good luck. + +Regards +Rudi. + + + + +From pgsql-performance-owner@postgresql.org Wed Sep 3 22:55:14 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 2BFCED1B8BD + for ; + Thu, 4 Sep 2003 01:55:06 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 77291-01 + for ; + Wed, 3 Sep 2003 22:54:37 -0300 (ADT) +Received: from bob.samurai.com (bob.samurai.com [205.207.28.75]) + by svr1.postgresql.org (Postfix) with ESMTP id 11979D1B4E2 + for ; + Wed, 3 Sep 2003 22:54:34 -0300 (ADT) +Received: from 6-allhosts (d226-85-166.home.cgocable.net [24.226.85.166]) + by bob.samurai.com (Postfix) with ESMTP + id 0395B1E2E; Wed, 3 Sep 2003 21:54:38 -0400 (EDT) +Subject: Re: SELECT's take a long time compared to other DBMS +From: Neil Conway +To: Rudi Starcevic +Cc: Relaxin , + PostgreSQL Performance +In-Reply-To: <3F569636.4090809@oasis.net.au> +References: <3F569012.3090209@oasis.net.au> + <3F569636.4090809@oasis.net.au> +Content-Type: text/plain +Message-Id: <1062640477.14620.7.camel@tokyo> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Wed, 03 Sep 2003 21:54:37 -0400 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/43 +X-Sequence-Number: 3409 + +On Wed, 2003-09-03 at 21:32, Rudi Starcevic wrote: +> Hmm ... Sorry I'm not sure then. I only use Linux with PG. +> Even though it's 'brand new' you still need to Analyze so that any +> Indexes etc. are built. + +ANALYZE doesn't build indexes, it only updates the statistics used by +the query optimizer (and in any case, "select * from " has only one +reasonable query plan anyway). + +-Neil + + +From pgsql-performance-owner@postgresql.org Wed Sep 3 23:01:41 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E503AD1B8BD + for ; + Thu, 4 Sep 2003 02:01:38 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 77654-02 + for ; + Wed, 3 Sep 2003 23:01:11 -0300 (ADT) +Received: from bob.samurai.com (bob.samurai.com [205.207.28.75]) + by svr1.postgresql.org (Postfix) with ESMTP id 7B50CD1B8B1 + for ; + Wed, 3 Sep 2003 23:01:07 -0300 (ADT) +Received: from 6-allhosts (d226-85-166.home.cgocable.net [24.226.85.166]) + by bob.samurai.com (Postfix) with ESMTP + id 8C6171E13; Wed, 3 Sep 2003 22:01:11 -0400 (EDT) +Subject: Re: Query on Postgresql performance +From: Neil Conway +To: Naveen Palavalli +Cc: PostgreSQL Performance +In-Reply-To: <001a01c37252$24f69390$8000000a@usc1mk75s5t1b6> +References: <001a01c37252$24f69390$8000000a@usc1mk75s5t1b6> +Content-Type: text/plain +Message-Id: <1062640870.14624.13.camel@tokyo> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Wed, 03 Sep 2003 22:01:10 -0400 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/44 +X-Sequence-Number: 3410 + +On Wed, 2003-09-03 at 15:32, Naveen Palavalli wrote: +> shared_buffers = 200 + +If you're using a relatively modern machine, this is probably on the low +side. + +> 1) Effects related to Vaccum :- I performed 10 trials of adding and +> deleting entries . In each trial , 1 client adds 10,000 entries and +> then deletes them . During the course of these 10 trials , the Add +> Rates (rate at which my server can add entries to the Postgresql +> database ) drops from around 200 Adds/second in the 1st trial to +> around 100 Adds/second in the 10th trial . But when I do a Vaccuum , +> Immediately I get back the Add Rates to around 200 Adds/Second . + +Well, there's nothing wrong with vacuuming frequently (since it won't +block concurrent database operations, and the more often you vacuum, the +less time each vacuum takes). + +> I was using Postgresql 7.3.3 earlier but it kept crashing the database +> after a Vaccum . So I switched to a older and stabler version 7.2.4 + +Can you reproduce the 7.3.3 crash? (BTW, in the future, it would be +appreciated if you could report these kinds of bugs to the dev team). + +-Neil + + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 00:04:58 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A8797D1B89D + for ; + Thu, 4 Sep 2003 03:04:52 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 81986-07 + for ; + Thu, 4 Sep 2003 00:04:20 -0300 (ADT) +Received: from gusi.leathercollection.ph (gusi.leathercollection.ph + [202.163.192.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 1FC36D1B914 + for ; + Thu, 4 Sep 2003 00:04:19 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by gusi.leathercollection.ph (Postfix) with ESMTP + id 21F0AEB4A0A; Thu, 4 Sep 2003 11:04:16 +0800 (PHT) +Received: from lawin.alabang.leathercollection.ph + (lawin.alabang.leathercollection.ph [192.168.0.2]) + by gusi.leathercollection.ph (Postfix) with ESMTP + id 224B5EB4A05; Thu, 4 Sep 2003 11:04:06 +0800 (PHT) +Received: by lawin.alabang.leathercollection.ph (Postfix, from userid 1000) + id 289751A4019; Thu, 4 Sep 2003 11:04:04 +0800 (PHT) +Date: Thu, 4 Sep 2003 11:04:04 +0800 +From: Federico Sevilla III +To: PostgreSQL Performance Mailing List +Cc: Linux-XFS Mailing List +Subject: PostgreSQL Reliability when fsync = false on Linux-XFS +Message-ID: <20030904030404.GA32319@leathercollection.ph> +Mail-Followup-To: PostgreSQL Performance Mailing List + , + Linux-XFS Mailing List +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +X-Organization: The Leather Collection, Inc. +X-Organization-URL: http://www.leathercollection.ph +X-Personal-URL: http://jijo.free.net.ph +User-Agent: Mutt/1.5.4i +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/45 +X-Sequence-Number: 3411 + +(Please follow Mail-Followup-To, I'm not on the pgsql-performance +mailing list but am on the Linux-XFS mailing list. My apologies too for +the cross-post. I'm cc'ing the Linux-XFS mailing list in case people +there will be interested in this, too.) + + +Hi, + +We have a server running PostgreSQL v7.3.3 on Debian GNU/Linux with +Linux kernel 2.4.21-xfs. The PostgreSQL data is stored on an XFS[1] +partition mounted with the options "rw,noatime,logbufs=8". The machine +is an Intel Pentium III 733MHz with 512MB RAM and a four-disk hardware +IDE RAID-5 array with a 3ware controller. + +Among other databases, we have a centralized Snort[2] database that is +analyzed by ACIDLab[3]. I noticed performance problems during SELECT and +INSERT operations when the tables reach around 200,000 records. Because +of timeout issues, the PHP-based ACIDLab can't be used properly. + +I read the performance section of the ACID FAQ[4] as well as the +PostgreSQL "Managing Kernel Resources" document , and so far have tuned +my system by setting /proc/sys/kernel/{shmall,shmmax} to 134217728. + +I also turned off fsync in /etc/postgresql/postgresql.conf. + +The latter did a LOT to improve INSERT performance, which is now +CPU-bound instead of I/O-bound. However, as expected, I am concerned +about the reliability penalty this will cause. Our server has been up +and running without problems for 67 days since the last reboot, but this +doesn't mean it will never hiccup either because of some random problem +or because of an extended power outage. + +Would anyone have "authoritative" information with respect to: + + - the way PostgreSQL expects data to be written to disk without the + fsync calls for things not to get corrupted in the event of a crash, + and + + - the way XFS writes data to disk without the fsync calls that + PostgreSQL normally does and how this will affect PostgreSQL data + integrity in the event of a system crash? + +I know that at the end of the day, if I value my data, I must (1) back +it up regularly, and (2) keep fsync enabled in PostgreSQL. However given +the significance performance hit (at least as far as massive INSERT or +UPDATE operations are concerned) and the journalling component of XFS, +it would be great to find out just how bad the odds are if the system +goes down unexpectedly. + +Thank you very much for your time. :) + + --> Jijo + +Note- I should also have selected RAID10 instead of RAID5, but that's a +change I can't afford to do at this point so I have to explore other +options. + +[1] http://oss.sgi.com/projects/xfs/ +[2] http://www.snort.org +[3] http://acidlab.sourceforge.net +[4] http://www.andrew.cmu.edu/~rdanyliw/snort/acid_faq.html#faq_c9 +[5] http://developer.postgresql.org/docs/postgres/kernel-resources.html + +-- +Federico Sevilla III : http://jijo.free.net.ph : When we speak of free +Network Administrator : The Leather Collection, Inc. : software we refer to +GnuPG Key ID : 0x93B746BE : freedom, not price. + +From pgsql-performance-owner@postgresql.org Thu Sep 4 00:25:07 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id F17FED1B52C + for ; + Thu, 4 Sep 2003 03:25:00 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 82167-09 + for ; + Thu, 4 Sep 2003 00:24:50 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 4F6F7D1B91B + for ; + Thu, 4 Sep 2003 00:24:50 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h843OnDf097774 + for ; Thu, 4 Sep 2003 03:24:49 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h843Ojae097756 + for pgsql-performance@postgresql.org; Thu, 4 Sep 2003 03:24:45 GMT +From: Christopher Browne +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: SELECT's take a long time compared to other DBMS +Date: Wed, 03 Sep 2003 23:19:22 -0400 +Organization: cbbrowne Computing Inc +Lines: 29 +Message-ID: +References: <3F569012.3090209@oasis.net.au> + +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.1003 (Gnus v5.10.3) XEmacs/21.4 (Rational FORTRAN, linux) +Cancel-Lock: sha1:FmkVGPCsvdDes3PEJ7JU0CdmegY= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/46 +X-Sequence-Number: 3412 + +Quoth "Relaxin" : +> Yes I Analyze also, but there was no need to because it was a fresh +> brand new database. + +That is _absolutely not true_. + +It is not true with any DBMS that uses a cost-based optimizer. +Cost-based optimizers need some equivalent to ANALYZE in order to +collect statistics to allow them to pick any path other than a +sequential scan. + +In this particular case, a seq scan is pretty likely to be the best +answer when there is no WHERE clause on the query. + +Actually, it doesn't make all that much sense that the other systems +would be terribly much faster, because they obviously need to do some +processing on 102,384 records. + +Can you tell us what you were *actually* doing? Somehow it sounds as +though the other databases were throwing away the data whereas +PostgreSQL was returning it all "kawhump!" in one batch. + +What programs were you using to submit the queries? +-- +let name="cbbrowne" and tld="acm.org" in name ^ "@" ^ tld;; +http://cbbrowne.com/info/oses.html +"Computers let you make more mistakes faster than any other invention +in human history, with the possible exception of handguns and +tequila." -- Mitch Radcliffe + +From pgsql-performance-owner@postgresql.org Thu Sep 4 00:25:08 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 217D1D1B53A + for ; + Thu, 4 Sep 2003 03:25:01 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 87003-04 + for ; + Thu, 4 Sep 2003 00:24:50 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 532BAD1B94F + for ; + Thu, 4 Sep 2003 00:24:50 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h843OnDh097774 + for ; Thu, 4 Sep 2003 03:24:50 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h843Ok1B097760 + for pgsql-performance@postgresql.org; Thu, 4 Sep 2003 03:24:46 GMT +From: Christopher Browne +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: SELECT's take a long time compared to other DBMS +Date: Wed, 03 Sep 2003 23:24:19 -0400 +Organization: cbbrowne Computing Inc +Lines: 26 +Message-ID: +References: <1062637505.84923.7.camel@jester> + +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.1003 (Gnus v5.10.3) XEmacs/21.4 (Rational FORTRAN, linux) +Cancel-Lock: sha1:WA5ip0o6AX0QZkWBvQgeyHH+AEE= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/47 +X-Sequence-Number: 3413 + +In the last exciting episode, "Relaxin" wrote: +> All queries were ran on the SERVER for all of the databases I tested. + +Queries obviously run "on the server." That's kind of the point of +the database system being a "client/server" system. + +The question is what client program(s) you used to process the result +sets. I'd be surprised to see any client process 100K records in any +meaningful way in much less than 30 seconds. Rendering that much data +into a console will take some time. Drawing it into cells on a GUI +window will take a lot more time. + +Supposing you were using a graphical client, it would be unsurprising +for it to have submitted something equivalent to "limit 30 rows" (or +whatever you can display on screen), and defer further processing 'til +later. If that were the case, then 26s to process the whole thing +would be a lot more efficient than 5-6s to process a mere 30 rows... + +> This is all resulting data for all of the databases that I tested. + +You seem to have omitted "all resulting data." +-- +If this was helpful, rate me +http://www.ntlug.org/~cbbrowne/sap.html +"Women who seek to be equal to men lack ambition. " +-- Timothy Leary + +From pgsql-performance-owner@postgresql.org Thu Sep 4 00:36:34 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E1983D1B8B4 + for ; + Thu, 4 Sep 2003 03:36:24 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 83402-08 + for ; + Thu, 4 Sep 2003 00:36:14 -0300 (ADT) +Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) + by svr1.postgresql.org (Postfix) with ESMTP id B279AD1B56B + for ; + Thu, 4 Sep 2003 00:36:13 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by mailav.tor1.inquent.com (Postfix) with ESMTP + id B1D2E1025B; Wed, 3 Sep 2003 23:28:07 -0400 (EDT) +Received: from [192.168.1.200] (dyn-133-83.tor.dsl.tht.net [134.22.133.83]) + by mailav.tor1.inquent.com (Postfix) with ESMTP + id 7F8D510248; Wed, 3 Sep 2003 23:28:05 -0400 (EDT) +Subject: Re: PostgreSQL Reliability when fsync = false on Linux-XFS +From: Rod Taylor +To: Federico Sevilla III +Cc: PostgreSQL Performance Mailing List , + Linux-XFS Mailing List +In-Reply-To: <20030904030404.GA32319@leathercollection.ph> +References: <20030904030404.GA32319@leathercollection.ph> +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="=-ZUA7x1WEMI42NEQ8G5Oh" +Message-Id: <1062646595.84923.35.camel@jester> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Wed, 03 Sep 2003 23:36:36 -0400 +X-Virus-Scanned: by AMaViS perl-11 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/48 +X-Sequence-Number: 3414 + +--=-ZUA7x1WEMI42NEQ8G5Oh +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +> - the way PostgreSQL expects data to be written to disk without the +> fsync calls for things not to get corrupted in the event of a crash, +> and + +If you want the filesystem to deal with this, I believe it is necessary +for it to write the data out in the same order the write requests are +supplied in between ALL PostgreSQL processes. If you can accomplish +this, you do not need WAL. + +There are shortcuts which can be taken in the above, which is where WAL +comes in. WAL writes are ordered between processes and WAL of a single +process always hits disk prior to commit -- fsync forces both of these. +Due to WAL being in place, data can be written at almost any time. The +benefit to WAL is a single file fsync rather than the entire database +requiring one (PostgreSQL pre-7.1 method). + +> I know that at the end of the day, if I value my data, I must (1) back +> it up regularly, and (2) keep fsync enabled in PostgreSQL. However given +> the significance performance hit (at least as far as massive INSERT or + +If you want good performance, invest in a SCSI controller that has +battery backed write cache. A few megs will do it. You will find +performance similar to fsync being off (you don't wait for disk +rotation) but without the whole dataloss issue. Another alternative is +to buy a small 15krpm disk dedicated for WAL. In theory you can achieve +one commit per rotation. + +I assume your inserts are not supplied in Bulk. The fsync overhead is +per transaction, not per insert. + +--=-ZUA7x1WEMI42NEQ8G5Oh +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: This is a digitally signed message part + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.3 (FreeBSD) + +iD8DBQA/VrNC6DETLow6vwwRAsKhAJ9cqzW44fD1U+hrIQ4/fLZKhP/onQCfXpp6 +c1wPATybuPvCvYC+zsgJiZc= +=fphL +-----END PGP SIGNATURE----- + +--=-ZUA7x1WEMI42NEQ8G5Oh-- + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 01:45:20 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 8B1A6D1B8C5 + for ; + Thu, 4 Sep 2003 04:45:18 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 96634-01 + for ; + Thu, 4 Sep 2003 01:44:48 -0300 (ADT) +Received: from grebe.mail.pas.earthlink.net (grebe.mail.pas.earthlink.net + [207.217.120.46]) + by svr1.postgresql.org (Postfix) with ESMTP id 64212D1B8B3 + for ; + Thu, 4 Sep 2003 01:44:47 -0300 (ADT) +Received: from 0-1pool116-178.nas15.indianapolis1.in.us.da.qwest.net + ([65.128.116.178] helo=nick) + by grebe.mail.pas.earthlink.net with smtp (Exim 3.33 #1) + id 19ulzC-0002v1-00 + for pgsql-performance@postgresql.org; Wed, 03 Sep 2003 21:44:46 -0700 +Reply-To: +From: "Nick Fankhauser" +To: +Subject: Re: SELECT's take a long time compared to other DBMS +Date: Wed, 3 Sep 2003 23:43:45 -0500 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) +In-Reply-To: +Importance: Normal +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/49 +X-Sequence-Number: 3415 + + +> Yes I Analyze also, but there was no need to because it was a fresh brand +> new database. + +This apparently wasn't the source of problem since he did an analyze anyway, +but my impression was that a fresh brand new database is exactly the +situation where an analyze is needed- ie: a batch of data has just been +loaded and stats haven't been collected yet. + +Am I mistaken? + +-Nick + + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 02:03:53 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 9D8DED1B8E9 + for ; + Thu, 4 Sep 2003 05:03:47 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 93554-09 + for ; + Thu, 4 Sep 2003 02:03:37 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 6B268D1B91B + for ; + Thu, 4 Sep 2003 02:03:35 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h84539jX014160; + Thu, 4 Sep 2003 01:03:09 -0400 (EDT) +To: nickf@ontko.com +Cc: pgsql-performance@postgresql.org +Subject: Re: SELECT's take a long time compared to other DBMS +In-reply-to: +References: +Comments: In-reply-to "Nick Fankhauser" + message dated "Wed, 03 Sep 2003 23:43:45 -0500" +Date: Thu, 04 Sep 2003 01:03:08 -0400 +Message-ID: <14159.1062651788@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/50 +X-Sequence-Number: 3416 + +"Nick Fankhauser" writes: +> This apparently wasn't the source of problem since he did an analyze anyway, +> but my impression was that a fresh brand new database is exactly the +> situation where an analyze is needed- ie: a batch of data has just been +> loaded and stats haven't been collected yet. + +Indeed. But as someone else already pointed out, a seqscan is the only +reasonable plan for an unqualified "SELECT whatever FROM table" query; +lack of stats wouldn't deter the planner from arriving at that +conclusion. + +My guess is that the OP is failing to account for some client-side +inefficiency in absorbing a large query result. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Sep 4 03:56:24 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 09B2ED1B8C9 + for ; + Thu, 4 Sep 2003 06:56:22 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 08968-01 + for ; + Thu, 4 Sep 2003 03:55:52 -0300 (ADT) +Received: from fuji.krosing.net (unknown [194.204.44.104]) + by svr1.postgresql.org (Postfix) with ESMTP id 67E59D1B8D3 + for ; + Thu, 4 Sep 2003 03:55:49 -0300 (ADT) +Received: from fuji.krosing.net (localhost.localdomain [127.0.0.1]) + by fuji.krosing.net (8.12.8/8.12.8) with ESMTP id h846tVsC007934; + Thu, 4 Sep 2003 09:55:31 +0300 +Received: (from hannu@localhost) + by fuji.krosing.net (8.12.8/8.12.8/Submit) id h846tRHG007932; + Thu, 4 Sep 2003 09:55:27 +0300 +X-Authentication-Warning: fuji.krosing.net: hannu set sender to hannu@tm.ee + using -f +Subject: Re: PostgreSQL Reliability when fsync = false on +From: Hannu Krosing +To: Rod Taylor +Cc: Federico Sevilla III , + PostgreSQL Performance Mailing List , + Linux-XFS Mailing List +In-Reply-To: <1062646595.84923.35.camel@jester> +References: <20030904030404.GA32319@leathercollection.ph> + <1062646595.84923.35.camel@jester> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1062658526.6270.5.camel@fuji.krosing.net> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Thu, 04 Sep 2003 09:55:27 +0300 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/51 +X-Sequence-Number: 3417 + +Rod Taylor kirjutas N, 04.09.2003 kell 06:36: +> Another alternative is +> to buy a small 15krpm disk dedicated for WAL. In theory you can achieve +> one commit per rotation. + +One commit per rotation would still be only 15000/60. = 250 tps, but +fortunately you can get better results if you use multiple concurrent +backends, then in the best case you can get one commit per backend per +rotation. + +----------------- +Hannu + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 04:03:31 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 2FD3AD1B8FC + for ; + Thu, 4 Sep 2003 07:03:30 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 02911-10 + for ; + Thu, 4 Sep 2003 04:02:59 -0300 (ADT) +Received: from smtp.pspl.co.in (unknown [202.54.11.65]) + by svr1.postgresql.org (Postfix) with ESMTP id DEE54D1B8D3 + for ; + Thu, 4 Sep 2003 04:02:52 -0300 (ADT) +Received: (from root@localhost) + by smtp.pspl.co.in (8.12.9/8.12.9) id h8479KEU008575 + for ; Thu, 4 Sep 2003 12:39:20 +0530 +Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) + (authenticated bits=0) + by persistent.co.in (8.12.9/8.12.9) with ESMTP id h8479ICO008549 + for ; Thu, 4 Sep 2003 12:39:18 +0530 +From: "Shridhar Daithankar" +To: PostgreSQL Performance Mailing List +Date: Thu, 04 Sep 2003 12:34:51 +0530 +MIME-Version: 1.0 +Subject: Re: PostgreSQL Reliability when fsync = false on Linux-XFS +Reply-To: shridhar_daithankar@persistent.co.in +Message-ID: <3F57316B.21521.9DD1CF4@localhost> +In-reply-to: <1062646595.84923.35.camel@jester> +References: <20030904030404.GA32319@leathercollection.ph> +X-mailer: Pegasus Mail for Windows (v4.12a) +Content-type: text/plain; charset=US-ASCII +Content-transfer-encoding: 7BIT +Content-description: Mail message body +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/52 +X-Sequence-Number: 3418 + +On 3 Sep 2003 at 23:36, Rod Taylor wrote: + +> > - the way PostgreSQL expects data to be written to disk without the +> > fsync calls for things not to get corrupted in the event of a crash, +> > and +> +> If you want the filesystem to deal with this, I believe it is necessary +> for it to write the data out in the same order the write requests are +> supplied in between ALL PostgreSQL processes. If you can accomplish +> this, you do not need WAL. +> +> There are shortcuts which can be taken in the above, which is where WAL +> comes in. WAL writes are ordered between processes and WAL of a single +> process always hits disk prior to commit -- fsync forces both of these. +> Due to WAL being in place, data can be written at almost any time. The +> benefit to WAL is a single file fsync rather than the entire database +> requiring one (PostgreSQL pre-7.1 method). +> +> > I know that at the end of the day, if I value my data, I must (1) back +> > it up regularly, and (2) keep fsync enabled in PostgreSQL. However given +> > the significance performance hit (at least as far as massive INSERT or +> +> If you want good performance, invest in a SCSI controller that has +> battery backed write cache. A few megs will do it. You will find +> performance similar to fsync being off (you don't wait for disk +> rotation) but without the whole dataloss issue. Another alternative is +> to buy a small 15krpm disk dedicated for WAL. In theory you can achieve +> one commit per rotation. + +Just wonderin. What if you symlink WAL to a directory which is on mounted USB +RAM drive? + +Will that increase any throughput? I am sure a 256/512MB flash drive will cost +lot less than a SCSI disk. May be even a GB on flash drive would do.. + +Just a thought.. + +Bye + Shridhar + +-- +Ambition, n: An overmastering desire to be vilified by enemies while living and +made ridiculous by friends when dead. -- Ambrose Bierce + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 04:27:47 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 71CA0D1B8BE + for ; + Thu, 4 Sep 2003 07:27:45 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 11194-01 + for ; + Thu, 4 Sep 2003 04:27:36 -0300 (ADT) +Received: from perrin.nxad.com (internal.nxad.com [69.1.70.251]) + by svr1.postgresql.org (Postfix) with ESMTP id 731ECD1B8E9 + for ; + Thu, 4 Sep 2003 04:27:34 -0300 (ADT) +Received: by perrin.nxad.com (Postfix, from userid 1001) + id 395A021058; Thu, 4 Sep 2003 00:27:35 -0700 (PDT) +Date: Thu, 4 Sep 2003 00:27:35 -0700 +From: Sean Chittenden +To: Shridhar Daithankar +Cc: PostgreSQL Performance Mailing List +Subject: Re: PostgreSQL Reliability when fsync = false on Linux-XFS +Message-ID: <20030904072735.GB75041@perrin.nxad.com> +References: <20030904030404.GA32319@leathercollection.ph> + <3F57316B.21521.9DD1CF4@localhost> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <3F57316B.21521.9DD1CF4@localhost> +X-PGP-Key: finger seanc@FreeBSD.org +X-PGP-Fingerprint: 3849 3760 1AFE 7B17 11A0 83A6 DD99 E31F BC84 B341 +X-Web-Homepage: http://sean.chittenden.org/ +User-Agent: Mutt/1.5.4i +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/53 +X-Sequence-Number: 3419 + +> Just wonderin. What if you symlink WAL to a directory which is on +> mounted USB RAM drive? + +USB 2.0 you mean? It supposedly runs at 1394 speeds, but USB 1.0/1.1 +runs at 1MB/s under ideal circumstances... that's slower than even old +IDE drives. + +> Will that increase any throughput? + +Probably not... + +> I am sure a 256/512MB flash drive will cost lot less than a SCSI +> disk. May be even a GB on flash drive would do.. + +That's true... but on a per $$/MB, you're better off investing in RAM +and increasing your effective_cache_size. If dd to a flash card is +faster than to an IDE drive, please let me know. :) -sc + +-- +Sean Chittenden +UNIX(TM), a BSD like Operating System + +From pgsql-performance-owner@postgresql.org Thu Sep 4 04:55:12 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 85685D1B8E9 + for ; + Thu, 4 Sep 2003 07:55:09 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 08914-10 + for ; + Thu, 4 Sep 2003 04:55:00 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 8B45FD1B8BC + for ; + Thu, 4 Sep 2003 04:54:58 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h847soDh054310 + for ; Thu, 4 Sep 2003 07:54:58 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h847mRSV052921 + for pgsql-performance@postgresql.org; Thu, 4 Sep 2003 07:48:27 GMT +From: "Relaxin" +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: SELECT's take a long time compared to other DBMS +Date: Thu, 4 Sep 2003 00:48:42 -0700 +Organization: Hub.Org Networking Services +Lines: 23 +Message-ID: +References: <3F569012.3090209@oasis.net.au> + +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/54 +X-Sequence-Number: 3420 + +> Can you tell us what you were *actually* doing? Somehow it sounds as +> though the other databases were throwing away the data whereas +> PostgreSQL was returning it all "kawhump!" in one batch. + +All of the databases that I tested the query against gave me immediate +access to ANY row of the resultset once the data had been returned. +Ex. If I'm currently at the first row and then wanted to goto the 100,000 +row, I would be there immediately, and if I wanted to then goto the 5 +row...same thing, I have the record immediately! + +The other databases I tested against stored the entire resultset on the +Server, I'm not sure what PG does...It seems that brings the entire +resultset client side. +If that is the case, how can I have PG store the resultset on the Server AND +still allow me immediate access to ANY row in the resultset? + + +> What programs were you using to submit the queries? +I used the same program for all of the database. I was using ODBC as +connectivity. + + + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 04:59:04 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A595BD1BAE7 + for ; + Thu, 4 Sep 2003 07:59:02 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 13221-01 + for ; + Thu, 4 Sep 2003 04:58:53 -0300 (ADT) +Received: from smtp.pspl.co.in (unknown [202.54.11.65]) + by svr1.postgresql.org (Postfix) with ESMTP id 29D13D1B8F5 + for ; + Thu, 4 Sep 2003 04:58:51 -0300 (ADT) +Received: (from root@localhost) + by smtp.pspl.co.in (8.12.9/8.12.9) id h8485LK8026414 + for ; Thu, 4 Sep 2003 13:35:21 +0530 +Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) + (authenticated bits=0) + by persistent.co.in (8.12.9/8.12.9) with ESMTP id h8485JCO026398 + for ; Thu, 4 Sep 2003 13:35:19 +0530 +From: "Shridhar Daithankar" +To: pgsql-performance@postgresql.org +Date: Thu, 04 Sep 2003 13:30:51 +0530 +MIME-Version: 1.0 +Subject: Re: SELECT's take a long time compared to other DBMS +Reply-To: shridhar_daithankar@persistent.co.in +Message-ID: <3F573E8B.31916.A1063F8@localhost> +In-reply-to: +X-mailer: Pegasus Mail for Windows (v4.12a) +Content-type: text/plain; charset=US-ASCII +Content-transfer-encoding: 7BIT +Content-description: Mail message body +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/55 +X-Sequence-Number: 3421 + +On 4 Sep 2003 at 0:48, Relaxin wrote: +> All of the databases that I tested the query against gave me immediate +> access to ANY row of the resultset once the data had been returned. +> Ex. If I'm currently at the first row and then wanted to goto the 100,000 +> row, I would be there immediately, and if I wanted to then goto the 5 +> row...same thing, I have the record immediately! +> +> The other databases I tested against stored the entire resultset on the +> Server, I'm not sure what PG does...It seems that brings the entire +> resultset client side. +> If that is the case, how can I have PG store the resultset on the Server AND +> still allow me immediate access to ANY row in the resultset? + +You can use a cursor and get only required rows. + + +Bye + Shridhar + +-- +Nick the Greek's Law of Life: All things considered, life is 9 to 5 against. + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 05:25:04 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 09310D1BA71 + for ; + Thu, 4 Sep 2003 08:25:01 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 15290-01 + for ; + Thu, 4 Sep 2003 05:24:52 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 651CDD1B8E9 + for ; + Thu, 4 Sep 2003 05:24:50 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h848OoDf062957 + for ; Thu, 4 Sep 2003 08:24:50 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h848GWA7060859 + for pgsql-performance@postgresql.org; Thu, 4 Sep 2003 08:16:32 GMT +From: "Relaxin" +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: SELECT's take a long time compared to other DBMS +Date: Thu, 4 Sep 2003 01:16:47 -0700 +Organization: Hub.Org Networking Services +Lines: 35 +Message-ID: +References: <3F573E8B.31916.A1063F8@localhost> +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/56 +X-Sequence-Number: 3422 + +All rows are required. + +""Shridhar Daithankar"" wrote in +message news:3F573E8B.31916.A1063F8@localhost... +> On 4 Sep 2003 at 0:48, Relaxin wrote: +> > All of the databases that I tested the query against gave me immediate +> > access to ANY row of the resultset once the data had been returned. +> > Ex. If I'm currently at the first row and then wanted to goto the +100,000 +> > row, I would be there immediately, and if I wanted to then goto the 5 +> > row...same thing, I have the record immediately! +> > +> > The other databases I tested against stored the entire resultset on the +> > Server, I'm not sure what PG does...It seems that brings the entire +> > resultset client side. +> > If that is the case, how can I have PG store the resultset on the Server +AND +> > still allow me immediate access to ANY row in the resultset? +> +> You can use a cursor and get only required rows. +> +> +> Bye +> Shridhar +> +> -- +> Nick the Greek's Law of Life: All things considered, life is 9 to 5 +against. +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org +> + + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 07:41:03 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 89C4DD1B914 + for ; + Thu, 4 Sep 2003 10:41:02 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 26209-03 + for ; + Thu, 4 Sep 2003 07:40:54 -0300 (ADT) +Received: from mail.libertyrms.com (unknown [209.167.124.227]) + by svr1.postgresql.org (Postfix) with ESMTP id B341DD1B8A3 + for ; + Thu, 4 Sep 2003 07:40:51 -0300 (ADT) +Received: from [10.1.2.130] (helo=dba2) + by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) + id 19urXq-0005n3-00 + for ; Thu, 04 Sep 2003 06:40:54 -0400 +Received: by dba2 (Postfix, from userid 1019) + id 89AA8CF15; Thu, 4 Sep 2003 06:40:54 -0400 (EDT) +Date: Thu, 4 Sep 2003 06:40:54 -0400 +From: Andrew Sullivan +To: pgsql-performance@postgresql.org +Subject: Re: Query on Postgresql performance +Message-ID: <20030904104054.GA1178@libertyrms.info> +Mail-Followup-To: Andrew Sullivan , + pgsql-performance@postgresql.org +References: <001a01c37252$24f69390$8000000a@usc1mk75s5t1b6> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <001a01c37252$24f69390$8000000a@usc1mk75s5t1b6> +User-Agent: Mutt/1.5.4i +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/57 +X-Sequence-Number: 3423 + +On Wed, Sep 03, 2003 at 12:32:42PM -0700, Naveen Palavalli wrote: +> My server spawns a new connection to Postgresql foreach client. My + +I don't think you want to do that. You should use a pool. Back end +startup is mighty expensive. + +> 1) Effects related to Vaccum :- I performed 10 trials of adding and +> deleting entries . In each trial , 1 client adds 10,000 entries +> and then deletes them . During the course of these 10 trials , + +You'll want to vacuum after every set of deletes, I should think. If +you're woking in more than one transaction for the deletes, then +fairly frequent vacuums of that table will be effective. + +> I was using Postgresql 7.3.3 earlier but it kept crashing the +> database after a Vaccum . So I switched to a older and stabler +> version 7.2.4 + +You don't want to use 7.3.3. It has a rare but serious bug and was +replaced in something like 24 hours with 7.3.4. The 7.2 branch is no +longer being maintained, so you really probably should use the 7.3 +branch. I'm unaware of others having stability problems with 7.3.4, +so if you see them, you should find your core dump and talk to the +people on -hackers. + +A + +-- +---- +Andrew Sullivan 204-4141 Yonge Street +Liberty RMS Toronto, Ontario Canada + M2P 2A8 + +1 416 646 3304 x110 + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 08:02:09 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 7F430D1B8BB + for ; + Thu, 4 Sep 2003 11:02:08 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 24076-10 + for ; + Thu, 4 Sep 2003 08:02:00 -0300 (ADT) +Received: from fuji.krosing.net (silmet.estpak.ee [194.126.97.78]) + by svr1.postgresql.org (Postfix) with ESMTP id 23820D1B8A3 + for ; + Thu, 4 Sep 2003 08:01:57 -0300 (ADT) +Received: from fuji.krosing.net (localhost.localdomain [127.0.0.1]) + by fuji.krosing.net (8.12.8/8.12.8) with ESMTP id h84B1tDN005704; + Thu, 4 Sep 2003 14:01:55 +0300 +Received: (from hannu@localhost) + by fuji.krosing.net (8.12.8/8.12.8/Submit) id h84B1sb8005702; + Thu, 4 Sep 2003 14:01:54 +0300 +X-Authentication-Warning: fuji.krosing.net: hannu set sender to hannu@tm.ee + using -f +Subject: Re: SELECT's take a long time compared to other DBMS +From: Hannu Krosing +To: Relaxin +Cc: pgsql-performance@postgresql.org +In-Reply-To: +References: +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1062673303.5200.135.camel@fuji.krosing.net> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Thu, 04 Sep 2003 14:01:53 +0300 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/58 +X-Sequence-Number: 3424 + +Relaxin kirjutas N, 04.09.2003 kell 03:28: +> I have a table with 102,384 records in it, each record is 934 bytes. + +I created a test database on my Linux (RH9) laptop with 30GB/4200RPM ide +drive and P3-1133Mhz, 768MB, populated it with 128000 rows of 930 bytes +each and did + +[hannu@fuji hannu]$ time psql test100k -c 'select * from test' > +/dev/null + +real 0m3.970s +user 0m0.980s +sys 0m0.570s + +so it seems definitely not a problem with postgres as such, but perhaps +with Cygwin and/or ODBC driver + +I also ran the same query using the "standard" pg adapter: + +>>> import pg, time +>>> +>>> con = pg.connect('test100k') +>>> +>>> def getall(): +... t1 = time.time() +... res = con.query('select * from test') +... t2 = time.time() +... list = res.getresult() +... t3 = time.time() +... print t2 - t1, t3-t2 +... +>>> getall() +3.27637195587 1.10105705261 +>>> getall() +3.07413101196 0.996125936508 +>>> getall() +3.03377199173 1.07322502136 + +which gave similar results + +------------------------------ +Hannu + + + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 10:49:35 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 2EEF0D1B9A6 + for ; + Thu, 4 Sep 2003 13:49:21 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 39231-01 + for ; + Thu, 4 Sep 2003 10:49:14 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id B71DCD1B98D + for ; + Thu, 4 Sep 2003 10:49:09 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h84DmmjX021374; + Thu, 4 Sep 2003 09:48:48 -0400 (EDT) +To: Sean Chittenden +Cc: Shridhar Daithankar , + PostgreSQL Performance Mailing List +Subject: Re: PostgreSQL Reliability when fsync = false on Linux-XFS +In-reply-to: <20030904072735.GB75041@perrin.nxad.com> +References: <20030904030404.GA32319@leathercollection.ph> + <3F57316B.21521.9DD1CF4@localhost> + <20030904072735.GB75041@perrin.nxad.com> +Comments: In-reply-to Sean Chittenden + message dated "Thu, 04 Sep 2003 00:27:35 -0700" +Date: Thu, 04 Sep 2003 09:48:48 -0400 +Message-ID: <21373.1062683328@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/59 +X-Sequence-Number: 3425 + +Sean Chittenden writes: +>> Just wonderin. What if you symlink WAL to a directory which is on +>> mounted USB RAM drive? + +> USB 2.0 you mean? It supposedly runs at 1394 speeds, but USB 1.0/1.1 +> runs at 1MB/s under ideal circumstances... that's slower than even old +> IDE drives. + +>> Will that increase any throughput? + +> Probably not... + +Also, doesn't flash memory have a very limited lifetime in write cycles? +Using it as WAL, you'd wear it out PDQ. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Sep 4 11:55:08 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id D4331D1BA9C + for ; + Thu, 4 Sep 2003 14:55:05 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 43891-04 + for ; + Thu, 4 Sep 2003 11:54:59 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 0E59CD1B9BE + for ; + Thu, 4 Sep 2003 11:54:55 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h84EsoDf071809 + for ; Thu, 4 Sep 2003 14:54:50 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h84EZ6Bb065719 + for pgsql-performance@postgresql.org; Thu, 4 Sep 2003 14:35:06 GMT +From: "Relaxin" +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: SELECT's take a long time compared to other DBMS +Date: Thu, 4 Sep 2003 07:35:24 -0700 +Organization: Hub.Org Networking Services +Lines: 63 +Message-ID: +References: + <1062673303.5200.135.camel@fuji.krosing.net> +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/60 +X-Sequence-Number: 3426 + +So after you did that, where able to position to ANY record within the +resultset? + +Ex. Position 100,000; then to Position 5; then to position 50,000, etc... + +If you are able to do that and have your positioned row available to you +immediately, then I'll believe that it's the ODBC driver. + +"Hannu Krosing" wrote in message +news:1062673303.5200.135.camel@fuji.krosing.net... +> Relaxin kirjutas N, 04.09.2003 kell 03:28: +> > I have a table with 102,384 records in it, each record is 934 bytes. +> +> I created a test database on my Linux (RH9) laptop with 30GB/4200RPM ide +> drive and P3-1133Mhz, 768MB, populated it with 128000 rows of 930 bytes +> each and did +> +> [hannu@fuji hannu]$ time psql test100k -c 'select * from test' > +> /dev/null +> +> real 0m3.970s +> user 0m0.980s +> sys 0m0.570s +> +> so it seems definitely not a problem with postgres as such, but perhaps +> with Cygwin and/or ODBC driver +> +> I also ran the same query using the "standard" pg adapter: +> +> >>> import pg, time +> >>> +> >>> con = pg.connect('test100k') +> >>> +> >>> def getall(): +> ... t1 = time.time() +> ... res = con.query('select * from test') +> ... t2 = time.time() +> ... list = res.getresult() +> ... t3 = time.time() +> ... print t2 - t1, t3-t2 +> ... +> >>> getall() +> 3.27637195587 1.10105705261 +> >>> getall() +> 3.07413101196 0.996125936508 +> >>> getall() +> 3.03377199173 1.07322502136 +> +> which gave similar results +> +> ------------------------------ +> Hannu +> +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 5: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faqs/FAQ.html +> + + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 11:56:25 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 62B1AD1B99E + for ; + Thu, 4 Sep 2003 14:56:18 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 42593-06 + for ; + Thu, 4 Sep 2003 11:55:50 -0300 (ADT) +Received: from beamish.nsd.ca (beamish.nsd.ca [205.150.156.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 01D11D1BA8D + for ; + Thu, 4 Sep 2003 11:55:46 -0300 (ADT) +Received: (from smap@localhost) by beamish.nsd.ca (8.9.3/8.9.3) id KAA03507; + Thu, 4 Sep 2003 10:55:49 -0400 +X-Authentication-Warning: beamish.nsd.ca: smap set sender to + using -f +Received: from reddog.nsd.ca(192.168.101.30) by beamish.nsd.ca via smap + (V2.1/2.1+anti-relay+anti-spam) + id xma003499; Thu, 4 Sep 03 10:55:35 -0400 +Received: from nsd.ca (jllachan-linux.nsd.ca [192.168.101.148]) + by reddog.nsd.ca (8.8.7/8.8.7) with ESMTP id KAA06352; + Thu, 4 Sep 2003 10:43:17 -0400 +Message-ID: <3F5753B9.F4A5A63F@nsd.ca> +Date: Thu, 04 Sep 2003 11:01:13 -0400 +From: Jean-Luc Lachance +X-Mailer: Mozilla 4.8 [en] (X11; U; Linux 2.4.18-24.7.x i686) +X-Accept-Language: en +MIME-Version: 1.0 +To: nickf@ontko.com +Cc: pgsql-performance@postgresql.org +Subject: Re: SELECT's take a long time compared to other DBMS +References: +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/61 +X-Sequence-Number: 3427 + +You forgot that the original poster's query was: + SELECT * from
+ +This should require a simple table scan. NO need for stats. +Either the table has not been properly vacuumed or he's got seq_scan +off... + +JLL + + +Nick Fankhauser wrote: +> +> > Yes I Analyze also, but there was no need to because it was a fresh brand +> > new database. +> +> This apparently wasn't the source of problem since he did an analyze anyway, +> but my impression was that a fresh brand new database is exactly the +> situation where an analyze is needed- ie: a batch of data has just been +> loaded and stats haven't been collected yet. +> +> Am I mistaken? +> +> -Nick +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: you can get off all lists at once with the unregister command +> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) + +From pgsql-performance-owner@postgresql.org Thu Sep 4 12:25:41 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3AF04D1B8CB + for ; + Thu, 4 Sep 2003 15:25:07 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 47853-02 + for ; + Thu, 4 Sep 2003 12:24:56 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 705C7D1B89A + for ; + Thu, 4 Sep 2003 12:24:56 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h84FOuDf081734 + for ; Thu, 4 Sep 2003 15:24:56 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h84F521X075771 + for pgsql-performance@postgresql.org; Thu, 4 Sep 2003 15:05:02 GMT +From: "Relaxin" +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: SELECT's take a long time compared to other DBMS +Date: Thu, 4 Sep 2003 08:05:15 -0700 +Organization: Hub.Org Networking Services +Lines: 39 +Message-ID: +References: + <3F5753B9.F4A5A63F@nsd.ca> +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/62 +X-Sequence-Number: 3428 + +The table has been Vacuumed and seq_scan is turned on. + +"Jean-Luc Lachance" wrote in message +news:3F5753B9.F4A5A63F@nsd.ca... +> You forgot that the original poster's query was: +> SELECT * from
+> +> This should require a simple table scan. NO need for stats. +> Either the table has not been properly vacuumed or he's got seq_scan +> off... +> +> JLL +> +> +> Nick Fankhauser wrote: +> > +> > > Yes I Analyze also, but there was no need to because it was a fresh +brand +> > > new database. +> > +> > This apparently wasn't the source of problem since he did an analyze +anyway, +> > but my impression was that a fresh brand new database is exactly the +> > situation where an analyze is needed- ie: a batch of data has just been +> > loaded and stats haven't been collected yet. +> > +> > Am I mistaken? +> > +> > -Nick +> > +> > ---------------------------(end of broadcast)--------------------------- +> > TIP 2: you can get off all lists at once with the unregister command +> > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 7: don't forget to increase your free space map settings +> + + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 13:10:25 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id D49F6D1B99C + for ; + Thu, 4 Sep 2003 16:10:22 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 51223-05 + for ; + Thu, 4 Sep 2003 13:09:52 -0300 (ADT) +Received: from lorax.kciLink.com (lorax.kciLink.com [206.112.95.1]) + by svr1.postgresql.org (Postfix) with ESMTP id F2951D1B574 + for ; + Thu, 4 Sep 2003 13:09:51 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id A896F3E33 + for ; + Thu, 4 Sep 2003 12:09:51 -0400 (EDT) +Received: from lorax.kciLink.com ([127.0.0.1]) + by localhost (lorax.kciLink.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 16807-01 for ; + Thu, 4 Sep 2003 12:09:41 -0400 (EDT) +Received: from lorax.kciLink.com (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id F1D523E24 + for ; + Thu, 4 Sep 2003 12:09:40 -0400 (EDT) +Received: (from news@localhost) + by lorax.kciLink.com (8.12.8p1/8.12.8/Submit) id h84G9esH023187 + for pgsql-performance@postgresql.org; + Thu, 4 Sep 2003 12:09:40 -0400 (EDT) +To: pgsql-performance@postgresql.org +Path: not-for-mail +From: Vivek Khera +Newsgroups: ml.postgres.performance +Subject: Re: FreeBSD page size +Date: Thu, 04 Sep 2003 12:09:40 -0400 +Organization: Khera Communications, Inc., Rockville, MD +Lines: 45 +Message-ID: +References: <3F4C0DC4.8070105@potentialtech.com> + <001201c36d24$3c572460$0500a8c0@MOBILE01> + + <20030828161233.GB83759@perrin.nxad.com> + <3F4E54FB.3020408@potentialtech.com> + <20030828193123.GI83317@perrin.nxad.com> + + + <20030903173214.I803@ganymede.hub.org> +NNTP-Posting-Host: yertle.kcilink.com +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Trace: lorax.kciLink.com 1062691780 65673 216.194.193.105 (4 Sep 2003 + 16:09:40 GMT) +X-Complaints-To: daemon@kciLink.com +NNTP-Posting-Date: Thu, 4 Sep 2003 16:09:40 +0000 (UTC) +User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Portable Code, + berkeley-unix) +Cancel-Lock: sha1:Cr0ew9tZP8ilJHNbIEHAiUaleds= +X-Virus-Scanned: by amavisd-new at kciLink.com +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/63 +X-Sequence-Number: 3429 + +>>>>> "MGF" == Marc G Fournier writes: + +MGF> Just curious, but Bruce(?) mentioned that apparently a 32k block size was +MGF> found to show a 15% improvement ... care to run one more test? :) + + +Well, it is hard to tell based on my quick and dirty test: + +16k page size: +restore time: 11322 seconds +vacuum analyze time: 1663 seconds (27 minutes) +select count(*) from user_list where owner_id=315; 56666.64 ms + + + +32k page size: +restore time: 11430 seconds +vacuum analyze time: 1346 seconds +select count(*) from user_list where owner_id=315; 63275.73 ms + + +one anomaly I note is that if I re-run the select count(*) query +above, the large the page size, the longer the query takes. In the +standard 8k page size, it was on the order of 306ms, with 16k page +size it was over 1400, and with 32k page size nearly 3000ms. + +Another anomaly I note is that for the larger indexes, the relpages +doesn't scale as expected. ie, I'd expect roughly half the relpages +per index for 32k page size as for 16k page size, but this is not +always the case... some are about the same size and some are about 2/3 +and some are about 1/2. The smaller indexes are often the same number +of pages (when under 20 pages). + + +I think I'm going to write a synthetic load generator that does a +bunch of inserts to some linked tables with several indexes, then goes +thru and pounds on it (update/select) from multiple children with +occasional vacuum's thrown in. That's the only way to get 'real' +numbers, it seems. + +-- +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Vivek Khera, Ph.D. Khera Communications, Inc. +Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 +AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ + +From pgsql-performance-owner@postgresql.org Thu Sep 4 13:30:46 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 6BDB1D1B9A8 + for ; + Thu, 4 Sep 2003 16:30:44 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 55572-01 + for ; + Thu, 4 Sep 2003 13:30:13 -0300 (ADT) +Received: from fuji.krosing.net (silmet.estpak.ee [194.126.97.78]) + by svr1.postgresql.org (Postfix) with ESMTP id BA231D1BAB6 + for ; + Thu, 4 Sep 2003 13:30:11 -0300 (ADT) +Received: from fuji.krosing.net (localhost.localdomain [127.0.0.1]) + by fuji.krosing.net (8.12.8/8.12.8) with ESMTP id h84GUADN006608; + Thu, 4 Sep 2003 19:30:10 +0300 +Received: (from hannu@localhost) + by fuji.krosing.net (8.12.8/8.12.8/Submit) id h84GU9H4006606; + Thu, 4 Sep 2003 19:30:09 +0300 +X-Authentication-Warning: fuji.krosing.net: hannu set sender to hannu@tm.ee + using -f +Subject: Re: SELECT's take a long time compared to other DBMS +From: Hannu Krosing +To: Relaxin +Cc: pgsql-performance@postgresql.org +In-Reply-To: +References: + <1062673303.5200.135.camel@fuji.krosing.net> + +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1062693009.6174.21.camel@fuji.krosing.net> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Thu, 04 Sep 2003 19:30:09 +0300 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/64 +X-Sequence-Number: 3430 + +Relaxin kirjutas N, 04.09.2003 kell 17:35: +> So after you did that, where able to position to ANY record within the +> resultset? +> +> Ex. Position 100,000; then to Position 5; then to position 50,000, etc... + +not in the case of : + time psql test100k -c 'select * from test' > /dev/null +as the whole result would be written to dev null (i.e discarded) + +Yes in case of python: after doing + +res = con.query('select * from test') # 3 sec - perform query +list = res.getresult() # 1 sec - construct list of tuples + +the whole 128k records are in a python list , +so that i can immediately access any record by python list syntax, +ie list[5], list[50000] etc. + +> If you are able to do that and have your positioned row available to you +> immediately, then I'll believe that it's the ODBC driver. + +It can also be the Cygwin port, which is known to have several problems, +and if you run both your client and server on the same machine, then it +can also be an interaction of the two processes (cygwin/pgsql server and +native win32 ODBC client) not playing together very well. + +> "Hannu Krosing" wrote in message +> news:1062673303.5200.135.camel@fuji.krosing.net... +> > Relaxin kirjutas N, 04.09.2003 kell 03:28: +> > > I have a table with 102,384 records in it, each record is 934 bytes. +> > +> > I created a test database on my Linux (RH9) laptop with 30GB/4200RPM ide +> > drive and P3-1133Mhz, 768MB, populated it with 128000 rows of 930 bytes +> > each and did +> > +> > [hannu@fuji hannu]$ time psql test100k -c 'select * from test' > +> > /dev/null +> > +> > real 0m3.970s +> > user 0m0.980s +> > sys 0m0.570s +> > +> > so it seems definitely not a problem with postgres as such, but perhaps +> > with Cygwin and/or ODBC driver +> > +> > I also ran the same query using the "standard" pg adapter: +> > +> > >>> import pg, time +> > >>> +> > >>> con = pg.connect('test100k') +> > >>> +> > >>> def getall(): +> > ... t1 = time.time() +> > ... res = con.query('select * from test') +> > ... t2 = time.time() +> > ... list = res.getresult() +> > ... t3 = time.time() +> > ... print t2 - t1, t3-t2 +> > ... +> > >>> getall() +> > 3.27637195587 1.10105705261 +> > >>> getall() +> > 3.07413101196 0.996125936508 +> > >>> getall() +> > 3.03377199173 1.07322502136 +> > +> > which gave similar results +------------------- +Hannu + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 13:55:08 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 7883ED1B9BE + for ; + Thu, 4 Sep 2003 16:55:07 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 55701-05 + for ; + Thu, 4 Sep 2003 13:54:57 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id A605CD1B8C6 + for ; + Thu, 4 Sep 2003 13:54:56 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h84GsuDf009752 + for ; Thu, 4 Sep 2003 16:54:56 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h84GqFL7009131 + for pgsql-performance@postgresql.org; Thu, 4 Sep 2003 16:52:15 GMT +From: "Relaxin" +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: SELECT's take a long time compared to other DBMS +Date: Thu, 4 Sep 2003 09:52:29 -0700 +Organization: Hub.Org Networking Services +Lines: 84 +Message-ID: +References: + <1062673303.5200.135.camel@fuji.krosing.net> + + <1062693009.6174.21.camel@fuji.krosing.net> +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/65 +X-Sequence-Number: 3431 + +I had these same issues with the PeerDirect version also. +"Hannu Krosing" wrote in message +news:1062693009.6174.21.camel@fuji.krosing.net... +> Relaxin kirjutas N, 04.09.2003 kell 17:35: +> > So after you did that, where able to position to ANY record within the +> > resultset? +> > +> > Ex. Position 100,000; then to Position 5; then to position 50,000, +etc... +> +> not in the case of : +> time psql test100k -c 'select * from test' > /dev/null +> as the whole result would be written to dev null (i.e discarded) +> +> Yes in case of python: after doing +> +> res = con.query('select * from test') # 3 sec - perform query +> list = res.getresult() # 1 sec - construct list of tuples +> +> the whole 128k records are in a python list , +> so that i can immediately access any record by python list syntax, +> ie list[5], list[50000] etc. +> +> > If you are able to do that and have your positioned row available to you +> > immediately, then I'll believe that it's the ODBC driver. +> +> It can also be the Cygwin port, which is known to have several problems, +> and if you run both your client and server on the same machine, then it +> can also be an interaction of the two processes (cygwin/pgsql server and +> native win32 ODBC client) not playing together very well. +> +> > "Hannu Krosing" wrote in message +> > news:1062673303.5200.135.camel@fuji.krosing.net... +> > > Relaxin kirjutas N, 04.09.2003 kell 03:28: +> > > > I have a table with 102,384 records in it, each record is 934 bytes. +> > > +> > > I created a test database on my Linux (RH9) laptop with 30GB/4200RPM +ide +> > > drive and P3-1133Mhz, 768MB, populated it with 128000 rows of 930 +bytes +> > > each and did +> > > +> > > [hannu@fuji hannu]$ time psql test100k -c 'select * from test' > +> > > /dev/null +> > > +> > > real 0m3.970s +> > > user 0m0.980s +> > > sys 0m0.570s +> > > +> > > so it seems definitely not a problem with postgres as such, but +perhaps +> > > with Cygwin and/or ODBC driver +> > > +> > > I also ran the same query using the "standard" pg adapter: +> > > +> > > >>> import pg, time +> > > >>> +> > > >>> con = pg.connect('test100k') +> > > >>> +> > > >>> def getall(): +> > > ... t1 = time.time() +> > > ... res = con.query('select * from test') +> > > ... t2 = time.time() +> > > ... list = res.getresult() +> > > ... t3 = time.time() +> > > ... print t2 - t1, t3-t2 +> > > ... +> > > >>> getall() +> > > 3.27637195587 1.10105705261 +> > > >>> getall() +> > > 3.07413101196 0.996125936508 +> > > >>> getall() +> > > 3.03377199173 1.07322502136 +> > > +> > > which gave similar results +> ------------------- +> Hannu +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 8: explain analyze is your friend +> + + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 14:41:24 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 140E8D1B914 + for ; + Thu, 4 Sep 2003 17:41:22 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 61437-02 + for ; + Thu, 4 Sep 2003 14:41:12 -0300 (ADT) +Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) + by svr1.postgresql.org (Postfix) with ESMTP id B9326D1B9A4 + for ; + Thu, 4 Sep 2003 14:41:10 -0300 (ADT) +Received: from ibm-e.pdx.osdl.net (ibm-e.pdx.osdl.net [172.20.1.71]) + by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h84HfAo23290; + Thu, 4 Sep 2003 10:41:10 -0700 +Subject: [GENERAL] how to get accurate values in pg_statistic (continued) +From: Mary Edie Meredith +To: pgsql-performance +Cc: osdldbt-general +Content-Type: text/plain +Organization: Open Source Development Lab +Message-Id: <1062697270.6854.3475.camel@ibm-e.pdx.osdl.net> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.2.2 +Date: 04 Sep 2003 10:41:10 -0700 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/66 +X-Sequence-Number: 3432 + +Our port of OSDL DBT3 test suite to PostgreSQL (see Background +information below) is nearing completion. We would also like to confirm +our understanding of an outstanding consistency issue. + +We have not been able to do meaningful kernel testing since the runs +(all parameters/kernels being equal) arewildly varying - sometimes +20-25% differences in the metrics run to run. + +We found plans were changing from test run to test run. In one case a +plan ran 20 minutes in the throughput test of one run, and 2 seconds in +another run! By forcing the contents of pg_statistics to be the same +before the queries run, we have consistent results now. So we know for +sure the problem is due to the random nature of the stats sampling: the +optimizer always saw different stats data resulting in different plans. + +Stephan Szabo kindly responded to our earlier queries suggesting we look +at default_statistics_target and ALTER TABLE ALTER COLUMN SET +STATISTICS. + +These determine the number of bins in the histogram for a given column. +But for a large number of rows (for example 6 million) the maximum value +(1000) does not guarantee that ANALYZE will do a full scan of the table. +We do not see a way to guarantee the same statistics run to run without +forcing ANALYZE to examine every row of every table. + +Are we wrong in our analysis? + +Are there main-stream alternatives we have missed? + +How do you do testing on large tables and make the execution plans +consistent? + +Is there a change to ANALYZE in 7.4 that solves our problem? + +TIA. + + +******************************************************************** +Background information: + +Database Test 3 (DBT-3) is a decision support workload. + +The test kit itself has been executing on PostgreSQL for some time, is +available on sourceforge, and is implemented on our Scalable Test +Platform (STP). + + +A bit of background: The test +(1) builds a database from load files, gathers statistics, +(2) runs a single stream of 22 queries plus a set of inserts and deletes +(the power test), then +(3) runs a multiple stream of the queries with one added stream of +inserts/deletes (the throughput test). + + +-- +Mary Edie Meredith +Open Source Development Lab + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 14:56:29 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E54C8D1B56C + for ; + Thu, 4 Sep 2003 17:55:07 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 61260-08 + for ; + Thu, 4 Sep 2003 14:54:58 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 55FF3D1BAA1 + for ; + Thu, 4 Sep 2003 14:54:57 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h84HsuDf027289 + for ; Thu, 4 Sep 2003 17:54:56 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h84HiMaZ024094 + for pgsql-performance@postgresql.org; Thu, 4 Sep 2003 17:44:22 GMT +From: William Yu +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: SELECT's take a long time compared to other DBMS +Date: Thu, 04 Sep 2003 10:44:28 -0700 +Organization: Hub.Org Networking Services +Lines: 31 +Message-ID: +References: +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@news.hub.org +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; + rv:1.4) Gecko/20030624 +X-Accept-Language: en-us, en +In-Reply-To: +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/67 +X-Sequence-Number: 3433 + +Relaxin wrote: +> I have a table with 102,384 records in it, each record is 934 bytes. +> +> Using the follow select statement: +> SELECT * from
+> +> PG Info: version 7.3.4 under cygwin on Windows 2000 +> ODBC: version 7.3.100 +> +> Machine: 500 Mhz/ 512MB RAM / IDE HDD +> +> Under PG: Data is returned in 26 secs!! +> Under SQL Server: Data is returned in 5 secs. +> Under SQLBase: Data is returned in 6 secs. +> Under SAPDB: Data is returned in 7 secs. + +I created a similar table (934 bytes, 102K records) on a slightly faster +machine: P3/800 + 512MB RAM + IDE HD. The server OS is Solaris 8 x86 and +the version is 7.3.3. + +On the server (via PSQL client) : 7.5 seconds +Using ODBC under VFPW: 10.5 seconds + +How that translates to what you should see, I'm not sure. Assuming it +was just the CPU difference, you should see numbers of roughly 13 +seconds. But the documentation says PG under CYGWIN is significantly +slower than PG under UNIX so your mileage may vary... + +Have you changed any of the settings yet in postgresql.conf, +specifically the shared_buffers setting? + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 15:25:18 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E8117D1B914 + for ; + Thu, 4 Sep 2003 17:47:14 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 59917-09 + for ; + Thu, 4 Sep 2003 14:46:43 -0300 (ADT) +Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) + by svr1.postgresql.org (Postfix) with ESMTP id 9FD24D1B53A + for ; + Thu, 4 Sep 2003 14:46:42 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by mailav.tor1.inquent.com (Postfix) with ESMTP + id 96BDC1025C; Thu, 4 Sep 2003 13:38:21 -0400 (EDT) +Received: from [10.0.2.5] (unknown [10.0.2.5]) + by mailav.tor1.inquent.com (Postfix) with ESMTP + id 18CEB10260; Thu, 4 Sep 2003 13:38:19 -0400 (EDT) +Subject: Re: [GENERAL] how to get accurate values in pg_statistic +From: Rod Taylor +To: Mary Edie Meredith +Cc: pgsql-performance , + OSDL - DB General +In-Reply-To: <1062697270.6854.3475.camel@ibm-e.pdx.osdl.net> +References: <1062697270.6854.3475.camel@ibm-e.pdx.osdl.net> +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="=-BhL2i6Xr3wD7stp4E1O0" +Message-Id: <1062697606.88158.7.camel@jester> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Thu, 04 Sep 2003 13:46:47 -0400 +X-Virus-Scanned: by AMaViS perl-11 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/68 +X-Sequence-Number: 3434 + +--=-BhL2i6Xr3wD7stp4E1O0 +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +On Thu, 2003-09-04 at 13:41, Mary Edie Meredith wrote: +> Our port of OSDL DBT3 test suite to PostgreSQL (see Background +> information below) is nearing completion. We would also like to confirm +> our understanding of an outstanding consistency issue. +>=20 +> We have not been able to do meaningful kernel testing since the runs +> (all parameters/kernels being equal) arewildly varying - sometimes +> 20-25% differences in the metrics run to run.=20 + +Run a VACUUM FULL ANALYZE between runs. This will force a full scan of +all data for stats, as well as ensure the table is consistently +compacted. + +--=-BhL2i6Xr3wD7stp4E1O0 +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: This is a digitally signed message part + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.3 (FreeBSD) + +iD8DBQA/V3qG6DETLow6vwwRAp9gAJ4zkYIOKsxrJ9o4iSjmDXRMOiAOlgCbBGff +jeCNRMGsXwXCpldxJtNXXMI= +=uQYr +-----END PGP SIGNATURE----- + +--=-BhL2i6Xr3wD7stp4E1O0-- + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 16:28:10 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B4EE8D1B53A + for ; + Thu, 4 Sep 2003 18:17:38 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 67090-01 + for ; + Thu, 4 Sep 2003 15:17:29 -0300 (ADT) +Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) + by svr1.postgresql.org (Postfix) with ESMTP id 90F70D1BAA0 + for ; + Thu, 4 Sep 2003 15:17:26 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id h84IHLA05216; + Thu, 4 Sep 2003 14:17:21 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200309041817.h84IHLA05216@candle.pha.pa.us> +Subject: Re: FreeBSD page size +In-Reply-To: +To: Vivek Khera +Date: Thu, 4 Sep 2003 14:17:21 -0400 (EDT) +Cc: pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL106 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/69 +X-Sequence-Number: 3435 + +Vivek Khera wrote: +> >>>>> "MGF" == Marc G Fournier writes: +> +> MGF> Just curious, but Bruce(?) mentioned that apparently a 32k block size was +> MGF> found to show a 15% improvement ... care to run one more test? :) +> +> +> Well, it is hard to tell based on my quick and dirty test: + +The 32k number is from Tatsuo testing a few years ago. + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Thu Sep 4 18:07:15 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A5D6D1B914 + for ; + Thu, 4 Sep 2003 20:56:50 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 23916-06 + for ; + Thu, 4 Sep 2003 17:56:20 -0300 (ADT) +Received: from lorax.kciLink.com (lorax.kciLink.com [206.112.95.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 15591D1BA96 + for ; + Thu, 4 Sep 2003 17:56:18 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id 46FB43E22 + for ; + Thu, 4 Sep 2003 16:56:20 -0400 (EDT) +Received: from lorax.kciLink.com ([127.0.0.1]) + by localhost (lorax.kciLink.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 39638-07 for ; + Thu, 4 Sep 2003 16:56:09 -0400 (EDT) +Received: from lorax.kciLink.com (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id BC54F3E07 + for ; + Thu, 4 Sep 2003 16:56:09 -0400 (EDT) +Received: (from news@localhost) + by lorax.kciLink.com (8.12.8p1/8.12.8/Submit) id h84Ku9qN054564 + for pgsql-performance@postgresql.org; + Thu, 4 Sep 2003 16:56:09 -0400 (EDT) +To: pgsql-performance@postgresql.org +Path: not-for-mail +From: Vivek Khera +Newsgroups: ml.postgres.performance +Subject: Re: FreeBSD page size +Date: Thu, 04 Sep 2003 16:56:09 -0400 +Organization: Khera Communications, Inc., Rockville, MD +Lines: 22 +Message-ID: +References: <200309041817.h84IHLA05216@candle.pha.pa.us> +NNTP-Posting-Host: yertle.kcilink.com +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Trace: lorax.kciLink.com 1062708969 55971 216.194.193.105 (4 Sep 2003 + 20:56:09 GMT) +X-Complaints-To: daemon@kciLink.com +NNTP-Posting-Date: Thu, 4 Sep 2003 20:56:09 +0000 (UTC) +User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Portable Code, + berkeley-unix) +Cancel-Lock: sha1:OS84l2oAUgOI0M5LkZWGXDewpZE= +X-Virus-Scanned: by amavisd-new at kciLink.com +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/70 +X-Sequence-Number: 3436 + +>>>>> "BM" == Bruce Momjian writes: + + +BM> The 32k number is from Tatsuo testing a few years ago. + +Can you verify for me that these parameters in postgresql.conf are +based on the BLCKSZ (ie one buffer is the size of the BLCKSIZ macro): + +shared_buffers +effective_cache_size + +Logically it makes sense, but I want to be sure I'm adjusting my +postgresql.conf parameters accordingly when I try different block +sizes. + +Thanks. + +-- +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Vivek Khera, Ph.D. Khera Communications, Inc. +Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 +AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ + +From pgsql-performance-owner@postgresql.org Thu Sep 4 18:59:26 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 0F7BFD1B899 + for ; + Thu, 4 Sep 2003 21:59:25 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 52601-07 + for ; + Thu, 4 Sep 2003 18:59:14 -0300 (ADT) +Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) + by svr1.postgresql.org (Postfix) with ESMTP id 81D3FD1B897 + for ; + Thu, 4 Sep 2003 18:59:08 -0300 (ADT) +Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) + by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h84LwJp5009213; + Thu, 4 Sep 2003 15:58:19 -0600 (MDT) +Date: Thu, 4 Sep 2003 15:56:22 -0600 (MDT) +From: "scott.marlowe" +To: Vivek Khera +Cc: +Subject: Re: FreeBSD page size (was Re: The results of my +In-Reply-To: +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-IHS-MailScanner: Found to be clean +X-IHS-MailScanner-SpamCheck: +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/71 +X-Sequence-Number: 3437 + +On Wed, 3 Sep 2003, Vivek Khera wrote: + +> >>>>> "SC" == Sean Chittenden writes: +> +> >> I need to step in and do 2 things: +> SC> Thanks for posting that. Let me know if you have any questions while +> SC> doing your testing. I've found that using 16K blocks on FreeBSD +> SC> results in about an 8% speedup in writes to the database, fwiw. +> +> Just double checking: if I do this, then I need to halve the +> parameters in postgresql.conf that involve buffers, specifically, +> max_fsm_pages and shared_buffers. I think max_fsm_pages should be +> adjusted since the number of pages in the system overall has been +> halved. +> +> Anything else that should be re-tuned for this? + +Yes, effective_cache_size as well is measured in pgsql blocks. + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 19:13:05 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B482DD1B8E9 + for ; + Thu, 4 Sep 2003 22:13:03 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 53358-10 + for ; + Thu, 4 Sep 2003 19:12:55 -0300 (ADT) +Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) + by svr1.postgresql.org (Postfix) with ESMTP id 95A99D1B89D + for ; + Thu, 4 Sep 2003 19:12:49 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id h84MCkE29256; + Thu, 4 Sep 2003 18:12:46 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200309042212.h84MCkE29256@candle.pha.pa.us> +Subject: Re: FreeBSD page size +In-Reply-To: +To: Vivek Khera +Date: Thu, 4 Sep 2003 18:12:46 -0400 (EDT) +Cc: pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL106 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/72 +X-Sequence-Number: 3438 + +Vivek Khera wrote: +> >>>>> "BM" == Bruce Momjian writes: +> +> +> BM> The 32k number is from Tatsuo testing a few years ago. +> +> Can you verify for me that these parameters in postgresql.conf are +> based on the BLCKSZ (ie one buffer is the size of the BLCKSIZ macro): +> +> shared_buffers +> effective_cache_size +> +> Logically it makes sense, but I want to be sure I'm adjusting my +> postgresql.conf parameters accordingly when I try different block +> sizes. + +Uh, yes, I think they have to be the same because they are pages in the +shared buffer cache, not disk blocks. + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Thu Sep 4 19:13:23 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id D47D3D1B53A + for ; + Thu, 4 Sep 2003 22:13:19 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 52797-08 + for ; + Thu, 4 Sep 2003 19:13:11 -0300 (ADT) +Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) + by svr1.postgresql.org (Postfix) with ESMTP id 2F0A7D1B973 + for ; + Thu, 4 Sep 2003 19:13:08 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id h84MDBA29273; + Thu, 4 Sep 2003 18:13:11 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200309042213.h84MDBA29273@candle.pha.pa.us> +Subject: Re: FreeBSD page size +In-Reply-To: +To: Vivek Khera +Date: Thu, 4 Sep 2003 18:13:11 -0400 (EDT) +Cc: pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL106 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/73 +X-Sequence-Number: 3439 + +Vivek Khera wrote: +> >>>>> "BM" == Bruce Momjian writes: +> +> +> BM> The 32k number is from Tatsuo testing a few years ago. +> +> Can you verify for me that these parameters in postgresql.conf are +> based on the BLCKSZ (ie one buffer is the size of the BLCKSIZ macro): +> +> shared_buffers +> effective_cache_size +> +> Logically it makes sense, but I want to be sure I'm adjusting my +> postgresql.conf parameters accordingly when I try different block +> sizes. + +Also, to check, you can use ipcs to see the shared memory sizes +allocated. + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Thu Sep 4 19:32:18 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 9E025D1B8E0 + for ; + Thu, 4 Sep 2003 22:32:17 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 56799-04 + for ; + Thu, 4 Sep 2003 19:32:08 -0300 (ADT) +Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) + by svr1.postgresql.org (Postfix) with ESMTP id C1FECD1B52C + for ; + Thu, 4 Sep 2003 19:32:05 -0300 (ADT) +Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) + by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h84MUXp5012286; + Thu, 4 Sep 2003 16:30:33 -0600 (MDT) +Date: Thu, 4 Sep 2003 16:28:36 -0600 (MDT) +From: "scott.marlowe" +To: Relaxin +Cc: +Subject: Re: SELECT's take a long time compared to other DBMS +In-Reply-To: +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-IHS-MailScanner: Found to be clean +X-IHS-MailScanner-SpamCheck: +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/74 +X-Sequence-Number: 3440 + +On Wed, 3 Sep 2003, Relaxin wrote: + +> I have a table with 102,384 records in it, each record is 934 bytes. +> +> Using the follow select statement: +> SELECT * from
+> +> PG Info: version 7.3.4 under cygwin on Windows 2000 +> ODBC: version 7.3.100 +> +> Machine: 500 Mhz/ 512MB RAM / IDE HDD +> +> +> Under PG: Data is returned in 26 secs!! +> Under SQL Server: Data is returned in 5 secs. +> Under SQLBase: Data is returned in 6 secs. +> Under SAPDB: Data is returned in 7 secs. + +This is typical of postgresql under cygwin, it's much faster under a Unix +OS like Linux or BSD. That said, you CAN do some things to help speed it +up, the biggest being tuning the shared_buffers to be something large +enough to hold a fair bit of data. Set the shared_buffers to 1000, +restart, and see if things get better. + +Running Postgresql in a unix emulation layer is guaranteed to make it +slow. If you've got a spare P100 with 128 Meg of RAM you can throw redhat +9 or FreeBSD 4.7 on and run Postgresql on, it will likely outrun your +500MHZ cygwin box, and might even keep up with the other databases on that +machine as well. + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 19:38:26 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 59A68D1B8A8 + for ; + Thu, 4 Sep 2003 22:38:25 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 54964-07 + for ; + Thu, 4 Sep 2003 19:38:15 -0300 (ADT) +Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) + by svr1.postgresql.org (Postfix) with ESMTP id ABABFD1B89D + for ; + Thu, 4 Sep 2003 19:38:12 -0300 (ADT) +Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) + by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h84Mb6p5012758; + Thu, 4 Sep 2003 16:37:06 -0600 (MDT) +Date: Thu, 4 Sep 2003 16:35:08 -0600 (MDT) +From: "scott.marlowe" +To: Federico Sevilla III +Cc: PostgreSQL Performance Mailing List , + Linux-XFS Mailing List +Subject: Re: PostgreSQL Reliability when fsync = false on Linux-XFS +In-Reply-To: <20030904030404.GA32319@leathercollection.ph> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-IHS-MailScanner: Found to be clean +X-IHS-MailScanner-SpamCheck: +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/75 +X-Sequence-Number: 3441 + +On Thu, 4 Sep 2003, Federico Sevilla III wrote: + +> (Please follow Mail-Followup-To, I'm not on the pgsql-performance +> mailing list but am on the Linux-XFS mailing list. My apologies too for +> the cross-post. I'm cc'ing the Linux-XFS mailing list in case people +> there will be interested in this, too.) +> +> +> Hi, +> +> We have a server running PostgreSQL v7.3.3 on Debian GNU/Linux with +> Linux kernel 2.4.21-xfs. The PostgreSQL data is stored on an XFS[1] + +Two points. + +1: 7.3.3 has a data loss issue fixed in 7.3.4. You should upgrade to +avoid the pain associated with this problem. + +2: When you turn off fsync, all bets are off. If the data doesn't get +written in the right order, your database may be corrupted if power is +shut off. + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 19:42:15 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 859DCD1B52C + for ; + Thu, 4 Sep 2003 22:42:10 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 57676-02 + for ; + Thu, 4 Sep 2003 19:41:42 -0300 (ADT) +Received: from gbg-web01 (unknown [193.243.135.18]) + by svr1.postgresql.org (Postfix) with ESMTP id 59A27D1B8A4 + for ; + Thu, 4 Sep 2003 19:41:38 -0300 (ADT) +Received: from webmail.defero.se (localhost [127.0.0.1]) + by gbg-web01 (Postfix) with SMTP id 8CD0D308003 + for ; + Fri, 5 Sep 2003 00:53:46 +0200 (CEST) +Received: from 62.119.108.236 (SquirrelMail authenticated user rasmus) + by www.defero.se with HTTP; Fri, 5 Sep 2003 00:53:46 +0200 (CEST) +Message-ID: <1564.62.119.108.236.1062716026.squirrel@www.defero.se> +Date: Fri, 5 Sep 2003 00:53:46 +0200 (CEST) +Subject: Performance problems on a fairly big table with two key columns. +From: "Rasmus Aveskogh" +To: pgsql-performance@postgresql.org +Reply-To: rasmus@defero.se +User-Agent: SquirrelMail/1.4.0 +MIME-Version: 1.0 +Content-Type: text/plain;charset=iso-8859-1 +X-Priority: 3 +Importance: Normal +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/76 +X-Sequence-Number: 3442 + + +Hi, + +I have a table that looks like this: + + DATA ID TIME +|------|----|------| + +The table holds app. 14M rows now and grows by app. 350k rows a day. + +The ID-column holds about 1500 unique values (integer). +The TIME-columns is of type timestamp without timezone. + +I have one index (b-tree) on the ID-column and one index (b-tree) on the +time-column. + +My queries most often look like this: + +SELECT DATA FROM WHERE ID = 1 AND TIME > now() - '1 day'::interval; + +or + +SELECT DATA FROM WHERE ID = 2 AND TIME > now() - '1 week'::interval; + + +Since I have about 350000 rows the last 24 hours the query planner chooses +to use my ID-index to get hold of the rows - then using only a filter on +the time column. + +This takes a lot of time (over a minute) on a P4 1900MHz which +unfortenately isn't good enough for my purpose (webpages times out and so +on..). + + +If I SELECT only the rows with a certain ID (regardless of time): + +SELECT DATA FROM WHERE ID = 3; + +..it still takes almost a minute so I guess this is the problem (not the +filtering on the TIME-column), especially since it recieves a lot of rows +which will be descarded using my filter anyway. +(I recieve ~6000 rows and want about 250). + +But using the TIME-column as a first subset of rows and discarding using +the ID-column as a filter is even worse since I then get 350k rows and +discards about 349750 of them using the filter. + +I tried applying a multicolumn index on ID and TIME, but that one won't +even be used (after ANALYZE). + +My only option here seems to have like a "daily" table which will only +carry the rows for the past 24 hours which will give my SELECT a result of +6000 initial rows out of ~350k (instead of 14M like now) and then 250 when +filtered. +But I really hope there is a cleaner solution to the problem - actually I +though a multicolumn index would do it. + +-ra + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 20:01:50 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 8B3C8D1B8C3 + for ; + Thu, 4 Sep 2003 23:01:48 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 58880-05 + for ; + Thu, 4 Sep 2003 20:01:40 -0300 (ADT) +Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) + by svr1.postgresql.org (Postfix) with ESMTP id 668D3D1B52C + for ; + Thu, 4 Sep 2003 20:01:37 -0300 (ADT) +Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) + by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h84N0Gp5014820; + Thu, 4 Sep 2003 17:00:16 -0600 (MDT) +Date: Thu, 4 Sep 2003 16:58:19 -0600 (MDT) +From: "scott.marlowe" +To: Relaxin +Cc: +Subject: Re: SELECT's take a long time compared to other DBMS +In-Reply-To: +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-IHS-MailScanner: Found to be clean +X-IHS-MailScanner-SpamCheck: +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/77 +X-Sequence-Number: 3443 + +You would "get" all rows, but they'd be stored server side until your +client asked for them. + +I.e. a cursor would level the field here, since you say that the other +test cases stored the entire result set on the server. Or did I +misunderstand what you meant there? + +On Thu, 4 Sep 2003, Relaxin wrote: + +> All rows are required. +> +> ""Shridhar Daithankar"" wrote in +> message news:3F573E8B.31916.A1063F8@localhost... +> > On 4 Sep 2003 at 0:48, Relaxin wrote: +> > > All of the databases that I tested the query against gave me immediate +> > > access to ANY row of the resultset once the data had been returned. +> > > Ex. If I'm currently at the first row and then wanted to goto the +> 100,000 +> > > row, I would be there immediately, and if I wanted to then goto the 5 +> > > row...same thing, I have the record immediately! +> > > +> > > The other databases I tested against stored the entire resultset on the +> > > Server, I'm not sure what PG does...It seems that brings the entire +> > > resultset client side. +> > > If that is the case, how can I have PG store the resultset on the Server +> AND +> > > still allow me immediate access to ANY row in the resultset? +> > +> > You can use a cursor and get only required rows. +> > +> > +> > Bye +> > Shridhar +> > +> > -- +> > Nick the Greek's Law of Life: All things considered, life is 9 to 5 +> against. +> > +> > +> > ---------------------------(end of broadcast)--------------------------- +> > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org +> > +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 5: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faqs/FAQ.html +> + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 20:25:15 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C7541D1B96E + for ; + Thu, 4 Sep 2003 23:25:08 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 60440-06 + for ; + Thu, 4 Sep 2003 20:25:00 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 83915D1B8E9 + for ; + Thu, 4 Sep 2003 20:24:57 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h84NOvDh016459 + for ; Thu, 4 Sep 2003 23:24:57 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h84NEWb2014149 + for pgsql-performance@postgresql.org; Thu, 4 Sep 2003 23:14:32 GMT +From: "Relaxin" +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: SELECT's take a long time compared to other DBMS +Date: Thu, 4 Sep 2003 16:14:50 -0700 +Organization: Hub.Org Networking Services +Lines: 10 +Message-ID: +References: +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/79 +X-Sequence-Number: 3445 + +> +> Have you changed any of the settings yet in postgresql.conf, +> specifically the shared_buffers setting? +> + +fsync = false +tcpip_socket = true +shared_buffers = 128 + + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 20:16:46 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3B6A2D1B8B0 + for ; + Thu, 4 Sep 2003 23:16:37 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 58676-09 + for ; + Thu, 4 Sep 2003 20:16:29 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id BBA1CD1BA9B + for ; + Thu, 4 Sep 2003 20:16:25 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h84NGGjX011538; + Thu, 4 Sep 2003 19:16:16 -0400 (EDT) +To: Mary Edie Meredith +Cc: pgsql-performance , + osdldbt-general +Subject: Re: [GENERAL] how to get accurate values in pg_statistic (continued) +In-reply-to: <1062697270.6854.3475.camel@ibm-e.pdx.osdl.net> +References: <1062697270.6854.3475.camel@ibm-e.pdx.osdl.net> +Comments: In-reply-to Mary Edie Meredith + message dated "04 Sep 2003 10:41:10 -0700" +Date: Thu, 04 Sep 2003 19:16:15 -0400 +Message-ID: <11537.1062717375@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/78 +X-Sequence-Number: 3444 + +Mary Edie Meredith writes: +> Stephan Szabo kindly responded to our earlier queries suggesting we look +> at default_statistics_target and ALTER TABLE ALTER COLUMN SET +> STATISTICS. + +> These determine the number of bins in the histogram for a given column. +> But for a large number of rows (for example 6 million) the maximum value +> (1000) does not guarantee that ANALYZE will do a full scan of the table. +> We do not see a way to guarantee the same statistics run to run without +> forcing ANALYZE to examine every row of every table. + +Do you actually still have a problem with the plans changing when the +stats target is above 100 or so? I think the notion of "force ANALYZE +to do a full scan" is inherently wrongheaded ... it certainly would not +produce numbers that have anything to do with ordinary practice. + +If you have data statistics that are so bizarre that the planner still +gets things wrong with a target of 1000, then I'd like to know more +about why. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Sep 4 20:50:36 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3CC72D1B89A + for ; + Thu, 4 Sep 2003 23:50:33 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 64126-03 + for ; + Thu, 4 Sep 2003 20:50:25 -0300 (ADT) +Received: from bob.samurai.com (bob.samurai.com [205.207.28.75]) + by svr1.postgresql.org (Postfix) with ESMTP id 89707D1B53A + for ; + Thu, 4 Sep 2003 20:50:22 -0300 (ADT) +Received: from 6-allhosts (d226-85-166.home.cgocable.net [24.226.85.166]) + by bob.samurai.com (Postfix) with ESMTP + id 1D80F1E0B; Thu, 4 Sep 2003 19:50:25 -0400 (EDT) +Subject: Re: [GENERAL] how to get accurate values in pg_statistic +From: Neil Conway +To: Rod Taylor +Cc: Mary Edie Meredith , + pgsql-performance , + OSDL - DB General +In-Reply-To: <1062697606.88158.7.camel@jester> +References: <1062697270.6854.3475.camel@ibm-e.pdx.osdl.net> + <1062697606.88158.7.camel@jester> +Content-Type: text/plain +Message-Id: <1062719424.364.5.camel@tokyo> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Thu, 04 Sep 2003 19:50:24 -0400 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/80 +X-Sequence-Number: 3446 + +On Thu, 2003-09-04 at 13:46, Rod Taylor wrote: +> Run a VACUUM FULL ANALYZE between runs. This will force a full scan of +> all data for stats + +It will? Are you sure about that? + +-Neil + + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 21:02:14 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 9DECED1B89A + for ; + Fri, 5 Sep 2003 00:02:10 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 63007-07 + for ; + Thu, 4 Sep 2003 21:02:03 -0300 (ADT) +Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) + by svr1.postgresql.org (Postfix) with ESMTP id 11112D1B8A5 + for ; + Thu, 4 Sep 2003 21:01:59 -0300 (ADT) +Received: from ibm-e.pdx.osdl.net (ibm-e.pdx.osdl.net [172.20.1.71]) + by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h8501uo32003; + Thu, 4 Sep 2003 17:01:56 -0700 +Subject: Re: [GENERAL] how to get accurate values in pg_statistic +From: Mary Edie Meredith +To: Neil Conway +Cc: Rod Taylor , + pgsql-performance , + OSDL - DB General +In-Reply-To: <1062719424.364.5.camel@tokyo> +References: <1062697270.6854.3475.camel@ibm-e.pdx.osdl.net> + <1062697606.88158.7.camel@jester> <1062719424.364.5.camel@tokyo> +Content-Type: text/plain +Organization: Open Source Development Lab +Message-Id: <1062720115.6854.3662.camel@ibm-e.pdx.osdl.net> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.2.2 +Date: 04 Sep 2003 17:01:56 -0700 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/81 +X-Sequence-Number: 3447 + +The documentation lead us to believe that it would not, but we are +testing just the same (at least checking that the pg_statistics are the +same after each load and VACUUM FULL ANALYZE). Will report back. + + + +On Thu, 2003-09-04 at 16:50, Neil Conway wrote: +> On Thu, 2003-09-04 at 13:46, Rod Taylor wrote: +> > Run a VACUUM FULL ANALYZE between runs. This will force a full scan of +> > all data for stats +> +> It will? Are you sure about that? +> +> -Neil +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 5: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faqs/FAQ.html +-- +Mary Edie Meredith +Open Source Development Lab + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 21:29:19 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 39261D1B8E0 + for ; + Fri, 5 Sep 2003 00:29:16 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 63568-08 + for ; + Thu, 4 Sep 2003 21:28:47 -0300 (ADT) +Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) + by svr1.postgresql.org (Postfix) with ESMTP id 3ECB3D1B52C + for ; + Thu, 4 Sep 2003 21:28:44 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by mailav.tor1.inquent.com (Postfix) with ESMTP + id 0B5D81025A; Thu, 4 Sep 2003 20:20:41 -0400 (EDT) +Received: from [192.168.1.200] (dyn-133-83.tor.dsl.tht.net [134.22.133.83]) + by mailav.tor1.inquent.com (Postfix) with ESMTP + id BEAD610248; Thu, 4 Sep 2003 20:20:38 -0400 (EDT) +Subject: Re: [GENERAL] how to get accurate values in pg_statistic +From: Rod Taylor +To: Neil Conway +Cc: Mary Edie Meredith , + pgsql-performance , + OSDL - DB General +In-Reply-To: <1062719424.364.5.camel@tokyo> +References: <1062697270.6854.3475.camel@ibm-e.pdx.osdl.net> + <1062697606.88158.7.camel@jester> <1062719424.364.5.camel@tokyo> +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="=-8i2qqsmwjCG8MjP8B6BK" +Message-Id: <1062721750.89833.10.camel@jester> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Thu, 04 Sep 2003 20:29:11 -0400 +X-Virus-Scanned: by AMaViS perl-11 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/82 +X-Sequence-Number: 3448 + +--=-8i2qqsmwjCG8MjP8B6BK +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +On Thu, 2003-09-04 at 19:50, Neil Conway wrote: +> On Thu, 2003-09-04 at 13:46, Rod Taylor wrote: +> > Run a VACUUM FULL ANALYZE between runs. This will force a full scan of +> > all data for stats +>=20 +> It will? Are you sure about that? + +You're right. According to the docs it won't. + +I had a poor stats issue on one table that was solved using that +command, coincidentally apparently. + +--=-8i2qqsmwjCG8MjP8B6BK +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: This is a digitally signed message part + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.3 (FreeBSD) + +iD8DBQA/V9jW6DETLow6vwwRApEhAJ0V5+Rp23CxX9ya6xK8CaiOdPQEhwCfeMwk +R4NQW7RHhFS/2S+s9I7VkT4= +=MtgZ +-----END PGP SIGNATURE----- + +--=-8i2qqsmwjCG8MjP8B6BK-- + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 22:25:10 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DEC81D1BA6C + for ; + Fri, 5 Sep 2003 01:25:07 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 70889-10 + for ; + Thu, 4 Sep 2003 22:25:00 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 3FA4AD1B9BC + for ; + Thu, 4 Sep 2003 22:24:57 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h851OvDh040893 + for ; Fri, 5 Sep 2003 01:24:57 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h851KjE8040164 + for pgsql-performance@postgresql.org; Fri, 5 Sep 2003 01:20:45 GMT +From: "Relaxin" +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: SELECT's take a long time compared to other DBMS +Date: Thu, 4 Sep 2003 17:45:20 -0700 +Organization: Hub.Org Networking Services +Lines: 42 +Message-ID: +References: + +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/83 +X-Sequence-Number: 3449 + +I reset the shared_buffers to 1000 from 128, but it made no difference. + +""scott.marlowe"" wrote in message +news:Pine.LNX.4.33.0309041625300.28714-100000@css120.ihs.com... +> On Wed, 3 Sep 2003, Relaxin wrote: +> +> > I have a table with 102,384 records in it, each record is 934 bytes. +> > +> > Using the follow select statement: +> > SELECT * from
+> > +> > PG Info: version 7.3.4 under cygwin on Windows 2000 +> > ODBC: version 7.3.100 +> > +> > Machine: 500 Mhz/ 512MB RAM / IDE HDD +> > +> > +> > Under PG: Data is returned in 26 secs!! +> > Under SQL Server: Data is returned in 5 secs. +> > Under SQLBase: Data is returned in 6 secs. +> > Under SAPDB: Data is returned in 7 secs. +> +> This is typical of postgresql under cygwin, it's much faster under a Unix +> OS like Linux or BSD. That said, you CAN do some things to help speed it +> up, the biggest being tuning the shared_buffers to be something large +> enough to hold a fair bit of data. Set the shared_buffers to 1000, +> restart, and see if things get better. +> +> Running Postgresql in a unix emulation layer is guaranteed to make it +> slow. If you've got a spare P100 with 128 Meg of RAM you can throw redhat +> 9 or FreeBSD 4.7 on and run Postgresql on, it will likely outrun your +> 500MHZ cygwin box, and might even keep up with the other databases on that +> machine as well. +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 5: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faqs/FAQ.html +> + + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 22:55:10 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 23954D1BA97 + for ; + Fri, 5 Sep 2003 01:55:08 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 75914-02 + for ; + Thu, 4 Sep 2003 22:55:01 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 66829D1BAA3 + for ; + Thu, 4 Sep 2003 22:54:57 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h851svDj046452 + for ; Fri, 5 Sep 2003 01:54:57 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h851aFOE043394 + for pgsql-performance@postgresql.org; Fri, 5 Sep 2003 01:36:15 GMT +From: Christopher Browne +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: SELECT's take a long time compared to other DBMS +Date: Thu, 04 Sep 2003 21:26:14 -0400 +Organization: cbbrowne Computing Inc +Lines: 34 +Message-ID: +References: + +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.1003 (Gnus v5.10.3) XEmacs/21.4 (Rational FORTRAN, linux) +Cancel-Lock: sha1:oRLWmsxHdfbzDVAr3LAfQy1h71s= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/84 +X-Sequence-Number: 3450 + +A long time ago, in a galaxy far, far away, "Relaxin" wrote: +>> Have you changed any of the settings yet in postgresql.conf, +>> specifically the shared_buffers setting? +> +> fsync = false +> tcpip_socket = true +> shared_buffers = 128 + +Change fsync to true (you want your data to survive, right?) and +increase shared buffers to something that represents ~10% of your +system memory, in blocks of 8K. + +So, if you have 512MB of RAM, then the total blocks is 65536, and it +would likely be reasonable to increase shared_buffers to 1/10 of that, +or about 6500. + +What is the value of effective_cache_size? That should probably be +increased a whole lot, too. If you are mainly just running the +database on your system, then it would be reasonable to set it to most +of memory, or + (* 1/2 (/ (* 512 1024 1024) 8192)) +32768. + +None of this is likely to substantially change the result of that one +query, however, and it seems quite likely that it is because +PostgreSQL is honestly returning the whole result set of ~100K rows at +once, whereas the other DBMSes are probably using cursors to return +only the few rows of the result that you actually looked at. +-- +"cbbrowne","@","cbbrowne.com" +http://www3.sympatico.ca/cbbrowne/linuxdistributions.html +Rules of the Evil Overlord #14. "The hero is not entitled to a last +kiss, a last cigarette, or any other form of last request." + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 23:25:12 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 5837CD1B8A8 + for ; + Fri, 5 Sep 2003 02:25:08 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 76582-10 + for ; + Thu, 4 Sep 2003 23:25:01 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 6D196D1B52C + for ; + Thu, 4 Sep 2003 23:24:57 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h852OvDf052710 + for ; Fri, 5 Sep 2003 02:24:57 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h852DBoQ050652 + for pgsql-performance@postgresql.org; Fri, 5 Sep 2003 02:13:11 GMT +From: "Relaxin" +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: SELECT's take a long time compared to other DBMS +Date: Thu, 4 Sep 2003 19:13:30 -0700 +Organization: Hub.Org Networking Services +Lines: 75 +Message-ID: +References: + +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/85 +X-Sequence-Number: 3451 + +Thank you Christopher. + +> Change fsync to true (you want your data to survive, right?) and +> increase shared buffers to something that represents ~10% of your +> system memory, in blocks of 8K. + +I turned it off just in the hope that things would run faster. + +> None of this is likely to substantially change the result of that one +> query, however, and it seems quite likely that it is because +> PostgreSQL is honestly returning the whole result set of ~100K rows at +> once, whereas the other DBMSes are probably using cursors to return +> only the few rows of the result that you actually looked at. + +Finally, someone who will actually assume/admit that it is returning the +entire result set to the client. +Where as other DBMS manage the records at the server. + +I hope PG could fix/enhance this issue. + +There are several issues that's stopping our company from going with PG +(with paid support, if available), but this seems to big the one at the top +of the list. + +The next one is the handling of BLOBS. PG handles them like no other system +I have ever come across. + +After that is a native Windows port, but we would deal cygwin (for a very +little while) if these other issues were handled. + +Thanks + + + + + +"Christopher Browne" wrote in message +news:m3fzjc58ll.fsf@chvatal.cbbrowne.com... +> A long time ago, in a galaxy far, far away, "Relaxin" +wrote: +> >> Have you changed any of the settings yet in postgresql.conf, +> >> specifically the shared_buffers setting? +> > +> > fsync = false +> > tcpip_socket = true +> > shared_buffers = 128 +> +> Change fsync to true (you want your data to survive, right?) and +> increase shared buffers to something that represents ~10% of your +> system memory, in blocks of 8K. +> +> So, if you have 512MB of RAM, then the total blocks is 65536, and it +> would likely be reasonable to increase shared_buffers to 1/10 of that, +> or about 6500. +> +> What is the value of effective_cache_size? That should probably be +> increased a whole lot, too. If you are mainly just running the +> database on your system, then it would be reasonable to set it to most +> of memory, or +> (* 1/2 (/ (* 512 1024 1024) 8192)) +> 32768. +> +> None of this is likely to substantially change the result of that one +> query, however, and it seems quite likely that it is because +> PostgreSQL is honestly returning the whole result set of ~100K rows at +> once, whereas the other DBMSes are probably using cursors to return +> only the few rows of the result that you actually looked at. +> -- +> "cbbrowne","@","cbbrowne.com" +> http://www3.sympatico.ca/cbbrowne/linuxdistributions.html +> Rules of the Evil Overlord #14. "The hero is not entitled to a last +> kiss, a last cigarette, or any other form of last request." +> + + + +From pgsql-performance-owner@postgresql.org Thu Sep 4 23:32:38 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DBADFD1B8A8 + for ; + Fri, 5 Sep 2003 02:32:30 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 78330-04 + for ; + Thu, 4 Sep 2003 23:32:24 -0300 (ADT) +Received: from bob.samurai.com (bob.samurai.com [205.207.28.75]) + by svr1.postgresql.org (Postfix) with ESMTP id E843FD1B52C + for ; + Thu, 4 Sep 2003 23:32:19 -0300 (ADT) +Received: from 6-allhosts (d226-85-166.home.cgocable.net [24.226.85.166]) + by bob.samurai.com (Postfix) with ESMTP + id D39771D6B; Thu, 4 Sep 2003 22:32:23 -0400 (EDT) +Subject: Re: SELECT's take a long time compared to other DBMS +From: Neil Conway +To: Relaxin +Cc: PostgreSQL Performance +In-Reply-To: +References: + + +Content-Type: text/plain +Message-Id: <1062729142.364.20.camel@tokyo> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Thu, 04 Sep 2003 22:32:23 -0400 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/86 +X-Sequence-Number: 3452 + +On Thu, 2003-09-04 at 22:13, Relaxin wrote: +> Finally, someone who will actually assume/admit that it is returning the +> entire result set to the client. +> Where as other DBMS manage the records at the server. + +Is there a reason you can't use cursors (explicitely, or via ODBC if it +provides some glue on top of them) to keep the result set on the server? + +http://candle.pha.pa.us/main/writings/pgsql/sgml/sql-declare.html +http://candle.pha.pa.us/main/writings/pgsql/sgml/sql-fetch.html + +> The next one is the handling of BLOBS. PG handles them like no other system +> I have ever come across. + +Just FYI, you can use both the lo_*() functions, as well as simple +bytea/text columns (which can be very large in PostgreSQL). + +-Neil + + + +From pgsql-performance-owner@postgresql.org Fri Sep 5 01:34:59 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 47E7CD1B9AA + for ; + Fri, 5 Sep 2003 04:34:51 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 87516-10 + for ; + Fri, 5 Sep 2003 01:34:41 -0300 (ADT) +Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) + by svr1.postgresql.org (Postfix) with ESMTP id AAC94D1B8D1 + for ; + Fri, 5 Sep 2003 01:34:39 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id h854Y7c03834; + Fri, 5 Sep 2003 00:34:07 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200309050434.h854Y7c03834@candle.pha.pa.us> +Subject: Re: Query too slow +In-Reply-To: <27125.1061913692@sss.pgh.pa.us> +To: Tom Lane +Date: Fri, 5 Sep 2003 00:34:06 -0400 (EDT) +Cc: Stephan Szabo , + Ang Chin Han , + Rhaoni Chiu Pereira , + PostgreSQL Performance +X-Mailer: ELM [version 2.4ME+ PL106 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/87 +X-Sequence-Number: 3453 + +Tom Lane wrote: +> Stephan Szabo writes: +> > On Tue, 26 Aug 2003, Ang Chin Han wrote: +> >> Veering aside a bit, since we usually pinpoint performance problems by +> >> looking at EXPLAIN ANALYZE's differences between the planner's +> >> estimation and actual execution's stats, what's involved in parsing the +> >> EXPLAIN ANALYZE results, and highlighting the places where they are way +> >> different? Bold, underline, or put some asterisks in front of those steps. +> +> > The hardest part is determining where it matters I think. You can use the +> > row counts as the base for that, but going from 1 row to 50 is not +> > necessarily going to be an issue, but it might be if a nested loop is +> > chosen. +> +> We've been chatting about this idea among the Red Hat group. The RHDB +> Visual Explain tool (get it at http://sources.redhat.com/rhdb/) already +> computes the percent of total runtime represented by each plan node. +> It seems like we could highlight nodes based on a large difference +> between estimated and actual percentage, or just highlight the nodes +> that are more than X percent of the runtime. + +Is there a TODO here? Perhaps: + + o Have EXPLAIN ANALYZE highlight poor optimizer estimates + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Fri Sep 5 02:49:04 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3B04BD1B8B1 + for ; + Fri, 5 Sep 2003 05:49:01 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 96983-08 + for ; + Fri, 5 Sep 2003 02:48:31 -0300 (ADT) +Received: from anduin.net (anduin.net [212.12.46.226]) + by svr1.postgresql.org (Postfix) with SMTP id 6D69FD1B973 + for ; + Fri, 5 Sep 2003 02:48:29 -0300 (ADT) +Received: (qmail 92566 invoked by uid 85); 5 Sep 2003 05:48:29 -0000 +Received: from ltning@anduin.net by anduin.net by uid 82 with + qmail-scanner-1.20rc1 (clamscan: 0.60. Clear:RC:1:. + Processed in 0.031791 secs); 05 Sep 2003 05:48:29 -0000 +X-Qmail-Scanner-Mail-From: ltning@anduin.net via anduin.net +X-Qmail-Scanner: 1.20rc1 (Clear:RC:1:. Processed in 0.031791 secs) +Received: from celduin.net (HELO anduin.net) (81.0.162.106) + by anduin.net with SMTP; 5 Sep 2003 05:48:29 -0000 +Date: Fri, 5 Sep 2003 06:54:24 +0200 +From: Eirik Oeverby +To: pgsql-performance@postgresql.org +Subject: Re: SELECT's take a long time compared to other DBMS +Message-Id: <20030905065424.03e5c217.ltning@anduin.net> +In-Reply-To: +References: + + <1062729142.364.20.camel@tokyo> + +X-Mailer: Sylpheed version 0.9.4 (GTK+ 1.2.10; i386-portbld-freebsd5.1) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/89 +X-Sequence-Number: 3455 + +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +Hi, + +I think the problem is the ODBC driver NOT using cursors properly even +if it should. The database itself is not doing anything it shouldn't do, +in fact it has all the needed functionality to handle this request in a +fast and effective way - just like any other respectable RDBMS. + +I don't know what ODBC driver you are using, and how it is configrued - +and I never actually used PostgreSQL with ODBC myself. However in the +applications I have developed we DO use 'standardized' DB access +libraries, which work on just about any DBMS you throw them at. +In our development system, which is running on a low-end dual P2-433mhz +box with IDE drives, we routinely test both simple queries as yours and +more complex ones, which at times returns several hundred +thousand (or sometimes even millions) of rows. And processing time is, +generally speaking, in range with what you are seeing on the other +DBMSes you have. + +So if PG is indeed returning ALL the rows, it is because it is +explicitly told to by the ODBC driver, so you need to look there to find +the problem. Could there be some kind of connection parameters you are +overlooking, or is the driver too old? Just throwing out ideas here, +most likely you have already thought about it :) + +Just thought I'd point out that this is NOT expected behaviour from PG +itself. + +/Eirik + +On Thu, 4 Sep 2003 21:59:01 -0700 +"Relaxin" wrote: + +> > Is there a reason you can't use cursors (explicitely, or via ODBC if +> > it provides some glue on top of them) to keep the result set on the +> > server? +> > +> > http://candle.pha.pa.us/main/writings/pgsql/sgml/sql-declare.html +> > http://candle.pha.pa.us/main/writings/pgsql/sgml/sql-fetch.html +> +> I can only use generally accepted forms of connectivity (ie. ODBC, ADO +> or OLEDB). +> This is what many of the people on the Windows side are going to need, +> because most of us are going to be converting from an existing already +> established system, such as Oracle, SQL Server or DB2, all of which +> have 1 or more of the 3 mentioned above. +> +> +> > > The next one is the handling of BLOBS. PG handles them like no +> > > other +> system +> > > I have ever come across. +> > +> > Just FYI, you can use both the lo_*() functions, as well as simple +> > bytea/text columns (which can be very large in PostgreSQL). +> > +> > -Neil +> +> I know PG has a ODBC driver (that's all I've been using), but it or PG +> just doesn't handle BLOBS the way people on the Windows side (don't +> know about Unix) are use too. +> +> There is this conversion to octet that must be performed on the data , +> I don't understand why, but I guess there was a reason for it long +> ago, but it seems that it can now be modified to just accept ANY byte +> you give it and then store it without any manipulation of the data. +> This will make Postgresql much more portable for the Windows +> developers...no need for any special handling for a data type that all +> large RDBMS support. +> +> +> Thanks +> +> +> +> ---------------------------(end of +> broadcast)--------------------------- TIP 3: 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 + + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.3 (FreeBSD) + +iD8DBQE/WBcAdAvR8ct7fEcRAvZPAJ9FgkYxck6Yh5gPeomk8QgWraeV0gCfQF/v +CjyihMwTdrEZo2Y5YBwLVrI= +=Ng2I +-----END PGP SIGNATURE----- + +From pgsql-performance-owner@postgresql.org Fri Sep 5 02:25:17 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 613CAD1B89E + for ; + Fri, 5 Sep 2003 05:25:14 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 91102-08 + for ; + Fri, 5 Sep 2003 02:25:04 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id B8856D1B897 + for ; + Fri, 5 Sep 2003 02:25:03 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h855P3Df094663 + for ; Fri, 5 Sep 2003 05:25:03 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h854wkkD089211 + for pgsql-performance@postgresql.org; Fri, 5 Sep 2003 04:58:46 GMT +From: "Relaxin" +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: SELECT's take a long time compared to other DBMS +Date: Thu, 4 Sep 2003 21:59:01 -0700 +Organization: Hub.Org Networking Services +Lines: 38 +Message-ID: +References: + + <1062729142.364.20.camel@tokyo> +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/88 +X-Sequence-Number: 3454 + +> Is there a reason you can't use cursors (explicitely, or via ODBC if it +> provides some glue on top of them) to keep the result set on the server? +> +> http://candle.pha.pa.us/main/writings/pgsql/sgml/sql-declare.html +> http://candle.pha.pa.us/main/writings/pgsql/sgml/sql-fetch.html + +I can only use generally accepted forms of connectivity (ie. ODBC, ADO or +OLEDB). +This is what many of the people on the Windows side are going to need, +because most of us are going to be converting from an existing already +established system, such as Oracle, SQL Server or DB2, all of which have 1 +or more of the 3 mentioned above. + + +> > The next one is the handling of BLOBS. PG handles them like no other +system +> > I have ever come across. +> +> Just FYI, you can use both the lo_*() functions, as well as simple +> bytea/text columns (which can be very large in PostgreSQL). +> +> -Neil + +I know PG has a ODBC driver (that's all I've been using), but it or PG just +doesn't handle BLOBS the way people on the Windows side (don't know about +Unix) are use too. + +There is this conversion to octet that must be performed on the data , I +don't understand why, but I guess there was a reason for it long ago, but it +seems that it can now be modified to just accept ANY byte you give it and +then store it without any manipulation of the data. +This will make Postgresql much more portable for the Windows developers...no +need for any special handling for a data type that all large RDBMS support. + + +Thanks + + + +From pgsql-general-owner@postgresql.org Fri Sep 5 03:08:46 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 9810BD1B574 + for ; + Fri, 5 Sep 2003 06:08:42 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 99715-09 + for ; + Fri, 5 Sep 2003 03:08:12 -0300 (ADT) +Received: from btj1.havleik.no (gw.havleik.no [217.8.139.34]) + by svr1.postgresql.org (Postfix) with ESMTP id 6A15ED1B89D + for ; + Fri, 5 Sep 2003 03:08:10 -0300 (ADT) +Received: from havleik.no (localhost [127.0.0.1]) + by btj1.havleik.no (8.12.6/8.12.6/SuSE Linux 0.6) with SMTP id + h85687o4012170 + for ; Fri, 5 Sep 2003 08:08:07 +0200 +Received: from 193.212.14.12 (SquirrelMail authenticated user btj) + by www.havleik.no with HTTP; Fri, 5 Sep 2003 08:08:07 +0200 (CEST) +Message-ID: <58940.193.212.14.12.1062742087.squirrel@www.havleik.no> +Date: Fri, 5 Sep 2003 08:08:07 +0200 (CEST) +Subject: Seq scan of table? +From: "Bjorn T Johansen" +To: pgsql-general@postgresql.org +User-Agent: SquirrelMail/1.4.0 RC2a +MIME-Version: 1.0 +Content-Type: text/plain;charset=iso-8859-1 +X-Priority: 3 +Importance: Normal +X-MailScanner-Information: Please contact Havleik Consulting for more + information +X-MailScanner: Found to be clean +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/411 +X-Sequence-Number: 48633 + +I am trying to tune my database and I discovered one select that does a +seq scan on a table but I can't see why... All the join fields are indexed +and I am returning just one record, so no sort is done. +Does it just pick seq scan for the heck of it or is it a reason? + +Regards, + +BTJ + +----------------------------------------------------------------------------------------------- +Bj�rn T Johansen (BSc,MNIF) +Executive Manager +btj@havleik.no Havleik Consulting +Phone : +47 67 54 15 17 Conradisvei 4 +Fax : +47 67 54 13 91 N-1338 Sandvika +Cellular : +47 926 93 298 http://www.havleik.no +----------------------------------------------------------------------------------------------- +"The stickers on the side of the box said "Supported Platforms: Windows +98, Windows NT 4.0, +Windows 2000 or better", so clearly Linux was a supported platform." +----------------------------------------------------------------------------------------------- + + +From pgsql-general-owner@postgresql.org Fri Sep 5 03:34:32 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E5103D1B8E3 + for ; + Fri, 5 Sep 2003 06:34:21 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 03355-05 + for ; + Fri, 5 Sep 2003 03:33:49 -0300 (ADT) +Received: from victoria1.openweb.be (victoria1.openweb.be [212.3.244.180]) + by svr1.postgresql.org (Postfix) with SMTP id 74F80D1B8B7 + for ; + Fri, 5 Sep 2003 03:33:46 -0300 (ADT) +Received: (qmail 18980 invoked from network); 5 Sep 2003 06:26:41 -0000 +Received: from unknown (HELO Morpheus) (217.145.35.101) + by radius2.openweb.be with SMTP; 5 Sep 2003 06:26:41 -0000 +From: "Bruno BAGUETTE" +To: "'Bjorn T Johansen'" , + +Subject: RE : Seq scan of table? +Date: Fri, 5 Sep 2003 08:34:47 +0200 +Message-ID: + +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.4024 +In-Reply-To: <58940.193.212.14.12.1062742087.squirrel@www.havleik.no> +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 +Importance: Normal +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=0.8 tagged_above=0.0 required=5.0 tests=BAYES_30, + FORGED_MUA_OUTLOOK, IN_REP_TO, MSGID_CHARS_SPAM, QUOTED_EMAIL_TEXT +X-Spam-Level: +X-Archive-Number: 200309/412 +X-Sequence-Number: 48634 + +Hello, + +> I am trying to tune my database and I discovered one select +> that does a seq scan on a table but I can't see why... All +> the join fields are indexed and I am returning just one +> record, so no sort is done. Does it just pick seq scan for +> the heck of it or is it a reason? + +Are the join fields both of the exactly same type ? If no (eg : INT2 and +INT4) +you must cast in order to have the same type. + +If the join fields are not of the same type, PostgreSQL will do a seq +scan. + +I had exactly the same problem and learned here that tip :-) + +Hope this help, + +--------------------------------------- +Bruno BAGUETTE - pgsql-ml@baguette.net + + + +From pgsql-general-owner@postgresql.org Fri Sep 5 03:45:10 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E9099D1B8EA + for ; + Fri, 5 Sep 2003 06:45:05 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 05593-01 + for ; + Fri, 5 Sep 2003 03:44:55 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id ECBF3D1B8E9 + for ; + Fri, 5 Sep 2003 03:44:52 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h856ipAn009566; + Fri, 5 Sep 2003 02:44:51 -0400 (EDT) +To: "Bjorn T Johansen" +Cc: pgsql-general@postgresql.org +Subject: Re: Seq scan of table? +In-reply-to: <58940.193.212.14.12.1062742087.squirrel@www.havleik.no> +References: <58940.193.212.14.12.1062742087.squirrel@www.havleik.no> +Comments: In-reply-to "Bjorn T Johansen" + message dated "Fri, 05 Sep 2003 08:08:07 +0200" +Date: Fri, 05 Sep 2003 02:44:51 -0400 +Message-ID: <9565.1062744291@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/414 +X-Sequence-Number: 48636 + +"Bjorn T Johansen" writes: +> I am trying to tune my database and I discovered one select that does a +> seq scan on a table but I can't see why... All the join fields are indexed +> and I am returning just one record, so no sort is done. +> Does it just pick seq scan for the heck of it or is it a reason? + +Who's to say, when you gave us no details? Show us the table schemas, +the exact query, and EXPLAIN ANALYZE output, and you might get useful +responses. + +(btw, pgsql-performance would be a more appropriate list for this issue +than pgsql-general.) + + regards, tom lane + +From pgsql-general-owner@postgresql.org Fri Sep 5 03:56:03 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id D3B7ED1B89D + for ; + Fri, 5 Sep 2003 06:55:59 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 01893-06 + for ; + Fri, 5 Sep 2003 03:55:29 -0300 (ADT) +Received: from btj1.havleik.no (gw.havleik.no [217.8.139.34]) + by svr1.postgresql.org (Postfix) with ESMTP id 1149FD1B9BC + for ; + Fri, 5 Sep 2003 03:55:27 -0300 (ADT) +Received: from havleik.no (localhost [127.0.0.1]) + by btj1.havleik.no (8.12.6/8.12.6/SuSE Linux 0.6) with SMTP id + h856tOo4012571 + for ; Fri, 5 Sep 2003 08:55:24 +0200 +Received: from 193.212.14.12 (SquirrelMail authenticated user btj) + by www.havleik.no with HTTP; Fri, 5 Sep 2003 08:55:24 +0200 (CEST) +Message-ID: <14218.193.212.14.12.1062744924.squirrel@www.havleik.no> +In-Reply-To: + +References: <58940.193.212.14.12.1062742087.squirrel@www.havleik.no> + +Date: Fri, 5 Sep 2003 08:55:24 +0200 (CEST) +Subject: Re: RE : Seq scan of table? +From: "Bjorn T Johansen" +To: pgsql-general@postgresql.org +User-Agent: SquirrelMail/1.4.0 RC2a +MIME-Version: 1.0 +Content-Type: text/plain;charset=iso-8859-1 +X-Priority: 3 +Importance: Normal +X-MailScanner-Information: Please contact Havleik Consulting for more + information +X-MailScanner: Found to be clean +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/415 +X-Sequence-Number: 48637 + +Well, I just checked and all the join fields are of the same type... + +BTJ + +> Hello, +> +>> I am trying to tune my database and I discovered one select +>> that does a seq scan on a table but I can't see why... All +>> the join fields are indexed and I am returning just one +>> record, so no sort is done. Does it just pick seq scan for +>> the heck of it or is it a reason? +> +> Are the join fields both of the exactly same type ? If no (eg : INT2 and +> INT4) +> you must cast in order to have the same type. +> +> If the join fields are not of the same type, PostgreSQL will do a seq +> scan. +> +> I had exactly the same problem and learned here that tip :-) +> +> Hope this help, +> +> --------------------------------------- +> Bruno BAGUETTE - pgsql-ml@baguette.net +> +> +> + + + +From pgsql-general-owner@postgresql.org Fri Sep 5 03:58:34 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 61814D1B9A8 + for ; + Fri, 5 Sep 2003 06:58:31 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 05935-02 + for ; + Fri, 5 Sep 2003 03:58:00 -0300 (ADT) +Received: from btj1.havleik.no (gw.havleik.no [217.8.139.34]) + by svr1.postgresql.org (Postfix) with ESMTP id E52F1D1B914 + for ; + Fri, 5 Sep 2003 03:57:58 -0300 (ADT) +Received: from havleik.no (localhost [127.0.0.1]) + by btj1.havleik.no (8.12.6/8.12.6/SuSE Linux 0.6) with SMTP id + h856vto4012624 + for ; Fri, 5 Sep 2003 08:57:55 +0200 +Received: from 193.212.14.12 (SquirrelMail authenticated user btj) + by www.havleik.no with HTTP; Fri, 5 Sep 2003 08:57:55 +0200 (CEST) +Message-ID: <14399.193.212.14.12.1062745075.squirrel@www.havleik.no> +In-Reply-To: <9565.1062744291@sss.pgh.pa.us> +References: <58940.193.212.14.12.1062742087.squirrel@www.havleik.no> + <9565.1062744291@sss.pgh.pa.us> +Date: Fri, 5 Sep 2003 08:57:55 +0200 (CEST) +Subject: Re: Seq scan of table? +From: "Bjorn T Johansen" +To: pgsql-general@postgresql.org +User-Agent: SquirrelMail/1.4.0 RC2a +MIME-Version: 1.0 +Content-Type: text/plain;charset=iso-8859-1 +X-Priority: 3 +Importance: Normal +X-MailScanner-Information: Please contact Havleik Consulting for more + information +X-MailScanner: Found to be clean +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/416 +X-Sequence-Number: 48638 + + + +> "Bjorn T Johansen" writes: +>> I am trying to tune my database and I discovered one select that does a +>> seq scan on a table but I can't see why... All the join fields are +>> indexed +>> and I am returning just one record, so no sort is done. +>> Does it just pick seq scan for the heck of it or is it a reason? +> +> Who's to say, when you gave us no details? Show us the table schemas, +> the exact query, and EXPLAIN ANALYZE output, and you might get useful +> responses. +> +> (btw, pgsql-performance would be a more appropriate list for this issue +> than pgsql-general.) +> +> regards, tom lane +> + +Well, since the select involves 10-12 tables and a large sql, I just +thought I would try without all that information first... :) + +And yes, pgsql-performance sounds like the right list.... + + +BTJ + + + +From pgsql-performance-owner@postgresql.org Fri Sep 5 05:35:09 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B8B94D1B8BD + for ; + Fri, 5 Sep 2003 08:35:04 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 09989-10 + for ; + Fri, 5 Sep 2003 05:34:56 -0300 (ADT) +Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net + [194.217.242.89]) + by svr1.postgresql.org (Postfix) with ESMTP id 84695D1B8B3 + for ; + Fri, 5 Sep 2003 05:34:53 -0300 (ADT) +Received: from mwynhau.demon.co.uk ([193.237.186.96] + helo=mainbox.archonet.com) + by anchor-post-31.mail.demon.net with esmtp (Exim 3.35 #1) + id 19vC3S-0002xZ-0V; Fri, 05 Sep 2003 09:34:54 +0100 +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mainbox.archonet.com (Postfix) with ESMTP + id 9E74316C50; Fri, 5 Sep 2003 09:34:53 +0100 (BST) +Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP + id D34E816B91; Fri, 5 Sep 2003 09:34:52 +0100 (BST) +From: Richard Huxton +To: rasmus@defero.se, pgsql-performance@postgresql.org +Subject: Re: Performance problems on a fairly big table with two key columns. +Date: Fri, 5 Sep 2003 09:34:52 +0100 +User-Agent: KMail/1.5 +References: <1564.62.119.108.236.1062716026.squirrel@www.defero.se> +In-Reply-To: <1564.62.119.108.236.1062716026.squirrel@www.defero.se> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200309050934.52082.dev@archonet.com> +X-Virus-Scanned: by AMaViS snapshot-20020531 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/90 +X-Sequence-Number: 3456 + +On Thursday 04 September 2003 23:53, Rasmus Aveskogh wrote: +> Hi, +> +> I have a table that looks like this: +> +> DATA ID TIME +> +> |------|----|------| +> +> The table holds app. 14M rows now and grows by app. 350k rows a day. +> +> The ID-column holds about 1500 unique values (integer). +> The TIME-columns is of type timestamp without timezone. +> +> I have one index (b-tree) on the ID-column and one index (b-tree) on the +> time-column. +> +> My queries most often look like this: +> +> SELECT DATA FROM WHERE ID = 1 AND TIME > now() - '1 day'::interval; +[snip] +> I tried applying a multicolumn index on ID and TIME, but that one won't +> even be used (after ANALYZE). + +The problem is likely to be that the parser isn't spotting that now()-'1 day' +is constant. Try an explicit time and see if the index is used. If so, you +can write a wrapper function for your expression (mark it STABLE so the +planner knows it won't change during the statement). + +Alternatively, you can do the calculation in the application and use an +explicit time. + +HTH +-- + Richard Huxton + Archonet Ltd + +From pgsql-general-owner@postgresql.org Fri Sep 5 05:48:32 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP + id 611D3D1B99E; Fri, 5 Sep 2003 08:48:29 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) + with ESMTP id 14420-02; Fri, 5 Sep 2003 05:47:59 -0300 (ADT) +Received: from btj1.havleik.no (gw.havleik.no [217.8.139.34]) + by svr1.postgresql.org (Postfix) with ESMTP + id 49A78D1B982; Fri, 5 Sep 2003 05:47:56 -0300 (ADT) +Received: from havleik.no (localhost [127.0.0.1]) + by btj1.havleik.no (8.12.6/8.12.6/SuSE Linux 0.6) with SMTP id + h858lso4013805; Fri, 5 Sep 2003 10:47:54 +0200 +Received: from 193.212.14.12 (SquirrelMail authenticated user btj) + by www.havleik.no with HTTP; Fri, 5 Sep 2003 10:47:54 +0200 (CEST) +Message-ID: <31414.193.212.14.12.1062751674.squirrel@www.havleik.no> +In-Reply-To: <58940.193.212.14.12.1062742087.squirrel@www.havleik.no> +References: <58940.193.212.14.12.1062742087.squirrel@www.havleik.no> +Date: Fri, 5 Sep 2003 10:47:54 +0200 (CEST) +Subject: Re: Seq scan of table? +From: "Bjorn T Johansen" +To: pgsql-general@postgresql.org +Cc: pgsql-performance@postgresql.org +User-Agent: SquirrelMail/1.4.0 RC2a +MIME-Version: 1.0 +Content-Type: text/plain;charset=iso-8859-1 +X-Priority: 3 +Importance: Normal +X-MailScanner-Information: Please contact Havleik Consulting for more + information +X-MailScanner: Found to be clean +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/419 +X-Sequence-Number: 48641 + +I think I have found out why.. I have a where clause on a ID field but it +seems like I need to cast this integer to the same integer as the field is +defined in the table, else it will do a tablescan. + +Is this assumtion correct? And if it is, do I then need to change all my +sql's to cast the where clause where I just have a number (eg where field += 1) to force the planner to use index scan instead of seq scan? + + +BTJ + +> I am trying to tune my database and I discovered one select that does a +> seq scan on a table but I can't see why... All the join fields are indexed +> and I am returning just one record, so no sort is done. +> Does it just pick seq scan for the heck of it or is it a reason? +> +> Regards, +> +> BTJ +> +> ----------------------------------------------------------------------------------------------- +> Bj�rn T Johansen (BSc,MNIF) +> Executive Manager +> btj@havleik.no Havleik Consulting +> Phone : +47 67 54 15 17 Conradisvei 4 +> Fax : +47 67 54 13 91 N-1338 Sandvika +> Cellular : +47 926 93 298 http://www.havleik.no +> ----------------------------------------------------------------------------------------------- +> "The stickers on the side of the box said "Supported Platforms: Windows +> 98, Windows NT 4.0, +> Windows 2000 or better", so clearly Linux was a supported platform." +> ----------------------------------------------------------------------------------------------- +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: you can get off all lists at once with the unregister command +> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) +> + + + +From pgsql-general-owner@postgresql.org Fri Sep 5 07:07:27 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP + id D6F2CD1B949; Fri, 5 Sep 2003 10:07:24 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) + with ESMTP id 19136-03; Fri, 5 Sep 2003 07:07:16 -0300 (ADT) +Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net + [194.217.242.89]) by svr1.postgresql.org (Postfix) with ESMTP + id 7437CD1B8AE; Fri, 5 Sep 2003 07:07:13 -0300 (ADT) +Received: from mwynhau.demon.co.uk ([193.237.186.96] + helo=mainbox.archonet.com) + by anchor-post-31.mail.demon.net with esmtp (Exim 3.35 #1) + id 19vDUp-0000Ch-0V; Fri, 05 Sep 2003 11:07:15 +0100 +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mainbox.archonet.com (Postfix) with ESMTP + id 4FAF617326; Fri, 5 Sep 2003 11:07:14 +0100 (BST) +Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP + id A8DA116B91; Fri, 5 Sep 2003 11:07:13 +0100 (BST) +From: Richard Huxton +To: "Bjorn T Johansen" , pgsql-general@postgresql.org +Subject: Re: [PERFORM] Seq scan of table? +Date: Fri, 5 Sep 2003 11:07:12 +0100 +User-Agent: KMail/1.5 +Cc: pgsql-performance@postgresql.org +References: <58940.193.212.14.12.1062742087.squirrel@www.havleik.no> + <31414.193.212.14.12.1062751674.squirrel@www.havleik.no> +In-Reply-To: <31414.193.212.14.12.1062751674.squirrel@www.havleik.no> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200309051107.12756.dev@archonet.com> +X-Virus-Scanned: by AMaViS snapshot-20020531 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/426 +X-Sequence-Number: 48648 + +On Friday 05 September 2003 09:47, Bjorn T Johansen wrote: +> I think I have found out why.. I have a where clause on a ID field but it +> seems like I need to cast this integer to the same integer as the field is +> defined in the table, else it will do a tablescan. +> +> Is this assumtion correct? And if it is, do I then need to change all my +> sql's to cast the where clause where I just have a number (eg where field +> = 1) to force the planner to use index scan instead of seq scan? + +PG's parser will assume an explicit number is an int4 - if you need an int8 +etc you'll need to cast it, yes. +You should find plenty of discussion of why in the archives, but the short +reason is that PG's type structure is quite flexible which means it can't +afford to make too many assumptions. + +-- + Richard Huxton + Archonet Ltd + +From pgsql-general-owner@postgresql.org Fri Sep 5 10:54:34 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP + id 4C969D1B89E; Fri, 5 Sep 2003 13:23:55 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) + with ESMTP id 36268-04; Fri, 5 Sep 2003 10:23:26 -0300 (ADT) +Received: from btj1.havleik.no (gw.havleik.no [217.8.139.34]) + by svr1.postgresql.org (Postfix) with ESMTP + id 1171BD1B550; Fri, 5 Sep 2003 10:23:22 -0300 (ADT) +Received: from pennywise.havleik.no (pennywise.havleik.no [10.1.1.2]) + by btj1.havleik.no (8.12.6/8.12.6/SuSE Linux 0.6) with ESMTP id + h85DNOo4016638; Fri, 5 Sep 2003 15:23:24 +0200 +Subject: Re: [PERFORM] Seq scan of table? +From: =?ISO-8859-1?Q?Bj=F8rn?= T Johansen +To: pgsql-general@postgresql.org, pgsql-performance@postgresql.org +In-Reply-To: <200309051107.12756.dev@archonet.com> +References: <58940.193.212.14.12.1062742087.squirrel@www.havleik.no> + <31414.193.212.14.12.1062751674.squirrel@www.havleik.no> + <200309051107.12756.dev@archonet.com> +Content-Type: text/plain +Organization: Havleik Consulting +Message-Id: <1062768204.11199.23.camel@pennywise.havleik.no> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Fri, 05 Sep 2003 15:23:24 +0200 +Content-Transfer-Encoding: 7bit +X-MailScanner-Information: Please contact Havleik Consulting for more + information +X-MailScanner: Found to be clean +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/441 +X-Sequence-Number: 48663 + +On Fri, 2003-09-05 at 12:07, Richard Huxton wrote: +> On Friday 05 September 2003 09:47, Bjorn T Johansen wrote: +> > I think I have found out why.. I have a where clause on a ID field but it +> > seems like I need to cast this integer to the same integer as the field is +> > defined in the table, else it will do a tablescan. +> > +> > Is this assumtion correct? And if it is, do I then need to change all my +> > sql's to cast the where clause where I just have a number (eg where field +> > = 1) to force the planner to use index scan instead of seq scan? +> +> PG's parser will assume an explicit number is an int4 - if you need an int8 +> etc you'll need to cast it, yes. +> You should find plenty of discussion of why in the archives, but the short +> reason is that PG's type structure is quite flexible which means it can't +> afford to make too many assumptions. + +Oki, I am using both int2 and int8 as well, so that explains it... +Thanks! + + +BTJ + + + + +From pgsql-general-owner@postgresql.org Fri Sep 5 11:40:49 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP + id F08C4D1B8FC; Fri, 5 Sep 2003 14:40:37 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) + with ESMTP id 42212-07; Fri, 5 Sep 2003 11:40:10 -0300 (ADT) +Received: from mx1.eskimo.com (mx1.eskimo.com [204.122.16.48]) + by svr1.postgresql.org (Postfix) with ESMTP + id 31421D1B89F; Fri, 5 Sep 2003 11:40:05 -0300 (ADT) +Received: from eskimo.com (johnnyb@eskimo.com [204.122.16.13]) + by mx1.eskimo.com (8.9.3/8.8.8) with ESMTP id HAA29349; + Fri, 5 Sep 2003 07:39:52 -0700 +Received: from localhost (johnnyb@localhost) + by eskimo.com (8.9.1a/8.9.1) with ESMTP id HAA21923; + Fri, 5 Sep 2003 07:39:50 -0700 (PDT) +X-Authentication-Warning: eskimo.com: johnnyb owned process doing -bs +Date: Fri, 5 Sep 2003 07:39:49 -0700 (PDT) +From: Jonathan Bartlett +To: Bjorn T Johansen +Cc: pgsql-general@postgresql.org, +Subject: Re: Seq scan of table? +In-Reply-To: <31414.193.212.14.12.1062751674.squirrel@www.havleik.no> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=X-UNKNOWN +Content-Transfer-Encoding: QUOTED-PRINTABLE +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/448 +X-Sequence-Number: 48670 + +> I think I have found out why.. I have a where clause on a ID field but it +> seems like I need to cast this integer to the same integer as the field is +> defined in the table, else it will do a tablescan. + +Yes, this is correct + +> Is this assumtion correct? And if it is, do I then need to change all my +> sql's to cast the where clause where I just have a number (eg where field +> =3D 1) to force the planner to use index scan instead of seq scan? + +Someone correct me if I'm wrong, but I believe numbers are int4's, so they +need to be cast if your column is not an int4. + +Jon + + + +> +> +> BTJ +> +> > I am trying to tune my database and I discovered one select that does a +> > seq scan on a table but I can't see why... All the join fields are inde= +xed +> > and I am returning just one record, so no sort is done. +> > Does it just pick seq scan for the heck of it or is it a reason? +> > +> > Regards, +> > +> > BTJ +> > +> > -----------------------------------------------------------------------= +------------------------ +> > Bj=F8rn T Johansen (BSc,MNIF) +> > Executive Manager +> > btj@havleik.no Havleik Consulting +> > Phone : +47 67 54 15 17 Conradisvei 4 +> > Fax : +47 67 54 13 91 N-1338 Sandvika +> > Cellular : +47 926 93 298 http://www.havleik.no +> > -----------------------------------------------------------------------= +------------------------ +> > "The stickers on the side of the box said "Supported Platforms: Windows +> > 98, Windows NT 4.0, +> > Windows 2000 or better", so clearly Linux was a supported platform." +> > -----------------------------------------------------------------------= +------------------------ +> > +> > +> > ---------------------------(end of broadcast)--------------------------- +> > TIP 2: you can get off all lists at once with the unregister command +> > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) +> > +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 5: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faqs/FAQ.html +> + + +From pgsql-performance-owner@postgresql.org Fri Sep 5 12:13:16 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP + id 3BCDAD1B8B7; Fri, 5 Sep 2003 15:13:13 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) + with ESMTP id 44839-09; Fri, 5 Sep 2003 12:12:42 -0300 (ADT) +Received: from fddlnint05.fds.com (fddlnint05.fds.com [208.15.91.52]) + by svr1.postgresql.org (Postfix) with ESMTP + id 4BF28D1B89F; Fri, 5 Sep 2003 12:12:41 -0300 (ADT) +In-Reply-To: +Subject: Re: SELECT's take a long time compared to other DBMS +To: noname@spam.com +Cc: pgsql-performance@postgresql.org, + pgsql-performance-owner@postgresql.org +X-Mailer: Lotus Notes Release 6.0 September 26, 2002 +Message-ID: + +From: "Patrick Hatcher" +Date: Fri, 5 Sep 2003 08:05:00 -0700 +X-MIMETrack: Serialize by Router on FDDLNINT05/FSG/SVR/FDD(Release 5.0.4 |June + 8, 2000) at 09/05/2003 11:07:36 AM +MIME-Version: 1.0 +Content-type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/95 +X-Sequence-Number: 3461 + + +Relaxin, +I can't remember during this thread if you said you were using ODBC or not. +If you are, then your problem is with the ODBC driver. You will need to +check the Declare/Fetch box or you will definitely bring back the entire +recordset. For small a small recordset this is not a problem, but the +larger the recordset the slower the data is return to the client. I played +around with the cache size on the driver and found a value between 100 to +200 provided good results. + +HTH +Patrick Hatcher + + + + + + "Relaxin" + Sent by: To: pgsql-performance@postgresql.org + pgsql-performance-owner@post cc: + gresql.org Subject: Re: [PERFORM] SELECT's take a long time compared to other DBMS + + + 09/04/2003 07:13 PM + + + + + +Thank you Christopher. + +> Change fsync to true (you want your data to survive, right?) and +> increase shared buffers to something that represents ~10% of your +> system memory, in blocks of 8K. + +I turned it off just in the hope that things would run faster. + +> None of this is likely to substantially change the result of that one +> query, however, and it seems quite likely that it is because +> PostgreSQL is honestly returning the whole result set of ~100K rows at +> once, whereas the other DBMSes are probably using cursors to return +> only the few rows of the result that you actually looked at. + +Finally, someone who will actually assume/admit that it is returning the +entire result set to the client. +Where as other DBMS manage the records at the server. + +I hope PG could fix/enhance this issue. + +There are several issues that's stopping our company from going with PG +(with paid support, if available), but this seems to big the one at the top +of the list. + +The next one is the handling of BLOBS. PG handles them like no other +system +I have ever come across. + +After that is a native Windows port, but we would deal cygwin (for a very +little while) if these other issues were handled. + +Thanks + + + + + +"Christopher Browne" wrote in message +news:m3fzjc58ll.fsf@chvatal.cbbrowne.com... +> A long time ago, in a galaxy far, far away, "Relaxin" +wrote: +> >> Have you changed any of the settings yet in postgresql.conf, +> >> specifically the shared_buffers setting? +> > +> > fsync = false +> > tcpip_socket = true +> > shared_buffers = 128 +> +> Change fsync to true (you want your data to survive, right?) and +> increase shared buffers to something that represents ~10% of your +> system memory, in blocks of 8K. +> +> So, if you have 512MB of RAM, then the total blocks is 65536, and it +> would likely be reasonable to increase shared_buffers to 1/10 of that, +> or about 6500. +> +> What is the value of effective_cache_size? That should probably be +> increased a whole lot, too. If you are mainly just running the +> database on your system, then it would be reasonable to set it to most +> of memory, or +> (* 1/2 (/ (* 512 1024 1024) 8192)) +> 32768. +> +> None of this is likely to substantially change the result of that one +> query, however, and it seems quite likely that it is because +> PostgreSQL is honestly returning the whole result set of ~100K rows at +> once, whereas the other DBMSes are probably using cursors to return +> only the few rows of the result that you actually looked at. +> -- +> "cbbrowne","@","cbbrowne.com" +> http://www3.sympatico.ca/cbbrowne/linuxdistributions.html +> Rules of the Evil Overlord #14. "The hero is not entitled to a last +> kiss, a last cigarette, or any other form of last request." +> + + + +---------------------------(end of broadcast)--------------------------- +TIP 8: explain analyze is your friend + + + + +From pgsql-hackers-owner@postgresql.org Fri Sep 5 12:18:23 2003 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 10C73D1B8B0 + for ; + Fri, 5 Sep 2003 15:18:17 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 47039-07 + for ; + Fri, 5 Sep 2003 12:17:46 -0300 (ADT) +Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) + by svr1.postgresql.org (Postfix) with ESMTP id EBB7FD1B960 + for ; + Fri, 5 Sep 2003 12:17:44 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id h85FHZw25603; + Fri, 5 Sep 2003 11:17:35 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200309051517.h85FHZw25603@candle.pha.pa.us> +Subject: checkpoints too frequent +In-Reply-To: +To: Vivek Khera +Date: Fri, 5 Sep 2003 11:17:35 -0400 (EDT) +Cc: PostgreSQL-development +X-Mailer: ELM [version 2.4ME+ PL106 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/393 +X-Sequence-Number: 43405 + +Vivek, you reported recently that increasing sort_mem and +checkpoint_segments increased performance. Can you run a test to see +how much of that improvement was just because of increasing +checkpoint_segments? + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Fri Sep 5 12:25:20 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 2D997D1B949 + for ; + Fri, 5 Sep 2003 15:25:13 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 47378-05 + for ; + Fri, 5 Sep 2003 12:24:42 -0300 (ADT) +Received: from gbg-web01 (unknown [193.243.135.18]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A840D1B8BA + for ; + Fri, 5 Sep 2003 12:24:41 -0300 (ADT) +Received: from webmail.defero.se (localhost [127.0.0.1]) + by gbg-web01 (Postfix) with SMTP + id 34488308003; Fri, 5 Sep 2003 17:36:50 +0200 (CEST) +Received: from 62.119.108.236 (SquirrelMail authenticated user rasmus) + by www.defero.se with HTTP; Fri, 5 Sep 2003 17:36:50 +0200 (CEST) +Message-ID: <1081.62.119.108.236.1062776210.squirrel@www.defero.se> +In-Reply-To: <200309050934.52082.dev@archonet.com> +References: <1564.62.119.108.236.1062716026.squirrel@www.defero.se> + <200309050934.52082.dev@archonet.com> +Date: Fri, 5 Sep 2003 17:36:50 +0200 (CEST) +Subject: Re: Performance problems on a fairly big table with two +From: "Rasmus Aveskogh" +To: "Richard Huxton" +Cc: pgsql-performance@postgresql.org +Reply-To: rasmus@defero.se +User-Agent: SquirrelMail/1.4.0 +MIME-Version: 1.0 +Content-Type: text/plain;charset=iso-8859-1 +X-Priority: 3 +Importance: Normal +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/96 +X-Sequence-Number: 3462 + + +Richard, + +Thanks a lot! You were right - the query parser "misunderstood" +now() - '1 day'::interval and only used one of the indexes (as I already +noticed). + +Actually all I had to do was to cast the result like this: + +(now() - '1 day'::interval)::date + +75s is not between 10ms and 200ms. + +Thanks again! + +-ra + + +> On Thursday 04 September 2003 23:53, Rasmus Aveskogh wrote: +>> Hi, +>> +>> I have a table that looks like this: +>> +>> DATA ID TIME +>> +>> |------|----|------| +>> +>> The table holds app. 14M rows now and grows by app. 350k rows a day. +>> +>> The ID-column holds about 1500 unique values (integer). +>> The TIME-columns is of type timestamp without timezone. +>> +>> I have one index (b-tree) on the ID-column and one index (b-tree) on the +>> time-column. +>> +>> My queries most often look like this: +>> +>> SELECT DATA FROM WHERE ID = 1 AND TIME > now() - '1 +>> day'::interval; +> [snip] +>> I tried applying a multicolumn index on ID and TIME, but that one won't +>> even be used (after ANALYZE). +> +> The problem is likely to be that the parser isn't spotting that now()-'1 +> day' +> is constant. Try an explicit time and see if the index is used. If so, you +> can write a wrapper function for your expression (mark it STABLE so the +> planner knows it won't change during the statement). +> +> Alternatively, you can do the calculation in the application and use an +> explicit time. +> +> HTH +> -- +> Richard Huxton +> Archonet Ltd +> + + +From pgsql-hackers-owner@postgresql.org Sat Sep 6 15:43:23 2003 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 5F244D1B8B7 + for ; + Fri, 5 Sep 2003 15:42:26 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 47153-10 + for ; + Fri, 5 Sep 2003 12:41:54 -0300 (ADT) +Received: from yertle.kcilink.com (yertle.kcilink.com [216.194.193.105]) + by svr1.postgresql.org (Postfix) with ESMTP id 1A573D1B91B + for ; + Fri, 5 Sep 2003 12:41:54 -0300 (ADT) +Received: by yertle.kcilink.com (Postfix, from userid 100) + id 7BC0E2178A; Fri, 5 Sep 2003 11:41:53 -0400 (EDT) +From: Vivek Khera +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +Message-ID: <16216.44737.326214.974984@yertle.int.kciLink.com> +Date: Fri, 5 Sep 2003 11:41:53 -0400 +To: Bruce Momjian +Cc: PostgreSQL-development +Subject: Re: checkpoints too frequent +In-Reply-To: <200309051517.h85FHZw25603@candle.pha.pa.us> +References: + <200309051517.h85FHZw25603@candle.pha.pa.us> +X-Mailer: VM 7.14 under 21.4 (patch 12) "Portable Code" XEmacs Lucid +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/486 +X-Sequence-Number: 43498 + +>>>>> "BM" == Bruce Momjian writes: + +BM> Vivek, you reported recently that increasing sort_mem and +BM> checkpoint_segments increased performance. Can you run a test to see +BM> how much of that improvement was just because of increasing +BM> checkpoint_segments? + +i was thinking just the same thing myself. + +i'll start that run now. + +From pgsql-general-owner@postgresql.org Fri Sep 5 13:09:52 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP + id A7608D1B947; Fri, 5 Sep 2003 16:09:51 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) + with ESMTP id 51002-07; Fri, 5 Sep 2003 13:09:20 -0300 (ADT) +Received: from lakemtao01.cox.net (lakemtao01.cox.net [68.1.17.244]) + by svr1.postgresql.org (Postfix) with ESMTP + id 6A054D1B56B; Fri, 5 Sep 2003 13:09:19 -0300 (ADT) +Received: from lhosts ([68.11.66.83]) by lakemtao01.cox.net + (InterMail vM.5.01.06.04 201-253-122-130-104-20030726) with ESMTP + id <20030905160917.RBKV722.lakemtao01.cox.net@lhosts>; + Fri, 5 Sep 2003 12:09:17 -0400 +Subject: Re: [PERFORM] Seq scan of table? +From: Ron Johnson +To: PgSQL General ML , + PgSQL Performance ML +In-Reply-To: +References: +Content-Type: text/plain +Message-Id: <1062778158.17023.205.camel@haggis> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Fri, 05 Sep 2003 11:09:18 -0500 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/456 +X-Sequence-Number: 48678 + +On Fri, 2003-09-05 at 09:39, Jonathan Bartlett wrote: +> > I think I have found out why.. I have a where clause on a ID field but it +> > seems like I need to cast this integer to the same integer as the field is +> > defined in the table, else it will do a tablescan. +> +> Yes, this is correct +> +> > Is this assumtion correct? And if it is, do I then need to change all my +> > sql's to cast the where clause where I just have a number (eg where field +> > = 1) to force the planner to use index scan instead of seq scan? +> +> Someone correct me if I'm wrong, but I believe numbers are int4's, so they +> need to be cast if your column is not an int4. + +You mean "constant" scalars? Yes, constants scalars are interpreted +as int4. + +-- +----------------------------------------------------------------- +Ron Johnson, Jr. ron.l.johnson@cox.net +Jefferson, LA USA + +"Millions of Chinese speak Chinese, and it's not hereditary..." +Dr. Dean Edell + + +From pgsql-performance-owner@postgresql.org Fri Sep 5 13:40:13 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 1EB39D1B8B3 + for ; + Fri, 5 Sep 2003 16:40:12 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 56496-06 + for ; + Fri, 5 Sep 2003 13:39:40 -0300 (ADT) +Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net + [194.217.242.85]) + by svr1.postgresql.org (Postfix) with ESMTP id 2188CD1BA38 + for ; + Fri, 5 Sep 2003 13:39:35 -0300 (ADT) +Received: from mwynhau.demon.co.uk ([193.237.186.96] + helo=mainbox.archonet.com) + by anchor-post-35.mail.demon.net with esmtp (Exim 3.35 #1) + id 19vJcU-000JxW-0Z; Fri, 05 Sep 2003 17:39:34 +0100 +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mainbox.archonet.com (Postfix) with ESMTP + id 1721E16AC1; Fri, 5 Sep 2003 17:39:33 +0100 (BST) +Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP + id 608AB16ABA; Fri, 5 Sep 2003 17:39:32 +0100 (BST) +From: Richard Huxton +To: rasmus@defero.se +Subject: Re: Performance problems on a fairly big table with two +Date: Fri, 5 Sep 2003 17:39:32 +0100 +User-Agent: KMail/1.5 +Cc: pgsql-performance@postgresql.org +References: <1564.62.119.108.236.1062716026.squirrel@www.defero.se> + <200309050934.52082.dev@archonet.com> + <1081.62.119.108.236.1062776210.squirrel@www.defero.se> +In-Reply-To: <1081.62.119.108.236.1062776210.squirrel@www.defero.se> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200309051739.32467.dev@archonet.com> +X-Virus-Scanned: by AMaViS snapshot-20020531 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/98 +X-Sequence-Number: 3464 + +On Friday 05 September 2003 16:36, Rasmus Aveskogh wrote: +> Richard, +> +> Thanks a lot! You were right - the query parser "misunderstood" +> now() - '1 day'::interval and only used one of the indexes (as I already +> noticed). +> +> Actually all I had to do was to cast the result like this: +> +> (now() - '1 day'::interval)::date +> +> 75s is not between 10ms and 200ms. +> +> Thanks again! + +Ah - good. You also want to be careful with differences between timestamp +with/without time zone etc. +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Fri Sep 5 17:04:58 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id CE7EBD1D1D5 + for ; + Fri, 5 Sep 2003 20:04:53 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 17355-02 + for ; + Fri, 5 Sep 2003 17:04:21 -0300 (ADT) +Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) + by svr1.postgresql.org (Postfix) with ESMTP id 2C3D0D1E117 + for ; + Fri, 5 Sep 2003 14:44:36 -0300 (ADT) +Received: from ibm-e.pdx.osdl.net (ibm-e.pdx.osdl.net [172.20.1.71]) + by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h85HiPo06325; + Fri, 5 Sep 2003 10:44:25 -0700 +Subject: Re: [GENERAL] how to get accurate values in pg_statistic +From: Mary Edie Meredith +To: Tom Lane +Cc: pgsql-performance , + osdldbt-general +In-Reply-To: <11537.1062717375@sss.pgh.pa.us> +References: <1062697270.6854.3475.camel@ibm-e.pdx.osdl.net> + <11537.1062717375@sss.pgh.pa.us> +Content-Type: text/plain +Organization: Open Source Development Lab +Message-Id: <1062783865.6854.4780.camel@ibm-e.pdx.osdl.net> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.2.2 +Date: 05 Sep 2003 10:44:25 -0700 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/100 +X-Sequence-Number: 3466 + +I certainly don't claim that it is appropriate to force customers into a +full analysis, particularly if random sampling versus a full scan of the +data reveals little to no performance differences in the plans. Being +able to sample accurately is _very nice for large tables. + +For our testing purposes, however, consistent results are extremely +important. We have observed that small difference in one plan for one of +22 queries can cause a difference in the DBT-3 results. If this +happens, a small change in performance runs between two Linux kernels +may appear to be due to the kernels, when in fact it is due to the plan +change. + +We know that the plans are _exactly the same if the data in the +pg_statistics table is the same from run to run (all other things being +equal). So what we need to have is identical optimizer costs +(pg_statistics) for the same table data for each. + +I feel certain that the pg_statistics table will be identical from run +to run if analyze looks at every row. Thus our hope to find a way to +get that. + +We did runs over night. We can confirm that VACUUM FULL ANALYZE does +not produce the same pg_statistics run to run. With the default (10) +default_statistics_target the plans are also different. + +We ran additional tests with default_statistics_target set to 1000 (the +max I believe). The plans are the same over the different runs, but the +pg_statistics table has different cost values. The performance results +of the runs are consistent (we would expect this with the same plans). +The resulting performance metrics are similar to the best plans we see +using the default histogram size (good news). + +However, we worry that one day the cost will change enough for whatever +reason to cause a plan change, especially for a larger database scale +factor (database size/row size). + +I know we appear to be an isolated case, but customers also do testing +and may have the same consistency issues we have. I can also imagine +cases where customers want to guarantee that plans stay the same +(between replicated sites, for example). If two developers are +analyzing changes to the optimizer, don't you want the costs used for +testing on their two systems to be identical for comparison purposes? + +Anyway, IMHO I believe that an option for an ANALYZE FULL ("sampling" +all rows) would be valuable. Any other ideas for how to force this +without code change are very welcome. + +Thanks for your info! + + + +On Thu, 2003-09-04 at 16:16, Tom Lane wrote: +> Mary Edie Meredith writes: +> > Stephan Szabo kindly responded to our earlier queries suggesting we look +> > at default_statistics_target and ALTER TABLE ALTER COLUMN SET +> > STATISTICS. +> +> > These determine the number of bins in the histogram for a given column. +> > But for a large number of rows (for example 6 million) the maximum value +> > (1000) does not guarantee that ANALYZE will do a full scan of the table. +> > We do not see a way to guarantee the same statistics run to run without +> > forcing ANALYZE to examine every row of every table. +> +> Do you actually still have a problem with the plans changing when the +> stats target is above 100 or so? I think the notion of "force ANALYZE +> to do a full scan" is inherently wrongheaded ... it certainly would not +> produce numbers that have anything to do with ordinary practice. +> +> If you have data statistics that are so bizarre that the planner still +> gets things wrong with a target of 1000, then I'd like to know more +> about why. +> +> regards, tom lane +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: you can get off all lists at once with the unregister command +> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) +-- +Mary Edie Meredith +Open Source Development Lab + + +From pgsql-performance-owner@postgresql.org Fri Sep 5 17:43:55 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 4A1FCD1D1D5 + for ; + Fri, 5 Sep 2003 20:05:22 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 17541-03 + for ; + Fri, 5 Sep 2003 17:05:10 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 20242D1E761 + for ; + Fri, 5 Sep 2003 15:25:10 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h85IP9Df094744 + for ; Fri, 5 Sep 2003 18:25:09 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h85IInWv093354 + for pgsql-performance@postgresql.org; Fri, 5 Sep 2003 18:18:49 GMT +From: "Relaxin" +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: SELECT's take a long time compared to other DBMS +Date: Fri, 5 Sep 2003 11:18:35 -0700 +Organization: Hub.Org Networking Services +Lines: 129 +Message-ID: +References: + +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/103 +X-Sequence-Number: 3469 + +Expect that the Declare/Fetch only creates a forwardonly cursor, you can go +backwards thru the result set. + +""Patrick Hatcher"" wrote in message +news:OFAD2A2CF4.499F8F67-ON88256D98.00527BCB-88256D98.00538130@fds.com... +> +> Relaxin, +> I can't remember during this thread if you said you were using ODBC or +not. +> If you are, then your problem is with the ODBC driver. You will need to +> check the Declare/Fetch box or you will definitely bring back the entire +> recordset. For small a small recordset this is not a problem, but the +> larger the recordset the slower the data is return to the client. I +played +> around with the cache size on the driver and found a value between 100 to +> 200 provided good results. +> +> HTH +> Patrick Hatcher +> +> +> +> +> +> "Relaxin" +> Sent by: To: +pgsql-performance@postgresql.org +> pgsql-performance-owner@post cc: +> gresql.org Subject: Re: +[PERFORM] SELECT's take a long time compared to other DBMS +> +> +> 09/04/2003 07:13 PM +> +> +> +> +> +> Thank you Christopher. +> +> > Change fsync to true (you want your data to survive, right?) and +> > increase shared buffers to something that represents ~10% of your +> > system memory, in blocks of 8K. +> +> I turned it off just in the hope that things would run faster. +> +> > None of this is likely to substantially change the result of that one +> > query, however, and it seems quite likely that it is because +> > PostgreSQL is honestly returning the whole result set of ~100K rows at +> > once, whereas the other DBMSes are probably using cursors to return +> > only the few rows of the result that you actually looked at. +> +> Finally, someone who will actually assume/admit that it is returning the +> entire result set to the client. +> Where as other DBMS manage the records at the server. +> +> I hope PG could fix/enhance this issue. +> +> There are several issues that's stopping our company from going with PG +> (with paid support, if available), but this seems to big the one at the +top +> of the list. +> +> The next one is the handling of BLOBS. PG handles them like no other +> system +> I have ever come across. +> +> After that is a native Windows port, but we would deal cygwin (for a very +> little while) if these other issues were handled. +> +> Thanks +> +> +> +> +> +> "Christopher Browne" wrote in message +> news:m3fzjc58ll.fsf@chvatal.cbbrowne.com... +> > A long time ago, in a galaxy far, far away, "Relaxin" +> wrote: +> > >> Have you changed any of the settings yet in postgresql.conf, +> > >> specifically the shared_buffers setting? +> > > +> > > fsync = false +> > > tcpip_socket = true +> > > shared_buffers = 128 +> > +> > Change fsync to true (you want your data to survive, right?) and +> > increase shared buffers to something that represents ~10% of your +> > system memory, in blocks of 8K. +> > +> > So, if you have 512MB of RAM, then the total blocks is 65536, and it +> > would likely be reasonable to increase shared_buffers to 1/10 of that, +> > or about 6500. +> > +> > What is the value of effective_cache_size? That should probably be +> > increased a whole lot, too. If you are mainly just running the +> > database on your system, then it would be reasonable to set it to most +> > of memory, or +> > (* 1/2 (/ (* 512 1024 1024) 8192)) +> > 32768. +> > +> > None of this is likely to substantially change the result of that one +> > query, however, and it seems quite likely that it is because +> > PostgreSQL is honestly returning the whole result set of ~100K rows at +> > once, whereas the other DBMSes are probably using cursors to return +> > only the few rows of the result that you actually looked at. +> > -- +> > "cbbrowne","@","cbbrowne.com" +> > http://www3.sympatico.ca/cbbrowne/linuxdistributions.html +> > Rules of the Evil Overlord #14. "The hero is not entitled to a last +> > kiss, a last cigarette, or any other form of last request." +> > +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 8: explain analyze is your friend +> +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 3: 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-general-owner@postgresql.org Sat Sep 6 15:43:18 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP + id 9F857D1BA9D; Fri, 5 Sep 2003 20:10:24 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) + with ESMTP id 18972-05; Fri, 5 Sep 2003 17:09:51 -0300 (ADT) +Received: from bob.samurai.com (bob.samurai.com [205.207.28.75]) + by svr1.postgresql.org (Postfix) with ESMTP + id 693FDD1E4BE; Fri, 5 Sep 2003 15:20:22 -0300 (ADT) +Received: from 6-allhosts (d226-85-166.home.cgocable.net [24.226.85.166]) + by bob.samurai.com (Postfix) with ESMTP + id 76A9A1E00; Fri, 5 Sep 2003 14:20:18 -0400 (EDT) +Subject: Re: [PERFORM] Seq scan of table? +From: Neil Conway +To: Richard Huxton +Cc: Bjorn T Johansen , + PostgreSQL General , + PostgreSQL Performance +In-Reply-To: <200309051107.12756.dev@archonet.com> +References: <58940.193.212.14.12.1062742087.squirrel@www.havleik.no> + <31414.193.212.14.12.1062751674.squirrel@www.havleik.no> + <200309051107.12756.dev@archonet.com> +Content-Type: text/plain +Message-Id: <1062786017.447.1.camel@tokyo> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Fri, 05 Sep 2003 14:20:18 -0400 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/503 +X-Sequence-Number: 48725 + +On Fri, 2003-09-05 at 06:07, Richard Huxton wrote: +> PG's parser will assume an explicit number is an int4 - if you need an int8 +> etc you'll need to cast it, yes. + +Or enclose the integer literal in single quotes. + +> You should find plenty of discussion of why in the archives, but the short +> reason is that PG's type structure is quite flexible which means it can't +> afford to make too many assumptions. + +Well, it's definitely a bug in PG, it's "quite flexible" type structure +notwithstanding. + +-Neil + + + +From pgsql-performance-owner@postgresql.org Fri Sep 5 17:02:15 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 26D48D1B960 + for ; + Fri, 5 Sep 2003 20:02:09 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 15734-06 + for ; + Fri, 5 Sep 2003 17:01:57 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 0CA9BD1EC75 + for ; + Fri, 5 Sep 2003 15:38:21 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h85IcFAn007127; + Fri, 5 Sep 2003 14:38:15 -0400 (EDT) +To: Mary Edie Meredith +Cc: pgsql-performance , + osdldbt-general +Subject: Re: [GENERAL] how to get accurate values in pg_statistic (continued) +In-reply-to: <1062783865.6854.4780.camel@ibm-e.pdx.osdl.net> +References: <1062697270.6854.3475.camel@ibm-e.pdx.osdl.net> + <11537.1062717375@sss.pgh.pa.us> + <1062783865.6854.4780.camel@ibm-e.pdx.osdl.net> +Comments: In-reply-to Mary Edie Meredith + message dated "05 Sep 2003 10:44:25 -0700" +Date: Fri, 05 Sep 2003 14:38:15 -0400 +Message-ID: <7126.1062787095@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/99 +X-Sequence-Number: 3465 + +Mary Edie Meredith writes: +> For our testing purposes, however, consistent results are extremely +> important. We have observed that small difference in one plan for one of +> 22 queries can cause a difference in the DBT-3 results. If this +> happens, a small change in performance runs between two Linux kernels +> may appear to be due to the kernels, when in fact it is due to the plan +> change. + +Fair enough. If you are trying to force exactly repeatable results, +why don't you just "set seed = 0" before you ANALYZE? There's only +one random-number generator, so that should force ANALYZE to make the +same random sampling every time. + +Also, it'd be a good idea to ANALYZE the needed tables by name, +explicitly, to ensure that they are analyzed in a known order +rather than whatever order ANALYZE happens to find them in pg_class. + + regards, tom lane + +From pgsql-general-owner@postgresql.org Fri Sep 5 17:13:41 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP + id D47D4D1BA45; Fri, 5 Sep 2003 20:11:43 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) + with ESMTP id 19340-07; Fri, 5 Sep 2003 17:11:11 -0300 (ADT) +Received: from anchor-post-32.mail.demon.net (anchor-post-32.mail.demon.net + [194.217.242.90]) by svr1.postgresql.org (Postfix) with ESMTP + id 730B3D1E27A; Fri, 5 Sep 2003 16:37:16 -0300 (ADT) +Received: from mwynhau.demon.co.uk ([193.237.186.96] + helo=mainbox.archonet.com) + by anchor-post-32.mail.demon.net with esmtp (Exim 3.35 #1) + id 19vMOQ-000APQ-0W; Fri, 05 Sep 2003 20:37:15 +0100 +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mainbox.archonet.com (Postfix) with ESMTP + id 3FC84173EE; Fri, 5 Sep 2003 20:37:14 +0100 (BST) +Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP + id 95D0E173ED; Fri, 5 Sep 2003 20:37:13 +0100 (BST) +From: Richard Huxton +To: Neil Conway +Subject: Re: [PERFORM] Seq scan of table? +Date: Fri, 5 Sep 2003 20:37:12 +0100 +User-Agent: KMail/1.5 +Cc: Bjorn T Johansen , + PostgreSQL General , + PostgreSQL Performance +References: <58940.193.212.14.12.1062742087.squirrel@www.havleik.no> + <200309051107.12756.dev@archonet.com> + <1062786017.447.1.camel@tokyo> +In-Reply-To: <1062786017.447.1.camel@tokyo> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200309052037.12689.dev@archonet.com> +X-Virus-Scanned: by AMaViS snapshot-20020531 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/468 +X-Sequence-Number: 48690 + +On Friday 05 September 2003 19:20, Neil Conway wrote: +> On Fri, 2003-09-05 at 06:07, Richard Huxton wrote: +> > PG's parser will assume an explicit number is an int4 - if you need an +> > int8 etc you'll need to cast it, yes. +> +> Or enclose the integer literal in single quotes. +> +> > You should find plenty of discussion of why in the archives, but the +> > short reason is that PG's type structure is quite flexible which means it +> > can't afford to make too many assumptions. +> +> Well, it's definitely a bug in PG, it's "quite flexible" type structure +> notwithstanding. + +It certainly catches out a lot of people. I'd guess it's in the top three +issues in the general/sql lists. I'd guess part of the problem is it's so +silent. In some ways it would be better to issue a NOTICE every time a +typecast is forced in a comparison - irritating as that would be. + +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Fri Sep 5 17:50:59 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B86B2D1B9A1 + for ; + Fri, 5 Sep 2003 20:49:46 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 24650-07 + for ; + Fri, 5 Sep 2003 17:49:36 -0300 (ADT) +Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) + by svr1.postgresql.org (Postfix) with ESMTP id 71619D1B8B3 + for ; + Fri, 5 Sep 2003 17:49:34 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id h85KnCv16810; + Fri, 5 Sep 2003 16:49:12 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200309052049.h85KnCv16810@candle.pha.pa.us> +Subject: Re: [GENERAL] how to get accurate values in pg_statistic +In-Reply-To: <1062783865.6854.4780.camel@ibm-e.pdx.osdl.net> +To: Mary Edie Meredith +Date: Fri, 5 Sep 2003 16:49:11 -0400 (EDT) +Cc: Tom Lane , + pgsql-performance , + osdldbt-general +X-Mailer: ELM [version 2.4ME+ PL106 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/104 +X-Sequence-Number: 3470 + +Mary Edie Meredith wrote: +> I certainly don't claim that it is appropriate to force customers into a +> full analysis, particularly if random sampling versus a full scan of the +> data reveals little to no performance differences in the plans. Being +> able to sample accurately is _very nice for large tables. +> +> For our testing purposes, however, consistent results are extremely +> important. We have observed that small difference in one plan for one of +> 22 queries can cause a difference in the DBT-3 results. If this +> happens, a small change in performance runs between two Linux kernels +> may appear to be due to the kernels, when in fact it is due to the plan +> change. +> +> We know that the plans are _exactly the same if the data in the +> pg_statistics table is the same from run to run (all other things being +> equal). So what we need to have is identical optimizer costs +> (pg_statistics) for the same table data for each. +> +> I feel certain that the pg_statistics table will be identical from run +> to run if analyze looks at every row. Thus our hope to find a way to +> get that. + + +Actually, if you are usig GEQO (many tables in a join) the optimizer +itself will randomly try plans --- even worse than random statistics. + +We do have: + + #geqo_random_seed = -1 # -1 = use variable seed + +that lets you force a specific random seed for testing purposes. I +wonder if that could be extended to control VACUUM radomization too. +Right now, it just controls GEQO and in fact gets reset on every +optimizer run. + +I wonder if you could just poke a srandom(10) in +src/backend/command/analyze.c. + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Fri Sep 5 18:20:47 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B2F92D1B8F5 + for ; + Fri, 5 Sep 2003 20:56:20 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 27580-01 + for ; + Fri, 5 Sep 2003 17:56:10 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 7EDDED1B8BC + for ; + Fri, 5 Sep 2003 17:56:09 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h85KtnAn016528; + Fri, 5 Sep 2003 16:55:49 -0400 (EDT) +To: Bruce Momjian +Cc: Mary Edie Meredith , + pgsql-performance , + osdldbt-general +Subject: Re: [GENERAL] how to get accurate values in pg_statistic +In-reply-to: <200309052049.h85KnCv16810@candle.pha.pa.us> +References: <200309052049.h85KnCv16810@candle.pha.pa.us> +Comments: In-reply-to Bruce Momjian + message dated "Fri, 05 Sep 2003 16:49:11 -0400" +Date: Fri, 05 Sep 2003 16:55:49 -0400 +Message-ID: <16527.1062795349@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/106 +X-Sequence-Number: 3472 + +Bruce Momjian writes: +> We do have: +> #geqo_random_seed = -1 # -1 = use variable seed + +> that lets you force a specific random seed for testing purposes. I +> wonder if that could be extended to control VACUUM radomization too. +> Right now, it just controls GEQO and in fact gets reset on every +> optimizer run. + +Actually, just the other day I was thinking we should take that out. +Since there is only one random number generator in the C library, +GEQO is messing with everyone else's state every time it decides to do +an srandom(). And there is certainly no need to do an explicit srandom +with a "random" seed every time through the optimizer, which is the +code's default behavior at the moment. That just decreases the +randomness AFAICS, compared to letting the established sequence run. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Sep 5 18:05:01 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 08F90D1B8E8 + for ; + Fri, 5 Sep 2003 21:02:20 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 26396-06 + for ; + Fri, 5 Sep 2003 18:02:09 -0300 (ADT) +Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) + by svr1.postgresql.org (Postfix) with ESMTP id 1EB29D1B53A + for ; + Fri, 5 Sep 2003 18:02:08 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id h85L22818312; + Fri, 5 Sep 2003 17:02:02 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200309052102.h85L22818312@candle.pha.pa.us> +Subject: Re: [GENERAL] how to get accurate values in pg_statistic +In-Reply-To: <16527.1062795349@sss.pgh.pa.us> +To: Tom Lane +Date: Fri, 5 Sep 2003 17:02:02 -0400 (EDT) +Cc: Mary Edie Meredith , + pgsql-performance , + osdldbt-general +X-Mailer: ELM [version 2.4ME+ PL106 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/105 +X-Sequence-Number: 3471 + +Tom Lane wrote: +> Bruce Momjian writes: +> > We do have: +> > #geqo_random_seed = -1 # -1 = use variable seed +> +> > that lets you force a specific random seed for testing purposes. I +> > wonder if that could be extended to control VACUUM radomization too. +> > Right now, it just controls GEQO and in fact gets reset on every +> > optimizer run. +> +> Actually, just the other day I was thinking we should take that out. +> Since there is only one random number generator in the C library, +> GEQO is messing with everyone else's state every time it decides to do +> an srandom(). And there is certainly no need to do an explicit srandom +> with a "random" seed every time through the optimizer, which is the +> code's default behavior at the moment. That just decreases the +> randomness AFAICS, compared to letting the established sequence run. + +Agreed. + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Fri Sep 5 18:36:57 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 0A8F7D1B9BD + for ; + Fri, 5 Sep 2003 21:10:27 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 28163-03 + for ; + Fri, 5 Sep 2003 18:09:56 -0300 (ADT) +Received: from bob.samurai.com (bob.samurai.com [205.207.28.75]) + by svr1.postgresql.org (Postfix) with ESMTP id ED563D1B53A + for ; + Fri, 5 Sep 2003 18:09:55 -0300 (ADT) +Received: from 6-allhosts (d226-85-166.home.cgocable.net [24.226.85.166]) + by bob.samurai.com (Postfix) with ESMTP + id 516131E3E; Fri, 5 Sep 2003 17:09:55 -0400 (EDT) +Subject: Re: SELECT's take a long time compared to other DBMS +From: Neil Conway +To: Relaxin +Cc: PostgreSQL Performance +In-Reply-To: +References: + + +Content-Type: text/plain +Message-Id: <1062796189.447.9.camel@tokyo> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Fri, 05 Sep 2003 17:09:49 -0400 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/107 +X-Sequence-Number: 3473 + +On Fri, 2003-09-05 at 14:18, Relaxin wrote: +> Expect that the Declare/Fetch only creates a forwardonly cursor, you can go +> backwards thru the result set. + +No, DECLARE can create scrollable cursors, read the ref page again. This +functionality is much improved in PostgreSQL 7.4, though. + +-Neil + + + +From pgsql-general-owner@postgresql.org Fri Sep 5 18:53:13 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 79C54D1B97B + for ; + Fri, 5 Sep 2003 21:53:12 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 32171-04 + for ; + Fri, 5 Sep 2003 18:53:02 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 4B824D1B94F + for ; + Fri, 5 Sep 2003 18:53:01 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h85LquAn020331; + Fri, 5 Sep 2003 17:52:56 -0400 (EDT) +To: Neil Conway +Cc: Richard Huxton , Bjorn T Johansen , + PostgreSQL General , + PostgreSQL Performance +Subject: Re: [PERFORM] Seq scan of table? +In-reply-to: <1062786017.447.1.camel@tokyo> +References: <58940.193.212.14.12.1062742087.squirrel@www.havleik.no> + <31414.193.212.14.12.1062751674.squirrel@www.havleik.no> + <200309051107.12756.dev@archonet.com> + <1062786017.447.1.camel@tokyo> +Comments: In-reply-to Neil Conway + message dated "Fri, 05 Sep 2003 14:20:18 -0400" +Date: Fri, 05 Sep 2003 17:52:55 -0400 +Message-ID: <20330.1062798775@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/481 +X-Sequence-Number: 48703 + +Neil Conway writes: +> On Fri, 2003-09-05 at 06:07, Richard Huxton wrote: +>> You should find plenty of discussion of why in the archives, but the short +>> reason is that PG's type structure is quite flexible which means it can't +>> afford to make too many assumptions. + +> Well, it's definitely a bug in PG, it's "quite flexible" type structure +> notwithstanding. + +Let's say it's something we'd really like to fix ;-) ... and will, as +soon as we can figure out a cure that's not worse than the disease. +Dorking around with the semantics of numeric expressions has proven +to be a risky business. See, eg, the thread starting here: +http://archives.postgresql.org/pgsql-hackers/2002-11/msg00468.php + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Sep 5 18:59:34 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 55982D1B53A + for ; + Fri, 5 Sep 2003 21:59:11 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 32279-07 + for ; + Fri, 5 Sep 2003 18:58:40 -0300 (ADT) +Received: from MX2.estpak.ee (mta1.mail.neti.ee [194.126.101.123]) + by svr1.postgresql.org (Postfix) with ESMTP id 23967D1B8A4 + for ; + Fri, 5 Sep 2003 18:58:39 -0300 (ADT) +Received: from neti.ee (virtual.estpak.ee [194.126.101.112]) + by MX2.estpak.ee (Postfix) with SMTP id 68C1173595 + for ; + Sat, 6 Sep 2003 00:56:35 +0300 (EEST) +Date: Fri, 5 Sep 2003 21:58:29 -0000 +To: +Subject: Serious issues with CPU usage +From: +X-Mailer: TWIG neti.ee +X-Client-IP: 213.219.85.42 +Message-Id: <20030905215635.68C1173595@MX2.estpak.ee> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/109 +X-Sequence-Number: 3475 + +Hi, + +i'm having _serious_ issues of postgres hogging up the CPU over time. A graph +showing this can be seen at http://andri.estpak.ee/cpu0.png . + +The database is running on Redhat 9 (stock 2.4.20-8 kernel), on a reiserfs +partition (~8% usage - no problem there), and this problem has been with +PostgreSQL 7.3.2 (both package provided by Redhat and self-rebuilt package) +and 7.3.4 (i used the 7.3.4 SRPM available at postgres ftp site). + +A VACUUM FULL is a remedy to this problem, but a simple VACUUM isn't. + +This can be reproduced, I think, by a simple UPDATE command: + +database=# EXPLAIN ANALYZE UPDATE table SET random_int_field = 1, last_updated += NOW() WHERE primary_key = 3772; + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------- + Index Scan using table_pkey on table (cost=0.00..6.81 rows=1 width=83) +(actual time=0.09..0.10 rows=1 loops=1) + Index Cond: (primary_key = 3772) + Total runtime: 0.37 msec + +When I repeat this command using simple , I can see the "Total +runtime" time grow ever so slightly - creeping from 0.37 to 0.38, then 0.39 +etc. Would probably get higher if I had the patience. :) + +The table "table" used in this example has 2721 rows, so size isn't an issue here. + +Any comments or suggestions are welcome. If more information is needed, let me +know and I'll post the needed details. + +From pgsql-performance-owner@postgresql.org Fri Sep 5 21:05:24 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 2A220D1B52C + for ; + Sat, 6 Sep 2003 00:05:21 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 41110-03 + for ; + Fri, 5 Sep 2003 21:05:11 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id DA690D1B89D + for ; + Fri, 5 Sep 2003 21:05:08 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h86050An028676; + Fri, 5 Sep 2003 20:05:00 -0400 (EDT) +To: andris@neti.ee +Cc: pgsql-performance@postgresql.org +Subject: Re: Serious issues with CPU usage +In-reply-to: <20030905215635.68C1173595@MX2.estpak.ee> +References: <20030905215635.68C1173595@MX2.estpak.ee> +Comments: In-reply-to + message dated "Fri, 05 Sep 2003 21:58:29 -0000" +Date: Fri, 05 Sep 2003 20:05:00 -0400 +Message-ID: <28675.1062806700@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/110 +X-Sequence-Number: 3476 + + writes: +> i'm having _serious_ issues of postgres hogging up the CPU over time. A graph +> showing this can be seen at http://andri.estpak.ee/cpu0.png . + +You really haven't shown us anything that would explain that graph ... +repeated UPDATEs will slow down a little until you vacuum, but not +by the ratio you seem to be indicating. At least not if they're +indexscans. If you've also got sequential-scan queries, and you're +doing many zillion updates between vacuums, the answer is to vacuum +more often. A decent rule of thumb is to vacuum whenever you've updated +more than about 10% of the rows in a table since your last vacuum. + +> A VACUUM FULL is a remedy to this problem, but a simple VACUUM isn't. + +I find that odd; maybe there's something else going on here. But you've +not given enough details to speculate. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Sep 5 22:07:13 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 59B10D1B4E2 + for ; + Sat, 6 Sep 2003 01:07:11 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 43714-05 + for ; + Fri, 5 Sep 2003 22:07:02 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id AD050D1BA5D + for ; + Fri, 5 Sep 2003 22:07:00 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h8616tsn091068 + for ; Sat, 6 Sep 2003 01:06:59 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h860tQSc088781 + for pgsql-performance@postgresql.org; Sat, 6 Sep 2003 00:55:26 GMT +From: "Relaxin" +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: SELECT's take a long time compared to other DBMS +Date: Fri, 5 Sep 2003 17:55:46 -0700 +Organization: Hub.Org Networking Services +Lines: 22 +Message-ID: +References: + + <1062796189.447.9.camel@tokyo> +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/111 +X-Sequence-Number: 3477 + +It is forward only in the ODBC driver. + +"Neil Conway" wrote in message +news:1062796189.447.9.camel@tokyo... +> On Fri, 2003-09-05 at 14:18, Relaxin wrote: +> > Expect that the Declare/Fetch only creates a forwardonly cursor, you can +go +> > backwards thru the result set. +> +> No, DECLARE can create scrollable cursors, read the ref page again. This +> functionality is much improved in PostgreSQL 7.4, though. +> +> -Neil +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: 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 Sat Sep 6 06:11:04 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C283FD1BA71 + for ; + Sat, 6 Sep 2003 09:11:02 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 60787-05 + for ; + Sat, 6 Sep 2003 06:10:32 -0300 (ADT) +Received: from fuji.krosing.net (unknown [194.204.44.104]) + by svr1.postgresql.org (Postfix) with ESMTP id BBBF1D1B97B + for ; + Sat, 6 Sep 2003 06:10:24 -0300 (ADT) +Received: from fuji.krosing.net (localhost.localdomain [127.0.0.1]) + by fuji.krosing.net (8.12.8/8.12.8) with ESMTP id h869AFEx006606; + Sat, 6 Sep 2003 12:10:15 +0300 +Received: (from hannu@localhost) + by fuji.krosing.net (8.12.8/8.12.8/Submit) id h869AE48006604; + Sat, 6 Sep 2003 12:10:14 +0300 +X-Authentication-Warning: fuji.krosing.net: hannu set sender to hannu@tm.ee + using -f +Subject: Re: Serious issues with CPU usage +From: Hannu Krosing +To: andris@neti.ee +Cc: pgsql-performance@postgresql.org +In-Reply-To: <20030905215635.68C1173595@MX2.estpak.ee> +References: <20030905215635.68C1173595@MX2.estpak.ee> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1062839412.4982.11.camel@fuji.krosing.net> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Sat, 06 Sep 2003 12:10:13 +0300 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/112 +X-Sequence-Number: 3478 + +andris@neti.ee kirjutas L, 06.09.2003 kell 00:58: +> Hi, +> +> i'm having _serious_ issues of postgres hogging up the CPU over time. A graph +> showing this can be seen at http://andri.estpak.ee/cpu0.png . +> +> The database is running on Redhat 9 (stock 2.4.20-8 kernel), on a reiserfs +> partition (~8% usage - no problem there), and this problem has been with +> PostgreSQL 7.3.2 (both package provided by Redhat and self-rebuilt package) +> and 7.3.4 (i used the 7.3.4 SRPM available at postgres ftp site). +> +> A VACUUM FULL is a remedy to this problem, but a simple VACUUM isn't. + +Could it be that FSM is too small for your vacuum interval ? + +Also, you could try running REINDEX (instead of or in addition to plain +VACUUM) and see if this is is an index issue. + +> This can be reproduced, I think, by a simple UPDATE command: +> +> database=# EXPLAIN ANALYZE UPDATE table SET random_int_field = 1, last_updated +> = NOW() WHERE primary_key = 3772; +> QUERY PLAN +> --------------------------------------------------------------------------------------------------------------------------------- +> Index Scan using table_pkey on table (cost=0.00..6.81 rows=1 width=83) +> (actual time=0.09..0.10 rows=1 loops=1) +> Index Cond: (primary_key = 3772) +> Total runtime: 0.37 msec +> +> When I repeat this command using simple , I can see the "Total +> runtime" time grow ever so slightly - creeping from 0.37 to 0.38, then 0.39 +> etc. Would probably get higher if I had the patience. :) +> +> The table "table" used in this example has 2721 rows, so size isn't an issue here. + +Due to the MVCC the raw table size (file size) can be much bigger if you +dont VACUUM often enough. + +> Any comments or suggestions are welcome. If more information is needed, let me +> know and I'll post the needed details. + +1. What types of queries do you run, and how often ? + +2. How is your database tuned (postgresql.conf settings) ? + +3. How much memory does your machine have ? + +BTW, are you sure that this is postgres that is using up the memory ? +I've read that reiserfs is a CPU hog, so this may be something that does +intensive disk access, so some IO stats would be useful as well as real +data and index file sizes. + +You could also set up logging and then check if there are some +pathological queries that run for several hour doing nested seqscans ;) + +----------------------- +Hannu + + + + + +From pgsql-performance-owner@postgresql.org Sun Sep 7 02:23:58 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 43C96D1B4F8 + for ; + Sun, 7 Sep 2003 05:23:57 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 08251-08 + for ; + Sun, 7 Sep 2003 02:23:25 -0300 (ADT) +Received: from flake.decibel.org (unknown [66.143.173.58]) + by svr1.postgresql.org (Postfix) with SMTP id 61883D1B4F4 + for ; + Sun, 7 Sep 2003 02:23:24 -0300 (ADT) +Received: (qmail 34795 invoked by uid 1001); 7 Sep 2003 05:23:24 -0000 +Date: Sun, 7 Sep 2003 00:23:24 -0500 +From: "Jim C. Nasby" +To: pgsql-performance@postgresql.org +Subject: Poor pg_dump performance +Message-ID: <20030907052324.GC37152@nasby.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +User-Agent: Mutt/1.4.1i +X-Operating-System: FreeBSD 4.8-RELEASE-p3 i386 +X-Distributed: Join the Effort! http://www.distributed.net +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/113 +X-Sequence-Number: 3479 + +First, sorry if this has been answered before; the list search seems to +be down... + +This is on a quad Xeon-PII 450 machine running FBSD 4.8. + +84386 pgsql 64 0 104M 99M RUN 1 78:20 61.87% 61.87% postgres +84385 decibel 64 0 3748K 2268K CPU1 3 49:49 37.79% 37.79% pg_dump + +(note that the CPU percents are per-cpu, so 100% would be 100% of one +CPU) + +According to vmstat, there's very little disk I/O, so that's not a +bottleneck. The command I used was: + +pg_dump -vFc -f pgsql-20030906.cdb stats + +It should be compressing, but if that was the bottleneck, shouldn't the +pg_dump process be at 100% CPU? It does seem a bit coincidental that the +two procs seem to be taking 100% of one CPU (top shows them running on +different CPUs though). + +This is version 7.3.4. +-- +Jim C. Nasby, Database Consultant jim@nasby.net +Member: Triangle Fraternity, Sports Car Club of America +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Sun Sep 7 13:23:17 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id EB348D1B503 + for ; + Sun, 7 Sep 2003 16:23:15 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 24933-05 + for ; + Sun, 7 Sep 2003 13:23:05 -0300 (ADT) +Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) + by svr1.postgresql.org (Postfix) with ESMTP id 81FF4D1B534 + for ; + Sun, 7 Sep 2003 13:23:03 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id h87GMt909846; + Sun, 7 Sep 2003 12:22:55 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200309071622.h87GMt909846@candle.pha.pa.us> +Subject: Re: [GENERAL] how to get accurate values in pg_statistic +In-Reply-To: <1062783865.6854.4780.camel@ibm-e.pdx.osdl.net> +To: Mary Edie Meredith +Date: Sun, 7 Sep 2003 12:22:55 -0400 (EDT) +Cc: Tom Lane , + pgsql-performance , + osdldbt-general +X-Mailer: ELM [version 2.4ME+ PL106 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/114 +X-Sequence-Number: 3480 + + +I have learned you can use: + + SET random = 0; + +to force identical statistics every time you run ANALYZE. + +--------------------------------------------------------------------------- + +Mary Edie Meredith wrote: +> I certainly don't claim that it is appropriate to force customers into a +> full analysis, particularly if random sampling versus a full scan of the +> data reveals little to no performance differences in the plans. Being +> able to sample accurately is _very nice for large tables. +> +> For our testing purposes, however, consistent results are extremely +> important. We have observed that small difference in one plan for one of +> 22 queries can cause a difference in the DBT-3 results. If this +> happens, a small change in performance runs between two Linux kernels +> may appear to be due to the kernels, when in fact it is due to the plan +> change. +> +> We know that the plans are _exactly the same if the data in the +> pg_statistics table is the same from run to run (all other things being +> equal). So what we need to have is identical optimizer costs +> (pg_statistics) for the same table data for each. +> +> I feel certain that the pg_statistics table will be identical from run +> to run if analyze looks at every row. Thus our hope to find a way to +> get that. +> +> We did runs over night. We can confirm that VACUUM FULL ANALYZE does +> not produce the same pg_statistics run to run. With the default (10) +> default_statistics_target the plans are also different. +> +> We ran additional tests with default_statistics_target set to 1000 (the +> max I believe). The plans are the same over the different runs, but the +> pg_statistics table has different cost values. The performance results +> of the runs are consistent (we would expect this with the same plans). +> The resulting performance metrics are similar to the best plans we see +> using the default histogram size (good news). +> +> However, we worry that one day the cost will change enough for whatever +> reason to cause a plan change, especially for a larger database scale +> factor (database size/row size). +> +> I know we appear to be an isolated case, but customers also do testing +> and may have the same consistency issues we have. I can also imagine +> cases where customers want to guarantee that plans stay the same +> (between replicated sites, for example). If two developers are +> analyzing changes to the optimizer, don't you want the costs used for +> testing on their two systems to be identical for comparison purposes? +> +> Anyway, IMHO I believe that an option for an ANALYZE FULL ("sampling" +> all rows) would be valuable. Any other ideas for how to force this +> without code change are very welcome. +> +> Thanks for your info! +> +> +> +> On Thu, 2003-09-04 at 16:16, Tom Lane wrote: +> > Mary Edie Meredith writes: +> > > Stephan Szabo kindly responded to our earlier queries suggesting we look +> > > at default_statistics_target and ALTER TABLE ALTER COLUMN SET +> > > STATISTICS. +> > +> > > These determine the number of bins in the histogram for a given column. +> > > But for a large number of rows (for example 6 million) the maximum value +> > > (1000) does not guarantee that ANALYZE will do a full scan of the table. +> > > We do not see a way to guarantee the same statistics run to run without +> > > forcing ANALYZE to examine every row of every table. +> > +> > Do you actually still have a problem with the plans changing when the +> > stats target is above 100 or so? I think the notion of "force ANALYZE +> > to do a full scan" is inherently wrongheaded ... it certainly would not +> > produce numbers that have anything to do with ordinary practice. +> > +> > If you have data statistics that are so bizarre that the planner still +> > gets things wrong with a target of 1000, then I'd like to know more +> > about why. +> > +> > regards, tom lane +> > +> > ---------------------------(end of broadcast)--------------------------- +> > TIP 2: you can get off all lists at once with the unregister command +> > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) +> -- +> Mary Edie Meredith +> Open Source Development Lab +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: you can get off all lists at once with the unregister command +> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) +> + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Sun Sep 7 15:04:58 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 61A26D1B521 + for ; + Sun, 7 Sep 2003 18:04:55 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 42885-05 + for ; + Sun, 7 Sep 2003 15:04:24 -0300 (ADT) +Received: from mwinf0404.wanadoo.fr (smtp5.wanadoo.fr [193.252.22.27]) + by svr1.postgresql.org (Postfix) with ESMTP id 5255ED1B4F6 + for ; + Sun, 7 Sep 2003 15:04:23 -0300 (ADT) +Received: from ifrance.com (AMontsouris-108-1-7-218.w193-251.abo.wanadoo.fr + [193.251.188.218]) + by mwinf0404.wanadoo.fr (SMTP Server) with ESMTP id 8AC1838000B7 + for ; + Sun, 7 Sep 2003 20:04:23 +0200 (CEST) +Date: Sun, 7 Sep 2003 20:04:20 +0200 +Mime-Version: 1.0 (Apple Message framework v552) +Content-Type: text/plain; delsp=yes; charset=ISO-8859-1; format=flowed +Subject: slow plan for min/max +From: =?ISO-8859-1?Q?Pailloncy_Jean-G=E9rard?= +To: pgsql-performance@postgresql.org +Content-Transfer-Encoding: quoted-printable +Message-Id: +X-Mailer: Apple Mail (2.552) +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/115 +X-Sequence-Number: 3481 + +I have: +> psql (PostgreSQL) 7.3.2 +I do a modification of 'access/index/indexam.c' where I comment: +> #ifdef NOT_USED +> if (scan->keys_are_unique && scan->got_tuple) +> { +> if (ScanDirectionIsForward(direction)) +> { +> if (scan->unique_tuple_pos <=3D 0) +> scan->unique_tuple_pos++; +> } +> else if (ScanDirectionIsBackward(direction)) +> { +> if (scan->unique_tuple_pos >=3D 0) +> scan->unique_tuple_pos--; +> } +> if (scan->unique_tuple_pos =3D=3D 0) +> return heapTuple; +> else +> return NULL; +> } +> #endif +I do not remember the references of the bug. +But the solution was planned for 7.4. + +I do: +> psql=3D# \di +> [skip] +> public | url_next_index_time | index | postgresql | url +> [skip] +> (11 rows) +I have an index on next_index_time field on table url. + +> psql=3D# explain select min(next_index_time) from url \g +> QUERY PLAN +> ------------------------------------------------------------------- +> Aggregate (cost=3D85157.70..85157.70 rows=3D1 width=3D4) +> -> Seq Scan on url (cost=3D0.00..80975.56 rows=3D1672856 width=3D4) +> (2 rows) +Silly SeqScan of all the table. + +> psql=3D# explain SELECT next_index_time FROM url ORDER BY=20=20 +> next_index_time LIMIT 1 \g +> QUERY PLAN +> -----------------------------------------------------------------------= +=20 +> ------------------------- +> Limit (cost=3D0.00..0.20 rows=3D1 width=3D4) +> -> Index Scan using url_next_index_time on url=20=20=20 +> (cost=3D0.00..340431.47 rows=3D1672856 width=3D4) +> (2 rows) +I ask for the same thing. +That's better ! + +Why the planner does that ? + +Jean-G=E9rard Pailloncy +Paris, France + + +From pgsql-performance-owner@postgresql.org Sun Sep 7 20:18:37 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id F36BBD1B4EB + for ; + Sun, 7 Sep 2003 23:18:35 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 86785-10 + for ; + Sun, 7 Sep 2003 20:18:06 -0300 (ADT) +Received: from smtp.istop.com (dci.doncaster.on.ca [66.11.168.194]) + by svr1.postgresql.org (Postfix) with ESMTP id D7E7AD1B516 + for ; + Sun, 7 Sep 2003 20:18:02 -0300 (ADT) +Received: from stark.dyndns.tv (gsstark.mtl.istop.com [66.11.160.162]) + by smtp.istop.com (Postfix) with ESMTP + id 5BFF736A9B; Sun, 7 Sep 2003 19:18:02 -0400 (EDT) +Received: from localhost ([127.0.0.1] helo=stark.dyndns.tv ident=foobar) + by stark.dyndns.tv with smtp (Exim 3.36 #1 (Debian)) + id 19w8nC-0003OM-00; Sun, 07 Sep 2003 19:18:02 -0400 +To: Mary Edie Meredith +Cc: Tom Lane , + pgsql-performance , + osdldbt-general +Subject: Re: [GENERAL] how to get accurate values in pg_statistic +References: <1062697270.6854.3475.camel@ibm-e.pdx.osdl.net> + <11537.1062717375@sss.pgh.pa.us> + <1062783865.6854.4780.camel@ibm-e.pdx.osdl.net> +In-Reply-To: <1062783865.6854.4780.camel@ibm-e.pdx.osdl.net> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 07 Sep 2003 19:18:01 -0400 +Message-ID: <87fzj86vdi.fsf@stark.dyndns.tv> +Lines: 21 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/116 +X-Sequence-Number: 3482 + + +Mary Edie Meredith writes: + +> We ran additional tests with default_statistics_target set to 1000 (the +> max I believe). The plans are the same over the different runs, but the +> pg_statistics table has different cost values. The performance results +> of the runs are consistent (we would expect this with the same plans). +> The resulting performance metrics are similar to the best plans we see +> using the default histogram size (good news). + +Hm, would it be possible to do a binary search and find the target at which +you start getting consistent plans? Perhaps the default of 10 is simply way +too small and should be raised? + +Obviously this would depend on the data model, but I suspect if your aim is +for the benchmark data to be representative of typical data models, which +scares me into thinking perhaps users are seeing similarly unpredictably +variable performance. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Sun Sep 7 21:32:55 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 0FE65D1B516 + for ; + Mon, 8 Sep 2003 00:32:54 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 90178-10 + for ; + Sun, 7 Sep 2003 21:32:46 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 20780D1B52D + for ; + Sun, 7 Sep 2003 21:32:43 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h880WQAn015708; + Sun, 7 Sep 2003 20:32:26 -0400 (EDT) +To: Greg Stark +Cc: Mary Edie Meredith , + pgsql-performance , + osdldbt-general +Subject: Re: [GENERAL] how to get accurate values in pg_statistic +In-reply-to: <87fzj86vdi.fsf@stark.dyndns.tv> +References: <1062697270.6854.3475.camel@ibm-e.pdx.osdl.net> + <11537.1062717375@sss.pgh.pa.us> + <1062783865.6854.4780.camel@ibm-e.pdx.osdl.net> + <87fzj86vdi.fsf@stark.dyndns.tv> +Comments: In-reply-to Greg Stark + message dated "07 Sep 2003 19:18:01 -0400" +Date: Sun, 07 Sep 2003 20:32:26 -0400 +Message-ID: <15707.1062981146@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 + tests=EMAIL_ATTRIBUTION, IN_REP_TO, RCVD_IN_OSIRUSOFT_COM, REFERENCES, + REPLY_WITH_QUOTES +X-Spam-Level: +X-Archive-Number: 200309/117 +X-Sequence-Number: 3483 + +Greg Stark writes: +> Perhaps the default of 10 is simply way +> too small and should be raised? + +I've suspected since the default existed that it might be too small ;-). +No one's yet done any experiments to try to establish a better default, +though. I suppose the first hurdle is to find a representative dataset. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Sep 8 07:51:31 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id BAFF0D1B53E + for ; + Mon, 8 Sep 2003 10:51:29 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 17492-01 + for ; + Mon, 8 Sep 2003 07:51:01 -0300 (ADT) +Received: from mail.ipv6.estpak.ee (tunnelbroker.ipv6.estpak.ee + [194.126.101.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 1AEDAD1B4F1 + for ; + Mon, 8 Sep 2003 07:50:58 -0300 (ADT) +Received: from andri.ipv6.estpak.ee ([2001:7d0:0:10:202:a5ff:fe67:9c13]) + by mail.ipv6.estpak.ee with esmtp (Exim 4.12) + id 19wJbl-000MMg-00; Mon, 08 Sep 2003 13:50:57 +0300 +From: Andri Saar +To: Tom Lane , Hannu Krosing +Subject: Re: Serious issues with CPU usage +Date: Mon, 8 Sep 2003 13:50:23 +0300 +User-Agent: KMail/1.5.2 +Cc: pgsql-performance@postgresql.org +References: <20030905215635.68C1173595@MX2.estpak.ee> + <28675.1062806700@sss.pgh.pa.us> +In-Reply-To: <28675.1062806700@sss.pgh.pa.us> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-15" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200309081350.23312.andris@estpak.ee> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/118 +X-Sequence-Number: 3484 + + +Hope that you don't find it too distracting, I decided to answer to emails in +one go. + +---- + +On Saturday 06 September 2003 03:05, Tom Lane wrote: +> indexscans. If you've also got sequential-scan queries, and you're +> doing many zillion updates between vacuums, the answer is to vacuum +> more often. A decent rule of thumb is to vacuum whenever you've updated +> more than about 10% of the rows in a table since your last vacuum. + +Basically I do this: +1) select about ~700 ID's I have to poll +2) poll them +3) update those 700 rows in that "table" I used (~2700 rows total). + +And I do this cycle once per minute, so yes, I've got a zillion updates. 700 +of 2700 is roughly 25%, so I'd have to vacuum once per minute? +The manual actually had a suggestion of vacuuming after big changes, but I +didn't think it was that bad. + +----- + +On Saturday 06 September 2003 12:10, Hannu Krosing wrote: +> Could it be that FSM is too small for your vacuum interval ? +> +> Also, you could try running REINDEX (instead of or in addition to plain +> VACUUM) and see if this is is an index issue. + +VACUUM ANALYZE helped to lessen the load. Not as much as VACUUM FULL, but +still bring it down to reasonable level. + +> 1. What types of queries do you run, and how often ? + +First, cycle posted above; second, every 5 minutes ~40 SELECTs that include +that table. I left the once-per-minute poller offline this weekend, and the +CPU usage didn't creep up. + +> 2. How is your database tuned (postgresql.conf settings) ? + +shared_buffers = 13000 +max_fsm_relations = 100000 +max_fsm_pages = 1000000 +max_locks_per_transaction = 256 +wal_buffers = 64 +sort_mem = 32768 +vacuum_mem = 16384 +fsync = false +effective_cache_size = 60000 + +Using these settings I was able to bring CPU usage down to a more reasonable +level: http://andri.estpak.ee/cpu1.png +This is much better than the first graph (see http://andri.estpak.ee/cpu0.png +), but you can still see CPU usage creeping up. +VACUUM FULL was done at 03:00 and 09:00. The small drop at ~12:45 is thanks to +VACUUM ANALYZE. + +If this is the best you can get with postgres right now, then I'll just have +to increase the frequency of VACUUMing, but that feels like a hackish +solution :( + +> 3. How much memory does your machine have ? + +1 gigabyte. + + +-- +andri + + +From pgsql-performance-owner@postgresql.org Mon Sep 8 08:13:35 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 0BD30D1B516 + for ; + Mon, 8 Sep 2003 11:13:28 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 18002-03 + for ; + Mon, 8 Sep 2003 08:12:59 -0300 (ADT) +Received: from smtp.pspl.co.in (www.pspl.co.in [202.54.11.65]) + by svr1.postgresql.org (Postfix) with ESMTP id 60BBDD1B505 + for ; + Mon, 8 Sep 2003 08:12:54 -0300 (ADT) +Received: (from root@localhost) + by smtp.pspl.co.in (8.12.9/8.12.9) id h88BKZxc019443 + for ; Mon, 8 Sep 2003 16:50:35 +0530 +Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) + (authenticated bits=0) + by persistent.co.in (8.12.9/8.12.9) with ESMTP id h88BKXsv019429 + for ; Mon, 8 Sep 2003 16:50:33 +0530 +From: "Shridhar Daithankar" +To: pgsql-performance@postgresql.org +Date: Mon, 08 Sep 2003 16:44:56 +0530 +MIME-Version: 1.0 +Subject: Re: Serious issues with CPU usage +Reply-To: shridhar_daithankar@persistent.co.in +Message-ID: <3F5CB208.7522.1539792D@localhost> +In-reply-to: <200309081350.23312.andris@estpak.ee> +References: <28675.1062806700@sss.pgh.pa.us> +X-mailer: Pegasus Mail for Windows (v4.12a) +Content-type: text/plain; charset=US-ASCII +Content-transfer-encoding: 7BIT +Content-description: Mail message body +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/119 +X-Sequence-Number: 3485 + +On 8 Sep 2003 at 13:50, Andri Saar wrote: +> If this is the best you can get with postgres right now, then I'll just have +> to increase the frequency of VACUUMing, but that feels like a hackish +> solution :( + +Use a autovacuum daemon. There is one in postgresql contrib module. It was +introduced during 7.4 development and it works with 7.3.x. as well. + +Current 7.4CVS head has some problems with stats collector but soon it should +be fine. + +Check it out.. + +Bye + Shridhar + +-- +Punishment becomes ineffective after a certain point. Men become insensitive. +-- Eneg, "Patterns of Force", stardate 2534.7 + + +From pgsql-performance-owner@postgresql.org Mon Sep 8 08:52:02 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id D09F3D1B54E + for ; + Mon, 8 Sep 2003 11:51:46 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 26304-07 + for ; + Mon, 8 Sep 2003 08:51:18 -0300 (ADT) +Received: from email02.aon.at (WARSL402PIP7.highway.telekom.at [195.3.96.94]) + by svr1.postgresql.org (Postfix) with SMTP id 4F52FD1B541 + for ; + Mon, 8 Sep 2003 08:51:13 -0300 (ADT) +Received: (qmail 19616 invoked from network); 8 Sep 2003 11:51:13 -0000 +Received: from m169p025.dipool.highway.telekom.at (HELO cantor) + ([62.46.11.25]) (envelope-sender ) + by qmail2rs.highway.telekom.at (qmail-ldap-1.03) with SMTP + for ; 8 Sep 2003 11:51:13 -0000 +From: Manfred Koizar +To: Andri Saar +Cc: Tom Lane , Hannu Krosing , + pgsql-performance@postgresql.org +Subject: Re: Serious issues with CPU usage +Date: Mon, 08 Sep 2003 13:53:02 +0200 +Message-ID: +References: <20030905215635.68C1173595@MX2.estpak.ee> + <28675.1062806700@sss.pgh.pa.us> + <200309081350.23312.andris@estpak.ee> +In-Reply-To: <200309081350.23312.andris@estpak.ee> +X-Mailer: Forte Agent 1.93/32.576 English (American) +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/120 +X-Sequence-Number: 3486 + +On Mon, 8 Sep 2003 13:50:23 +0300, Andri Saar +wrote: +>Basically I do this: +>1) select about ~700 ID's I have to poll +>2) poll them +>3) update those 700 rows in that "table" I used (~2700 rows total). +> +>And I do this cycle once per minute, so yes, I've got a zillion updates. 700 +>of 2700 is roughly 25%, so I'd have to vacuum once per minute? + +With such a small table VACUUM should be a matter of less than one +second: + +fred=# vacuum verbose t; +INFO: --Relation public.t-- +INFO: Index t_pkey: Pages 65; Tuples 16384: Deleted 4096. + CPU 0.01s/0.10u sec elapsed 0.21 sec. +INFO: Removed 4096 tuples in 154 pages. + CPU 0.04s/0.02u sec elapsed 0.07 sec. +INFO: Pages 192: Changed 192, Empty 0; Tup 16384: Vac 4096, Keep 0, +UnUsed 0. + Total CPU 0.08s/0.16u sec elapsed 0.36 sec. +VACUUM +Time: 415.00 ms + +And this is on a 400 MHz machine under cygwin, so don't worry if you +have a real computer. + +Servus + Manfred + +From pgsql-performance-owner@postgresql.org Mon Sep 8 11:05:08 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id D14FED1B52B + for ; + Mon, 8 Sep 2003 14:05:05 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 49531-01 + for ; + Mon, 8 Sep 2003 11:04:37 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 7B857D1B520 + for ; + Mon, 8 Sep 2003 11:04:32 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h88E4XAn009958; + Mon, 8 Sep 2003 10:04:33 -0400 (EDT) +To: Andri Saar +Cc: Hannu Krosing , pgsql-performance@postgresql.org +Subject: Re: Serious issues with CPU usage +In-reply-to: <200309081350.23312.andris@estpak.ee> +References: <20030905215635.68C1173595@MX2.estpak.ee> + <28675.1062806700@sss.pgh.pa.us> + <200309081350.23312.andris@estpak.ee> +Comments: In-reply-to Andri Saar + message dated "Mon, 08 Sep 2003 13:50:23 +0300" +Date: Mon, 08 Sep 2003 10:04:33 -0400 +Message-ID: <9957.1063029873@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/121 +X-Sequence-Number: 3487 + +Andri Saar writes: +> If this is the best you can get with postgres right now, then I'll just have +> to increase the frequency of VACUUMing, but that feels like a hackish +> solution :( + +Not at all. The overhead represented by VACUUM would have to be paid +somewhere, somehow, in any database. Postgres allows you to control +exactly when it gets paid. + +It looks to me like throwing a plain VACUUM into your poller cycle +(or possibly VACUUM ANALYZE depending on how fast the table's stats +change) would solve your problems nicely. + +Note that once you have that policy in place, you will want to do one +VACUUM FULL, and possibly a REINDEX, to get the table's physical size +back down to something commensurate with 2700 useful rows. I shudder +to think of where it had gotten to before. Routine VACUUMing should +hold it to a reasonable size after that. + + regards, tom lane + +From pgsql-admin-owner@postgresql.org Mon Sep 8 18:51:27 2003 +X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP + id 7F44FD1B4E9; Mon, 8 Sep 2003 21:51:24 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) + with ESMTP id 35154-08; Mon, 8 Sep 2003 18:50:55 -0300 (ADT) +Received: from host2.hostseguro.com (unknown [200.198.188.133]) + by svr1.postgresql.org (Postfix) with ESMTP + id 35FFFD1B500; Mon, 8 Sep 2003 18:50:52 -0300 (ADT) +Received: from cpanel by host2.hostseguro.com with local (Exim 4.20) + id 19wN17-0006MI-OW; Mon, 08 Sep 2003 11:29:21 -0300 +Received: from 200.180.189.246 ([200.180.189.246]) + by sistemica.info (IMP) with HTTP + for ; Mon, 8 Sep 2003 11:29:21 -0300 +Message-ID: <1063031361.3f5c9241ad59d@sistemica.info> +Date: Mon, 8 Sep 2003 11:29:21 -0300 +From: Rhaoni Chiu Pereira +To: PostgreSQL Performance , + Lista PostgreSQL +Subject: Explain Doc +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.2.1 +X-Originating-IP: 200.180.189.246 +X-MailScanner-Information: Verificado pelo McAfee VirusScan / Scanned by + McAfee VirusScan +X-MailScanner: Nao infectado / Found to be clean +X-AntiAbuse: This header was added to track abuse, + please include it with any abuse report +X-AntiAbuse: Primary Hostname - host2.hostseguro.com +X-AntiAbuse: Original Domain - postgresql.org +X-AntiAbuse: Originator/Caller UID/GID - [32001 32001] / [47 12] +X-AntiAbuse: Sender Address Domain - sistemica.info +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/148 +X-Sequence-Number: 10236 + +Hi List, + + + Could anyone tell me a documentation that explains the " explain " result +and how to analyze it ? + +Atenciosamente, + +Rhaoni Chiu Pereira +Sist�mica Computadores + +Visite-nos na Web: http://sistemica.info +Fone/Fax : +55 51 3328 1122 + + + + + + +From pgsql-performance-owner@postgresql.org Mon Sep 8 11:32:21 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B3EE7D1B516 + for ; + Mon, 8 Sep 2003 14:32:18 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 56420-04 + for ; + Mon, 8 Sep 2003 11:31:50 -0300 (ADT) +Received: from mail.ipv6.estpak.ee (tunnelbroker.ipv6.estpak.ee + [194.126.101.242]) + by svr1.postgresql.org (Postfix) with ESMTP id DD49DD1B4E4 + for ; + Mon, 8 Sep 2003 11:31:45 -0300 (ADT) +Received: from andri.ipv6.estpak.ee ([2001:7d0:0:10:202:a5ff:fe67:9c13]) + by mail.ipv6.estpak.ee with esmtp (Exim 4.12) + id 19wN3T-0004fm-00; Mon, 08 Sep 2003 17:31:47 +0300 +From: Andri Saar +To: Tom Lane +Subject: Re: Serious issues with CPU usage +Date: Mon, 8 Sep 2003 17:31:13 +0300 +User-Agent: KMail/1.5.2 +Cc: Hannu Krosing , pgsql-performance@postgresql.org +References: <20030905215635.68C1173595@MX2.estpak.ee> + <200309081350.23312.andris@estpak.ee> + <9957.1063029873@sss.pgh.pa.us> +In-Reply-To: <9957.1063029873@sss.pgh.pa.us> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-15" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200309081731.13136.andris@estpak.ee> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/122 +X-Sequence-Number: 3488 + +On Monday 08 September 2003 17:04, Tom Lane wrote: +> +> It looks to me like throwing a plain VACUUM into your poller cycle +> (or possibly VACUUM ANALYZE depending on how fast the table's stats +> change) would solve your problems nicely. +> + +I compled the pg_autovacuum daemon from 7.4beta sources as Shridhar Daithankar +recommended, and it seems to work fine. At first glance I thought VACUUM is a +thing you do maybe once per week during routine administration tasks like +making a full backup, but I was wrong. + +Thanks to all for your help, we can consider this problem solved. + +Note to future generations: default postgres configuration settings are very +conservative and don't be afraid to VACUUM very often. + + +andri + + +From pgsql-performance-owner@postgresql.org Mon Sep 8 11:49:12 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A1197D1B4E5 + for ; + Mon, 8 Sep 2003 14:49:05 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 57679-05 + for ; + Mon, 8 Sep 2003 11:48:37 -0300 (ADT) +Received: from smtp.pspl.co.in (unknown [202.54.11.65]) + by svr1.postgresql.org (Postfix) with ESMTP id E66EFD1B4ED + for ; + Mon, 8 Sep 2003 11:48:31 -0300 (ADT) +Received: (from root@localhost) + by smtp.pspl.co.in (8.12.9/8.12.9) id h88EuHNe020987 + for ; Mon, 8 Sep 2003 20:26:17 +0530 +Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) + (authenticated bits=0) + by persistent.co.in (8.12.9/8.12.9) with ESMTP id h88EuEsv020959 + for ; Mon, 8 Sep 2003 20:26:15 +0530 +From: "Shridhar Daithankar" +To: pgsql-performance@postgresql.org +Date: Mon, 08 Sep 2003 20:20:35 +0530 +MIME-Version: 1.0 +Subject: Re: Serious issues with CPU usage +Reply-To: shridhar_daithankar@persistent.co.in +Message-ID: <3F5CE493.6485.15FEE75A@localhost> +In-reply-to: <200309081731.13136.andris@estpak.ee> +References: <9957.1063029873@sss.pgh.pa.us> +X-mailer: Pegasus Mail for Windows (v4.12a) +Content-type: text/plain; charset=US-ASCII +Content-transfer-encoding: 7BIT +Content-description: Mail message body +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/123 +X-Sequence-Number: 3489 + +On 8 Sep 2003 at 17:31, Andri Saar wrote: +> Note to future generations: default postgres configuration settings are very +> conservative and don't be afraid to VACUUM very often. + +You should have looked at earlier default postgresql they were arcane by that +standard. + +7.4 at least attempts to determine the shared_buffers while doing initdb. That +results in much better default performance. + +Bye + Shridhar + +-- +Ritchie's Rule: (1) Everything has some value -- if you use the right currency. +(2) Paint splashes last longer than the paint job. (3) Search and ye shall find +-- but make sure it was lost. + + +From pgsql-performance-owner@postgresql.org Mon Sep 8 13:00:44 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C0DF3D1B533 + for ; + Mon, 8 Sep 2003 16:00:36 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 75005-01 + for ; + Mon, 8 Sep 2003 13:00:26 -0300 (ADT) +Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) + by svr1.postgresql.org (Postfix) with ESMTP id A41C7D1B529 + for ; + Mon, 8 Sep 2003 13:00:25 -0300 (ADT) +Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) + by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h88Fwrp5000281; + Mon, 8 Sep 2003 09:58:58 -0600 (MDT) +Date: Mon, 8 Sep 2003 09:56:28 -0600 (MDT) +From: "scott.marlowe" +To: =?ISO-8859-1?Q?Pailloncy_Jean-G=E9rard?= +Cc: +Subject: Re: slow plan for min/max +In-Reply-To: +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=ISO-8859-1 +Content-Transfer-Encoding: 8BIT +X-IHS-MailScanner: Found to be clean +X-IHS-MailScanner-SpamCheck: +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 + tests=EMAIL_ATTRIBUTION, IN_REP_TO, RCVD_IN_OSIRUSOFT_COM, + USER_AGENT_PINE +X-Spam-Level: +X-Archive-Number: 200309/124 +X-Sequence-Number: 3490 + +On Sun, 7 Sep 2003, Pailloncy Jean-G�rard wrote: + +Asking a question about why max(id) is so much slower than select id order +by id desc limit 1, Pailloncy said: + +> I ask for the same thing. +> That's better ! + +This is a Frequently asked question about something that isn't likely to +change any time soon. + +Basically, Postgresql uses an MVCC locking system that makes massively +parallel operation possible, but costs in certain areas, and one of those +areas is aggregate performance over large sets. MVCC makes it very hard +to optimize all but the simplest of aggregates, and even those +optimzations which are possible would wind up being quite ugly at the +parser level. + +You might want to search the archives in the last couple years for this +subject, as it's come up quite often. + + +From pgsql-performance-owner@postgresql.org Mon Sep 8 15:50:06 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id AB321D1B4E3 + for ; + Mon, 8 Sep 2003 18:50:03 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 05037-01 + for ; + Mon, 8 Sep 2003 15:49:33 -0300 (ADT) +Received: from bob.samurai.com (bob.samurai.com [205.207.28.75]) + by svr1.postgresql.org (Postfix) with ESMTP id B14C8D1B4EB + for ; + Mon, 8 Sep 2003 15:49:31 -0300 (ADT) +Received: from 6-allhosts (d226-85-166.home.cgocable.net [24.226.85.166]) + by bob.samurai.com (Postfix) with ESMTP + id 62F261D96; Mon, 8 Sep 2003 14:49:32 -0400 (EDT) +Subject: Re: slow plan for min/max +From: Neil Conway +To: "scott.marlowe" +Cc: Pailloncy =?ISO-8859-1?Q?Jean-G=E9rard?= , + PostgreSQL Performance +In-Reply-To: +References: +Content-Type: text/plain +Message-Id: <1063046951.9051.68.camel@tokyo> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Mon, 08 Sep 2003 14:49:12 -0400 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/125 +X-Sequence-Number: 3491 + +On Mon, 2003-09-08 at 11:56, scott.marlowe wrote: +> Basically, Postgresql uses an MVCC locking system that makes massively +> parallel operation possible, but costs in certain areas, and one of those +> areas is aggregate performance over large sets. MVCC makes it very hard +> to optimize all but the simplest of aggregates, and even those +> optimzations which are possible would wind up being quite ugly at the +> parser level. + +As was pointed out in a thread a couple days ago, MIN/MAX() optimization +has absolutely nothing to do with MVCC. It does, however, make +optimizing COUNT() more difficult. + +-Neil + + + +From pgsql-performance-owner@postgresql.org Mon Sep 8 17:37:46 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A527AD1B4FC + for ; + Mon, 8 Sep 2003 20:37:44 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 15147-09 + for ; + Mon, 8 Sep 2003 17:37:35 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id D61CDD1B4E1 + for ; + Mon, 8 Sep 2003 17:37:33 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h88KbXsl079666 + for ; Mon, 8 Sep 2003 20:37:33 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h88K9xsn071747 + for pgsql-performance@postgresql.org; Mon, 8 Sep 2003 20:09:59 GMT +From: Christopher Browne +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: slow plan for min/max +Date: Mon, 08 Sep 2003 15:32:16 -0400 +Organization: Hub.Org Networking Services +Lines: 59 +Message-ID: <60n0df5b5r.fsf@dev6.int.libertyrms.info> +References: + +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Complaints-To: usenet@news.hub.org +User-Agent: Gnus/5.1003 (Gnus v5.10.3) XEmacs/21.4 (Rational FORTRAN, linux) +Cancel-Lock: sha1:0+8X5l7Uy3vT/qUJi+A0u9RmhIs= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/126 +X-Sequence-Number: 3492 + +scott.marlowe@ihs.com ("scott.marlowe") writes: +> On Sun, 7 Sep 2003, Pailloncy Jean-G�rard wrote: +> +> Asking a question about why max(id) is so much slower than select id order +> by id desc limit 1, Pailloncy said: +> +>> I ask for the same thing. That's better ! +> +> This is a Frequently asked question about something that isn't +> likely to change any time soon. +> +> Basically, Postgresql uses an MVCC locking system that makes +> massively parallel operation possible, but costs in certain areas, +> and one of those areas is aggregate performance over large sets. +> MVCC makes it very hard to optimize all but the simplest of +> aggregates, and even those optimzations which are possible would +> wind up being quite ugly at the parser level. + +MVCC makes it difficult to optimize aggregates resembling COUNT(*) or +SUM(*), at least vis-a-vis having this available for a whole table +(e.g. - you have to be doing 'SELECT COUNT(*), SUM(SOMEFIELD) FROM +THIS_TABLE' with NO "WHERE" clause). + +But there is nothing about MVCC that makes it particularly difficult +to handle the transformation: + + select max(field) from some_table where another_field < + still_another_field; + + (which isn't particularly efficient) into + + select field from some_table where another_field < + still_another_field order by field desc limit 1; + +The problems observed are thus: + + 1. If the query asks for other data, it might be necessary to scan + the table to get the other data, making the optimization + irrelevant; + + 2. If there's a good index to key on, the transformed version might + be a bunch quicker, but it is nontrivial to determine that, a + priori; + + 3. It would be a fairly hairy optimization to throw into the query + optimizer, so people are reluctant to try to do so. + +Note that MVCC has _nothing_ to do with any of those three problems. + +The MVCC-related point is that there is reluctance to create some +special case that will be troublesome to maintain instead of having +some comprehensive handling of _all_ aggregates. It seems a better +idea to "fix them all" rather than to kludge things up by fixing one +after another. +-- +let name="cbbrowne" and tld="cbbrowne.com" in name ^ "@" ^ tld;; +http://cbbrowne.com/info/lisp.html +Signs of a Klingon Programmer - 10. "A TRUE Klingon Warrior does not +comment his code!" + +From pgsql-performance-owner@postgresql.org Mon Sep 8 17:41:03 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 05F61D1B4FC + for ; + Mon, 8 Sep 2003 20:41:02 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 23975-03 + for ; + Mon, 8 Sep 2003 17:40:32 -0300 (ADT) +Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) + by svr1.postgresql.org (Postfix) with ESMTP id 6B54DD1B522 + for ; + Mon, 8 Sep 2003 17:40:29 -0300 (ADT) +Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) + by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h88Kdbp5026167; + Mon, 8 Sep 2003 14:39:37 -0600 (MDT) +Date: Mon, 8 Sep 2003 14:37:10 -0600 (MDT) +From: "scott.marlowe" +To: Neil Conway +Cc: Pailloncy =?ISO-8859-1?Q?Jean-G=E9rard?= , + PostgreSQL Performance +Subject: Re: slow plan for min/max +In-Reply-To: <1063046951.9051.68.camel@tokyo> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-IHS-MailScanner: Found to be clean +X-IHS-MailScanner-SpamCheck: +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/127 +X-Sequence-Number: 3493 + +On Mon, 8 Sep 2003, Neil Conway wrote: + +> On Mon, 2003-09-08 at 11:56, scott.marlowe wrote: +> > Basically, Postgresql uses an MVCC locking system that makes massively +> > parallel operation possible, but costs in certain areas, and one of those +> > areas is aggregate performance over large sets. MVCC makes it very hard +> > to optimize all but the simplest of aggregates, and even those +> > optimzations which are possible would wind up being quite ugly at the +> > parser level. +> +> As was pointed out in a thread a couple days ago, MIN/MAX() optimization +> has absolutely nothing to do with MVCC. It does, however, make +> optimizing COUNT() more difficult. + +Not exactly. While max(id) is easily optimized by query replacement, +more complex aggregates will still have perfomance issues that would not +be present in a row locking database. i.e. max((field1/field2)*field3) is +still going to cost more to process, isn't it? + + + +From pgsql-performance-owner@postgresql.org Mon Sep 8 18:26:46 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 81F98D1B528 + for ; + Mon, 8 Sep 2003 21:26:45 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 25330-10 + for ; + Mon, 8 Sep 2003 18:26:35 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 044C5D1B51B + for ; + Mon, 8 Sep 2003 18:26:29 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h88LQGAn003304; + Mon, 8 Sep 2003 17:26:16 -0400 (EDT) +To: "scott.marlowe" +Cc: Neil Conway , + Pailloncy =?ISO-8859-1?Q?Jean-G=E9rard?= , + PostgreSQL Performance +Subject: Re: slow plan for min/max +In-reply-to: +References: +Comments: In-reply-to "scott.marlowe" + message dated "Mon, 08 Sep 2003 14:37:10 -0600" +Date: Mon, 08 Sep 2003 17:26:16 -0400 +Message-ID: <3303.1063056376@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/128 +X-Sequence-Number: 3494 + +"scott.marlowe" writes: +> On Mon, 8 Sep 2003, Neil Conway wrote: +>> As was pointed out in a thread a couple days ago, MIN/MAX() optimization +>> has absolutely nothing to do with MVCC. It does, however, make +>> optimizing COUNT() more difficult. + +> Not exactly. While max(id) is easily optimized by query replacement, +> more complex aggregates will still have perfomance issues that would not +> be present in a row locking database. i.e. max((field1/field2)*field3) is +> still going to cost more to process, isn't it? + +Er, what makes you think that would be cheap in any database? + +Postgres would actually have an advantage given its support for +expressional indexes (nee functional indexes). If we had an optimizer +transform to convert MAX() into an index scan, I would expect it to be +able to match up max((field1/field2)*field3) with an index on +((field1/field2)*field3). + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Sep 8 19:07:52 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 9C50ED1B519 + for ; + Mon, 8 Sep 2003 22:07:51 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 36954-08 + for ; + Mon, 8 Sep 2003 19:07:41 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 024C8D1B4E6 + for ; + Mon, 8 Sep 2003 19:07:38 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h88M7Xsl005163 + for ; Mon, 8 Sep 2003 22:07:33 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h88LiKYS098242 + for pgsql-performance@postgresql.org; Mon, 8 Sep 2003 21:44:20 GMT +From: Christopher Browne +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: slow plan for min/max +Date: Mon, 08 Sep 2003 17:41:43 -0400 +Organization: cbbrowne Computing Inc +Lines: 34 +Message-ID: +References: <1063046951.9051.68.camel@tokyo> + +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.1003 (Gnus v5.10.3) XEmacs/21.4 (Rational FORTRAN, linux) +Cancel-Lock: sha1:LTmRI82KgRPwpQorJEdOC/anwPA= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/131 +X-Sequence-Number: 3497 + +After takin a swig o' Arrakan spice grog, scott.marlowe@ihs.com ("scott.marlowe") belched out...: +> On Mon, 8 Sep 2003, Neil Conway wrote: +>> On Mon, 2003-09-08 at 11:56, scott.marlowe wrote: +>> > Basically, Postgresql uses an MVCC locking system that makes massively +>> > parallel operation possible, but costs in certain areas, and one of those +>> > areas is aggregate performance over large sets. MVCC makes it very hard +>> > to optimize all but the simplest of aggregates, and even those +>> > optimzations which are possible would wind up being quite ugly at the +>> > parser level. +>> +>> As was pointed out in a thread a couple days ago, MIN/MAX() optimization +>> has absolutely nothing to do with MVCC. It does, however, make +>> optimizing COUNT() more difficult. +> +> Not exactly. While max(id) is easily optimized by query replacement, +> more complex aggregates will still have perfomance issues that would not +> be present in a row locking database. i.e. max((field1/field2)*field3) is +> still going to cost more to process, isn't it? + +That sort of MAX() would be difficult to optimize in almost any case, +and would mandate doing a scan across the relevant portion of the +table... + +... Unless you had a functional index on (field1/field2)*field3, in +which case it might well be that this would cost Still Less. + +I still can't fathom what this has to do with MVCC; you have yet to +actually connect it with that... +-- +let name="cbbrowne" and tld="ntlug.org" in String.concat "@" [name;tld];; +http://www3.sympatico.ca/cbbrowne/lsf.html +"Cars move huge weights at high speeds by controlling violent +explosions many times a second. ...car analogies are always fatal..." +-- + +From pgsql-admin-owner@postgresql.org Mon Sep 8 19:05:18 2003 +X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP + id 0C763D1B51C; Mon, 8 Sep 2003 22:05:15 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) + with ESMTP id 37148-04; Mon, 8 Sep 2003 19:04:45 -0300 (ADT) +Received: from mailer.acaso.net (209.Red-213-97-17.pooles.rima-tde.net + [213.97.17.209]) by svr1.postgresql.org (Postfix) with ESMTP + id 6C8C1D1B4E6; Mon, 8 Sep 2003 19:04:42 -0300 (ADT) +Received: from 6-allhosts (unknown [192.168.0.4]) + by mailer.acaso.net (Postfix) with ESMTP + id 5EC48100B3; Tue, 9 Sep 2003 00:04:41 +0200 (CEST) +Subject: Re: [PERFORM] Explain Doc +From: Alberto Caso +To: Rhaoni Chiu Pereira +Cc: PostgreSQL Performance , + Lista PostgreSQL +In-Reply-To: <1063031361.3f5c9241ad59d@sistemica.info> +References: <1063031361.3f5c9241ad59d@sistemica.info> +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="=-2uAQjN4TWVWLNOWEzh4G" +Organization: Adaptia Soluciones Integrales +Message-Id: <1063058680.1106.3.camel@localhost> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Tue, 09 Sep 2003 00:04:40 +0200 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/149 +X-Sequence-Number: 10237 + +--=-2uAQjN4TWVWLNOWEzh4G +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +On Mon, 08-sep-2003 at 16:29, Rhaoni Chiu Pereira wrote: + +> Could anyone tell me a documentation that explains the " explain " re= +sult +> and how to analyze it ? +>=20 + +http://archives.postgresql.org/pgsql-performance/2003-09/msg00000.php + +Regards, + +--=20 +Alberto Caso Palomino +Adaptia Soluciones Integrales +http://www.adaptia.net +alberto.caso@adaptia.net + + + +--=-2uAQjN4TWVWLNOWEzh4G +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada + digitalmente + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.2 (GNU/Linux) + +iD8DBQA/XPz4/tUyzpgV/S0RAiydAKCpDacC5mJHKdYj/PcbHe19wNaQQACgn8zd +pRjTpWSvWiVA0HtbcnrRwCw= +=js28 +-----END PGP SIGNATURE----- + +--=-2uAQjN4TWVWLNOWEzh4G-- + + +From pgsql-performance-owner@postgresql.org Mon Sep 8 19:08:02 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A75C9D1B522 + for ; + Mon, 8 Sep 2003 22:08:00 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 38034-06 + for ; + Mon, 8 Sep 2003 19:07:49 -0300 (ADT) +Received: from smtp.istop.com (dci.doncaster.on.ca [66.11.168.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 8D15FD1B500 + for ; + Mon, 8 Sep 2003 19:07:46 -0300 (ADT) +Received: from stark.dyndns.tv (gsstark.mtl.istop.com [66.11.160.162]) + by smtp.istop.com (Postfix) with ESMTP + id 98D7336974; Mon, 8 Sep 2003 18:07:48 -0400 (EDT) +Received: from localhost ([127.0.0.1] helo=stark.dyndns.tv ident=foobar) + by stark.dyndns.tv with smtp (Exim 3.36 #1 (Debian)) + id 19wUAm-0002wL-00; Mon, 08 Sep 2003 18:07:48 -0400 +To: "scott.marlowe" +Cc: =?iso-8859-1?q?Pailloncy_Jean-G=E9rard?= , + +Subject: Re: slow plan for min/max +References: +In-Reply-To: +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 08 Sep 2003 18:07:48 -0400 +Message-ID: <87wucj3pe3.fsf@stark.dyndns.tv> +Lines: 13 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/132 +X-Sequence-Number: 3498 + + +"scott.marlowe" writes: + +> Basically, Postgresql uses an MVCC locking system that makes massively + +As discussed, uh, a few days ago, this particular problem is not caused by +MVCC but by postgres having a general purpose aggregate system and not having +special code for handling min/max. Aggregates normally require access to every +record they're operating on, not just the first or last in some particular +order. You'll note the LIMIT 1/DISTINCT ON work-around works fine with MVCC... + +-- +greg + + +From pgsql-performance-owner@postgresql.org Mon Sep 8 19:43:07 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 2CDD7D1B4EC + for ; + Mon, 8 Sep 2003 22:43:03 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 46563-03 + for ; + Mon, 8 Sep 2003 19:42:33 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id E3441D1B4E9 + for ; + Mon, 8 Sep 2003 19:42:30 -0300 (ADT) +Received: from [66.219.92.2] (HELO temoku) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3622037; Mon, 08 Sep 2003 15:42:44 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: "scott.marlowe" , + Neil Conway +Subject: Re: slow plan for min/max +Date: Mon, 8 Sep 2003 15:40:48 -0700 +User-Agent: KMail/1.4.3 +Cc: Pailloncy =?iso-8859-1?q?Jean-G=E9rard?= , + PostgreSQL Performance +References: +In-Reply-To: +MIME-Version: 1.0 +Content-Transfer-Encoding: quoted-printable +Message-Id: <200309081540.48926.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/133 +X-Sequence-Number: 3499 + +Scott, +=20 +> Not exactly. While max(id) is easily optimized by query replacement,=20 +> more complex aggregates will still have perfomance issues that would not= +=20 +> be present in a row locking database. i.e. max((field1/field2)*field3) i= +s=20 +> still going to cost more to process, isn't it? + +Sorry, no.=20=20=20 + +The issue has nothing to do with MVCC. It has everything to do with the f= +act=20 +that PostgreSQL allows you to create your own aggregates using functions in= +=20 +any of 11 languages. This forces the planner to treat aggregates as a=20 +"black box" which does not allow index utilization, because the planner=20 +simply doesn't know what the aggregate is doing internally. + +To put it another way, the planner sees SUM() or CONCAT() -- which require= +=20 +table scans as they must include all values -- as identical to MAX() and=20 +MIN().=20=20=20=20 + +Escaping this would require programming a special exception for MAX() and= +=20 +MIN() into the planner and parser. This has been discussed numerous times= +=20 +on HACKERS; the problem is, making special exceptions for MAX() and MIN()= +=20 +would then make it very difficult to implement MAX() or MIN() for new data= +=20 +types, as well as requiring a lot of debugging in numerous places. So far= +,=20 +nobody has been frustrated enough to spend 3 months tackling the problem. + +--=20 +-Josh Berkus + Aglio Database Solutions + San Francisco + + +From pgsql-performance-owner@postgresql.org Mon Sep 8 20:17:52 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 4FB40D1B4E9 + for ; + Mon, 8 Sep 2003 23:17:45 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 53526-02 + for ; + Mon, 8 Sep 2003 20:17:17 -0300 (ADT) +Received: from wight.ymogen.net (unknown [217.27.240.153]) + by svr1.postgresql.org (Postfix) with SMTP id 80146D1B4E3 + for ; + Mon, 8 Sep 2003 20:17:12 -0300 (ADT) +Received: (qmail 32132 invoked from network); 8 Sep 2003 23:17:09 -0000 +Received: from dsl-217-155-239-51.zen.co.uk (HELO finisterre) (217.155.239.51) + by wight.ymogen.net with SMTP; 8 Sep 2003 23:17:09 -0000 +From: "Matt Clark" +To: "scott.marlowe" +Cc: +Subject: Re: slow plan for min/max +Date: Tue, 9 Sep 2003 00:17:09 +0100 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) +In-Reply-To: +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +Importance: Normal +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/134 +X-Sequence-Number: 3500 + + +>This is a Frequently asked question about something that isn't likely to +>change any time soon. + +You're right, it is in the FAQ, but pretty well buried. It is entirely +non-obvious to most people that min() and max() don't/can't use indices. +Something so counterintuitive should be explicitly and prominently +advertised, especially since the "order by X limit 1" workaround is so +simple. + +Actually, referring down to later parts of this thread, why can't this +optimisation be performed internally for built-in types? I understand the +issue with aggregates over user-defined types, but surely optimising max() +for int4, text, etc is safe and easy? + +Of course I may be so far out of my depth as to be drowning, in which case +please put me out of my misery. + +M + + +From pgsql-performance-owner@postgresql.org Mon Sep 8 20:38:47 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 832F0D1B4E3 + for ; + Mon, 8 Sep 2003 23:38:45 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 47184-08 + for ; + Mon, 8 Sep 2003 20:38:37 -0300 (ADT) +Received: from wight.ymogen.net (unknown [217.27.240.153]) + by svr1.postgresql.org (Postfix) with SMTP id D2B5DD1B520 + for ; + Mon, 8 Sep 2003 20:38:33 -0300 (ADT) +Received: (qmail 837 invoked from network); 8 Sep 2003 23:38:36 -0000 +Received: from dsl-217-155-239-51.zen.co.uk (HELO finisterre) (217.155.239.51) + by wight.ymogen.net with SMTP; 8 Sep 2003 23:38:36 -0000 +From: "Matt Clark" +To: "scott.marlowe" +Cc: +Subject: Re: slow plan for min/max +Date: Tue, 9 Sep 2003 00:38:36 +0100 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) +In-Reply-To: +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +Importance: Normal +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/135 +X-Sequence-Number: 3501 + +> Actually, referring down to later parts of this thread, why can't this +> optimisation be performed internally for built-in types? I understand the +> issue with aggregates over user-defined types, but surely optimising max() +> for int4, text, etc is safe and easy? + +Sorry, missed the bit about user-defined functions. So I should have said +built-in functions operating over built-in types. Which does sound more +complicated, but anyone redefining max() is surely not in a position to seek +sympathy if they lose performance? + + +From pgsql-performance-owner@postgresql.org Mon Sep 8 20:42:44 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 64A87D1B527 + for ; + Mon, 8 Sep 2003 23:42:41 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 53516-07 + for ; + Mon, 8 Sep 2003 20:42:33 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 6E6CAD1B520 + for ; + Mon, 8 Sep 2003 20:42:30 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h88NgWAn009769; + Mon, 8 Sep 2003 19:42:32 -0400 (EDT) +To: "Matt Clark" +Cc: "scott.marlowe" , pgsql-performance@postgresql.org +Subject: Re: slow plan for min/max +In-reply-to: +References: +Comments: In-reply-to "Matt Clark" + message dated "Tue, 09 Sep 2003 00:17:09 +0100" +Date: Mon, 08 Sep 2003 19:42:31 -0400 +Message-ID: <9768.1063064551@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/136 +X-Sequence-Number: 3502 + +"Matt Clark" writes: +> Actually, referring down to later parts of this thread, why can't this +> optimisation be performed internally for built-in types? I understand the +> issue with aggregates over user-defined types, but surely optimising max() +> for int4, text, etc is safe and easy? + +I can't see that the datatype involved has anything to do with it. +None of the issues that come up in making the planner do this are +datatype-specific. You could possibly avoid adding some columns +to pg_aggregate if you instead hard-wired the equivalent knowledge +(for builtin types only) into some code somewhere, but a patch that +approached it that way would be rejected as unmaintainable. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Sep 8 20:57:41 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B9FE4D1B4EC + for ; + Mon, 8 Sep 2003 23:57:39 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 58887-01 + for ; + Mon, 8 Sep 2003 20:57:11 -0300 (ADT) +Received: from mail.sld.cu (mail.sld.cu [200.55.135.213]) + by svr1.postgresql.org (Postfix) with ESMTP id 49400D1B4EB + for ; + Mon, 8 Sep 2003 20:57:03 -0300 (ADT) +Received: (from daemon@localhost) + by mail.sld.cu (8.11.6/8.11.6) id h88NuBj19443 + for ; Mon, 8 Sep 2003 19:56:11 -0400 +Received: from UNKNOWN(196.1.112.17), claiming to be "infomed.sld.cu" + via SMTP by mail.sld.cu, id smtpdkEm94H; Mon Sep 8 19:56:02 2003 +Received: (from uucp@localhost) + by infomed.sld.cu (8.11.6/8.11.6) with UUCP id h88Ntlp07824 + for pgsql-performance@postgresql.org; Mon, 8 Sep 2003 19:55:47 -0400 +Received: from jagua.cfg.sld.cu (jagua.cfg.sld.cu [169.158.166.216]) + by infosur.cfg.sld.cu (8.11.6/8.11.6) with ESMTP id h88NeWw20328 + for ; Mon, 8 Sep 2003 19:40:32 -0400 +Received: from moria (fcmc.cfg.sld.cu [169.158.166.215]) + by jagua.cfg.sld.cu (8.11.6/8.11.6) with SMTP id h88NcMJ31068 + for ; Mon, 8 Sep 2003 19:38:22 -0400 +Message-ID: <001301c3766a$aca792a0$0e14a8c0@moria> +From: =?iso-8859-1?Q?Odiel_Le=F3n?= +To: +Subject: +Date: Mon, 8 Sep 2003 19:38:23 -0500 +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 5.00.2919.6700 +X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 +X-MailScanner: Found to be clean, Found to be clean +X-MailScanner-Information: Please contact the ISP for more information +X-MailScanner-Infomed: Found to be clean +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= +X-Spam-Level: +X-Archive-Number: 200309/137 +X-Sequence-Number: 3503 + + + + +From pgsql-performance-owner@postgresql.org Mon Sep 8 21:42:19 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 35152D1B500 + for ; + Tue, 9 Sep 2003 00:42:12 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 67257-04 + for ; + Mon, 8 Sep 2003 21:42:04 -0300 (ADT) +Received: from wight.ymogen.net (unknown [217.27.240.153]) + by svr1.postgresql.org (Postfix) with SMTP id 04493D1B4F1 + for ; + Mon, 8 Sep 2003 21:42:00 -0300 (ADT) +Received: (qmail 3797 invoked from network); 9 Sep 2003 00:42:03 -0000 +Received: from dsl-217-155-239-51.zen.co.uk (HELO finisterre) (217.155.239.51) + by wight.ymogen.net with SMTP; 9 Sep 2003 00:42:03 -0000 +From: "Matt Clark" +To: "Tom Lane" +Cc: "scott.marlowe" , + +Subject: Re: slow plan for min/max +Date: Tue, 9 Sep 2003 01:42:03 +0100 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) +In-reply-to: <9768.1063064551@sss.pgh.pa.us> +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +Importance: Normal +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/138 +X-Sequence-Number: 3504 + +> "Matt Clark" writes: +> > Actually, referring down to later parts of this thread, why can't this +> > optimisation be performed internally for built-in types? I +> understand the +> > issue with aggregates over user-defined types, but surely +> optimising max() +> > for int4, text, etc is safe and easy? +> +> I can't see that the datatype involved has anything to do with it. +> None of the issues that come up in making the planner do this are +> datatype-specific. You could possibly avoid adding some columns +> to pg_aggregate if you instead hard-wired the equivalent knowledge +> (for builtin types only) into some code somewhere, but a patch that +> approached it that way would be rejected as unmaintainable. + +I don't pretend to have any useful knowledge of the internals of this, so +much of what I write may seem like noise to you guys. The naive question is +'I have an index on X, so finding max(X) should be trivial, so why can't the +planner exploit that triviality?'. AFAICS the short sophisticated answer is +that it just isn't trivial in the general case. + +Upon rereading the docs on aggregates I see that it really isn't trivial at +all. Not even knowing things like 'this index uses the same function as +this aggregate' gets you very far, because of the very general nature of the +implementation of aggs. + +So it should be flagged very prominently in the docs that max() and min() +are almost always not what 90% of people want to use 90% of the time, +because indexes do the same job much better for anything other than tiny +tables. + +Know what we (OK, I) need? An explicitly non-aggregate max() and min(), +implemented differently, so they can be optimised. let's call them +idx_max() and idx_min(), which completely bypass the standard aggregate +code. Because let's face it, in most cases where you regularly want a max +or a min you have an index defined, and you want the DB to use it. + +And I would volunteer to do it, I would, but you really don't want my C in +your project ;-) I do volunteer to do some doc tweaking though - who do I +talk to? + +M + + +From pgsql-performance-owner@postgresql.org Mon Sep 8 23:21:38 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A31F1D1B50E + for ; + Tue, 9 Sep 2003 02:21:36 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 68728-10 + for ; + Mon, 8 Sep 2003 23:21:29 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id A3C92D1B4E2 + for ; + Mon, 8 Sep 2003 23:21:25 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h892LQAn016729; + Mon, 8 Sep 2003 22:21:26 -0400 (EDT) +To: "Matt Clark" +Cc: "scott.marlowe" , pgsql-performance@postgresql.org +Subject: Re: slow plan for min/max +In-reply-to: +References: +Comments: In-reply-to "Matt Clark" + message dated "Tue, 09 Sep 2003 01:42:03 +0100" +Date: Mon, 08 Sep 2003 22:21:26 -0400 +Message-ID: <16728.1063074086@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/139 +X-Sequence-Number: 3505 + +"Matt Clark" writes: +> Know what we (OK, I) need? An explicitly non-aggregate max() and min(), +> implemented differently, so they can be optimised. + +Not per se. The way I've been visualizing this is that we add to +pg_aggregate a column named, say, aggsortop, with the definition: + + zero: no index optimization possible + not zero: OID of a comparison operator ('<' or '>') + +A nonzero entry means that the aggregate's value is the same as the +first item of the aggregate's input when sorted by the given operator. +(So MIN uses the '<' operator for its datatype and MAX uses '>'.) +Of course we have to add a clause to CREATE AGGREGATE to allow this to +be set for max/min aggregates of user-defined types. But that's just a +small matter of programming. This gives us all the type-specific info +we need; the aggsortop can be matched against the opclasses of indexes +to figure out whether a particular index is relevant to a particular max +or min call. + +The hard part comes in teaching the planner to use this information +intelligently. Exactly which queries is it even *possible* to use the +transformation for? Which queries is it really a win for? (Obviously +it's not if there's no matching index, but even if there is, the +presence of WHERE or GROUP BY clauses has got to affect the answer.) +How do you structure the resulting query plan, if it's at all complex +(think multiple aggregate calls...)? I'm not clear on the answers to +any of those questions, so I'm not volunteering to try to code it up ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Sep 9 00:04:43 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id BDE4BD1B543 + for ; + Tue, 9 Sep 2003 03:03:11 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 86288-05 + for ; + Tue, 9 Sep 2003 00:03:01 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id 891E4D1B506 + for ; + Tue, 9 Sep 2003 00:03:00 -0300 (ADT) +Received: from [63.195.55.98] (HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3622652; Mon, 08 Sep 2003 20:02:58 -0700 +Content-Type: text/plain; + charset="us-ascii" +From: Josh Berkus +Organization: Aglio Database Solutions +To: Tom Lane +Subject: Quick question +Date: Mon, 8 Sep 2003 20:02:18 -0700 +User-Agent: KMail/1.4.3 +Cc: pgsql-performance@postgresql.org +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-Id: <200309082002.18830.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/140 +X-Sequence-Number: 3506 + +Tom, + +Back in the 7.0 days, + +WHERE EXISTS (SELECT * FROM a WHERE condition) + +was significantly slower on broad tables than + +WHERE EXISTS (SELECT small_col FROM a WHERE condition) + +Is this still true, or something that's been fixed in the last 3 versions? +Joe Celko is making fun of me because Oracle doesn't have this performance +issue. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Tue Sep 9 00:15:15 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E9DD1D1B518 + for ; + Tue, 9 Sep 2003 03:14:44 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 85321-08 + for ; + Tue, 9 Sep 2003 00:14:34 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 071C7D1B503 + for ; + Tue, 9 Sep 2003 00:14:34 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h893ETAn019154; + Mon, 8 Sep 2003 23:14:29 -0400 (EDT) +To: Josh Berkus +Cc: pgsql-performance@postgresql.org +Subject: Re: Quick question +In-reply-to: <200309082002.18830.josh@agliodbs.com> +References: <200309082002.18830.josh@agliodbs.com> +Comments: In-reply-to Josh Berkus + message dated "Mon, 08 Sep 2003 20:02:18 -0700" +Date: Mon, 08 Sep 2003 23:14:29 -0400 +Message-ID: <19153.1063077269@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/141 +X-Sequence-Number: 3507 + +Josh Berkus writes: +> Back in the 7.0 days, +> WHERE EXISTS (SELECT * FROM a WHERE condition) +> was significantly slower on broad tables than +> WHERE EXISTS (SELECT small_col FROM a WHERE condition) +> Is this still true, or something that's been fixed in the last 3 versions? + +It's still true that all the sub-select's output columns will be +evaluated. Given that this happens for at most one row, I'm not sure +how significant the hit really is. But it's annoying, seeing that the +outer EXISTS doesn't care what the column values are. + +> Joe Celko is making fun of me because Oracle doesn't have this performance +> issue. + +Perhaps Joe can tell us exactly which part of SQL92 says it's okay not +to evaluate side-effect-producing functions in the targetlist of an +EXISTS subselect. + +I would like to make the system change the targetlist to just "SELECT 1" +in an EXISTS subquery. But I'm slightly concerned about changing the +semantics of existing queries. If someone can produce proof that this +is allowed (or even better, required) by the SQL spec, it'd be easier... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Sep 9 03:28:41 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id D63C1D1B4F6 + for ; + Tue, 9 Sep 2003 06:28:38 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 35837-04 + for ; + Tue, 9 Sep 2003 03:28:09 -0300 (ADT) +Received: from master.nslk.com (master.nslk.com [66.78.39.110]) + by svr1.postgresql.org (Postfix) with ESMTP id E3A89D1B4E9 + for ; + Tue, 9 Sep 2003 03:27:50 -0300 (ADT) +Received: from [203.94.84.129] (helo=waruna) + by master.nslk.com with asmtp (Exim 4.20) id 19wbye-0001eN-GG + for pgsql-performance@postgresql.org; Tue, 09 Sep 2003 02:27:49 -0400 +Message-ID: <003201c3769b$75e7f490$81545ecb@nirmani> +Reply-To: "Waruna Geekiyanage" +From: "Waruna Geekiyanage" +To: +Subject: Slow query? +Date: Tue, 9 Sep 2003 12:27:27 +0600 +Organization: Nirmani Solutions +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_NextPart_000_002E_01C376CD.BAF6DE20" +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 6.00.2720.3000 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2727.1300 +X-AntiAbuse: This header was added to track abuse, + please include it with any abuse report +X-AntiAbuse: Primary Hostname - master.nslk.com +X-AntiAbuse: Original Domain - postgresql.org +X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] +X-AntiAbuse: Sender Address Domain - nirmani.com +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=4.0 tagged_above=0.0 required=5.0 tests=BAYES_30, + HTML_30_40, RCVD_IN_DSBL +X-Spam-Level: **** +X-Archive-Number: 200309/142 +X-Sequence-Number: 3508 + +This is a multi-part message in MIME format. + +------=_NextPart_000_002E_01C376CD.BAF6DE20 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + +Hi All, + Is it usual that the following query to take 22 secs with the machine I ha= +ve? +Any other reason? +Hope I have provided all the details need. + +Thanks, +Waruna + +Tables: +/* --------------------------------------------------------=20 + Table structure for table "tvDiary"=20 +-------------------------------------------------------- */ +CREATE TABLE "tvDiary" ( + "member" int4 NOT NULL, + "timeSlot" int2 NOT NULL references "timeSlot"("code"), + "channel" varchar(4) NOT NULL references "tvChannel"("code"), + "date" date NOT NULL, + CONSTRAINT "tvDiary_pkey" PRIMARY KEY ("date", "member", "timeSlot") +); +Indexed on "date" + +/* --------------------------------------------------------=20 + Table structure for table "mDiary"=20 +-------------------------------------------------------- */ +CREATE TABLE "mDiary" ( + "member" int4 NOT NULL, + "area" char(1) NOT NULL, + "district" int2 references "district"("code"), + "date" date NOT NULL, + CONSTRAINT "mDiary_pkey" PRIMARY KEY ("date", "member") +); +Indexed on "date" + +# Records +tvDiary : 7 300 000 +mDiary : 850 000 + +machine :=20 +Celeron 1.0GHz RAM - 390MB , 40 GB IDE HDD +RedHat Linux 9 + +kernel.shmmni =3D 4096 +kernel.shmall =3D 33554432 +kernel.shmmax =3D 134217728 + +postgres 7.3.4 + +shared_buffers =3D 8192 +sort_mem =3D 65536 + +Query: + +SELECT COUNT(td.member) AS count, td.date AS date, td."timeSlot" AS "timeSl= +ot", td.channel AS channel,=20=20=20 + tg.district AS district,tg.area AS area=20 +FROM "tvDiary" td ,(SELECT DISTINCT(md.member) AS member, md.area AS area, = +md.district as district=20 + FROM "mDiary" md=20 + WHERE (md.date BETWEEN '20020301' AND '2002033= +0') ) AS tg=20 +WHERE(td.date BETWEEN '20020301' AND '20020330') AND (td.member=3Dtg.member= +)=20 +GROUP BY td.date,td."timeSlot", td.channel,tg.district,tg.area; + + QUERY PLAN + +---------------------------------------------------------------------------= +----- +---------------------------------------------------------------------------= +----- +----------------------- + Aggregate (cost=3D91790.44..100942.65 rows=3D52298 width=3D28) (actual ti= +me=3D18396.42..21764.44 rows=3D57478 loops=3D1) + -> Group (cost=3D91790.44..99635.19 rows=3D522983 width=3D28) (actual = +time=3D18396.34..21158.23 rows=3D281733 loops=3D1) + -> Sort (cost=3D91790.44..93097.90 rows=3D522983 width=3D28) (ac= +tual time=3D18396.30..18588.91 rows=3D281733 loops=3D1) + Sort Key: td.date, td."timeSlot", td.channel, tg.district, t= +g.area + -> Merge Join (cost=3D34290.10..42116.42 rows=3D522983 wid= +th=3D28) (actual time=3D8159.30..10513.62 rows=3D281733 ops=3D1) + Merge Cond: ("outer".member =3D "inner".member) + -> Sort (cost=3D29121.48..29755.35 rows=3D253551 wid= +th=3D17) (actual time=3D6752.36..6933.38 rows=3D282552 loops=3D1) + Sort Key: td.member + -> Index Scan using d_tvdiary_key on "tvDiary" = +td (cost=3D0.00..6362.82 rows=3D253551 width=3D17) (actual time=3D95.80..4= +766.25 rows=3D282587 + loops=3D1) + Index Cond: ((date >=3D '2002-03-01'::date= +) AND (date <=3D '2002-03-30'::date)) + -> Sort (cost=3D5168.63..5179.26 rows=3D4251 width= +=3D11) (actual time=3D1406.88..1590.72 rows=3D281955 loops=3D1) + Sort Key: tg.member + -> Subquery Scan tg (cost=3D4487.31..4912.42 r= +ows=3D4251 width=3D11) (actual time=3D1228.55..1397.20 rows=3D2348 loops=3D= +1) + -> Unique (cost=3D4487.31..4912.42 rows= +=3D4251 width=3D11) (actual time=3D1228.52..1390.12 rows=3D2348 loops=3D1) + -> Sort (cost=3D4487.31..4593.59 r= +ows=3D42511 width=3D11) (actual time=3D1228.51..1257.87 rows=3D46206 loops= +=3D1) + Sort Key: member, area, distri= +ct + -> Index Scan using d_mdiary_= +key on "mDiary" md (cost=3D0.00..1219.17 rows=3D42511 width=3D11) (actual = +time=3D60.20..750. +67 rows=3D46206 loops=3D1) + Index Cond: ((date >=3D = +'2002-03-01'::date) AND (date <=3D '2002-03-30'::date)) + Total runtime: 21992.24 msec +(19 rows) + + +------=_NextPart_000_002E_01C376CD.BAF6DE20 +Content-Type: text/html; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + + + + + + + + +
Hi All,
+
 Is it usual that the following query= + to take=20 +22 secs with the machine I have?
+
Any other reason?
+
Hope I have provided all the details= +=20 +need.
+
+
 
+
Thanks,
+
Waruna
+
 
+
Tables:
+
/*=20 +--------------------------------------------------------
  Table= +=20 +structure for table "tvDiary"=20 +
-------------------------------------------------------- */
CREATE T= +ABLE=20 +"tvDiary" (
    "member" int4 NOT NULL,
  &n= +bsp;=20 +"timeSlot" int2 NOT NULL references "timeSlot"("code"),
  =20 +"channel" varchar(4) NOT NULL references "tvChannel"("code"),
 &nbs= +p;=20 +"date" date NOT NULL,
   CONSTRAINT "tvDiary_pkey" PRIMARY KEY= +=20 +("date", "member", "timeSlot")
);
Indexed on "date"
+
 
+
/*=20 +--------------------------------------------------------
  Table= +=20 +structure for table "mDiary"=20 +
-------------------------------------------------------- */
CREATE T= +ABLE=20 +"mDiary" (
   "member" int4 NOT NULL,
   "area"= +=20 +char(1) NOT NULL,
   "district" int2 references=20 +"district"("code"),
   "date" date NOT NULL,
  = +=20 +CONSTRAINT "mDiary_pkey" PRIMARY KEY ("date", "member")
);
Indexed on= +=20 +"date"
+
 
+
# Records
tvDiary : 7 300 000
mDiary= + : 850=20 +000
+
 
+
machine :
Celeron 1.0GHz RAM - 390MB ,= + 40 GB=20 +IDE HDD
RedHat Linux 9
+
 
+
kernel.shmmni =3D 4096
kernel.shmall = +=3D=20 +33554432
kernel.shmmax =3D 134217728
+
 
+
postgres 7.3.4
+
 
+
shared_buffers =3D 8192
sort_mem =3D=20 +65536
+
 
+
Query:
+
 
+
SELECT COUNT(td.member) AS count, td.date = +AS date,=20 +td."timeSlot" AS "timeSlot", td.channel AS=20 +channel,   
+
    tg.district AS district= +,tg.area=20 +AS area
FROM "tvDiary" td ,(SELECT DISTINCT(md.member) AS member, md.ar= +ea AS=20 +area, md.district as district
       = +;=20 +               = +=20 +    FROM "mDiary" md
    =20 +               = +=20 +        WHERE (md.date BETWEEN '20020301' AND= +=20 +'20020330') ) AS tg
WHERE(td.date BETWEEN '20020301' AND '20020330') AN= +D=20 +(td.member=3Dtg.member)
GROUP BY td.date,td."timeSlot",=20 +td.channel,tg.district,tg.area;
+
 
+
 QUERY PLAN
+
 
+
------------------------------------------------------------------= +--------------
---------------------------------------------------------= +-----------------------
-----------------------
 Aggregate = +=20 +(cost=3D91790.44..100942.65 rows=3D52298 width=3D28) (actual time=3D18396.4= +2..21764.44=20 +rows=3D57478 loops=3D1)
   ->  Group =20 +(cost=3D91790.44..99635.19 rows=3D522983 width=3D28) (actual time=3D18396.3= +4..21158.23=20 +rows=3D281733 loops=3D1)
        = +;=20 +->  Sort  (cost=3D91790.44..93097.90 rows=3D522983 width=3D28)= + (actual=20 +time=3D18396.30..18588.91 rows=3D281733=20 +loops=3D1)
          &= +nbsp;   =20 +Sort Key: td.date, td."timeSlot", td.channel, tg.district,=20 +tg.area
          &nbs= +p;   =20 +->  Merge Join  (cost=3D34290.10..42116.42 rows=3D522983 width= +=3D28)=20 +(actual time=3D8159.30..10513.62 rows=3D281733=20 +ops=3D1)
          &nb= +sp;         =20 +Merge Cond: ("outer".member =3D=20 +"inner".member)
         &n= +bsp;          =20 +->  Sort  (cost=3D29121.48..29755.35 rows=3D253551 width=3D17)= + (actual=20 +time=3D6752.36..6933.38 rows=3D282552=20 +loops=3D1)
          &= +nbsp;           &nbs= +p;   =20 +Sort Key:=20 +td.member
          &n= +bsp;            = +;   =20 +->  Index Scan using d_tvdiary_key on "tvDiary" td =20 +(cost=3D0.00..6362.82 rows=3D253551 width=3D17) (actual time=3D95.80..4766.= +25=20 +rows=3D282587
 loops=3D1)
      &n= +bsp;            = +;            &n= +bsp;=20 +Index Cond: ((date >=3D '2002-03-01'::date) AND (date <=3D=20 +'2002-03-30'::date))
        &nb= +sp;           =20 +->  Sort  (cost=3D5168.63..5179.26 rows=3D4251 width=3D11) (ac= +tual=20 +time=3D1406.88..1590.72 rows=3D281955=20 +loops=3D1)
          &= +nbsp;           &nbs= +p;   =20 +Sort Key:=20 +tg.member
          &n= +bsp;            = +;   =20 +->  Subquery Scan tg  (cost=3D4487.31..4912.42 rows=3D4251 wid= +th=3D11)=20 +(actual time=3D1228.55..1397.20 rows=3D2348=20 +loops=3D1)
          &= +nbsp;           &nbs= +p;         =20 +->  Unique  (cost=3D4487.31..4912.42 rows=3D4251 width=3D11) (= +actual=20 +time=3D1228.52..1390.12 rows=3D2348=20 +loops=3D1)
          &= +nbsp;           &nbs= +p;            &= +nbsp;  =20 +->  Sort  (cost=3D4487.31..4593.59 rows=3D42511 width=3D11) (a= +ctual=20 +time=3D1228.51..1257.87 rows=3D46206=20 +loops=3D1)
          &= +nbsp;           &nbs= +p;            &= +nbsp;        =20 +Sort Key: member, area,=20 +district
          &nb= +sp;            = +            &nb= +sp;        =20 +->  Index Scan using d_mdiary_key on "mDiary" md =20 +(cost=3D0.00..1219.17 rows=3D42511 width=3D11) (actual time=3D60.20..750.67=20 +rows=3D46206=20 +loops=3D1)
          &= +nbsp;           &nbs= +p;            &= +nbsp;           &nbs= +p;  =20 +Index Cond: ((date >=3D '2002-03-01'::date) AND (date <=3D=20 +'2002-03-30'::date))
 Total runtime: 21992.24 msec
(19=20 +rows)
+ +------=_NextPart_000_002E_01C376CD.BAF6DE20-- + + +From pgsql-performance-owner@postgresql.org Tue Sep 9 04:53:29 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 23E09D1B531 + for ; + Tue, 9 Sep 2003 07:53:28 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 45306-08 + for ; + Tue, 9 Sep 2003 04:52:58 -0300 (ADT) +Received: from gatekeeper.gmanetwork.com (unknown [202.61.78.68]) + by svr1.postgresql.org (Postfix) with ESMTP id 6880CD1B504 + for ; + Tue, 9 Sep 2003 04:52:51 -0300 (ADT) +Received: from gmanewmedia.com (mailhost.gmanmi.tv [192.168.6.3]) + by gatekeeper.gmanetwork.com (8.11.0/8.11.0) with ESMTP id h897qjZ00771 + for ; Tue, 9 Sep 2003 15:52:45 +0800 +Received: from 192.168.6.40 ([192.168.6.40]) + by gmanewmedia.com (8.11.1/) with ESMTP id h897TFo27117 + for ; + Tue, 9 Sep 2003 15:29:31 +0800 (PHT) (envelope-from jerome@gmanmi.tv) +X-RAV-AntiVirus: This e-mail has been scanned for viruses on host: + gmanewmedia.com +From: JM +Reply-To: jerome@gmanmi.tv +Organization: GMANMI +To: pgsql-performance@postgresql.org +Subject: increase performancr with "noatime"? +Date: Tue, 9 Sep 2003 16:12:48 +0800 +User-Agent: KMail/1.5 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200309091612.48937.jerome@gmanmi.tv> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/143 +X-Sequence-Number: 3509 + +would it cause problem in postgres DB if /var/lib/psql partition is mounted +with "noatime"? + +TIA +JM + +From pgsql-performance-owner@postgresql.org Tue Sep 9 09:39:04 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id CDE19D1B4FF + for ; + Tue, 9 Sep 2003 12:38:04 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 92680-04 + for ; + Tue, 9 Sep 2003 09:37:57 -0300 (ADT) +Received: from mail.libertyrms.com (unknown [209.167.124.227]) + by svr1.postgresql.org (Postfix) with ESMTP id B1526D1B4FE + for ; + Tue, 9 Sep 2003 09:37:53 -0300 (ADT) +Received: from [10.1.2.130] (helo=dba2) + by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) + id 19whkr-0008J9-00 + for ; Tue, 09 Sep 2003 08:37:57 -0400 +Received: by dba2 (Postfix, from userid 1019) + id 6D933C583; Tue, 9 Sep 2003 08:37:57 -0400 (EDT) +Date: Tue, 9 Sep 2003 08:37:57 -0400 +From: Andrew Sullivan +To: pgsql-performance@postgresql.org +Subject: Re: increase performancr with "noatime"? +Message-ID: <20030909123757.GA18087@libertyrms.info> +Mail-Followup-To: Andrew Sullivan , + pgsql-performance@postgresql.org +References: <200309091612.48937.jerome@gmanmi.tv> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <200309091612.48937.jerome@gmanmi.tv> +User-Agent: Mutt/1.5.4i +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/144 +X-Sequence-Number: 3510 + +On Tue, Sep 09, 2003 at 04:12:48PM +0800, JM wrote: +> would it cause problem in postgres DB if /var/lib/psql partition is mounted +> with "noatime"? + +No; in fact, that's been suggested by many people. I don't know +whether anyone's done any tests to prove that it helps. + +A + +-- +---- +Andrew Sullivan 204-4141 Yonge Street +Liberty RMS Toronto, Ontario Canada + M2P 2A8 + +1 416 646 3304 x110 + + +From pgsql-performance-owner@postgresql.org Tue Sep 9 09:41:09 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E07E4D1B4E3 + for ; + Tue, 9 Sep 2003 12:41:06 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 94297-04 + for ; + Tue, 9 Sep 2003 09:40:39 -0300 (ADT) +Received: from ns1.bee.lt (ns.bi.lt [213.226.131.131]) + by svr1.postgresql.org (Postfix) with ESMTP id B6200D1B527 + for ; + Tue, 9 Sep 2003 09:40:34 -0300 (ADT) +Received: from B027543 (inet.bee.lt [213.226.131.30]) + by ns1.bee.lt (8.11.6/8.11.6) with SMTP id h89Cebi19479 + for ; Tue, 9 Sep 2003 15:40:37 +0300 +Message-ID: <00be01c376cf$91510620$f20214ac@bite.lt> +From: "Mindaugas Riauba" +To: +Subject: Need advice about triggers +Date: Tue, 9 Sep 2003 15:40:31 +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.1158 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/145 +X-Sequence-Number: 3511 + + + Hello, + + I have small table (up to 10000 rows) and every row will be updated +once per minute. Table also has "before update on each row" trigger +written in plpgsql. But trigger 99.99% of the time will do nothing +to the database. It will just compare old and new values in the row +and those values almost always will be identical. + + Now I tried simple test and was able to do 10000 updates on 1000 +rows table in ~30s. That's practically enough but I'd like to have +more room to slow down. + Also best result I achieved by doing commit+vacuum every ~500 +updates. + + How can I improve performance and will version 7.4 bring something +valuable for my task? Rewrite to some other scripting language is not +a problem. Trigger is simple enough. + + Postgres v7.3.4, shared_buffers=4096 max_fsm settings also bumped up +10 times. + + Thanks, + + Mindaugas + + +From pgsql-performance-owner@postgresql.org Tue Sep 9 09:45:28 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C456ED1B527 + for ; + Tue, 9 Sep 2003 12:45:25 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 92747-06 + for ; + Tue, 9 Sep 2003 09:44:58 -0300 (ADT) +Received: from mta8.adelphia.net (mta8.adelphia.net [68.168.78.196]) + by svr1.postgresql.org (Postfix) with ESMTP id 6C9AFD1B521 + for ; + Tue, 9 Sep 2003 09:44:39 -0300 (ADT) +Received: from potentialtech.com ([24.53.179.151]) by mta8.adelphia.net + (InterMail vM.5.01.05.32 201-253-122-126-132-20030307) with ESMTP + id <20030909124439.OGFU14490.mta8.adelphia.net@potentialtech.com>; + Tue, 9 Sep 2003 08:44:39 -0400 +Message-ID: <3F5DCB35.3090809@potentialtech.com> +Date: Tue, 09 Sep 2003 08:44:37 -0400 +From: Bill Moran +User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3) Gecko/20030429 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Andrew Sullivan +Cc: pgsql-performance@postgresql.org +Subject: Re: increase performancr with "noatime"? +References: <200309091612.48937.jerome@gmanmi.tv> + <20030909123757.GA18087@libertyrms.info> +In-Reply-To: <20030909123757.GA18087@libertyrms.info> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/146 +X-Sequence-Number: 3512 + +Andrew Sullivan wrote: +> On Tue, Sep 09, 2003 at 04:12:48PM +0800, JM wrote: +> +>>would it cause problem in postgres DB if /var/lib/psql partition is mounted +>>with "noatime"? +> +> +> No; in fact, that's been suggested by many people. I don't know +> whether anyone's done any tests to prove that it helps. + +http://www.potentialtech.com/wmoran/postgresql.php#results + +You can see, from my _limited_ testing, that it doesn't seem to help enough +to be worth worrying about. In this test, it actually seems to hurt +performance. Read the whole page, though. These tests are heavy on the +writing, it's quite possible that it could improve things if your database +is a heavy read scenerio. + +-- +Bill Moran +Potential Technologies +http://www.potentialtech.com + + +From pgsql-performance-owner@postgresql.org Tue Sep 9 10:15:12 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id BC673D1B530 + for ; + Tue, 9 Sep 2003 13:15:09 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 94742-08 + for ; + Tue, 9 Sep 2003 10:14:41 -0300 (ADT) +Received: from anchor-post-33.mail.demon.net (anchor-post-33.mail.demon.net + [194.217.242.91]) + by svr1.postgresql.org (Postfix) with ESMTP id 95711D1B4F6 + for ; + Tue, 9 Sep 2003 10:14:22 -0300 (ADT) +Received: from mwynhau.demon.co.uk ([193.237.186.96] + helo=mainbox.archonet.com) + by anchor-post-33.mail.demon.net with esmtp (Exim 3.35 #1) + id 19wiK9-0008sc-0X; Tue, 09 Sep 2003 14:14:26 +0100 +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mainbox.archonet.com (Postfix) with ESMTP + id 03FA417216; Tue, 9 Sep 2003 14:14:25 +0100 (BST) +Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP + id 121BC1720E; Tue, 9 Sep 2003 14:14:24 +0100 (BST) +From: Richard Huxton +To: "Mindaugas Riauba" , + +Subject: Re: Need advice about triggers +Date: Tue, 9 Sep 2003 14:14:23 +0100 +User-Agent: KMail/1.5 +References: <00be01c376cf$91510620$f20214ac@bite.lt> +In-Reply-To: <00be01c376cf$91510620$f20214ac@bite.lt> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="windows-1257" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200309091414.23458.dev@archonet.com> +X-Virus-Scanned: by AMaViS snapshot-20020531 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/147 +X-Sequence-Number: 3513 + +On Tuesday 09 September 2003 13:40, Mindaugas Riauba wrote: +> Hello, +> +> I have small table (up to 10000 rows) and every row will be updated +> once per minute. Table also has "before update on each row" trigger +> written in plpgsql. But trigger 99.99% of the time will do nothing +> to the database. It will just compare old and new values in the row +> and those values almost always will be identical. +> +> Now I tried simple test and was able to do 10000 updates on 1000 +> rows table in ~30s. That's practically enough but I'd like to have +> more room to slow down. +> Also best result I achieved by doing commit+vacuum every ~500 +> updates. +> +> How can I improve performance and will version 7.4 bring something +> valuable for my task? Rewrite to some other scripting language is not +> a problem. Trigger is simple enough. + +Well, try it without the trigger. If performance improves markedly, it might +be worth rewriting in C. + +If not, you're probably saturating the disk I/O - using iostat/vmstat will let +you see what's happening. If it is your disks, you might see if moving the +WAL onto a separate drive would help, or check the archives for plenty of +discussion about raid setups. + +> Postgres v7.3.4, shared_buffers=4096 max_fsm settings also bumped up +> 10 times. + +Well effective_cache_size is useful for reads, but won't help with writing. +You might want to look at wal_buffers and see if increasing that helps, but I +couldn't say for sure. +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Tue Sep 9 10:28:26 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B72DAD1B520 + for ; + Tue, 9 Sep 2003 13:28:23 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 95539-08 + for ; + Tue, 9 Sep 2003 10:27:56 -0300 (ADT) +Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) + by svr1.postgresql.org (Postfix) with ESMTP id A2A0FD1B4F6 + for ; + Tue, 9 Sep 2003 10:27:52 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by mailav.tor1.inquent.com (Postfix) with ESMTP + id 7EC5B1025C; Tue, 9 Sep 2003 09:19:25 -0400 (EDT) +Received: from [10.0.2.8] (unknown [10.0.2.8]) + by mailav.tor1.inquent.com (Postfix) with ESMTP + id A6BE010248; Tue, 9 Sep 2003 09:19:23 -0400 (EDT) +Subject: Re: Need advice about triggers +From: Rod Taylor +To: Mindaugas Riauba +Cc: Postgresql Performance +In-Reply-To: <00be01c376cf$91510620$f20214ac@bite.lt> +References: <00be01c376cf$91510620$f20214ac@bite.lt> +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="=-oEpXWNR807newZCxoHgv" +Message-Id: <1063114086.67981.5.camel@jester> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Tue, 09 Sep 2003 09:28:07 -0400 +X-Virus-Scanned: by AMaViS perl-11 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/148 +X-Sequence-Number: 3514 + +--=-oEpXWNR807newZCxoHgv +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +> How can I improve performance and will version 7.4 bring something +> valuable for my task? Rewrite to some other scripting language is not +> a problem. Trigger is simple enough. + +Your best bet is to have additional clients connected to the database +requesting work. Approx NUMCPUs * 2 + 1 seems to be ideal. (+1 to ensure +there is something waiting when the others complete. *2 to ensure that +you can have 50% reading from disk, 50% doing calculations) + +You may simply want to put vacuum into a loop of it's own so it executes +~1 second after the previous run finished. Work should still be going +on even though vacuum is running. + +--=-oEpXWNR807newZCxoHgv +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: This is a digitally signed message part + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.3 (FreeBSD) + +iD8DBQA/XdVm6DETLow6vwwRAtoeAJ4kZ2d1jzJG5NMstnxZdMnDQcgOOQCcCbw6 +fzObcMoxLLgG9YBe2skRwfg= +=ffrR +-----END PGP SIGNATURE----- + +--=-oEpXWNR807newZCxoHgv-- + + +From pgsql-performance-owner@postgresql.org Tue Sep 9 10:34:26 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B6BA9D1B537 + for ; + Tue, 9 Sep 2003 13:34:08 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 96808-09 + for ; + Tue, 9 Sep 2003 10:33:41 -0300 (ADT) +Received: from ns1.bee.lt (ns.bi.lt [213.226.131.131]) + by svr1.postgresql.org (Postfix) with ESMTP id 742ADD1B54A + for ; + Tue, 9 Sep 2003 10:33:36 -0300 (ADT) +Received: from B027543 (inet.bee.lt [213.226.131.30]) + by ns1.bee.lt (8.11.6/8.11.6) with SMTP id h89DXdi19816 + for ; Tue, 9 Sep 2003 16:33:40 +0300 +Message-ID: <00dc01c376d6$f9f99c30$f20214ac@bite.lt> +From: "Mindaugas Riauba" +To: +References: <00be01c376cf$91510620$f20214ac@bite.lt> + <200309091414.23458.dev@archonet.com> +Subject: Re: Need advice about triggers +Date: Tue, 9 Sep 2003 16:33: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.1158 +X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/149 +X-Sequence-Number: 3515 + + +> > How can I improve performance and will version 7.4 bring something +> > valuable for my task? Rewrite to some other scripting language is not +> > a problem. Trigger is simple enough. +> +> Well, try it without the trigger. If performance improves markedly, it +might +> be worth rewriting in C. + + Nope. Execution time is practically the same without trigger. + +> If not, you're probably saturating the disk I/O - using iostat/vmstat will +let +> you see what's happening. If it is your disks, you might see if moving the +> WAL onto a separate drive would help, or check the archives for plenty of +> discussion about raid setups. + + Bottleneck in this case is CPU. postmaster process uses almost 100% of +CPU. + +> > Postgres v7.3.4, shared_buffers=4096 max_fsm settings also bumped up +> > 10 times. +> Well effective_cache_size is useful for reads, but won't help with +writing. +> You might want to look at wal_buffers and see if increasing that helps, +but I +> couldn't say for sure. + + Disk I/O should not be a problem in this case. vmstat shows ~300kb/s write +activity. + + Mindaugas + + +From pgsql-performance-owner@postgresql.org Tue Sep 9 10:36:58 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 020C1D1B520 + for ; + Tue, 9 Sep 2003 13:36:56 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 05160-05 + for ; + Tue, 9 Sep 2003 10:36:27 -0300 (ADT) +Received: from mwinf0404.wanadoo.fr (smtp5.wanadoo.fr [193.252.22.27]) + by svr1.postgresql.org (Postfix) with ESMTP id 16ECCD1B4F9 + for ; + Tue, 9 Sep 2003 10:36:23 -0300 (ADT) +Received: from ifrance.com (AMontsouris-108-1-18-106.w80-15.abo.wanadoo.fr + [80.15.147.106]) + by mwinf0404.wanadoo.fr (SMTP Server) with ESMTP id 491C13800316 + for ; + Tue, 9 Sep 2003 15:36:26 +0200 (CEST) +Date: Tue, 9 Sep 2003 15:36:24 +0200 +Subject: Re: slow plan for min/max +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Mime-Version: 1.0 (Apple Message framework v552) +From: =?ISO-8859-1?Q?Pailloncy_Jean-G=E9rard?= +To: pgsql-performance@postgresql.org +Content-Transfer-Encoding: quoted-printable +In-Reply-To: +Message-Id: <9AF964B4-E2CA-11D7-96D3-00039394E6D8@ifrance.com> +X-Mailer: Apple Mail (2.552) +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/150 +X-Sequence-Number: 3516 + +I did not expect so many answers about this question. +Thanks. + +I find by myself the "order by trick" to speed min/max function. + +Jean-G=E9rard Pailloncy + + +From pgsql-performance-owner@postgresql.org Tue Sep 9 10:43:37 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 85BC7D1B4E3 + for ; + Tue, 9 Sep 2003 13:43:34 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 07029-04 + for ; + Tue, 9 Sep 2003 10:43:07 -0300 (ADT) +Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) + by svr1.postgresql.org (Postfix) with ESMTP id 2E195D1B4FF + for ; + Tue, 9 Sep 2003 10:43:03 -0300 (ADT) +Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) + by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h89Dfcwb006419; + Tue, 9 Sep 2003 07:41:38 -0600 (MDT) +Date: Tue, 9 Sep 2003 07:39:06 -0600 (MDT) +From: "scott.marlowe" +To: Mindaugas Riauba +Cc: +Subject: Re: Need advice about triggers +In-Reply-To: <00be01c376cf$91510620$f20214ac@bite.lt> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-IHS-MailScanner: Found to be clean +X-IHS-MailScanner-SpamCheck: +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/151 +X-Sequence-Number: 3517 + +On Tue, 9 Sep 2003, Mindaugas Riauba wrote: + +> +> Hello, +> +> I have small table (up to 10000 rows) and every row will be updated +> once per minute. Table also has "before update on each row" trigger +> written in plpgsql. But trigger 99.99% of the time will do nothing +> to the database. It will just compare old and new values in the row +> and those values almost always will be identical. + +If the rows aren't going to actually change all that often, perhaps you +could program your trigger to just silently drop the update, i.e. only +change the rows that need updating and ignore the rest? That should speed +things up. Unless I'm misunderstanding your needs here. + + +From pgsql-performance-owner@postgresql.org Tue Sep 9 11:42:04 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id BBEC4D1B519 + for ; + Tue, 9 Sep 2003 14:41:20 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 16919-03 + for ; + Tue, 9 Sep 2003 11:40:51 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id D8A6ED1B4EC + for ; + Tue, 9 Sep 2003 11:40:46 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h89EemAn021263; + Tue, 9 Sep 2003 10:40:48 -0400 (EDT) +To: "Mindaugas Riauba" +Cc: pgsql-performance@postgresql.org +Subject: Re: Need advice about triggers +In-reply-to: <00dc01c376d6$f9f99c30$f20214ac@bite.lt> +References: <00be01c376cf$91510620$f20214ac@bite.lt> + <200309091414.23458.dev@archonet.com> + <00dc01c376d6$f9f99c30$f20214ac@bite.lt> +Comments: In-reply-to "Mindaugas Riauba" + message dated "Tue, 09 Sep 2003 16:33:32 +0300" +Date: Tue, 09 Sep 2003 10:40:48 -0400 +Message-ID: <21262.1063118448@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/152 +X-Sequence-Number: 3518 + +"Mindaugas Riauba" writes: +>> Well, try it without the trigger. If performance improves markedly, it +>> might be worth rewriting in C. + +> Nope. Execution time is practically the same without trigger. + +>> If not, you're probably saturating the disk I/O - + +> Bottleneck in this case is CPU. postmaster process uses almost 100% of +> CPU. + +That seems very odd. Updates should be I/O intensive, not CPU +intensive. I wouldn't have been surprised to hear of a plpgsql trigger +consuming lots of CPU, but without it, I'm not sure where the time is +going. Can you show us an EXPLAIN ANALYZE result for a typical update +command? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Sep 9 11:42:08 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 10774D1B526 + for ; + Tue, 9 Sep 2003 14:41:25 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 16452-05 + for ; + Tue, 9 Sep 2003 11:40:55 -0300 (ADT) +Received: from anchor-post-30.mail.demon.net (anchor-post-30.mail.demon.net + [194.217.242.88]) + by svr1.postgresql.org (Postfix) with ESMTP id 60EC5D1B4F6 + for ; + Tue, 9 Sep 2003 11:40:51 -0300 (ADT) +Received: from mwynhau.demon.co.uk ([193.237.186.96] + helo=mainbox.archonet.com) + by anchor-post-30.mail.demon.net with esmtp (Exim 3.35 #1) + id 19wjfr-000J1k-0U; Tue, 09 Sep 2003 15:40:55 +0100 +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mainbox.archonet.com (Postfix) with ESMTP + id 5E420177A3; Tue, 9 Sep 2003 15:40:54 +0100 (BST) +Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP + id 15F591720E; Tue, 9 Sep 2003 15:40:53 +0100 (BST) +From: Richard Huxton +To: "Mindaugas Riauba" , + +Subject: Re: Need advice about triggers +Date: Tue, 9 Sep 2003 15:40:51 +0100 +User-Agent: KMail/1.5 +References: <00be01c376cf$91510620$f20214ac@bite.lt> + <200309091414.23458.dev@archonet.com> + <00dc01c376d6$f9f99c30$f20214ac@bite.lt> +In-Reply-To: <00dc01c376d6$f9f99c30$f20214ac@bite.lt> +MIME-Version: 1.0 +Content-Type: Multipart/Mixed; + boundary="Boundary-00=_zZeX/rn0IcgGLdE" +Message-Id: <200309091540.51382.dev@archonet.com> +X-Virus-Scanned: by AMaViS snapshot-20020531 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/153 +X-Sequence-Number: 3519 + +--Boundary-00=_zZeX/rn0IcgGLdE +Content-Type: text/plain; + charset="windows-1257" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +On Tuesday 09 September 2003 14:33, Mindaugas Riauba wrote: +> > Well, try it without the trigger. If performance improves markedly, it +> might +> > be worth rewriting in C. +> +> Nope. Execution time is practically the same without trigger. + +OK - no point in rewriting it then. + +> > If not, you're probably saturating the disk I/O - using iostat/vmstat +> > will +> +> let +> +> > you see what's happening. If it is your disks, you might see if moving +> > the WAL onto a separate drive would help, or check the archives for +> > plenty of discussion about raid setups. +> +> Bottleneck in this case is CPU. postmaster process uses almost 100% of +> CPU. + +> Disk I/O should not be a problem in this case. vmstat shows ~300kb/s +> write activity. + +Hmm - I must admit I wasn't expecting that. Closest I can get on my test +machine here: AMD 400MHz / 256MB / IDE disk / other stuff running is about 20 +secs. + +I've attached the perl script I used - what sort of timings does it give you? + +-- + Richard Huxton + Archonet Ltd +--Boundary-00=_zZeX/rn0IcgGLdE +Content-Type: text/x-perl; charset="windows-1257"; name="big_update_test.pl" +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="big_update_test.pl" + +#!/usr/bin/perl -w +use DBI; +use Benchmark; + +# How many clients, how many inserts each +my $num_upd = 10000; +my $num_rows = 1000; + +my $dbname = "richardh"; +my $dbh = DBI->connect("dbi:Pg:dbname=$dbname", "", ""); + +# Comment out create_table after the first run. +create_table($dbh, $num_rows); +my $t0 = new Benchmark; +run_updates($dbh, $num_rows, $num_upd); +my $t1 = new Benchmark; +$td = timediff($t1, $t0); +print "the code took:",timestr($td),"\n"; + +$dbh->disconnect; +exit; + + +sub create_table { + my $dbh = shift; + my $num_rows = shift; + + my $sth = $dbh->prepare("CREATE TABLE foo (a int4, v varchar(100), t timestamp with time zone, PRIMARY KEY (a))"); + $sth->execute or die $dbh->errstr; + + $sth = $dbh->prepare("INSERT INTO foo (a,v,t) VALUES (?,?,now())"); + my $vartext = 'AAAAAAAA'; + for (my $i=0; $i<$num_rows; $i++) { + $sth->execute($i,$vartext) or die $dbh->errstr; + $vartext++; + } +} + + +sub run_updates { + my $dbh = shift; + my $num_rows = shift; + my $num_upd = shift; + my $batchsize = 500; + + my $sth = $dbh->prepare("UPDATE foo SET t=now() WHERE a=?"); + for (my $i=0; $i<$num_upd; $i++) { + if ($i % $batchsize==0) { $dbh->begin_work; } + if ($i % $batchsize==499) { + $dbh->commit; + print "update $i\n"; + $dbh->do("VACUUM foo;"); + } + $sth->execute() or die $dbh->errstr; + } +} + +--Boundary-00=_zZeX/rn0IcgGLdE-- + + +From pgsql-performance-owner@postgresql.org Tue Sep 9 12:19:03 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 23B82D1B533 + for ; + Tue, 9 Sep 2003 15:18:58 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 17885-10 + for ; + Tue, 9 Sep 2003 12:18:27 -0300 (ADT) +Received: from fuji.krosing.net (silmet.estpak.ee [194.126.97.78]) + by svr1.postgresql.org (Postfix) with ESMTP id 514F9D1B521 + for ; + Tue, 9 Sep 2003 12:18:26 -0300 (ADT) +Received: from fuji.krosing.net (localhost.localdomain [127.0.0.1]) + by fuji.krosing.net (8.12.8/8.12.8) with ESMTP id h89FIFmQ021677; + Tue, 9 Sep 2003 18:18:20 +0300 +Received: (from hannu@localhost) + by fuji.krosing.net (8.12.8/8.12.8/Submit) id h89FI7pN021675; + Tue, 9 Sep 2003 18:18:07 +0300 +X-Authentication-Warning: fuji.krosing.net: hannu set sender to hannu@tm.ee + using -f +Subject: Re: Need advice about triggers +From: Hannu Krosing +To: Mindaugas Riauba +Cc: pgsql-performance@postgresql.org +In-Reply-To: <00be01c376cf$91510620$f20214ac@bite.lt> +References: <00be01c376cf$91510620$f20214ac@bite.lt> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1063120683.6150.43.camel@fuji.krosing.net> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Tue, 09 Sep 2003 18:18:03 +0300 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/154 +X-Sequence-Number: 3520 + +Mindaugas Riauba kirjutas T, 09.09.2003 kell 15:40: +> Hello, +> +> I have small table (up to 10000 rows) and every row will be updated +> once per minute. Table also has "before update on each row" trigger +> written in plpgsql. But trigger 99.99% of the time will do nothing +> to the database. It will just compare old and new values in the row +> and those values almost always will be identical. +> +> Now I tried simple test and was able to do 10000 updates on 1000 +> rows table in ~30s. That's practically enough but I'd like to have +> more room to slow down. + +Is it 10000 *rows* or 10000*1000 = 10 000 000 *rows* updated ? + +When I run a simple update 10 times on 1000 rows (with no trigger, which +you claim to take about the same time) it took 0.25 sec. + +> Also best result I achieved by doing commit+vacuum every ~500 +> updates. + +It seems like you are updating more than one row at each update ? + +--------------- +Hannu + + +From pgsql-performance-owner@postgresql.org Tue Sep 9 13:09:40 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 62027D1B50E + for ; + Tue, 9 Sep 2003 16:09:39 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 36861-01 + for ; + Tue, 9 Sep 2003 13:09:07 -0300 (ADT) +Received: from lorax.kciLink.com (lorax.kciLink.com [206.112.95.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 7AAB7D1B4EA + for ; + Tue, 9 Sep 2003 13:09:07 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id 249993EC1 + for ; + Tue, 9 Sep 2003 12:09:07 -0400 (EDT) +Received: from lorax.kciLink.com ([127.0.0.1]) + by localhost (lorax.kciLink.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 87313-03-3 for ; + Tue, 9 Sep 2003 12:08:56 -0400 (EDT) +Received: from lorax.kciLink.com (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id 959CB3E42 + for ; + Tue, 9 Sep 2003 12:08:56 -0400 (EDT) +Received: (from news@localhost) + by lorax.kciLink.com (8.12.8p1/8.12.8/Submit) id h89G8tHi010978 + for pgsql-performance@postgresql.org; + Tue, 9 Sep 2003 12:08:55 -0400 (EDT) +To: pgsql-performance@postgresql.org +Path: not-for-mail +From: Vivek Khera +Newsgroups: ml.postgres.performance +Subject: Re: increase performancr with "noatime"? +Date: Tue, 09 Sep 2003 12:08:55 -0400 +Organization: Khera Communications, Inc., Rockville, MD +Lines: 23 +Message-ID: +References: <200309091612.48937.jerome@gmanmi.tv> + <20030909123757.GA18087@libertyrms.info> +NNTP-Posting-Host: yertle.kcilink.com +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Trace: lorax.kciLink.com 1063123735 8185 216.194.193.105 (9 Sep 2003 + 16:08:55 GMT) +X-Complaints-To: daemon@kciLink.com +NNTP-Posting-Date: Tue, 9 Sep 2003 16:08:55 +0000 (UTC) +User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Portable Code, + berkeley-unix) +Cancel-Lock: sha1:l2uQJw5Yd88dGWTwLKoJp6527ao= +X-Virus-Scanned: by amavisd-new at kciLink.com +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/155 +X-Sequence-Number: 3521 + +>>>>> "AS" == Andrew Sullivan writes: + +AS> On Tue, Sep 09, 2003 at 04:12:48PM +0800, JM wrote: +>> would it cause problem in postgres DB if /var/lib/psql partition is mounted +>> with "noatime"? + +AS> No; in fact, that's been suggested by many people. I don't know +AS> whether anyone's done any tests to prove that it helps. + +I honestly can't expect it to be much of an improvement since the +number of files involved compared with the size of the files is +minimal. However, if you're opening/closing the files often it might +cause you problems. I think in the normal case where it does matter +you have pooled connections so the open/close happens rarely. + +Of course, if I had a good synthetic workload to pound on my DB, I'd +run a test... Sean? + +-- +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Vivek Khera, Ph.D. Khera Communications, Inc. +Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 +AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ + +From pgsql-performance-owner@postgresql.org Tue Sep 9 13:54:45 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 23A22D1B53E + for ; + Tue, 9 Sep 2003 16:54:43 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 39253-05 + for ; + Tue, 9 Sep 2003 13:54:12 -0300 (ADT) +Received: from smtp.istop.com (dci.doncaster.on.ca [66.11.168.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 1A72FD1B531 + for ; + Tue, 9 Sep 2003 13:54:11 -0300 (ADT) +Received: from stark.dyndns.tv (gsstark.mtl.istop.com [66.11.160.162]) + by smtp.istop.com (Postfix) with ESMTP + id A772B36961; Tue, 9 Sep 2003 12:54:05 -0400 (EDT) +Received: from localhost ([127.0.0.1] helo=stark.dyndns.tv ident=foobar) + by stark.dyndns.tv with smtp (Exim 3.36 #1 (Debian)) + id 19wlki-0006S6-00; Tue, 09 Sep 2003 12:54:04 -0400 +To: "scott.marlowe" +Cc: Neil Conway , + =?iso-8859-1?q??= =?iso-8859-1?q? Pailloncy Jean-G�rard?= , + PostgreSQL Performance +Subject: Re: slow plan for min/max +References: +In-Reply-To: +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 09 Sep 2003 12:54:04 -0400 +Message-ID: <87ad9d52dv.fsf@stark.dyndns.tv> +Lines: 28 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char E9 hex) in message + header 'Cc' + Cc: ...-8859-1?q? Pailloncy Jean-G\351rard?= ; + Tue, 9 Sep 2003 17:15:58 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 40340-06 + for ; + Tue, 9 Sep 2003 14:15:27 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id D0625D1B4E6 + for ; + Tue, 9 Sep 2003 14:15:25 -0300 (ADT) +Received: from [63.195.55.98] (HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3624233; Tue, 09 Sep 2003 10:14:42 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Organization: Aglio Database Solutions +To: Greg Stark +Subject: Re: slow plan for min/max +Date: Tue, 9 Sep 2003 10:14:03 -0700 +User-Agent: KMail/1.4.3 +Cc: PostgreSQL Performance +References: + <87ad9d52dv.fsf@stark.dyndns.tv> +In-Reply-To: <87ad9d52dv.fsf@stark.dyndns.tv> +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-Id: <200309091014.03405.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/157 +X-Sequence-Number: 3523 + +Greg, + +> The only connection to MVCC is that the "obvious" solution doesn't work, +> namely storing a cache of the aggregate in the table information. + +Well, that solution also doesn't work if you use a WHERE condition or JOIN, +now does it? + +> So what would it take to implement this for "all" aggregates? Where I think +> "all" really just means min(), max(), first(), last(). + +Um, what the heck are first() and last()? These are not supported aggregates +... table rows are *not* ordered. + +> For min() and max() it would have to indicate not only that only the first +> or last record is necessary but also the sort order to impose. + +I think Tom already suggested this based on adding a field to CREATE +AGGREGATE. But I think implementation isn't as simple as you think it is. + +> Now the problem I see is if there's no index on the sort order imposed, and +> the previous step wasn't a merge join or something else that would return +> the records in order then it's not necessarily any faster to sort the +> records and return only some. It might be for small numbers of records, but +> it might be faster to just read them all in and check each one for min/max +> the linear way. + +Yes, Tom mentioned this also. Working out the rules whereby the planner could +decide the viability of index use is a non-trivial task. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Tue Sep 9 15:44:04 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id AC8BED1B506 + for ; + Tue, 9 Sep 2003 18:44:02 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 63552-01 + for ; + Tue, 9 Sep 2003 15:43:32 -0300 (ADT) +Received: from wolff.to (wolff.to [66.93.249.74]) + by svr1.postgresql.org (Postfix) with SMTP id 835C7D1B504 + for ; + Tue, 9 Sep 2003 15:43:30 -0300 (ADT) +Received: (qmail 15002 invoked by uid 500); 9 Sep 2003 18:49:54 -0000 +Date: Tue, 9 Sep 2003 13:49:54 -0500 +From: Bruno Wolff III +To: Greg Stark +Cc: "scott.marlowe" , Neil Conway , + =?iso-8859-1?B?PT9pc28tODg1OS0xP3E/IFBhaWxsb25jeSBKZWFuLUfpcmFyZD89?= + , + PostgreSQL Performance +Subject: Re: slow plan for min/max +Message-ID: <20030909184954.GA14198@wolff.to> +Mail-Followup-To: Greg Stark , + "scott.marlowe" , + Neil Conway , + =?iso-8859-1?Q?=3D=3Fiso-8859-1=3Fq=3F_Pailloncy_Jean-G?= + =?iso-8859-1?B?6XJhcmQ/PQ==?= , + PostgreSQL Performance +References: + <87ad9d52dv.fsf@stark.dyndns.tv> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <87ad9d52dv.fsf@stark.dyndns.tv> +User-Agent: Mutt/1.5.4i +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/158 +X-Sequence-Number: 3524 + +On Tue, Sep 09, 2003 at 12:54:04 -0400, + Greg Stark wrote: +> +> So what would it take to implement this for "all" aggregates? Where I think +> "all" really just means min(), max(), first(), last(). + +There can be other aggregates where indexes are helpful. The case of interest +is when functions such that if the new item is contains the current value +of the aggregate then the new value of the aggregate with be that of the +current item. This allows you to skip looking at all of the other items +contained in the current item. Dual problems can also benefit in a similar +manner. In a case where the set is totally ordered by the contains index +(as is the case or max and min) then the problem is even simpler and you +can use the greatest or least element as appropiate. + +From pgsql-performance-owner@postgresql.org Tue Sep 9 16:07:59 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 9687AD1B4E8 + for ; + Tue, 9 Sep 2003 19:07:58 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 68058-01 + for ; + Tue, 9 Sep 2003 16:07:28 -0300 (ADT) +Received: from stubee.d2hosting.net (d2hosting.net [66.70.41.160]) + by svr1.postgresql.org (Postfix) with ESMTP id B0437D1B4E7 + for ; + Tue, 9 Sep 2003 16:07:21 -0300 (ADT) +Received: from idigx.com ([208.207.88.112]) + by stubee.d2hosting.net (8.11.6/linuxconf) with ESMTP id h89J6uM13783; + Tue, 9 Sep 2003 14:06:57 -0500 +Message-ID: <3F5E24D0.4040309@idigx.com> +Date: Tue, 09 Sep 2003 14:06:56 -0500 +From: Thomas Swan +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; + rv:1.5b) Gecko/20030901 Thunderbird/0.2 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Tom Lane +Cc: "scott.marlowe" , Neil Conway , + =?ISO-8859-1?Q?Pailloncy_Jean-G=E9rard?= , + PostgreSQL Performance +Subject: Re: slow plan for min/max +References: + <3303.1063056376@sss.pgh.pa.us> +In-Reply-To: <3303.1063056376@sss.pgh.pa.us> +X-Enigmail-Version: 0.81.5.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/159 +X-Sequence-Number: 3525 + +Tom Lane wrote: + +>"scott.marlowe" writes: +> +> +>>On Mon, 8 Sep 2003, Neil Conway wrote: +>> +>> +>>>As was pointed out in a thread a couple days ago, MIN/MAX() optimization +>>>has absolutely nothing to do with MVCC. It does, however, make +>>>optimizing COUNT() more difficult. +>>> +>>> +> +> +> +>>Not exactly. While max(id) is easily optimized by query replacement, +>>more complex aggregates will still have perfomance issues that would not +>>be present in a row locking database. i.e. max((field1/field2)*field3) is +>>still going to cost more to process, isn't it? +>> +>> +> +>Er, what makes you think that would be cheap in any database? +> +>Postgres would actually have an advantage given its support for +>expressional indexes (nee functional indexes). If we had an optimizer +>transform to convert MAX() into an index scan, I would expect it to be +>able to match up max((field1/field2)*field3) with an index on +>((field1/field2)*field3). +> +> + +Would it be possible to rewrite min and max at the parser level into a +select/subselect (clause) condition ( repeat condition ) order by +(clause ) descending/ascending limit 1 and thereby avoiding the +penalties of altering the default aggregate behavior? Would it yield +anything beneficial? + + + +From pgsql-performance-owner@postgresql.org Tue Sep 9 16:28:17 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DCA8BD1B4F9 + for ; + Tue, 9 Sep 2003 19:28:15 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 72481-01 + for ; + Tue, 9 Sep 2003 16:28:06 -0300 (ADT) +Received: from wolff.to (wolff.to [66.93.249.74]) + by svr1.postgresql.org (Postfix) with SMTP id A2E15D1B4EC + for ; + Tue, 9 Sep 2003 16:28:03 -0300 (ADT) +Received: (qmail 15423 invoked by uid 500); 9 Sep 2003 19:34:28 -0000 +Date: Tue, 9 Sep 2003 14:34:28 -0500 +From: Bruno Wolff III +To: Thomas Swan +Cc: Tom Lane , "scott.marlowe" , + Neil Conway , + Pailloncy =?iso-8859-1?Q?Jean-G=E9rard?= , + PostgreSQL Performance +Subject: Re: slow plan for min/max +Message-ID: <20030909193428.GA15389@wolff.to> +Mail-Followup-To: Thomas Swan , Tom Lane , + "scott.marlowe" , + Neil Conway , + Pailloncy =?iso-8859-1?Q?Jean-G=E9rard?= , + PostgreSQL Performance +References: + <3303.1063056376@sss.pgh.pa.us> <3F5E24D0.4040309@idigx.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <3F5E24D0.4040309@idigx.com> +User-Agent: Mutt/1.5.4i +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/160 +X-Sequence-Number: 3526 + +On Tue, Sep 09, 2003 at 14:06:56 -0500, + Thomas Swan wrote: +> +> Would it be possible to rewrite min and max at the parser level into a +> select/subselect (clause) condition ( repeat condition ) order by +> (clause ) descending/ascending limit 1 and thereby avoiding the +> penalties of altering the default aggregate behavior? Would it yield +> anything beneficial? + +That isn't always going to be the best way to do the calculation. If there +are other aggregates or if the groups are small, doing things the normal +way (and hash aggregates in 7.4 will help) can be faster. + +From pgsql-performance-owner@postgresql.org Tue Sep 9 20:49:36 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3AAD7D1B53C + for ; + Tue, 9 Sep 2003 23:49:32 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 13860-02 + for ; + Tue, 9 Sep 2003 20:49:04 -0300 (ADT) +Received: from mail.bangjafwac.com (unknown [63.224.86.161]) + by svr1.postgresql.org (Postfix) with ESMTP id 195A8D1B500 + for ; + Tue, 9 Sep 2003 20:48:53 -0300 (ADT) +Received: from bangjafwac.com ([::ffff:63.224.86.165]) + (AUTH: PLAIN chuston, TLS: TLSv1/SSLv3,168bits,DES-CBC3-SHA) + by mail.bangjafwac.com with esmtp; Tue, 09 Sep 2003 17:45:57 -0600 +Date: Tue, 9 Sep 2003 17:49:02 -0600 +Mime-Version: 1.0 (Apple Message framework v552) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Subject: Reading data in bulk - help? +From: Chris Huston +To: pgsql-performance@postgresql.org +Content-Transfer-Encoding: 7bit +Message-Id: <305D78CA-E320-11D7-A142-000393011B1A@bangjafwac.com> +X-Mailer: Apple Mail (2.552) +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/161 +X-Sequence-Number: 3527 + +I've got an application that needs to chunk through ~2GB of data. The +data is ~7000 different sets of 300 records each. I put all of the data +into a postgres database but that doesn't look like its going to work +because of how the data lives on the disk. + +When the app runs on a 500 Mhz G4 the CPU is 30% idle... the processing +application eating about 50%, postgres taking about 10%. I don't know +how to tell for sure but it looks like postgres is blocking on disk i/o. + +For a serial scan of the postgres table (e.g. "select * from +datatable"), "iostat" reports 128K per transfer, ~140 tps and between +14 and 20 MB/s from disk0 - with postgres taking more than 90% CPU. + +If I then run a loop asking for only the 300 records at a time (e.g. +"select from datatable where group_id='123'"), iostat reports 8k per +transfer, ~200 tps, less than 1MB/s throughput and postgres taking ~10% +CPU. (There is an index defined for group_id and EXPLAIN says it's +being used.) + +So I'm guessing that postgres is jumping all over the disk and my app +is just waiting on data. Is there a way to fix this? Or should I move +to a scientific data file format like NCSA's HDF? + +I need to push new values into each of the 7000 datasets once or twice +a day and then read-process the entire data set as many times as I can +in a 12 hour period - nearly every day of the year. Currently there is +only single table but I had planned to add several others. + +Thanks, +- Chris + + +From pgsql-performance-owner@postgresql.org Tue Sep 9 21:13:31 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 77F27D1B4FD + for ; + Wed, 10 Sep 2003 00:13:30 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 14214-06 + for ; + Tue, 9 Sep 2003 21:13:01 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id 0F6D2D1B4E7 + for ; + Tue, 9 Sep 2003 21:12:58 -0300 (ADT) +Received: from [66.219.92.2] (HELO temoku) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3625468; Tue, 09 Sep 2003 17:13:28 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Chris Huston , + pgsql-performance@postgresql.org +Subject: Re: Reading data in bulk - help? +Date: Tue, 9 Sep 2003 17:11:32 -0700 +User-Agent: KMail/1.4.3 +References: <305D78CA-E320-11D7-A142-000393011B1A@bangjafwac.com> +In-Reply-To: <305D78CA-E320-11D7-A142-000393011B1A@bangjafwac.com> +MIME-Version: 1.0 +Content-Transfer-Encoding: quoted-printable +Message-Id: <200309091711.32275.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/162 +X-Sequence-Number: 3528 + +Chris, + +> I've got an application that needs to chunk through ~2GB of data. The=20 +> data is ~7000 different sets of 300 records each. I put all of the data= +=20 +> into a postgres database but that doesn't look like its going to work=20 +> because of how the data lives on the disk. + +Your problem is curable through 4 steps: + +1) adjust your postgresql.conf to appropriate levels for memory usage. + +2) if those sets of 300 are blocks in some contiguous order, then cluster t= +hem=20 +to force their physical ordering on disk to be the same order you want to= +=20 +read them in. This will require you to re-cluster whenever you change a= +=20 +significant number of records, but from the sound of it that happens in=20 +batches. + +3) Get better disks, preferrably a RAID array, or just very fast scsi if th= +e=20 +database is small. If you're budget-constrained, Linux software raid (or= +=20 +BSD raid) on IDE disks is cheap. What kind of RAID depends on what else=20 +you'll be doing with the app; RAID 5 is better for read-only access, RAID 1= ++0=20 +is better for read-write. + +4) Make sure that you aren't dumping the data to the same disk postgreSQL= +=20 +lives on! Preferably, make sure that your swap partition is on a differen= +t=20 +disk/array from postgresql. If the computing app is complex and requires= +=20 +disk reads aside from postgres data, you should make sure that it lives on= +=20 +yet another disk. Or you can simplify this with a good, really large=20 +multi-channel RAID array. + +--=20 +-Josh Berkus + Aglio Database Solutions + San Francisco + + +From pgsql-performance-owner@postgresql.org Tue Sep 9 21:22:56 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C5D8CD1B4EE + for ; + Wed, 10 Sep 2003 00:22:54 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 14592-09 + for ; + Tue, 9 Sep 2003 21:22:26 -0300 (ADT) +Received: from wight.ymogen.net (unknown [217.27.240.153]) + by svr1.postgresql.org (Postfix) with SMTP id BD970D1B4E5 + for ; + Tue, 9 Sep 2003 21:22:21 -0300 (ADT) +Received: (qmail 8596 invoked from network); 10 Sep 2003 00:22:09 -0000 +Received: from dsl-217-155-239-51.zen.co.uk (HELO finisterre) (217.155.239.51) + by wight.ymogen.net with SMTP; 10 Sep 2003 00:22:09 -0000 +From: "Matt Clark" +To: "Tom Lane" +Cc: "scott.marlowe" , + +Subject: Re: slow plan for min/max +Date: Wed, 10 Sep 2003 01:22:09 +0100 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) +In-Reply-To: <16728.1063074086@sss.pgh.pa.us> +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +Importance: Normal +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/163 +X-Sequence-Number: 3529 + +> > Know what we (OK, I) need? An explicitly non-aggregate max() and min(), +> > implemented differently, so they can be optimised. +> +> Not per se. The way I've been visualizing this is that we add to +> pg_aggregate a column named, say, aggsortop, with the definition: +...snip of cunning potentially geralisable plan... +> How do you structure the resulting query plan, if it's at all complex +> (think multiple aggregate calls...)? I'm not clear on the answers to +> any of those questions, so I'm not volunteering to try to code it up ... + +So, you're not going to code it, I'm not going to code it, I doubt anyone +else is soon. + +The issue is going to remain then, that max() and min() are implemented in a +way that is grossly counterintuitively slow for 99% of uses. It's not bad, +or wrong, just a consequence of many higher level factors. This should +therefore be very prominently flagged in the docs until there is either a +general or specific solution. + +FYI I have rewritten 4 queries today to work around this (with nice +performance benefits) as a result of this thread. Yeah, I should have +spotted the _silly_ seq scans beforehand, but if you're not looking, you +don't tend to see. Best improvement is 325msec to 0.60msec! + +I'm happy to do the doc work. + +M + + +From pgsql-performance-owner@postgresql.org Wed Sep 10 00:26:01 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 143BDD1B537 + for ; + Wed, 10 Sep 2003 03:25:54 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 57919-04 + for ; + Wed, 10 Sep 2003 00:25:43 -0300 (ADT) +Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) + by svr1.postgresql.org (Postfix) with ESMTP id 2E261D1B50A + for ; + Wed, 10 Sep 2003 00:25:42 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id h8A3PNU07656; + Tue, 9 Sep 2003 23:25:23 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200309100325.h8A3PNU07656@candle.pha.pa.us> +Subject: Re: Hardware recommendations to scale to silly load +In-Reply-To: +To: Matt Clark +Date: Tue, 9 Sep 2003 23:25:23 -0400 (EDT) +Cc: Ron Johnson , + PgSQL Performance ML +X-Mailer: ELM [version 2.4ME+ PL106 (25)] +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary=ELM1063164323-4470-1_ +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/164 +X-Sequence-Number: 3530 + +--ELM1063164323-4470-1_ +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII + +Matt Clark wrote: +> > Just a data point, but on my Dual Xeon 2.4Gig machine with a 10k SCSI +> > drive I can do 4k inserts/second if I turn fsync off. If you have a +> > battery-backed controller, you should be able to do the same. (You will +> > not need to turn fsync off --- fsync will just be fast because of the +> > disk drive RAM). +> > +> > Am I missing something? +> +> I think Ron asked this, but I will too, is that 4k inserts in +> one transaction or 4k transactions each with one insert? +> +> fsync is very much faster (as are all random writes) with the +> write-back cache, but I'd hazard a guess that it's still not +> nearly as fast as turning fsync off altogether. I'll do a test +> perhaps... + +Sorry to be replying late. Here is what I found. + +fsync on + Inserts all in one transaction 3700 inserts/second + Inserts in separate transactions 870 inserts/second + +fsync off + Inserts all in one transaction 3700 inserts/second + Inserts all in one transaction 2500 inserts/second + +ECPG test program attached. + +-- + + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +--ELM1063164323-4470-1_ +Content-Transfer-Encoding: 7bit +Content-Type: text/plain +Content-Disposition: inline; filename="/wrk/tmp/speedtest.pgc" + +/* + * Thread test program + * by Philip Yarra + */ + + +#include + +void ins1(void); + +EXEC SQL BEGIN DECLARE SECTION; +char *dbname; +int iterations = 10; +EXEC SQL END DECLARE SECTION; + +int +main(int argc, char *argv[]) +{ + + if (argc < 2 || argc > 3) + { + fprintf(stderr, "Usage: %s dbname [iterations]\n", argv[0]); + return 1; + } + dbname = argv[1]; + + if (argc == 3) + iterations = atoi(argv[2]); + if (iterations % 2 != 0) + { + fprintf(stderr, "iterations must be an even number\n"); + return 1; + } + + EXEC SQL CONNECT TO:dbname AS test0; + + /* DROP might fail */ + EXEC SQL AT test0 DROP TABLE test_thread; + EXEC SQL AT test0 COMMIT WORK; + EXEC SQL AT test0 CREATE TABLE test_thread(message TEXT); + EXEC SQL AT test0 COMMIT WORK; + EXEC SQL DISCONNECT test0; + + ins1(); + + return 0; +} + +void +ins1(void) +{ + int i; + EXEC SQL WHENEVER sqlerror sqlprint; + EXEC SQL CONNECT TO:dbname AS test1; + EXEC SQL AT test1 SET AUTOCOMMIT TO ON; + + for (i = 0; i < iterations; i++) + EXEC SQL AT test1 INSERT INTO test_thread VALUES('thread1'); +// EXEC SQL AT test1 COMMIT WORK; + + EXEC SQL DISCONNECT test1; + + printf("thread 1 : done!\n"); +} + + + +--ELM1063164323-4470-1_-- + +From pgsql-performance-owner@postgresql.org Wed Sep 10 04:37:43 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 66470D1B4E9 + for ; + Wed, 10 Sep 2003 07:37:41 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 93330-06 + for ; + Wed, 10 Sep 2003 04:37:10 -0300 (ADT) +Received: from mail.bangjafwac.com (unknown [63.224.86.161]) + by svr1.postgresql.org (Postfix) with ESMTP id 9B30AD1B4E2 + for ; + Wed, 10 Sep 2003 04:36:59 -0300 (ADT) +Received: from bangjafwac.com ([::ffff:63.224.86.165]) + (AUTH: PLAIN chuston, TLS: TLSv1/SSLv3,168bits,DES-CBC3-SHA) + by mail.bangjafwac.com with esmtp; Wed, 10 Sep 2003 01:33:59 -0600 +Date: Wed, 10 Sep 2003 01:37:02 -0600 +Subject: Re: Reading data in bulk - help? +Content-Type: text/plain; charset=US-ASCII; format=flowed +Mime-Version: 1.0 (Apple Message framework v552) +Cc: pgsql-performance@postgresql.org +To: josh@agliodbs.com +From: Chris Huston +In-Reply-To: <200309091711.32275.josh@agliodbs.com> +Message-Id: <91D7A447-E361-11D7-A142-000393011B1A@bangjafwac.com> +Content-Transfer-Encoding: 7bit +X-Mailer: Apple Mail (2.552) +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/165 +X-Sequence-Number: 3531 + +Thanks Josh that helped. I had gone looking for some kind of cluster +option but was looking under create database, create index and +initlocation - didn't see the CLUSTER index ON table. + +I ran the CLUSTER which took about 2 1/2 hours to complete. That +improved the query performance about 6x - which is great - but is still +taking 26 minutes to do what a serial read does in about 2 1/2 minutes. + +At this point I'm ok because each fetch is taking around 200 +milliseconds from call to the time the data is ready. The processing +takes 300-600ms per batch. I've got the fetch and the processing +running in separate threads so even if postgres was running faster it +wouldn't help this implementation. + +However, "iostat" is still reporting average size per transfer of about +10kB and total thru-put of about 1MB/s. The transfers per second went +from >200/s to about 80/s. It still seams like it ought to be a faster. + +The system is currently running on a single processor 500Mhz G4. We're +likely to move to a two processor 2Ghz G5 in the next few months. Then +each block may take only a 30-60 milliseconds to complete and their can +be two concurrent blocks processing at once. + +Sometime before then I need to figure out how to cut the fetch times +from the now 200ms to something like 10ms. There are currently +1,628,800 records in the single data table representing 6817 groups. +Each group has 2 to 284 records - with 79% having the max 284 (max +grows by 1 every day - although the value may change throughout the +day). Each record is maybe 1 or 2k so ideally each batch/group should +require 284-568k - at 10MB/s - that'd be + +RELATED QUESTION: How now do I speed up the following query: "select +distinct group_id from datatable"? Which results in a sequential scan +of the db. Why doesn't it use the group_id index? I only do this once +per run so it's not as critical as the fetch speed which is done 6817 +times. + +Thanks for the help! +- Chris + +On Tuesday, Sep 9, 2003, at 18:11 America/Denver, Josh Berkus wrote: + +> Chris, +> +>> I've got an application that needs to chunk through ~2GB of data. The +>> data is ~7000 different sets of 300 records each. I put all of the +>> data +>> into a postgres database but that doesn't look like its going to work +>> because of how the data lives on the disk. +> +> Your problem is curable through 4 steps: +> +> 1) adjust your postgresql.conf to appropriate levels for memory usage. +> +> 2) if those sets of 300 are blocks in some contiguous order, then +> cluster them +> to force their physical ordering on disk to be the same order you want +> to +> read them in. This will require you to re-cluster whenever you +> change a +> significant number of records, but from the sound of it that happens in +> batches. +> +> 3) Get better disks, preferrably a RAID array, or just very fast scsi +> if the +> database is small. If you're budget-constrained, Linux software +> raid (or +> BSD raid) on IDE disks is cheap. What kind of RAID depends on what +> else +> you'll be doing with the app; RAID 5 is better for read-only access, +> RAID 1+0 +> is better for read-write. +> +> 4) Make sure that you aren't dumping the data to the same disk +> postgreSQL +> lives on! Preferably, make sure that your swap partition is on a +> different +> disk/array from postgresql. If the computing app is complex and +> requires +> disk reads aside from postgres data, you should make sure that it +> lives on +> yet another disk. Or you can simplify this with a good, really large +> multi-channel RAID array. +> +> -- +> -Josh Berkus +> Aglio Database Solutions +> San Francisco +> +> +> ---------------------------(end of +> broadcast)--------------------------- +> TIP 3: 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 Wed Sep 10 04:41:22 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DCBE2D1B506 + for ; + Wed, 10 Sep 2003 07:41:17 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 92693-08 + for ; + Wed, 10 Sep 2003 04:40:48 -0300 (ADT) +Received: from loki.globexplorer.com (unknown [208.35.14.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 229D9D1B4E2 + for ; + Wed, 10 Sep 2003 04:40:42 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="Windows-1252" +Subject: Re: Hardware recommendations to scale to silly load +Content-Transfer-Encoding: quoted-printable +Date: Wed, 10 Sep 2003 00:40:45 -0700 +Message-ID: + <71E37EF6B7DCC1499CEA0316A25683280105717D@loki.wc.globexplorer.net> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Hardware recommendations to scale to silly load +Thread-Index: AcN3WOpKsf9pk+gMSKqLyixgGvHVmwAFb/Tq +From: "Gregory S. Williamson" +To: "Bruce Momjian" , + "Matt Clark" +Cc: "Ron Johnson" , + "PgSQL Performance ML" +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/166 +X-Sequence-Number: 3532 + +Nitpicking -- + +Perhaps the 4th data line is meant to be: + Inserts in separate transactions 2500 inserts/second + ^^^^^^^^^^^^^^^^^^^^^^^ +?? + + +Greg Williamson + +-----Original Message----- +From: Bruce Momjian [mailto:pgman@candle.pha.pa.us] +Sent: Tue 9/9/2003 8:25 PM +To: Matt Clark +Cc: Ron Johnson; PgSQL Performance ML +Subject: Re: [PERFORM] Hardware recommendations to scale to silly load + +Matt Clark wrote: +> > Just a data point, but on my Dual Xeon 2.4Gig machine with a 10k SCSI +> > drive I can do 4k inserts/second if I turn fsync off. If you have a +> > battery-backed controller, you should be able to do the same. (You will +> > not need to turn fsync off --- fsync will just be fast because of the +> > disk drive RAM). +> > +> > Am I missing something? +>=20 +> I think Ron asked this, but I will too, is that 4k inserts in +> one transaction or 4k transactions each with one insert? +>=20 +> fsync is very much faster (as are all random writes) with the +> write-back cache, but I'd hazard a guess that it's still not +> nearly as fast as turning fsync off altogether. I'll do a test +> perhaps... + +Sorry to be replying late. Here is what I found. + +fsync on + Inserts all in one transaction 3700 inserts/second + Inserts in separate transactions 870 inserts/second + +fsync off + Inserts all in one transaction 3700 inserts/second + Inserts all in one transaction 2500 inserts/second + +ECPG test program attached. + +-- + + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + + + + +From pgsql-performance-owner@postgresql.org Wed Sep 10 06:01:46 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 1A2F8D1B543 + for ; + Wed, 10 Sep 2003 09:01:45 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 13003-03 + for ; + Wed, 10 Sep 2003 06:01:36 -0300 (ADT) +Received: from zigo.dhs.org (as2-4-3.an.g.bonet.se [194.236.34.191]) + by svr1.postgresql.org (Postfix) with ESMTP id E151BD1B533 + for ; + Wed, 10 Sep 2003 06:01:31 -0300 (ADT) +Received: from zigo.dhs.org (zigo [127.0.0.1]) + by zigo.dhs.org (8.12.8/8.12.8) with ESMTP id h8A91A3b015086; + Wed, 10 Sep 2003 11:01:10 +0200 +Received: from localhost (db@localhost) + by zigo.dhs.org (8.12.8/8.12.8/Submit) with ESMTP id h8A917I8015082; + Wed, 10 Sep 2003 11:01:07 +0200 +Date: Wed, 10 Sep 2003 11:01:07 +0200 (CEST) +From: Dennis Bjorklund +To: Chris Huston +Cc: josh@agliodbs.com, +Subject: Re: Reading data in bulk - help? +In-Reply-To: <91D7A447-E361-11D7-A142-000393011B1A@bangjafwac.com> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/167 +X-Sequence-Number: 3533 + +On Wed, 10 Sep 2003, Chris Huston wrote: + +> Sometime before then I need to figure out how to cut the fetch times +> from the now 200ms to something like 10ms. + +You didn't say anything about Joshs first point of adjusting +postgresql.conf to match your machine. Settings like effective_cache_size +you almost always want to increase from the default setting, also shared +memory. + +-- +/Dennis + + +From pgsql-performance-owner@postgresql.org Wed Sep 10 07:22:33 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 08515D1B542 + for ; + Wed, 10 Sep 2003 10:22:32 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 31677-01 + for ; + Wed, 10 Sep 2003 07:22:02 -0300 (ADT) +Received: from ns1.bee.lt (ns.bi.lt [213.226.131.131]) + by svr1.postgresql.org (Postfix) with ESMTP id AA1CED1B53B + for ; + Wed, 10 Sep 2003 07:21:58 -0300 (ADT) +Received: from B027543 (inet.bee.lt [213.226.131.30]) + by ns1.bee.lt (8.11.6/8.11.6) with SMTP id h8AAM0i25060 + for ; Wed, 10 Sep 2003 13:22:00 +0300 +Message-ID: <053a01c37785$5f89d4d0$f20214ac@bite.lt> +From: "Mindaugas Riauba" +To: +References: <00be01c376cf$91510620$f20214ac@bite.lt> + <200309091414.23458.dev@archonet.com> + <00dc01c376d6$f9f99c30$f20214ac@bite.lt> + <21262.1063118448@sss.pgh.pa.us> +Subject: Re: Need advice about triggers +Date: Wed, 10 Sep 2003 13:21:55 +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.1158 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/168 +X-Sequence-Number: 3534 + + +> >> Well, try it without the trigger. If performance improves markedly, it +> >> might be worth rewriting in C. +> +> > Nope. Execution time is practically the same without trigger. +> +> >> If not, you're probably saturating the disk I/O - +> +> > Bottleneck in this case is CPU. postmaster process uses almost 100% of +> > CPU. +> +> That seems very odd. Updates should be I/O intensive, not CPU +> intensive. I wouldn't have been surprised to hear of a plpgsql trigger +> consuming lots of CPU, but without it, I'm not sure where the time is +> going. Can you show us an EXPLAIN ANALYZE result for a typical update +> command? + + Two EXPLAIN ANALYZE below. One is before another is after REINDEX. It +seems +that REINDEX before updates helps. Time went down to ~17s. Also CPU is not +at +100%. vmstat output is below (machine is 2xCPU so 40% load means 80% on one +CPU). + + So the solution would be REINDEX before updates and VACUUM at the same +time? +Without REINDEX performance slowly degrades. + + Mindaugas + + +router_db=# explain analyze update ifdata set ifspeed=256000, +ifreason='12121', iflastupdate=CURRENT_TIMESTAMP WHERE clientid='#0003904#'; + QUERY PLAN +---------------------------------------------------------------------------- +------------------------------------------------ + Index Scan using ifdata_clientid_key on ifdata (cost=0.00..5.64 rows=1 +width=116) (actual time=0.17..0.36 rows=1 loops=1) + Index Cond: (clientid = '#0003904#'::character varying) + Total runtime: 1.70 msec +(3 rows) + +router_db=# reindex table ifdata; +REINDEX +router_db=# explain analyze update ifdata set ifspeed=256000, +ifreason='12121', iflastupdate=CURRENT_TIMESTAMP WHERE clientid='#0003904#'; + QUERY PLAN +---------------------------------------------------------------------------- +------------------------------------------------ + Index Scan using ifdata_clientid_key on ifdata (cost=0.00..5.65 rows=1 +width=116) (actual time=0.06..0.07 rows=1 loops=1) + Index Cond: (clientid = '#0003904#'::character varying) + Total runtime: 0.47 msec +(3 rows) + +---------------------------------------------------------------------------- +--- + + procs memory swap io system +cpu + r b w swpd free buff cache si so bi bo in cs us sy +id + 0 0 0 5048 20616 273556 1614692 0 0 4 3 2 0 0 1 +3 + 0 0 0 5048 20612 273556 1614692 0 0 0 0 109 8 0 0 +100 + 0 0 0 5048 20612 273556 1614692 0 0 0 168 144 20 0 0 +100 + 1 0 0 5048 19420 273556 1614612 0 0 0 192 123 4120 35 2 +63 + 0 1 1 5048 19420 273572 1614652 0 0 0 672 144 4139 32 2 +66 + 1 0 0 5048 19420 273580 1614660 0 0 0 360 125 4279 33 12 +55 + 1 0 0 5048 19420 273580 1614724 0 0 0 272 119 5887 41 2 +57 + 1 0 0 5048 19420 273580 1614716 0 0 0 488 124 4871 40 1 +59 + + +From pgsql-performance-owner@postgresql.org Wed Sep 10 08:47:56 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 66EE6D1B538 + for ; + Wed, 10 Sep 2003 11:47:53 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 30471-10 + for ; + Wed, 10 Sep 2003 08:47:24 -0300 (ADT) +Received: from mail2.fbab.net (spectre.fbab.net [195.54.134.139]) + by svr1.postgresql.org (Postfix) with SMTP id B01F7D1B52B + for ; + Wed, 10 Sep 2003 08:47:20 -0300 (ADT) +Received: (qmail 25383 invoked by uid 136); 10 Sep 2003 11:47:22 -0000 +Received: from mag@fbab.net by mail2.fbab.net by uid 133 with + qmail-scanner-1.20rc1 (avp: 4.0.3.0. Clear:RC:1:. + Processed in 0.061223 secs); 10 Sep 2003 11:47:22 -0000 +Received: from unknown (HELO mail2.fbab.net) (195.54.134.228) + by mail2.fbab.net with SMTP; 10 Sep 2003 11:47:22 -0000 +Received: from 129.178.88.66 (SquirrelMail authenticated user magimap1) + by mail2.fbab.net with HTTP; Wed, 10 Sep 2003 13:47:22 +0200 (CEST) +Message-ID: <51478.129.178.88.66.1063194442.squirrel@mail2.fbab.net> +In-Reply-To: <91D7A447-E361-11D7-A142-000393011B1A@bangjafwac.com> +References: <200309091711.32275.josh@agliodbs.com> + <91D7A447-E361-11D7-A142-000393011B1A@bangjafwac.com> +Date: Wed, 10 Sep 2003 13:47:22 +0200 (CEST) +Subject: Re: Reading data in bulk - help? +From: "Magnus Naeslund(w)" +To: "Chris Huston" +Cc: josh@agliodbs.com, pgsql-performance@postgresql.org +Reply-To: mag@fbab.net +User-Agent: SquirrelMail/1.4.1 +MIME-Version: 1.0 +Content-Type: text/plain;charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Priority: 3 +Importance: Normal +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/169 +X-Sequence-Number: 3535 + +Chris Huston said: +> Thanks Josh that helped. I had gone looking for some kind of cluster +> option but was looking under create database, create index and +> initlocation - didn't see the CLUSTER index ON table. +> +> I ran the CLUSTER which took about 2 1/2 hours to complete. That +> improved the query performance about 6x - which is great - but is still +> taking 26 minutes to do what a serial read does in about 2 1/2 minutes. +> +> At this point I'm ok because each fetch is taking around 200 +> milliseconds from call to the time the data is ready. The processing +> takes 300-600ms per batch. I've got the fetch and the processing +> running in separate threads so even if postgres was running faster it +> wouldn't help this implementation. +> +> However, "iostat" is still reporting average size per transfer of about +> 10kB and total thru-put of about 1MB/s. The transfers per second went +> from >200/s to about 80/s. It still seams like it ought to be a faster. +> +> The system is currently running on a single processor 500Mhz G4. We're +> likely to move to a two processor 2Ghz G5 in the next few months. Then +> each block may take only a 30-60 milliseconds to complete and their can +> be two concurrent blocks processing at once. +> +> Sometime before then I need to figure out how to cut the fetch times +> from the now 200ms to something like 10ms. There are currently +> 1,628,800 records in the single data table representing 6817 groups. +> Each group has 2 to 284 records - with 79% having the max 284 (max +> grows by 1 every day - although the value may change throughout the +> day). Each record is maybe 1 or 2k so ideally each batch/group should +> require 284-568k - at 10MB/s - that'd be +> +> RELATED QUESTION: How now do I speed up the following query: "select +> distinct group_id from datatable"? Which results in a sequential scan +> of the db. Why doesn't it use the group_id index? I only do this once +> per run so it's not as critical as the fetch speed which is done 6817 +> times. +> +> Thanks for the help! +> - Chris +> + +How are you fetching the data? +If you are using cursors, be sure to fetch a substatial bit at a time so +that youre not punished by latency. +I got a big speedup when i changed my original clueless code to fetch 64 +rows in a go instead of only one. + +Magnus + + + +From pgsql-performance-owner@postgresql.org Wed Sep 10 13:42:31 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 6C050D1B545 + for ; + Wed, 10 Sep 2003 16:42:25 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 27763-04 + for ; + Wed, 10 Sep 2003 13:41:53 -0300 (ADT) +Received: from fuji.krosing.net (silmet.estpak.ee [194.126.97.78]) + by svr1.postgresql.org (Postfix) with ESMTP id CD4D0D1BB46 + for ; + Wed, 10 Sep 2003 12:05:48 -0300 (ADT) +Received: from fuji.krosing.net (localhost.localdomain [127.0.0.1]) + by fuji.krosing.net (8.12.8/8.12.8) with ESMTP id h8AF5ej9003860; + Wed, 10 Sep 2003 18:05:40 +0300 +Received: (from hannu@localhost) + by fuji.krosing.net (8.12.8/8.12.8/Submit) id h8AF5ZrX003858; + Wed, 10 Sep 2003 18:05:35 +0300 +X-Authentication-Warning: fuji.krosing.net: hannu set sender to hannu@tm.ee + using -f +Subject: Re: Need advice about triggers +From: Hannu Krosing +To: Mindaugas Riauba +Cc: pgsql-performance@postgresql.org +In-Reply-To: <053a01c37785$5f89d4d0$f20214ac@bite.lt> +References: <00be01c376cf$91510620$f20214ac@bite.lt> + <200309091414.23458.dev@archonet.com> + <00dc01c376d6$f9f99c30$f20214ac@bite.lt> + <21262.1063118448@sss.pgh.pa.us> + <053a01c37785$5f89d4d0$f20214ac@bite.lt> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1063206334.3356.12.camel@fuji.krosing.net> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Wed, 10 Sep 2003 18:05:35 +0300 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/171 +X-Sequence-Number: 3537 + +Mindaugas Riauba kirjutas K, 10.09.2003 kell 13:21: + +> +> router_db=# explain analyze update ifdata set ifspeed=256000, +> ifreason='12121', iflastupdate=CURRENT_TIMESTAMP WHERE clientid='#0003904#'; +> QUERY PLAN +> ---------------------------------------------------------------------------- +> ------------------------------------------------ +> Index Scan using ifdata_clientid_key on ifdata (cost=0.00..5.64 rows=1 +> width=116) (actual time=0.17..0.36 rows=1 loops=1) +> Index Cond: (clientid = '#0003904#'::character varying) +> Total runtime: 1.70 msec +> (3 rows) + +could you try the same query on similar table, where clientid is int4 ? + +is it faster ? + +does the performance degrade at a slower rate? + +--------------- +Hannu + + +From pgsql-performance-owner@postgresql.org Wed Sep 10 13:08:08 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 77D94D1B501 + for ; + Wed, 10 Sep 2003 16:08:04 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 05555-10 + for ; + Wed, 10 Sep 2003 13:07:54 -0300 (ADT) +Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) + by svr1.postgresql.org (Postfix) with ESMTP id 7DE82D1B506 + for ; + Wed, 10 Sep 2003 13:07:52 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id h8AG6qR04095; + Wed, 10 Sep 2003 12:06:52 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200309101606.h8AG6qR04095@candle.pha.pa.us> +Subject: Re: Hardware recommendations to scale to silly load +In-Reply-To: + <71E37EF6B7DCC1499CEA0316A25683280105717D@loki.wc.globexplorer.net> +To: "Gregory S. Williamson" +Date: Wed, 10 Sep 2003 12:06:52 -0400 (EDT) +Cc: Matt Clark , Ron Johnson , + PgSQL Performance ML +X-Mailer: ELM [version 2.4ME+ PL106 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/170 +X-Sequence-Number: 3536 + +Gregory S. Williamson wrote: +> Nitpicking -- +> +> Perhaps the 4th data line is meant to be: +> Inserts in separate transactions 2500 inserts/second +> ^^^^^^^^^^^^^^^^^^^^^^^ + + +Oh, yes, sorry. It is: + +> Sorry to be replying late. Here is what I found. +> +> fsync on +> Inserts all in one transaction 3700 inserts/second +> Inserts in separate transactions 870 inserts/second +> +> fsync off +> Inserts all in one transaction 3700 inserts/second +> Inserts in separate transactions 2500 inserts/second + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Wed Sep 10 14:17:14 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 8A239D1B4F6 + for ; + Wed, 10 Sep 2003 17:17:03 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 37505-03 + for ; + Wed, 10 Sep 2003 14:16:33 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id B59C7D1B4E3 + for ; + Wed, 10 Sep 2003 14:16:31 -0300 (ADT) +Received: from [63.195.55.98] (HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3627535; Wed, 10 Sep 2003 10:17:00 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Organization: Aglio Database Solutions +To: Chris Huston +Subject: Re: Reading data in bulk - help? +Date: Wed, 10 Sep 2003 10:16:14 -0700 +User-Agent: KMail/1.4.3 +Cc: pgsql-performance@postgresql.org +References: <91D7A447-E361-11D7-A142-000393011B1A@bangjafwac.com> +In-Reply-To: <91D7A447-E361-11D7-A142-000393011B1A@bangjafwac.com> +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-Id: <200309101016.14652.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/172 +X-Sequence-Number: 3538 + +Chris, + +> The system is currently running on a single processor 500Mhz G4. We're +> likely to move to a two processor 2Ghz G5 in the next few months. Then +> each block may take only a 30-60 milliseconds to complete and their can +> be two concurrent blocks processing at once. + +What about explaining your disk setup? Or mentioning postgresql.conf? For +somebody who wants help, you're ignoring a lot of advice and questions. + +Personally, I'm not going to be of any further help until you report back on +the other 3 of 4 options. + +> RELATED QUESTION: How now do I speed up the following query: "select +> distinct group_id from datatable"? Which results in a sequential scan +> of the db. Why doesn't it use the group_id index? I only do this once +> per run so it's not as critical as the fetch speed which is done 6817 +> times. + +Because it can't until PostgreSQL 7.4, which has hash aggregates. Up to +7.3, we have to use seq scans for all group bys. I'd suggest that you keep a +table of group_ids, instead. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Wed Sep 10 14:56:10 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3FE35D1B4F6 + for ; + Wed, 10 Sep 2003 17:56:09 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 38287-10 + for ; + Wed, 10 Sep 2003 14:55:39 -0300 (ADT) +Received: from mx1.neteconomist.com (mx1.neteconomist.com [65.122.18.6]) + by svr1.postgresql.org (Postfix) with ESMTP id 06E5FD1B501 + for ; + Wed, 10 Sep 2003 14:55:38 -0300 (ADT) +Received: from mx1.neteconomist.com (localhost.localdomain [127.0.0.1]) + by mx1.neteconomist.com (8.12.8/8.12.8) with ESMTP id h8AHrfWg009712 + for ; Wed, 10 Sep 2003 13:53:41 -0400 +Received: (from aturner@localhost) + by mx1.neteconomist.com (8.12.8/8.12.8/Submit) id h8AHreUn009709 + for pgsql-performance@postgresql.org; Wed, 10 Sep 2003 13:53:40 -0400 +Date: Wed, 10 Sep 2003 13:53:40 -0400 +From: aturner@neteconomist.com +To: pgsql-performance@postgresql.org +Subject: Upgrade Woes +Message-ID: <20030910175340.GC5506@neteconomist.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/173 +X-Sequence-Number: 3539 + +Hi, + +My name is Alex Turner and I work for a small Tech company in Pottstown PA. We run Postgresql on a number of systems for a variety of different applications, and it has been a joy to deal with all around, working fast and reliably for over 2 years. + +We recently upgraded from RedHat 7.2 to RedHat 9.0, and we are running Postgres 7.3.2 on our Proliant ML370 (Raid 1 2x18 10k, and Raid 5 3x36 10k, 2x866 PIII, 2GB RAM). + +We seem to have had a serious drop after the upgrade. The database is a database of properties that is updated on a daily basis, and when I say updated I mean that I insert/update the whole data download because the data provider doesn't tell us what changed, just gives us a complete dump. The integrity of the dumb isn't great so I can't process as a COPY or a block transaction because some of the data is often bad. Each and every row is a seperate insert or update. +Data insert performance used to degrade in a linear fasion as time progressed I'm guessing as the transaction logs filled up. About once every six weeks I would dump the database, destroy and recreate the db and reload the dump. This 'reset' the whole thing, and brought insert/vacuum times back down. Since the upgrade, performance has degraded very rapidly over the first week, and then more slowly later, but enough that we now have to reload the db every 2-3 weeks. The insert procedure triggers a stored procedure that updates a timestamp on the record so that we can figure out what records have been touched, and which have not so that we can determine which properties have been removed from the feed as the record was not touched in the last two days. + +I have noticed that whilst inserts seem to be slower than before, the vacuum full doesn't seem to take as long overall. + +postgresql.conf is pretty virgin, and we run postmaster with -B512 -N256 -i. /var/lib/pgsql/data is a symlink to /eda/data, /eda being the mount point for the Raid 5 array. + +the database isn't huge, storing about 30000 properties, and the largest table is 2.1 Million rows for property features. The dump file is only 221MB. Alas, I did not design the schema, but I have made several 'tweaks' to it to greatly improve read performance allowing us to be the fastest provider in the Tristate area. Unfortunately the Job starts at 01:05 (thats the earliest the dump is available) and runs until completion finishing with a vacuum full. The vacuum full locks areas of the database long enough that our service is temporarily down. At the worst point, the vacuum full was starting after 09:00, which our customers didn't appreciate. + +I'm wondering if there is anything I can do with postgres to allieviate this problem. Either upgrading to 7.3.4 (although I tried 7.3.3 for another app, and we had to roll back to 7.3.2 because of performance problems), or working with the postgresql.conf to enhance performance. I really don't want to roll back the OS version if possible, but I'm not ruling it out at this point, as that seems to be the biggest thing that has changed. All the drive lights are showing green, so I don't believe the array is running in degraded mode. I keep logs of all the insert jobs, and plotting average insert times on a graph revealed that this started at the time of the upgrade. + +Any help/suggestions would be grealy appreciated, + +Thanks, + +Alex Turner +NetEconomist + +P.S. Sorry this is so long, but I wanted to include as much info as possible. + +From pgsql-performance-owner@postgresql.org Wed Sep 10 16:38:13 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A2B11D1B4FE + for ; + Wed, 10 Sep 2003 19:38:10 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 61261-05 + for ; + Wed, 10 Sep 2003 16:38:01 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 05919D1B4E3 + for ; + Wed, 10 Sep 2003 16:38:00 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h8AJbxsl024711 + for ; Wed, 10 Sep 2003 19:37:59 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h8AJA0WG016559 + for pgsql-performance@postgresql.org; Wed, 10 Sep 2003 19:10:00 GMT +From: Christopher Browne +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: Upgrade Woes +Date: Wed, 10 Sep 2003 14:25:19 -0400 +Organization: Hub.Org Networking Services +Lines: 35 +Message-ID: <60he3kzek0.fsf@dev6.int.libertyrms.info> +References: <20030910175340.GC5506@neteconomist.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@news.hub.org +User-Agent: Gnus/5.1003 (Gnus v5.10.3) XEmacs/21.4 (Rational FORTRAN, linux) +Cancel-Lock: sha1:fTCvURWh4L9JEAcB++ciMSsqexE= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/175 +X-Sequence-Number: 3541 + +aturner@neteconomist.com writes: +> P.S. Sorry this is so long, but I wanted to include as much info as possible. + +Throw in the non-commented lines in postgresql.conf; that would more +than likely make numeric answers possible, for some of it. If the +config is "out-of-the-box," then it's pretty likely that some +significant improvements can be gotten from modifying a few of the +config parameters. Increasing buffers would probably help query +speed, and if you're getting too many dead tuples, increasing the free +space map would make it possible for more to vacuum out. + +Beyond that, you might want to grab the code for pg_autovacuum, and +drop that into place, as that would do periodic ANALYZEs that would +probably improve the quality of your selects somewhat. (It's in the +7.4 code "contrib" base, but works fine with 7.3.) + +I think you might also get some significant improvements out of +changing the way you load the properties. If you set up a schema that +is suitably "permissive," and write a script that massages it a +little, COPY should do the trick to load the data in, which should be +helpful to the load process. If the data comes in a little more +intelligently (which might well involve some parts of the process +"dumbing down" :-)), you might take advantage of COPY and perhaps +other things (we see through the glass darkly). + +I would think it also begs the question of whether or not you _truly_ +need the "vacuum full." Are you _certain_ you need that? I would +think it likely that running "vacuum analyze" (and perhaps doing it a +little bit, continuously, during the load, via pg_autovacuum) would +likely suffice. Have you special reason to think otherwise? +-- +output = ("cbbrowne" "@" "libertyrms.info") + +Christopher Browne +(416) 646 3304 x124 (land) + +From pgsql-performance-owner@postgresql.org Wed Sep 10 15:32:28 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E374AD1B4E5 + for ; + Wed, 10 Sep 2003 18:32:26 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 50643-02 + for ; + Wed, 10 Sep 2003 15:31:57 -0300 (ADT) +Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net + [194.217.242.85]) + by svr1.postgresql.org (Postfix) with ESMTP id A1CF1D1B4E8 + for ; + Wed, 10 Sep 2003 15:31:55 -0300 (ADT) +Received: from mwynhau.demon.co.uk ([193.237.186.96] + helo=mainbox.archonet.com) + by anchor-post-35.mail.demon.net with esmtp (Exim 3.35 #1) + id 19x9kx-000N7V-0Z; Wed, 10 Sep 2003 19:31:55 +0100 +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mainbox.archonet.com (Postfix) with ESMTP + id BAA2A16375; Wed, 10 Sep 2003 19:31:54 +0100 (BST) +Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP + id 292841596B; Wed, 10 Sep 2003 19:31:54 +0100 (BST) +From: Richard Huxton +To: aturner@neteconomist.com, pgsql-performance@postgresql.org +Subject: Re: Upgrade Woes +Date: Wed, 10 Sep 2003 19:31:53 +0100 +User-Agent: KMail/1.5 +References: <20030910175340.GC5506@neteconomist.com> +In-Reply-To: <20030910175340.GC5506@neteconomist.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200309101931.53746.dev@archonet.com> +X-Virus-Scanned: by AMaViS snapshot-20020531 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/174 +X-Sequence-Number: 3540 + +On Wednesday 10 September 2003 18:53, aturner@neteconomist.com wrote: +> Hi, +> +> My name is Alex Turner and I work for a small Tech company in Pottstown PA. +> We run Postgresql on a number of systems for a variety of different +> applications, and it has been a joy to deal with all around, working fast +> and reliably for over 2 years. +> +> We recently upgraded from RedHat 7.2 to RedHat 9.0, and we are running +> Postgres 7.3.2 on our Proliant ML370 (Raid 1 2x18 10k, and Raid 5 3x36 10k, +> 2x866 PIII, 2GB RAM). +[snip] +> I have noticed that whilst inserts seem to be slower than before, the +> vacuum full doesn't seem to take as long overall. +> +> postgresql.conf is pretty virgin, and we run postmaster with -B512 -N256 +> -i. /var/lib/pgsql/data is a symlink to /eda/data, /eda being the mount +> point for the Raid 5 array. + +First things first then, go to: +http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php +and read the item on Performance Tuning and the commented postgresql.conf + +> the database isn't huge, storing about 30000 properties, and the largest +> table is 2.1 Million rows for property features. The dump file is only +> 221MB. Alas, I did not design the schema, but I have made several 'tweaks' +> to it to greatly improve read performance allowing us to be the fastest +> provider in the Tristate area. Unfortunately the Job starts at 01:05 +> (thats the earliest the dump is available) and runs until completion +> finishing with a vacuum full. The vacuum full locks areas of the database +> long enough that our service is temporarily down. At the worst point, the +> vacuum full was starting after 09:00, which our customers didn't +> appreciate. + +You might be able to avoid a vacuum full by tweaking the *fsm* settings to be +able to cope with activity. + +> I'm wondering if there is anything I can do with postgres to allieviate +> this problem. Either upgrading to 7.3.4 (although I tried 7.3.3 for +> another app, and we had to roll back to 7.3.2 because of performance +> problems), + +Hmm - can't think what would have changed radically between 7.3.2 and 7.3.3, +upgrading to .4 is probably sensible. + +[snip] +> Any help/suggestions would be grealy appreciated, + +You say that each insert/update is a separate transaction. I don't know how +much "bad" data you get in the dump, but you might be able to do something +like: + +1. Set batch size to 128 items +2. Read batch-size rows from the dump +3. Try to insert/update the batch. If it works, move along by the size of the +batch and back to #1 +4. If batch-size=1, record error, move along one row and back to #1 +5. If batch-size>1, halve batch-size and go back to #3 + +Your initial batch-size will depend on how many errors there are (but +obviously use a power of 2). + +You could also run an ordinary vacuum every 1000 rows or so (number depends on +your *fsm* settings as mentioned above). + +You might also want to try a REINDEX once a night/week too. +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Wed Sep 10 16:45:15 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 89298D1B52B + for ; + Wed, 10 Sep 2003 19:45:13 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 61023-03 + for ; + Wed, 10 Sep 2003 16:45:03 -0300 (ADT) +Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) + by svr1.postgresql.org (Postfix) with ESMTP id B9AFFD1B522 + for ; + Wed, 10 Sep 2003 16:45:00 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id h8AJiod26547; + Wed, 10 Sep 2003 15:44:50 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200309101944.h8AJiod26547@candle.pha.pa.us> +Subject: Re: [GENERAL] how to get accurate values in pg_statistic (continued) +In-Reply-To: <11537.1062717375@sss.pgh.pa.us> +To: Tom Lane +Date: Wed, 10 Sep 2003 15:44:50 -0400 (EDT) +Cc: Mary Edie Meredith , + pgsql-performance , + osdldbt-general +X-Mailer: ELM [version 2.4ME+ PL106 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/176 +X-Sequence-Number: 3542 + +Tom Lane wrote: +> Mary Edie Meredith writes: +> > Stephan Szabo kindly responded to our earlier queries suggesting we look +> > at default_statistics_target and ALTER TABLE ALTER COLUMN SET +> > STATISTICS. +> +> > These determine the number of bins in the histogram for a given column. +> > But for a large number of rows (for example 6 million) the maximum value +> > (1000) does not guarantee that ANALYZE will do a full scan of the table. +> > We do not see a way to guarantee the same statistics run to run without +> > forcing ANALYZE to examine every row of every table. +> +> Do you actually still have a problem with the plans changing when the +> stats target is above 100 or so? I think the notion of "force ANALYZE +> to do a full scan" is inherently wrongheaded ... it certainly would not +> produce numbers that have anything to do with ordinary practice. +> +> If you have data statistics that are so bizarre that the planner still +> gets things wrong with a target of 1000, then I'd like to know more +> about why. + +Has there been any progress in determining if the number of default +buckets (10) is the best value? + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Wed Sep 10 17:16:11 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 474F0D1B538 + for ; + Wed, 10 Sep 2003 20:16:01 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 64200-04 + for ; + Wed, 10 Sep 2003 17:15:52 -0300 (ADT) +Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) + by svr1.postgresql.org (Postfix) with ESMTP id A875ED1B533 + for ; + Wed, 10 Sep 2003 17:15:48 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id h8AKF1Q10151; + Wed, 10 Sep 2003 16:15:01 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200309102015.h8AKF1Q10151@candle.pha.pa.us> +Subject: Re: Query too slow +In-Reply-To: <200309050434.h854Y7c03834@candle.pha.pa.us> +To: Bruce Momjian +Date: Wed, 10 Sep 2003 16:15:01 -0400 (EDT) +Cc: Tom Lane , + Stephan Szabo , + Ang Chin Han , + Rhaoni Chiu Pereira , + PostgreSQL Performance +X-Mailer: ELM [version 2.4ME+ PL106 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/177 +X-Sequence-Number: 3543 + +Bruce Momjian wrote: +> Tom Lane wrote: +> > Stephan Szabo writes: +> > > On Tue, 26 Aug 2003, Ang Chin Han wrote: +> > >> Veering aside a bit, since we usually pinpoint performance problems by +> > >> looking at EXPLAIN ANALYZE's differences between the planner's +> > >> estimation and actual execution's stats, what's involved in parsing the +> > >> EXPLAIN ANALYZE results, and highlighting the places where they are way +> > >> different? Bold, underline, or put some asterisks in front of those steps. +> > +> > > The hardest part is determining where it matters I think. You can use the +> > > row counts as the base for that, but going from 1 row to 50 is not +> > > necessarily going to be an issue, but it might be if a nested loop is +> > > chosen. +> > +> > We've been chatting about this idea among the Red Hat group. The RHDB +> > Visual Explain tool (get it at http://sources.redhat.com/rhdb/) already +> > computes the percent of total runtime represented by each plan node. +> > It seems like we could highlight nodes based on a large difference +> > between estimated and actual percentage, or just highlight the nodes +> > that are more than X percent of the runtime. +> +> Is there a TODO here? Perhaps: +> +> o Have EXPLAIN ANALYZE highlight poor optimizer estimates + +No one commented, so I had to guess --- I added it. + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Wed Sep 10 18:00:28 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 48970D1B4FC + for ; + Wed, 10 Sep 2003 21:00:27 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 73764-03 + for ; + Wed, 10 Sep 2003 17:59:57 -0300 (ADT) +Received: from mail.bangjafwac.com (unknown [63.224.86.161]) + by svr1.postgresql.org (Postfix) with ESMTP id 3B469D1B536 + for ; + Wed, 10 Sep 2003 17:59:47 -0300 (ADT) +Received: from bangjafwac.com ([::ffff:63.224.86.165]) + (AUTH: PLAIN chuston, TLS: TLSv1/SSLv3,168bits,DES-CBC3-SHA) + by mail.bangjafwac.com with esmtp; Wed, 10 Sep 2003 14:56:45 -0600 +Date: Wed, 10 Sep 2003 14:59:50 -0600 +Subject: Re: Reading data in bulk - help? +Content-Type: text/plain; charset=US-ASCII; format=flowed +Mime-Version: 1.0 (Apple Message framework v552) +From: Chris Huston +To: pgsql-performance@postgresql.org +Content-Transfer-Encoding: 7bit +In-Reply-To: <51478.129.178.88.66.1063194442.squirrel@mail2.fbab.net> +Message-Id: +X-Mailer: Apple Mail (2.552) +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/178 +X-Sequence-Number: 3544 + + +On Wednesday, Sep 10, 2003, at 11:16 America/Denver, Josh Berkus wrote: + +> What about explaining your disk setup? Or mentioning +> postgresql.conf? For +> somebody who wants help, you're ignoring a lot of advice and questions. +> +> Personally, I'm not going to be of any further help until you report +> back on +> the other 3 of 4 options. + +EEEK! Peace. Sorry I didn't include that info in the response. + +1) Memory - clumsily adjusted shared_buffer - tried three values: 64, +128, 256 with no discernible change in performance. Also adjusted, +clumsily, effective_cache_size to 1000, 2000, 4000 - with no +discernible change in performance. I looked at the Admin manual and +googled around for how to set these values and I confess I'm clueless +here. I have no idea how many kernel disk page buffers are used nor do +I understand what the "shared memory buffers" are used for (although +the postgresql.conf file hints that it's for communication between +multiple connections). Any advice or pointers to articles/docs is +appreciated. + +2) Clustering - tried it - definite improvement - thanks for the tip + +3) RAID - haven't tried it - but I'm guessing that the speed +improvement from a RAID 5 may be on the order of 10x - which I can +likely get from using something like HDF. Since the data is unlikely to +grow beyond 10-20gig, a fast drive and firewire ought to give me the +performance I need. I know experimentally that the current machine can +sustain a 20MB/s transfer rate which is 20-30x the speed of these +queries. (If there's any concern about my enthusiasm for postgres - no +worries - I've been very happy with it on several projects - it might +not be the right tool for this kind of job - but I haven't come to that +conclusion yet.) + +4) I'd previously commented out the output/writing steps from the app - +to isolate read performance. + +On Wednesday, Sep 10, 2003, at 05:47 America/Denver, Magnus Naeslund(w) +wrote: +> +> How are you fetching the data? +> If you are using cursors, be sure to fetch a substatial bit at a time +> so +> that youre not punished by latency. +> I got a big speedup when i changed my original clueless code to fetch +> 64 +> rows in a go instead of only one. +That's an excellent question... I hadn't thought about it. I'm using a +JDBC connection... I have no idea (yet) how the results are moving +between postgres and the client app. I'm testing once with the app and +the DB on the same machine (to remove network latency) and once with +db/app on separate machines. However, I wonder if postgres is blocking +on network io (even if it's the loopback interface) and not on disk?! + +I'll definitely look into it. Maybe I'll try a loop in psql and see +what the performance looks like. Thanks Magnus. + +On Wednesday, Sep 10, 2003, at 07:05 America/Denver, Sean McCorkle +wrote: + +> I ended up solving the problem by going "retro" and using the +> quasi-database functions of unix and flat files: grep, sort, +> uniq and awk. +That's an cool KISS approach. If I end up moving out of postgres I'll +speed test this approach against HDF. Thanks. + + +This is a very helpful list, +- Chris + + +From pgsql-performance-owner@postgresql.org Wed Sep 10 19:38:14 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 9BC2CD1B55E + for ; + Wed, 10 Sep 2003 22:38:12 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 82442-06 + for ; + Wed, 10 Sep 2003 19:38:03 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 9E2C7D1B563 + for ; + Wed, 10 Sep 2003 19:38:00 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h8AMbxsl070634 + for ; Wed, 10 Sep 2003 22:37:59 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h8AM8iKo064676 + for pgsql-performance@postgresql.org; Wed, 10 Sep 2003 22:08:44 GMT +From: William Yu +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: Reading data in bulk - help? +Date: Wed, 10 Sep 2003 15:08:48 -0700 +Organization: Hub.Org Networking Services +Lines: 20 +Message-ID: +References: <51478.129.178.88.66.1063194442.squirrel@mail2.fbab.net> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@news.hub.org +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; + rv:1.4) Gecko/20030624 +X-Accept-Language: en-us, en +In-Reply-To: +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/179 +X-Sequence-Number: 3545 + +> 1) Memory - clumsily adjusted shared_buffer - tried three values: 64, +> 128, 256 with no discernible change in performance. Also adjusted, +> clumsily, effective_cache_size to 1000, 2000, 4000 - with no discernible +> change in performance. I looked at the Admin manual and googled around +> for how to set these values and I confess I'm clueless here. I have no +> idea how many kernel disk page buffers are used nor do I understand what +> the "shared memory buffers" are used for (although the postgresql.conf +> file hints that it's for communication between multiple connections). +> Any advice or pointers to articles/docs is appreciated. + +The standard procedure is 1/4 of your memory for shared_buffers. Easiest +way to calculate would be ###MB / 32 * 1000. E.g. if you have 256MB of +memory, your shared_buffers should be 256 / 32 * 1000 = 8000. + +The remaining memory you have leftover should be "marked" as OS cache +via the effective_cache_size setting. I usually just multiply the +shared_buffers value by 3 on systems with a lot of memory. With less +memory, OS/Postgres/etc takes up a larger percentage of memory so values +of 2 or 2.5 would be more accurate. + + +From pgsql-performance-owner@postgresql.org Wed Sep 10 20:38:16 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 329B0D1B51A + for ; + Wed, 10 Sep 2003 23:38:11 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 92953-08 + for ; + Wed, 10 Sep 2003 20:38:03 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 74612D1B4E8 + for ; + Wed, 10 Sep 2003 20:38:00 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h8ANc0sl082629 + for ; Wed, 10 Sep 2003 23:38:00 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h8AN9xtr077029 + for pgsql-performance@postgresql.org; Wed, 10 Sep 2003 23:09:59 GMT +From: Christopher Browne +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: [GENERAL] how to get accurate values in pg_statistic (continued) +Date: Wed, 10 Sep 2003 18:22:04 -0400 +Organization: Hub.Org Networking Services +Lines: 63 +Message-ID: <60znhcxp0z.fsf@dev6.int.libertyrms.info> +References: <11537.1062717375@sss.pgh.pa.us> + <200309101944.h8AJiod26547@candle.pha.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@news.hub.org +User-Agent: Gnus/5.1003 (Gnus v5.10.3) XEmacs/21.4 (Rational FORTRAN, linux) +Cancel-Lock: sha1:vrVa8Dza7LAS2wo17O5hsTcjUw4= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/180 +X-Sequence-Number: 3546 + +pgman@candle.pha.pa.us (Bruce Momjian) writes: +> Tom Lane wrote: +>> Mary Edie Meredith writes: +>> > Stephan Szabo kindly responded to our earlier queries suggesting +>> > we look at default_statistics_target and ALTER TABLE ALTER COLUMN +>> > SET STATISTICS. +>> +>> > These determine the number of bins in the histogram for a given +>> > column. But for a large number of rows (for example 6 million) +>> > the maximum value (1000) does not guarantee that ANALYZE will do +>> > a full scan of the table. We do not see a way to guarantee the +>> > same statistics run to run without forcing ANALYZE to examine +>> > every row of every table. +>> +>> Do you actually still have a problem with the plans changing when +>> the stats target is above 100 or so? I think the notion of "force +>> ANALYZE to do a full scan" is inherently wrongheaded ... it +>> certainly would not produce numbers that have anything to do with +>> ordinary practice. +>> +>> If you have data statistics that are so bizarre that the planner +>> still gets things wrong with a target of 1000, then I'd like to +>> know more about why. +> +> Has there been any progress in determining if the number of default +> buckets (10) is the best value? + +I would think this is much more the key to the issue for their +benchmark than issues of correctly replicating the random number +generator. + +I'm not clear on how data is collected into the histogram bins; +obviously it's not selecting all 6 million rows, but how many rows is +it? + +The "right answer" for most use seems likely to involve: + + a) Getting an appropriate number of bins (I suspect 10 is a bit + small, but I can't justify that mathematically), and + b) Attaching an appropriate sample size to those bins. + +What is apparently going wrong with the benchmark (and this can +doubtless arise in "real life," too) is that the random selection is +pulling too few records with the result that some of the bins are +being filled in a "skewed" manner that causes the optimizer to draw +the wrong conclusions. (I may merely be restating the obvious here, +but if I say it a little differently than it has been said before, +someone may notice the vital "wrong assumption.") + +If the samples are crummy, then perhaps: + - There need to be more bins + - There need to be more samples + +Does the sample size change if you increase the number of bins? If +not, then having more, smaller bins will lead to them getting +increasingly skewed if there is any accidental skew in the selection. + +Do we also need a parameter to control sample size? +-- +output = reverse("ofni.smrytrebil" "@" "enworbbc") + +Christopher Browne +(416) 646 3304 x124 (land) + +From pgsql-performance-owner@postgresql.org Wed Sep 10 21:18:18 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 57D86D1B54F + for ; + Thu, 11 Sep 2003 00:18:12 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 01481-05 + for ; + Wed, 10 Sep 2003 21:17:43 -0300 (ADT) +Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) + by svr1.postgresql.org (Postfix) with ESMTP id 58E19D1B4E7 + for ; + Wed, 10 Sep 2003 21:17:39 -0300 (ADT) +Received: from ibm-e.pdx.osdl.net (ibm-e.pdx.osdl.net [172.20.1.71]) + by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h8B0HFo23862; + Wed, 10 Sep 2003 17:17:15 -0700 +Subject: Re: [osdldbt-general] Re: [GENERAL] how to get accurate +From: Mary Edie Meredith +To: Bruce Momjian +Cc: Tom Lane , + pgsql-performance , + osdldbt-general +In-Reply-To: <200309101944.h8AJiod26547@candle.pha.pa.us> +References: <200309101944.h8AJiod26547@candle.pha.pa.us> +Content-Type: text/plain +Organization: Open Source Development Lab +Message-Id: <1063239434.14271.8130.camel@ibm-e.pdx.osdl.net> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.2.2 +Date: 10 Sep 2003 17:17:15 -0700 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/181 +X-Sequence-Number: 3547 + +We tried 1000 as the default and found that the plans were good plans +and were consistent, but the pg_statistics was not exactly the same. + +We took Tom's' advice and tried SET SEED=0 (actually select setseed (0) +). + +We did runs last night on our project machine which produced consistent +pg_statistics data and (of course) the same plans. + +We will next try runs where we vary the default buckets. Other than 10 +and 1000, what numbers would you like us to try besides. Previously the +number 100 was mentioned. Are there others? + +On Wed, 2003-09-10 at 12:44, Bruce Momjian wrote: +> Tom Lane wrote: +> > Mary Edie Meredith writes: +> > > Stephan Szabo kindly responded to our earlier queries suggesting we look +> > > at default_statistics_target and ALTER TABLE ALTER COLUMN SET +> > > STATISTICS. +> > +> > > These determine the number of bins in the histogram for a given column. +> > > But for a large number of rows (for example 6 million) the maximum value +> > > (1000) does not guarantee that ANALYZE will do a full scan of the table. +> > > We do not see a way to guarantee the same statistics run to run without +> > > forcing ANALYZE to examine every row of every table. +> > +> > Do you actually still have a problem with the plans changing when the +> > stats target is above 100 or so? I think the notion of "force ANALYZE +> > to do a full scan" is inherently wrongheaded ... it certainly would not +> > produce numbers that have anything to do with ordinary practice. +> > +> > If you have data statistics that are so bizarre that the planner still +> > gets things wrong with a target of 1000, then I'd like to know more +> > about why. +> +> Has there been any progress in determining if the number of default +> buckets (10) is the best value? +-- +Mary Edie Meredith +Open Source Development Lab + + +From pgsql-performance-owner@postgresql.org Wed Sep 10 22:13:55 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3B1ACD1B52F + for ; + Thu, 11 Sep 2003 01:13:47 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 03571-10 + for ; + Wed, 10 Sep 2003 22:13:18 -0300 (ADT) +Received: from ms-smtp-03.southeast.rr.com (ms-smtp-03.southeast.rr.com + [24.93.67.84]) + by svr1.postgresql.org (Postfix) with ESMTP id 12260D1B4E2 + for ; + Wed, 10 Sep 2003 22:13:15 -0300 (ADT) +Received: from socialserve.com (clt74-104-204.carolina.rr.com [24.74.104.204]) + by ms-smtp-03.southeast.rr.com (8.12.5/8.12.2) with ESMTP id + h8B1B94R023249 for ; + Wed, 10 Sep 2003 21:11:09 -0400 (EDT) +Date: Wed, 10 Sep 2003 21:13:29 -0400 +Mime-Version: 1.0 (Apple Message framework v552) +Content-Type: text/plain; delsp=yes; charset=US-ASCII; format=flowed +Subject: Attempt at work around of int4 query won't touch int8 index ... +From: James Robinson +To: pgsql-performance@postgresql.org +Content-Transfer-Encoding: 7bit +Message-Id: <2756862E-E3F5-11D7-8513-000A9566A412@socialserve.com> +X-Mailer: Apple Mail (2.552) +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/182 +X-Sequence-Number: 3548 + +Hello, + + I'm trying a work-around on the "index on int8 column gets ignored by +planner when queried by literal numbers lacking the explicit '::int8'" +issue, and had hoped that perhaps I could create a functional index on +the result of casting the pk field to int4, and mabye with a little +luck the planner would consider the functional index instead. Here's +what I'm playing with on 7.3.4: + +social=# create table foo (id int8 primary key, stuff text); +NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index +'foo_pkey' for table 'foo' +CREATE TABLE +social=# create index foo_pkey_int4 on foo(int4(id)); +CREATE INDEX + +social=# explain analyze select id from foo where id = 42; + QUERY PLAN +------------------------------------------------------------------------ +-------------------- + Seq Scan on foo (cost=0.00..22.50 rows=1 width=8) (actual +time=0.01..0.01 rows=0 loops=1) + Filter: (id = 42) + Total runtime: 0.15 msec +(3 rows) + +social=# explain analyze select id from foo where id = 42::int8; + QUERY PLAN +------------------------------------------------------------------------ +------------------------------------ + Index Scan using foo_pkey on foo (cost=0.00..4.82 rows=1 width=8) +(actual time=0.02..0.02 rows=0 loops=1) + Index Cond: (id = 42::bigint) + Total runtime: 0.09 msec +(3 rows) + +social=# explain analyze select id from foo where id = int4(33); + QUERY PLAN +------------------------------------------------------------------------ +-------------------- + Seq Scan on foo (cost=0.00..22.50 rows=1 width=8) (actual +time=0.01..0.01 rows=0 loops=1) + Filter: (id = 33) + Total runtime: 0.07 msec +(3 rows) + +Is this just a dead end, or is there some variation of this that might +possibly work, so that ultimately an undoctored literal number, when +applied to an int8 column, could find an index? + +Thanks, +James + + +From pgsql-performance-owner@postgresql.org Wed Sep 10 23:44:32 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 98C9AD1B4E3 + for ; + Thu, 11 Sep 2003 02:44:29 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 21425-09 + for ; + Wed, 10 Sep 2003 23:44:23 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 3A85AD1B4E2 + for ; + Wed, 10 Sep 2003 23:44:17 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h8B2iIAn020902; + Wed, 10 Sep 2003 22:44:19 -0400 (EDT) +To: James Robinson +Cc: pgsql-performance@postgresql.org +Subject: Re: Attempt at work around of int4 query won't touch int8 index ... +In-reply-to: <2756862E-E3F5-11D7-8513-000A9566A412@socialserve.com> +References: <2756862E-E3F5-11D7-8513-000A9566A412@socialserve.com> +Comments: In-reply-to James Robinson + message dated "Wed, 10 Sep 2003 21:13:29 -0400" +Date: Wed, 10 Sep 2003 22:44:17 -0400 +Message-ID: <20901.1063248257@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/183 +X-Sequence-Number: 3549 + +James Robinson writes: +> Is this just a dead end, or is there some variation of this that might +> possibly work, so that ultimately an undoctored literal number, when +> applied to an int8 column, could find an index? + +I think it's a dead end. What I was playing with this afternoon was +removing the int8-and-int4 comparison operators from pg_operator. +It works as far as making "int8col = 42" do the right thing, but I'm +not sure yet about side-effects. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Sep 10 23:51:05 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C37F4D1B500 + for ; + Thu, 11 Sep 2003 02:50:57 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 31033-01 + for ; + Wed, 10 Sep 2003 23:50:29 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id E6EAED1B4E2 + for ; + Wed, 10 Sep 2003 23:50:24 -0300 (ADT) +Received: from [63.195.55.98] (HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3629160; Wed, 10 Sep 2003 19:50:59 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Organization: Aglio Database Solutions +To: Chris Huston , + pgsql-performance@postgresql.org +Subject: Re: Reading data in bulk - help? +Date: Wed, 10 Sep 2003 19:50:08 -0700 +User-Agent: KMail/1.4.3 +References: +In-Reply-To: +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-Id: <200309101950.08960.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/184 +X-Sequence-Number: 3550 + +Chris, + +> 1) Memory - clumsily adjusted shared_buffer - tried three values: 64, +> 128, 256 with no discernible change in performance. Also adjusted, +> clumsily, effective_cache_size to 1000, 2000, 4000 - with no +> discernible change in performance. I looked at the Admin manual and +> googled around for how to set these values and I confess I'm clueless +> here. I have no idea how many kernel disk page buffers are used nor do +> I understand what the "shared memory buffers" are used for (although +> the postgresql.conf file hints that it's for communication between +> multiple connections). Any advice or pointers to articles/docs is +> appreciated. + +You want values *much* higher than that. How much RAM do you have? See: +http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html +http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_conf_e.html + +For example, if you have 512mb RAM, I'd crank up the shared buffers to 8000. +the sort_mem to 8mb, and the effective_cache_size to 24,000. + +> 3) RAID - haven't tried it - but I'm guessing that the speed +> improvement from a RAID 5 may be on the order of 10x + +Probably not ... more like 1.5x - 2.0x, but that's still a significant help, +yes? Also, the advantage will get better the more your data grows. + +> - which I can +> likely get from using something like HDF. + +HDF sucks for I/O speed. XServe will become a much more significant option +in the market when Apple can bring themselves to abandon HDF, and adopt XFS +or something. This is part of your problem. + +> Since the data is unlikely to +> grow beyond 10-20gig, a fast drive and firewire ought to give me the +> performance I need. + +Not sure about that. Is Firewire really faster for I/O than modern SCSI or +233mhz ATA? I don't do much Mac anymore, but I'd the impression that +Firewire was mainly for peripherals .... + +What is important for your app in terms of speed is to get the data coming +from multiple drives over multiple channels. Were it a PC, I'd recommend a +motherboard with 4 IDE channels or Serial ATA, and spreading the data over 4 +drives via RAID 0 or RAID 5, and adding dual processors. Then you could use +multiple postgres connections to read different parts of the table +simultaneously. + +> I know experimentally that the current machine can +> sustain a 20MB/s transfer rate which is 20-30x the speed of these +> queries. + +That is interesting. Adjust your PostgreSQL.conf and see what results you +get. It's possible that PostgreSQL is convinced that you have little or no +RAM because of your .conf settings, and is swapping stuff to temp file on +disk. + +> 4) I'd previously commented out the output/writing steps from the app - +> to isolate read performance. + +OK. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Sep 11 00:08:27 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 8CB94D1B51C + for ; + Thu, 11 Sep 2003 03:08:16 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 31817-03 + for ; + Thu, 11 Sep 2003 00:08:06 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id ED342D1B4EC + for ; + Thu, 11 Sep 2003 00:08:05 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h8B385sl096023 + for ; Thu, 11 Sep 2003 03:08:05 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h8B37cJQ095870 + for pgsql-performance@postgresql.org; Thu, 11 Sep 2003 03:07:38 GMT +From: Christopher Browne +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: [osdldbt-general] Re: [GENERAL] how to get accurate +Date: Wed, 10 Sep 2003 23:07:12 -0400 +Organization: cbbrowne Computing Inc +Lines: 49 +Message-ID: +References: <200309101944.h8AJiod26547@candle.pha.pa.us> + <1063239434.14271.8130.camel@ibm-e.pdx.osdl.net> +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.1003 (Gnus v5.10.3) XEmacs/21.4 (Rational FORTRAN, linux) +Cancel-Lock: sha1:4iS0BwP2jd0/DRDnldjk8arSL8M= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/185 +X-Sequence-Number: 3551 + +The world rejoiced as maryedie@osdl.org (Mary Edie Meredith) wrote: +> We tried 1000 as the default and found that the plans were good +> plans and were consistent, but the pg_statistics was not exactly the +> same. +> +> We took Tom's' advice and tried SET SEED=0 (actually select setseed +> (0) ). + +When you're trying to get strict replicability of results, setting the +seed to some specific value is necessary. + +Some useful results could be attained by varying the seed, and seeing +how the plans change. + +> We did runs last night on our project machine which produced +> consistent pg_statistics data and (of course) the same plans. + +> We will next try runs where we vary the default buckets. Other than +> 10 and 1000, what numbers would you like us to try besides. +> Previously the number 100 was mentioned. Are there others? + +That presumably depends on what your goal is. + +A useful experiment would be to see at what point (e.g. - at what +bucket size) plans tend to "settle down" to the right values. + +It might well be that defaulting to 23 buckets (I'm picking that out +of thin air) would cause the plans to typically be stable whatever +seed got used. + +A test for this would be to, for each bucket size value, repeatedly +ANALYZE and check query plans. + +At bucket size 10, you have seen the query plans vary quite a bit. + +At 1000, they seem to stabilize very well. + +The geometric centre, between 10 and 1000, is 100, so it would surely +be useful to see if query plans are stable at that bucket size. + +The most interesting number to know would be the lowest number of +buckets at which query plans are nearly always stable. Supposing that +number was 23 (the number I earlier pulled out of the air), then that +can be used as evidence that the default value for SET STATISTICS +should be changed from 10 to 23. +-- +wm(X,Y):-write(X),write('@'),write(Y). wm('aa454','freenet.carleton.ca'). +http://www3.sympatico.ca/cbbrowne/nonrdbms.html +Sturgeon's Law: 90% of *EVERYTHING* is crud. + +From pgsql-performance-owner@postgresql.org Thu Sep 11 01:31:13 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id BA028D1B4EC + for ; + Thu, 11 Sep 2003 04:31:11 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 52954-01 + for ; + Thu, 11 Sep 2003 01:31:01 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 91E9FD1B4E7 + for ; + Thu, 11 Sep 2003 01:31:00 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h8B4UxAn021963; + Thu, 11 Sep 2003 00:31:00 -0400 (EDT) +To: Christopher Browne +Cc: pgsql-performance@postgresql.org +Subject: Re: [GENERAL] how to get accurate values in pg_statistic (continued) +In-reply-to: <60znhcxp0z.fsf@dev6.int.libertyrms.info> +References: <11537.1062717375@sss.pgh.pa.us> + <200309101944.h8AJiod26547@candle.pha.pa.us> + <60znhcxp0z.fsf@dev6.int.libertyrms.info> +Comments: In-reply-to Christopher Browne + message dated "Wed, 10 Sep 2003 18:22:04 -0400" +Date: Thu, 11 Sep 2003 00:30:59 -0400 +Message-ID: <21962.1063254659@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/186 +X-Sequence-Number: 3552 + +Christopher Browne writes: +> The "right answer" for most use seems likely to involve: +> a) Getting an appropriate number of bins (I suspect 10 is a bit +> small, but I can't justify that mathematically), and + +I suspect that also, but I don't have real evidence for it either. +We've heard complaints from a number of people for whom it was indeed +too small ... but that doesn't prove it's not appropriate in the +majority of cases ... + +> Does the sample size change if you increase the number of bins? + +Yes, read the comments in backend/commands/analyze.c. + +> Do we also need a parameter to control sample size? + +Not if the paper I read before writing that code is correct. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Sep 11 01:39:57 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 138D5D1B519 + for ; + Thu, 11 Sep 2003 04:39:56 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 43667-05 + for ; + Thu, 11 Sep 2003 01:39:46 -0300 (ADT) +Received: from houston.familyhealth.com.au (unknown [203.59.48.253]) + by svr1.postgresql.org (Postfix) with ESMTP id 7FE70D1B4E6 + for ; + Thu, 11 Sep 2003 01:39:40 -0300 (ADT) +Received: from mars (work-40.internal [192.168.0.40]) + by houston.familyhealth.com.au (8.12.9/8.12.9) with SMTP id + h8B4cCO0061530; Thu, 11 Sep 2003 12:38:14 +0800 (WST) + (envelope-from chriskl@familyhealth.com.au) +Message-ID: <089901c3781e$df9fce10$2800a8c0@mars> +From: "Christopher Kings-Lynne" +To: "Josh Berkus" , + "Chris Huston" , + +References: + <200309101950.08960.josh@agliodbs.com> +Subject: Re: Reading data in bulk - help? +Date: Thu, 11 Sep 2003 12:40:43 +0800 +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.1158 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=0.5 tagged_above=0.0 required=5.0 + tests=QUOTED_EMAIL_TEXT, RCVD_IN_OSIRUSOFT_COM, REFERENCES +X-Spam-Level: +X-Archive-Number: 200309/187 +X-Sequence-Number: 3553 + +> You want values *much* higher than that. How much RAM do you have? See: +> http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html +> http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_conf_e.html + +Now THAT is a remarkable document! I vote for putting that information into +the PostgreSQL documentation tree. + +Chris + + +From pgsql-performance-owner@postgresql.org Thu Sep 11 11:20:41 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 6712AD1B555 + for ; + Thu, 11 Sep 2003 14:19:35 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 49938-03 + for ; + Thu, 11 Sep 2003 11:19:07 -0300 (ADT) +Received: from mx1.neteconomist.com (mx1.neteconomist.com [65.122.18.6]) + by svr1.postgresql.org (Postfix) with ESMTP id 6FD46D1B4EC + for ; + Thu, 11 Sep 2003 11:19:03 -0300 (ADT) +Received: from mx1.neteconomist.com (localhost.localdomain [127.0.0.1]) + by mx1.neteconomist.com (8.12.8/8.12.8) with ESMTP id h8BEGMWg028691; + Thu, 11 Sep 2003 10:16:22 -0400 +Received: (from aturner@localhost) + by mx1.neteconomist.com (8.12.8/8.12.8/Submit) id h8BEGMM8028689; + Thu, 11 Sep 2003 10:16:22 -0400 +Date: Thu, 11 Sep 2003 10:16:22 -0400 +From: aturner@neteconomist.com +To: Richard Huxton +Cc: pgsql-performance@postgresql.org +Subject: Re: Upgrade Woes +Message-ID: <20030911141622.GB26759@neteconomist.com> +References: <20030910175340.GC5506@neteconomist.com> + <200309101931.53746.dev@archonet.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <200309101931.53746.dev@archonet.com> +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/188 +X-Sequence-Number: 3554 + +Thanks for the URL, I went through postgresql.conf and made some modifications to the config based on information therein. I will have to wait and see how it affects things, as I won't know for a week or so. + +Select time has never been a problem, the DB has always been very fast, it's the insert time that has been a problem. I'm not sure how much this is a function of the drive array sucking, the OS not doing a good job or the DB getting caught up in transaction logs. + +What does seem odd is that the performance degrades as time goes on, and the space that the DB files takes up increases as well. + +The Vacuum full is performed once at the end of the whole job. We could probably get away with doing this once per week, but in the past I have noticed that if I don't run it regularlly, when I do run it, it seems to take much longer. This has lead me to run more regularly than not. + +As for 7.3.3, the project in question suffered a 10x performance degredation on 7.3.3 which went away when we rolled back to 7.3.2. Almost all the inserts had triggers which updated stats tables, the database in question was very very write heavy, it was pretty much a datawarehouse for X10 sensor information which was then mined for analysis. + +I had certainly considered building the script to do binary seperation style inserts, split the job in half, insert, if it fails, split in half again until you get everything in. This would probably work okay considering only about two dozen out of 30,000 rows fail. The only reason not to do that it the time and effort required, particularly as we are looking at a substantial overhaul of the whole system in the next 6 months. + +Alex Turner + + +On Wed, Sep 10, 2003 at 07:31:53PM +0100, Richard Huxton wrote: +> On Wednesday 10 September 2003 18:53, aturner@neteconomist.com wrote: +> > Hi, +> > +> > My name is Alex Turner and I work for a small Tech company in Pottstown PA. +> > We run Postgresql on a number of systems for a variety of different +> > applications, and it has been a joy to deal with all around, working fast +> > and reliably for over 2 years. +> > +> > We recently upgraded from RedHat 7.2 to RedHat 9.0, and we are running +> > Postgres 7.3.2 on our Proliant ML370 (Raid 1 2x18 10k, and Raid 5 3x36 10k, +> > 2x866 PIII, 2GB RAM). +> [snip] +> > I have noticed that whilst inserts seem to be slower than before, the +> > vacuum full doesn't seem to take as long overall. +> > +> > postgresql.conf is pretty virgin, and we run postmaster with -B512 -N256 +> > -i. /var/lib/pgsql/data is a symlink to /eda/data, /eda being the mount +> > point for the Raid 5 array. +> +> First things first then, go to: +> http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php +> and read the item on Performance Tuning and the commented postgresql.conf +> +> > the database isn't huge, storing about 30000 properties, and the largest +> > table is 2.1 Million rows for property features. The dump file is only +> > 221MB. Alas, I did not design the schema, but I have made several 'tweaks' +> > to it to greatly improve read performance allowing us to be the fastest +> > provider in the Tristate area. Unfortunately the Job starts at 01:05 +> > (thats the earliest the dump is available) and runs until completion +> > finishing with a vacuum full. The vacuum full locks areas of the database +> > long enough that our service is temporarily down. At the worst point, the +> > vacuum full was starting after 09:00, which our customers didn't +> > appreciate. +> +> You might be able to avoid a vacuum full by tweaking the *fsm* settings to be +> able to cope with activity. +> +> > I'm wondering if there is anything I can do with postgres to allieviate +> > this problem. Either upgrading to 7.3.4 (although I tried 7.3.3 for +> > another app, and we had to roll back to 7.3.2 because of performance +> > problems), +> +> Hmm - can't think what would have changed radically between 7.3.2 and 7.3.3, +> upgrading to .4 is probably sensible. +> +> [snip] +> > Any help/suggestions would be grealy appreciated, +> +> You say that each insert/update is a separate transaction. I don't know how +> much "bad" data you get in the dump, but you might be able to do something +> like: +> +> 1. Set batch size to 128 items +> 2. Read batch-size rows from the dump +> 3. Try to insert/update the batch. If it works, move along by the size of the +> batch and back to #1 +> 4. If batch-size=1, record error, move along one row and back to #1 +> 5. If batch-size>1, halve batch-size and go back to #3 +> +> Your initial batch-size will depend on how many errors there are (but +> obviously use a power of 2). +> +> You could also run an ordinary vacuum every 1000 rows or so (number depends on +> your *fsm* settings as mentioned above). +> +> You might also want to try a REINDEX once a night/week too. +> -- +> Richard Huxton +> Archonet Ltd +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: 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 Sep 11 12:48:16 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id EBBB1D1B512 + for ; + Thu, 11 Sep 2003 15:48:08 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 63480-01 + for ; + Thu, 11 Sep 2003 12:47:38 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id AA1C6D1B4F6 + for ; + Thu, 11 Sep 2003 12:47:37 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h8BFlWAn027549; + Thu, 11 Sep 2003 11:47:33 -0400 (EDT) +To: aturner@neteconomist.com +Cc: Richard Huxton , + pgsql-performance@postgresql.org +Subject: Re: Upgrade Woes +In-reply-to: <20030911141622.GB26759@neteconomist.com> +References: <20030910175340.GC5506@neteconomist.com> + <200309101931.53746.dev@archonet.com> + <20030911141622.GB26759@neteconomist.com> +Comments: In-reply-to aturner@neteconomist.com + message dated "Thu, 11 Sep 2003 10:16:22 -0400" +Date: Thu, 11 Sep 2003 11:47:32 -0400 +Message-ID: <27548.1063295252@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/189 +X-Sequence-Number: 3555 + +aturner@neteconomist.com writes: +> As for 7.3.3, the project in question suffered a 10x performance +> degredation on 7.3.3 which went away when we rolled back to 7.3.2. + +I would like to pursue that report and find out why. I've just gone +through the CVS logs between 7.3.2 and 7.3.3, and I don't see any change +that would explain a 10x slowdown. Can you provide more details about +exactly what slowed down? + +Also, what PG version were you using on the old RedHat 7.2 installation? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Sep 11 12:55:44 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C2EB1D1B521 + for ; + Thu, 11 Sep 2003 15:55:41 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 63400-03 + for ; + Thu, 11 Sep 2003 12:55:11 -0300 (ADT) +Received: from jefftrout.com (h00a0cc4084e5.ne.client2.attbi.com + [24.128.241.68]) + by svr1.postgresql.org (Postfix) with SMTP id 5286BD1B536 + for ; + Thu, 11 Sep 2003 12:54:55 -0300 (ADT) +Received: (qmail 72007 invoked from network); 11 Sep 2003 15:54:55 -0000 +Received: from unknown (HELO torgo) (threshar@10.10.10.10) + by 10.10.10.10 with SMTP; 11 Sep 2003 15:54:55 -0000 +Date: Thu, 11 Sep 2003 11:54:55 -0400 (EDT) +From: Jeff +To: "aturner@neteconomist.com" +Cc: Richard Huxton , + "pgsql-performance@postgresql.org" +Subject: Re: Upgrade Woes +In-Reply-To: <20030911141622.GB26759@neteconomist.com> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/190 +X-Sequence-Number: 3556 + +On Thu, 11 Sep 2003, aturner@neteconomist.com wrote: + +> +> The Vacuum full is performed once at the end of the whole job. +> +have you also tried vacuum analyze periodically - it does not lock the +table and can help quite a bit? + +still odd why it would be that much slower between those versions. + +-- +Jeff Trout +http://www.jefftrout.com/ +http://www.stuarthamm.net/ + + + +From pgsql-performance-owner@postgresql.org Thu Sep 11 13:00:37 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 55063D1B502 + for ; + Thu, 11 Sep 2003 16:00:34 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 62676-08 + for ; + Thu, 11 Sep 2003 13:00:02 -0300 (ADT) +Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) + by svr1.postgresql.org (Postfix) with ESMTP id 3A123D1B51C + for ; + Thu, 11 Sep 2003 12:59:58 -0300 (ADT) +Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) + by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h8BFwYMc016198; + Thu, 11 Sep 2003 09:58:34 -0600 (MDT) +Date: Thu, 11 Sep 2003 09:55:47 -0600 (MDT) +From: "scott.marlowe" +To: Tom Lane +Cc: Christopher Browne , + +Subject: Re: [GENERAL] how to get accurate values in pg_statistic +In-Reply-To: <21962.1063254659@sss.pgh.pa.us> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-IHS-MailScanner: Found to be clean +X-IHS-MailScanner-SpamCheck: +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/191 +X-Sequence-Number: 3557 + +On Thu, 11 Sep 2003, Tom Lane wrote: + +> Christopher Browne writes: +> > The "right answer" for most use seems likely to involve: +> > a) Getting an appropriate number of bins (I suspect 10 is a bit +> > small, but I can't justify that mathematically), and +> +> I suspect that also, but I don't have real evidence for it either. +> We've heard complaints from a number of people for whom it was indeed +> too small ... but that doesn't prove it's not appropriate in the +> majority of cases ... +> +> > Does the sample size change if you increase the number of bins? +> +> Yes, read the comments in backend/commands/analyze.c. +> +> > Do we also need a parameter to control sample size? +> +> Not if the paper I read before writing that code is correct. + +I was just talking to a friend of mine who does statistical analysis, and +he suggested a different way of looking at this. I know little of the +analyze.c, but I'll be reading it some today. + +His theory was that we can figure out the number of target bins by +basically running analyze twice with two different random seeds, and +initially setting the bins to 10. + +The, compare the variance of the two runs. If the variance is great, +increase the target by X, and run two again. repeat, wash, rinse, until +the variance drops below some threshold. + +I like the idea, I'm not at all sure if it's practical for Postgresql to +implement it. + + +From pgsql-performance-owner@postgresql.org Thu Sep 11 14:38:25 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id CAD8AD1B528 + for ; + Thu, 11 Sep 2003 17:38:23 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 78902-06 + for ; + Thu, 11 Sep 2003 14:38:14 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 09363D1B537 + for ; + Thu, 11 Sep 2003 14:38:13 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h8BHcCsl098380 + for ; Thu, 11 Sep 2003 17:38:12 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h8BHA2Pf090761 + for pgsql-performance@postgresql.org; Thu, 11 Sep 2003 17:10:02 GMT +From: Christopher Browne +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: [GENERAL] how to get accurate values in pg_statistic +Date: Thu, 11 Sep 2003 12:32:01 -0400 +Organization: Hub.Org Networking Services +Lines: 49 +Message-ID: <60he3jwake.fsf@dev6.int.libertyrms.info> +References: <21962.1063254659@sss.pgh.pa.us> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@news.hub.org +User-Agent: Gnus/5.1003 (Gnus v5.10.3) XEmacs/21.4 (Rational FORTRAN, linux) +Cancel-Lock: sha1:wAtzRsG9N4xJfnmez4OypNB5S7M= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/192 +X-Sequence-Number: 3558 + +scott.marlowe@ihs.com ("scott.marlowe") writes: +> On Thu, 11 Sep 2003, Tom Lane wrote: +> +>> Christopher Browne writes: +>> > The "right answer" for most use seems likely to involve: +>> > a) Getting an appropriate number of bins (I suspect 10 is a bit +>> > small, but I can't justify that mathematically), and +>> +>> I suspect that also, but I don't have real evidence for it either. +>> We've heard complaints from a number of people for whom it was indeed +>> too small ... but that doesn't prove it's not appropriate in the +>> majority of cases ... +>> +>> > Does the sample size change if you increase the number of bins? +>> +>> Yes, read the comments in backend/commands/analyze.c. +>> +>> > Do we also need a parameter to control sample size? +>> +>> Not if the paper I read before writing that code is correct. +> +> I was just talking to a friend of mine who does statistical analysis, and +> he suggested a different way of looking at this. I know little of the +> analyze.c, but I'll be reading it some today. +> +> His theory was that we can figure out the number of target bins by +> basically running analyze twice with two different random seeds, and +> initially setting the bins to 10. +> +> The, compare the variance of the two runs. If the variance is great, +> increase the target by X, and run two again. repeat, wash, rinse, until +> the variance drops below some threshold. +> +> I like the idea, I'm not at all sure if it's practical for Postgresql to +> implement it. + +It may suffice to do some analytic runs on some "reasonable datasets" +in order to come up with a better default than 10. + +If you run this process a few times on some different databases and +find that the variance keeps dropping pretty quickly, then that would +be good material for arguing that 10 should change to 17 or 23 or 31 +or some such value. (The only interesting pttern in that is that +those are all primes :-).) +-- +output = ("cbbrowne" "@" "libertyrms.info") + +Christopher Browne +(416) 646 3304 x124 (land) + +From pgsql-performance-owner@postgresql.org Thu Sep 11 16:13:33 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 72797D1B550 + for ; + Thu, 11 Sep 2003 19:13:32 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 91400-08 + for ; + Thu, 11 Sep 2003 16:13:02 -0300 (ADT) +Received: from mx1.neteconomist.com (mx1.neteconomist.com [65.122.18.6]) + by svr1.postgresql.org (Postfix) with ESMTP id 5B38DD1B56B + for ; + Thu, 11 Sep 2003 16:13:00 -0300 (ADT) +Received: from mx1.neteconomist.com (localhost.localdomain [127.0.0.1]) + by mx1.neteconomist.com (8.12.8/8.12.8) with ESMTP id h8BJAJWg016439; + Thu, 11 Sep 2003 15:10:19 -0400 +Received: (from aturner@localhost) + by mx1.neteconomist.com (8.12.8/8.12.8/Submit) id h8BJAIT3016437; + Thu, 11 Sep 2003 15:10:18 -0400 +Date: Thu, 11 Sep 2003 15:10:18 -0400 +From: aturner@neteconomist.com +To: Tom Lane +Cc: Richard Huxton , + pgsql-performance@postgresql.org +Subject: Re: Upgrade Woes +Message-ID: <20030911191018.GA11764@neteconomist.com> +References: <20030910175340.GC5506@neteconomist.com> + <200309101931.53746.dev@archonet.com> + <20030911141622.GB26759@neteconomist.com> + <27548.1063295252@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <27548.1063295252@sss.pgh.pa.us> +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/193 +X-Sequence-Number: 3559 + +In the performance case the machine was running RedHat AS 2.1. I have posted the database schema at (obtained from pg_dump -s): + +http://serverbeach.plexq.com/~aturner/schema.sql + +The time to run all the stats procedures dropped through the floor. refresh_hourly_iud, adl_hourly_iud, rebuild_daily_total etc. There is a python script that calls the proc once for each hour or day. When running the historical calc job for a 7 day period back, it would crawl on 7.3.3. We started benching the drive array and found other issues with the system in the mean time (like the drive array was giving us 10MB/sec write speed - the guy who set it up did not enable write to cache). Once it was reconfigured the DB performance did not improve much (bonnie++ was used to verify the RAID array speed). + +Alex Turner + +On Thu, Sep 11, 2003 at 11:47:32AM -0400, Tom Lane wrote: +> aturner@neteconomist.com writes: +> > As for 7.3.3, the project in question suffered a 10x performance +> > degredation on 7.3.3 which went away when we rolled back to 7.3.2. +> +> I would like to pursue that report and find out why. I've just gone +> through the CVS logs between 7.3.2 and 7.3.3, and I don't see any change +> that would explain a 10x slowdown. Can you provide more details about +> exactly what slowed down? +> +> Also, what PG version were you using on the old RedHat 7.2 installation? +> +> regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Sep 12 07:27:10 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 4660FD1B4E5 + for ; + Fri, 12 Sep 2003 10:27:08 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 38171-08 + for ; + Fri, 12 Sep 2003 07:26:39 -0300 (ADT) +Received: from cmailg4.svr.pol.co.uk (cmailg4.svr.pol.co.uk [195.92.195.174]) + by svr1.postgresql.org (Postfix) with ESMTP id 35BBCD1B52C + for ; + Fri, 12 Sep 2003 07:26:31 -0300 (ADT) +Received: from user-2040.bbd23tcl.dsl.pol.co.uk ([81.77.247.248] helo=rj) + by cmailg4.svr.pol.co.uk with esmtp (Exim 4.14) id 19xl8K-0003As-V9 + for pgsql-performance@postgresql.org; Fri, 12 Sep 2003 11:26:33 +0100 +From: Richard Jones +Reply-To: rj@last.fm +Organization: Last.FM +To: pgsql-performance@postgresql.org +Subject: best arrangement of 3 disks for (insert) performance +Date: Fri, 12 Sep 2003 11:26:29 +0100 +User-Agent: KMail/1.5.1 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200309121126.29756.rj@last.fm> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/194 +X-Sequence-Number: 3560 + +Hi all, +I have some new hardware on the way and would like some advice on how to get +the most out of it.. + +its a dual xeon 2.4, 4gb ram and 3x identical 15k rpm scsi disks + +should i mirror 2 of the disks for postgres data, and use the 3rd disk for the +o/s and the pg logs or raid5 the 3 disks or even stripe 2 disks for pg and +use the 3rd for o/s,logs,backups ? + +the machine will be dealing with lots of inserts, basically as many as we can +throw at it + +thanks, +Richard + +From pgsql-performance-owner@postgresql.org Fri Sep 12 08:06:56 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id BDA74D1B551 + for ; + Fri, 12 Sep 2003 11:06:53 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 55530-06 + for ; + Fri, 12 Sep 2003 08:06:24 -0300 (ADT) +Received: from wight.ymogen.net (unknown [217.27.240.153]) + by svr1.postgresql.org (Postfix) with SMTP id D9F8CD1B540 + for ; + Fri, 12 Sep 2003 08:06:20 -0300 (ADT) +Received: (qmail 31808 invoked from network); 12 Sep 2003 11:06:18 -0000 +Received: from host213-123-217-162.in-addr.btopenworld.com (HELO solent) + (213.123.217.162) + by wight.ymogen.net with SMTP; 12 Sep 2003 11:06:18 -0000 +From: "Matt Clark" +To: , +Subject: Re: best arrangement of 3 disks for (insert) performance +Date: Fri, 12 Sep 2003 12:06:12 +0100 +Message-ID: +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 IMO, Build 9.0.2416 (9.0.2911.0) +Importance: Normal +In-Reply-To: <200309121126.29756.rj@last.fm> +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/195 +X-Sequence-Number: 3561 + +> the machine will be dealing with lots of inserts, basically as many as we can +> throw at it + +If you mean lots of _transactions_ with few inserts per transaction you should get a RAID controller w/ battery backed write-back +cache. Nothing else will improve your write performance by nearly as much. You could sell the RAM and one of the CPU's to pay for +it ;-) + +If you have lots of inserts but all in a few transactions then it's not quite so critical. + +M + + + +From pgsql-performance-owner@postgresql.org Fri Sep 12 11:35:06 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 146D9D1B54C + for ; + Fri, 12 Sep 2003 14:34:56 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 94485-05 + for ; + Fri, 12 Sep 2003 11:34:28 -0300 (ADT) +Received: from jefftrout.com (h00a0cc4084e5.ne.client2.attbi.com + [24.128.241.68]) + by svr1.postgresql.org (Postfix) with SMTP id 9CF68D1B536 + for ; + Fri, 12 Sep 2003 11:34:18 -0300 (ADT) +Received: (qmail 78922 invoked from network); 12 Sep 2003 14:34:26 -0000 +Received: from unknown (HELO torgo) (threshar@10.10.10.10) + by 10.10.10.10 with SMTP; 12 Sep 2003 14:34:26 -0000 +Date: Fri, 12 Sep 2003 10:34:26 -0400 (EDT) +From: Jeff +To: pgsql-performance@postgresql.org +Subject: software vs hw hard on linux +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/196 +X-Sequence-Number: 3562 + +Due to various third party issues, and the fact PG rules, we're planning +on migrating our deplorable informix db to PG. It is a rather large DB +with a rather high amount of activity (mostly updates). So I'm going to +be aquiring a dual (or quad if they'll give me money) box. (In my testing +my glorious P2 with a 2 spindle raid0 is able to handle it fairly well) + +What I'm wondering about is what folks experience with software raid vs +hardware raid on linux is. A friend of mine ran a set of benchmarks at +work and found sw raid was running obscenely faster than the mylex and +(some other brand that isn't 3ware) raids.. + +On the pro-hw side you have ones with battery backed cache, chacnes are +they are less likely to fail.. + +On the pro-sw side you have lots of speed and less cost (unfortunately, +there is a pathetic budget so spending $15k on a raid card is out of the +question really). + +any thoughts? + +-- +Jeff Trout +http://www.jefftrout.com/ +http://www.stuarthamm.net/ + + + +From pgsql-performance-owner@postgresql.org Fri Sep 12 11:52:15 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 23A50D1B4F1 + for ; + Fri, 12 Sep 2003 14:52:09 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 95501-05 + for ; + Fri, 12 Sep 2003 11:51:40 -0300 (ADT) +Received: from mx1.neteconomist.com (mx1.neteconomist.com [65.122.18.6]) + by svr1.postgresql.org (Postfix) with ESMTP id 04ACDD1B52A + for ; + Fri, 12 Sep 2003 11:51:36 -0300 (ADT) +Received: from mx1.neteconomist.com (localhost.localdomain [127.0.0.1]) + by mx1.neteconomist.com (8.12.8/8.12.8) with ESMTP id h8CEnOWg030246; + Fri, 12 Sep 2003 10:49:24 -0400 +Received: (from aturner@localhost) + by mx1.neteconomist.com (8.12.8/8.12.8/Submit) id h8CEnOtT030244; + Fri, 12 Sep 2003 10:49:24 -0400 +Date: Fri, 12 Sep 2003 10:49:24 -0400 +From: aturner@neteconomist.com +To: Jeff +Cc: pgsql-performance@postgresql.org +Subject: Re: software vs hw hard on linux +Message-ID: <20030912144924.GB26895@neteconomist.com> +References: +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/197 +X-Sequence-Number: 3563 + +My personal experience with RAID cards is that you have to spend money to get good performance. You need battery backed cache because RAID 5 only works well with write to cache turned on, and you need a good size cache too. If you don't have it, RAID 5 performance will suck big time. If you need speed, RAID 10 seems to be the only way to go, but of course that means you are gonna spend $$s on drives and chasis. I wish someone would start a website like storagereview.com for RAID cards because I have had _vastly_ differing experience with different cards. We currently have a compaq ML370 with a Compaq Smart Array 5300, and quite frankly it sucks (8MB/sec write). I get better performance numbers off my new Tyan Thunder s2469UGN board with a single U320 10k RPM drive (50MB/sec) than we get off our RAID 5 array including seeks/sec. Definately shop around, and hopefully some other folks can give some suggestions of a good RAID card, and a good config. + +Alex Turner + +P.S. If there is movement for a RAID review site, I would be willing to start one, I'm pretty dissapointed at the lack of resources out there for this. + +On Fri, Sep 12, 2003 at 10:34:26AM -0400, Jeff wrote: +> Due to various third party issues, and the fact PG rules, we're planning +> on migrating our deplorable informix db to PG. It is a rather large DB +> with a rather high amount of activity (mostly updates). So I'm going to +> be aquiring a dual (or quad if they'll give me money) box. (In my testing +> my glorious P2 with a 2 spindle raid0 is able to handle it fairly well) +> +> What I'm wondering about is what folks experience with software raid vs +> hardware raid on linux is. A friend of mine ran a set of benchmarks at +> work and found sw raid was running obscenely faster than the mylex and +> (some other brand that isn't 3ware) raids.. +> +> On the pro-hw side you have ones with battery backed cache, chacnes are +> they are less likely to fail.. +> +> On the pro-sw side you have lots of speed and less cost (unfortunately, +> there is a pathetic budget so spending $15k on a raid card is out of the +> question really). +> +> any thoughts? +> +> -- +> Jeff Trout +> http://www.jefftrout.com/ +> http://www.stuarthamm.net/ +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org + +From pgsql-performance-owner@postgresql.org Fri Sep 12 12:25:26 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 7B1A8D1B536 + for ; + Fri, 12 Sep 2003 15:24:21 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 98388-08 + for ; + Fri, 12 Sep 2003 12:24:10 -0300 (ADT) +Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) + by svr1.postgresql.org (Postfix) with ESMTP id 03A72D1B50B + for ; + Fri, 12 Sep 2003 12:24:10 -0300 (ADT) +Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) + by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h8CFMnMc012667; + Fri, 12 Sep 2003 09:22:50 -0600 (MDT) +Date: Fri, 12 Sep 2003 09:19:55 -0600 (MDT) +From: "scott.marlowe" +To: Christopher Browne +Cc: +Subject: Re: [GENERAL] how to get accurate values in pg_statistic +In-Reply-To: <60he3jwake.fsf@dev6.int.libertyrms.info> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-IHS-MailScanner: Found to be clean +X-IHS-MailScanner-SpamCheck: +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/198 +X-Sequence-Number: 3564 + +On Thu, 11 Sep 2003, Christopher Browne wrote: + +> scott.marlowe@ihs.com ("scott.marlowe") writes: +> > On Thu, 11 Sep 2003, Tom Lane wrote: +> > +> >> Christopher Browne writes: +> >> > The "right answer" for most use seems likely to involve: +> >> > a) Getting an appropriate number of bins (I suspect 10 is a bit +> >> > small, but I can't justify that mathematically), and +> >> +> >> I suspect that also, but I don't have real evidence for it either. +> >> We've heard complaints from a number of people for whom it was indeed +> >> too small ... but that doesn't prove it's not appropriate in the +> >> majority of cases ... +> >> +> >> > Does the sample size change if you increase the number of bins? +> >> +> >> Yes, read the comments in backend/commands/analyze.c. +> >> +> >> > Do we also need a parameter to control sample size? +> >> +> >> Not if the paper I read before writing that code is correct. +> > +> > I was just talking to a friend of mine who does statistical analysis, and +> > he suggested a different way of looking at this. I know little of the +> > analyze.c, but I'll be reading it some today. +> > +> > His theory was that we can figure out the number of target bins by +> > basically running analyze twice with two different random seeds, and +> > initially setting the bins to 10. +> > +> > The, compare the variance of the two runs. If the variance is great, +> > increase the target by X, and run two again. repeat, wash, rinse, until +> > the variance drops below some threshold. +> > +> > I like the idea, I'm not at all sure if it's practical for Postgresql to +> > implement it. +> +> It may suffice to do some analytic runs on some "reasonable datasets" +> in order to come up with a better default than 10. +> +> If you run this process a few times on some different databases and +> find that the variance keeps dropping pretty quickly, then that would +> be good material for arguing that 10 should change to 17 or 23 or 31 +> or some such value. (The only interesting pttern in that is that +> those are all primes :-).) + +That's a good intermediate solution, but it really doesn't solve +everyone's issue. If one table/field has a nice even distribution (i.e. +10 rows with id 1, 10 rows with id2, so on and so on) then it won't need +nearly as high of a default target as a row with lots of weird spikes and +such in it. + +That's why Joe (my statistics friend) made the point about iterating over +each table with higher targets until the variance drops to something +reasonable. + +I would imagine a simple script would be a good proof of concept of this, +but in the long run, it would be a huge win if the analyze.c code did this +automagically eventually, so that you don't have a target that's still too +low for some complex data sets and too high for simple ones. + +Well, time for me to get to work on a proof of concept... + + +From pgsql-performance-owner@postgresql.org Fri Sep 12 13:38:39 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 6811AD1B52F + for ; + Fri, 12 Sep 2003 16:38:36 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 16347-06 + for ; + Fri, 12 Sep 2003 13:38:26 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id B042AD1B4F9 + for ; + Fri, 12 Sep 2003 13:38:25 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h8CGcPsl055102 + for ; Fri, 12 Sep 2003 16:38:25 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h8CGA2XQ047525 + for pgsql-performance@postgresql.org; Fri, 12 Sep 2003 16:10:02 GMT +From: Christopher Browne +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: best arrangement of 3 disks for (insert) performance +Date: Fri, 12 Sep 2003 11:24:41 -0400 +Organization: Hub.Org Networking Services +Lines: 30 +Message-ID: <60fzj2t4g6.fsf@dev6.int.libertyrms.info> +References: <200309121126.29756.rj@last.fm> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@news.hub.org +User-Agent: Gnus/5.1003 (Gnus v5.10.3) XEmacs/21.4 (Rational FORTRAN, linux) +Cancel-Lock: sha1:mGV0YGS8RXyFhLx5wMbvQmlzwqM= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/200 +X-Sequence-Number: 3566 + +rj@last.fm (Richard Jones) writes: +> I have some new hardware on the way and would like some advice on +> how to get the most out of it.. +> +> its a dual xeon 2.4, 4gb ram and 3x identical 15k rpm scsi disks +> +> should i mirror 2 of the disks for postgres data, and use the 3rd +> disk for the o/s and the pg logs or raid5 the 3 disks or even stripe +> 2 disks for pg and use the 3rd for o/s,logs,backups ? +> +> the machine will be dealing with lots of inserts, basically as many +> as we can throw at it + +Having WAL on a separate drive from the database would be something of +a win. I'd buy that 1 disk for OS+WAL and then RAID [something] +across the other two drives for the database would be pretty helpful. + +After doing some [loose] benchmarking, the VERY best way to improve +performance would involve a RAID controller with battery-backed cache. + +On a box with similar configuration to yours, it took ~3h for a +particular set of data to load; on another one with battery-backed +cache (and a dozen fast SCSI drives :-)), the same data took as little +as 6 minutes to load. The BIG effect seemed to come from the +controller. +-- +(reverse (concatenate 'string "ofni.smrytrebil" "@" "enworbbc")) + +Christopher Browne +(416) 646 3304 x124 (land) + +From pgsql-performance-owner@postgresql.org Fri Sep 12 13:38:37 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 682CED1B51F + for ; + Fri, 12 Sep 2003 16:38:36 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 08529-09 + for ; + Fri, 12 Sep 2003 13:38:26 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id B61AAD1B4FC + for ; + Fri, 12 Sep 2003 13:38:25 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h8CGcPsn055102 + for ; Fri, 12 Sep 2003 16:38:25 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h8CGA2ie047530 + for pgsql-performance@postgresql.org; Fri, 12 Sep 2003 16:10:02 GMT +From: Christopher Browne +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: software vs hw hard on linux +Date: Fri, 12 Sep 2003 11:32:18 -0400 +Organization: Hub.Org Networking Services +Lines: 20 +Message-ID: <607k4et43h.fsf@dev6.int.libertyrms.info> +References: +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@news.hub.org +User-Agent: Gnus/5.1003 (Gnus v5.10.3) XEmacs/21.4 (Rational FORTRAN, linux) +Cancel-Lock: sha1:8dX1pWkLPBUWgWwpIHdCkvLe8zo= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/199 +X-Sequence-Number: 3565 + +threshar@torgo.978.org (Jeff) writes: +> On the pro-sw side you have lots of speed and less cost (unfortunately, +> there is a pathetic budget so spending $15k on a raid card is out of the +> question really). + +I have been playing with a Perq3 QC card + +which isn't anywhere near $15K, and which certainly seems to provide the +characteristic improved performance. + +PriceWatch is showing several LSI Logic cards in the $300-$400 range +with battery backed cache, which doesn't seem too out of line. + +It would seem a good tradeoff to buy one of these cards and drop a +SCSI drive off the array. +-- +output = ("cbbrowne" "@" "libertyrms.info") + +Christopher Browne +(416) 646 3304 x124 (land) + +From pgsql-performance-owner@postgresql.org Fri Sep 12 13:51:48 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 64340D1B53A + for ; + Fri, 12 Sep 2003 16:51:45 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 15813-09 + for ; + Fri, 12 Sep 2003 13:51:35 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id 13ABAD1B550 + for ; + Fri, 12 Sep 2003 13:51:32 -0300 (ADT) +Received: from [66.219.92.2] (HELO temoku) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3633612; Fri, 12 Sep 2003 09:51:50 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: rj@last.fm, pgsql-performance@postgresql.org +Subject: Re: best arrangement of 3 disks for (insert) performance +Date: Fri, 12 Sep 2003 09:49:52 -0700 +User-Agent: KMail/1.4.3 +References: <200309121126.29756.rj@last.fm> +In-Reply-To: <200309121126.29756.rj@last.fm> +MIME-Version: 1.0 +Content-Transfer-Encoding: quoted-printable +Message-Id: <200309120949.52871.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/201 +X-Sequence-Number: 3567 + +RIchard, + +> its a dual xeon 2.4, 4gb ram and 3x identical 15k rpm scsi disks +>=20 +> should i mirror 2 of the disks for postgres data, and use the 3rd disk fo= +r=20 +the=20 +> o/s and the pg logs or raid5 the 3 disks or even stripe 2 disks for pg an= +d=20 +> use the 3rd for o/s,logs,backups ? + +I'd mirror 2. Stripey RAID with few disks imposes a heavy performance=20 +penalty on data writes (particularly updates), sometimes as much as 50% for= + a=20 +RAID5-3disk config.=20=20 + +I am a little curious why you've got a dual-xeon, but could only afford 3= +=20 +disks .... + +--=20 +-Josh Berkus + Aglio Database Solutions + San Francisco + + +From pgsql-performance-owner@postgresql.org Fri Sep 12 13:56:49 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 87501D1B53C + for ; + Fri, 12 Sep 2003 16:56:46 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 17565-07 + for ; + Fri, 12 Sep 2003 13:56:36 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id 844DDD1B53A + for ; + Fri, 12 Sep 2003 13:56:35 -0300 (ADT) +Received: from [66.219.92.2] (HELO temoku) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3633625; Fri, 12 Sep 2003 09:57:04 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Jeff , pgsql-performance@postgresql.org +Subject: Re: software vs hw hard on linux +Date: Fri, 12 Sep 2003 09:55:06 -0700 +User-Agent: KMail/1.4.3 +References: +In-Reply-To: +MIME-Version: 1.0 +Content-Transfer-Encoding: quoted-printable +Message-Id: <200309120955.06474.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/203 +X-Sequence-Number: 3569 + +Jeff, + +> What I'm wondering about is what folks experience with software raid vs +> hardware raid on linux is. A friend of mine ran a set of benchmarks at +> work and found sw raid was running obscenely faster than the mylex and +> (some other brand that isn't 3ware) raids.. + +Our company has stopped recommending hardware raid for all low-to-medium en= +d=20 +systems. Our experience is that Linux SW RAID does as good a job as any= +=20 +$700 to $1000 RAID card, and has the advantage of not having lots of driver= +=20 +issues (for example, we still have one system running Linux 2.2.19 because= +=20 +the Mylex driver maintainer passed away in early 2002). + +The exception to this is if you are expecting to frequently max out your CP= +U=20 +and/or RAM with your application, in which case the SW RAID might not be so= +=20 +good because you would get query-vs.-RAID CPU contention. + +--=20 +-Josh Berkus + Aglio Database Solutions + San Francisco + + +From pgsql-performance-owner@postgresql.org Fri Sep 12 13:56:20 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 17BB4D1B4FC + for ; + Fri, 12 Sep 2003 16:56:19 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 19117-02 + for ; + Fri, 12 Sep 2003 13:55:47 -0300 (ADT) +Received: from cmailm3.svr.pol.co.uk (cmailm3.svr.pol.co.uk [195.92.193.19]) + by svr1.postgresql.org (Postfix) with ESMTP id D75F4D1B4F6 + for ; + Fri, 12 Sep 2003 13:55:45 -0300 (ADT) +Received: from user-2040.bbd23tcl.dsl.pol.co.uk ([81.77.247.248] helo=rj) + by cmailm3.svr.pol.co.uk with esmtp (Exim 4.14) + id 19xrCy-0005af-Sz; Fri, 12 Sep 2003 17:55:44 +0100 +From: Richard Jones +Reply-To: rj@last.fm +Organization: Last.FM +To: Christopher Browne , + pgsql-performance@postgresql.org +Subject: Re: best arrangement of 3 disks for (insert) performance +Date: Fri, 12 Sep 2003 17:55:40 +0100 +User-Agent: KMail/1.5.1 +References: <200309121126.29756.rj@last.fm> + <60fzj2t4g6.fsf@dev6.int.libertyrms.info> +In-Reply-To: <60fzj2t4g6.fsf@dev6.int.libertyrms.info> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +Message-Id: <200309121755.40826.rj@last.fm> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/202 +X-Sequence-Number: 3568 + +The machine is coming from dell, and i have the option of a=20 +PERC 3/SC RAID Controller (32MB) +or software raid. + +does anyone have any experience of this controller?=20 +its an additional =A3345 for this controller, i'd be interested to know wha= +t=20 +people think - my other option is to buy the raid controller separately,=20 +which appeals to me but i wouldnt know what to look for in a raid controlle= +r. + +that raid controller review site sounds like a good idea :) + +Richard. + +On Friday 12 September 2003 4:24 pm, Christopher Browne wrote: +> rj@last.fm (Richard Jones) writes: +> > I have some new hardware on the way and would like some advice on +> > how to get the most out of it.. +> > +> > its a dual xeon 2.4, 4gb ram and 3x identical 15k rpm scsi disks +> > +> > should i mirror 2 of the disks for postgres data, and use the 3rd +> > disk for the o/s and the pg logs or raid5 the 3 disks or even stripe +> > 2 disks for pg and use the 3rd for o/s,logs,backups ? +> > +> > the machine will be dealing with lots of inserts, basically as many +> > as we can throw at it +> +> Having WAL on a separate drive from the database would be something of +> a win. I'd buy that 1 disk for OS+WAL and then RAID [something] +> across the other two drives for the database would be pretty helpful. +> +> After doing some [loose] benchmarking, the VERY best way to improve +> performance would involve a RAID controller with battery-backed cache. +> +> On a box with similar configuration to yours, it took ~3h for a +> particular set of data to load; on another one with battery-backed +> cache (and a dozen fast SCSI drives :-)), the same data took as little +> as 6 minutes to load. The BIG effect seemed to come from the +> controller. + + +From pgsql-performance-owner@postgresql.org Fri Sep 12 13:57:37 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 9983AD1B536 + for ; + Fri, 12 Sep 2003 16:57:35 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 19444-02 + for ; + Fri, 12 Sep 2003 13:57:25 -0300 (ADT) +Received: from cmailm5.svr.pol.co.uk (cmailm5.svr.pol.co.uk [195.92.193.21]) + by svr1.postgresql.org (Postfix) with ESMTP id D9212D1B51F + for ; + Fri, 12 Sep 2003 13:57:24 -0300 (ADT) +Received: from user-2040.bbd23tcl.dsl.pol.co.uk ([81.77.247.248] helo=rj) + by cmailm5.svr.pol.co.uk with esmtp (Exim 4.14) id 19xrEa-00069f-7X + for pgsql-performance@postgresql.org; Fri, 12 Sep 2003 17:57:24 +0100 +From: Richard Jones +Reply-To: rj@last.fm +Organization: Last.FM +To: pgsql-performance@postgresql.org +Subject: Re: best arrangement of 3 disks for (insert) performance +Date: Fri, 12 Sep 2003 17:57:20 +0100 +User-Agent: KMail/1.5.1 +References: <200309121126.29756.rj@last.fm> + <200309120949.52871.josh@agliodbs.com> +In-Reply-To: <200309120949.52871.josh@agliodbs.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200309121757.20150.rj@last.fm> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/204 +X-Sequence-Number: 3570 + +The dual xeon arrangement is because the machine will also have to do some +collaborative filtering which is very cpu intensive and very disk +un-intensive, after loading the data into ram. + +On Friday 12 September 2003 5:49 pm, you wrote: +> RIchard, +> +> > its a dual xeon 2.4, 4gb ram and 3x identical 15k rpm scsi disks +> > +> > should i mirror 2 of the disks for postgres data, and use the 3rd disk +> > for +> +> the +> +> > o/s and the pg logs or raid5 the 3 disks or even stripe 2 disks for pg +> > and use the 3rd for o/s,logs,backups ? +> +> I'd mirror 2. Stripey RAID with few disks imposes a heavy performance +> penalty on data writes (particularly updates), sometimes as much as 50% for +> a RAID5-3disk config. +> +> I am a little curious why you've got a dual-xeon, but could only afford 3 +> disks .... + + +From pgsql-performance-owner@postgresql.org Fri Sep 12 14:03:48 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 741B3D1B4F6 + for ; + Fri, 12 Sep 2003 17:03:47 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 17219-05 + for ; + Fri, 12 Sep 2003 14:03:17 -0300 (ADT) +Received: from oscar.sybex.com (unknown [63.86.158.35]) + by svr1.postgresql.org (Postfix) with SMTP id 17E15D1B4E8 + for ; + Fri, 12 Sep 2003 14:03:16 -0300 (ADT) +Received: from bert.sybex.com by oscar.sybex.com + via smtpd (for svr1.postgresql.org [64.117.224.193]) with SMTP; + 12 Sep 2003 17:03:16 UT +Subject: Re: best arrangement of 3 disks for (insert) performance - Dell +To: pgsql-performance@postgresql.org +X-Mailer: Lotus Notes Release 5.0.11 July 24, 2002 +Message-ID: + +From: "Thom Dyson" +Date: Fri, 12 Sep 2003 10:03:10 -0700 +X-MIMETrack: Serialize by Router on Bert/Sybex(Release 5.0.9 |November 16, + 2001) at 09/12/2003 10:03:17 AM +MIME-Version: 1.0 +Content-type: text/plain; charset=iso-8859-1 +Content-transfer-encoding: quoted-printable +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/205 +X-Sequence-Number: 3571 + + +The Dell PERC controllers have a very strong reputation for terrible +performance. If you search the archives of the Dell Linux Power Edge list +(dell.com/linux), you will find many, many people who get better +performance from software RAID, rather than the hw RAID on the PERC. +Having said that, the 3/SC might be one of the better PERC controllers. I +would spend and hour or two and benchmark hw vs. sw before I committed to +either one. + +Thom Dyson +Director of Information Services +Sybex, Inc. + +On 9/12/2003 9:55:40 AM, Richard Jones wrote: +> The machine is coming from dell, and i have the option of a +> PERC 3/SC RAID Controller (32MB) +> or software raid. +> +> does anyone have any experience of this controller? +> its an additional =A3345 for this controller, i'd be interested to know +what +> people think - my other option is to buy the raid controller separately, +> which appeals to me but i wouldnt know what to look for in a raid +> controller. +> +> that raid controller review site sounds like a good idea :) +> +> Richard. + + + +From pgsql-performance-owner@postgresql.org Fri Sep 12 14:35:17 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 4F003D1B4F9 + for ; + Fri, 12 Sep 2003 17:35:16 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 18065-08 + for ; + Fri, 12 Sep 2003 14:34:46 -0300 (ADT) +Received: from isis.pcis.net (cr.pcis.net [207.18.226.3]) + by svr1.postgresql.org (Postfix) with ESMTP id 78099D1B4E5 + for ; + Fri, 12 Sep 2003 14:34:44 -0300 (ADT) +Received: from lyric.ofsloans.com (unverified [209.180.142.225]) by + isis.pcis.net + (Rockliffe SMTPRA 4.5.6) with ESMTP id ; + Fri, 12 Sep 2003 12:33:31 -0500 +Subject: Re: best arrangement of 3 disks for (insert) performance +From: Will LaShell +To: Thom Dyson +Cc: pgsql-performance@postgresql.org +In-Reply-To: + +References: + +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="=-uw30WTvJqovo+0f2oQ+1" +X-Mailer: Ximian Evolution 1.0.8 (1.0.8-11) +Date: 12 Sep 2003 10:33:28 -0700 +Message-Id: <1063388010.31215.5.camel@lyric.ofsloans.com> +Mime-Version: 1.0 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/206 +X-Sequence-Number: 3572 + +--=-uw30WTvJqovo+0f2oQ+1 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable + +I would like to point out though on the PERC controllers that are LSI +based ( Megaraid ) there -are- settings that can be changed to fix any +o the performance issues. Check the linux megaraid driver list archives +to see the full description. I've seen it come up many times and +basically all the problems have turned up resolved. + +Will + + +On Fri, 2003-09-12 at 10:03, Thom Dyson wrote: +>=20 +> The Dell PERC controllers have a very strong reputation for terrible +> performance. If you search the archives of the Dell Linux Power Edge list +> (dell.com/linux), you will find many, many people who get better +> performance from software RAID, rather than the hw RAID on the PERC. +> Having said that, the 3/SC might be one of the better PERC controllers. I +> would spend and hour or two and benchmark hw vs. sw before I committed to +> either one. +>=20 +> Thom Dyson +> Director of Information Services +> Sybex, Inc. +>=20 +> On 9/12/2003 9:55:40 AM, Richard Jones wrote: +> > The machine is coming from dell, and i have the option of a +> > PERC 3/SC RAID Controller (32MB) +> > or software raid. +> > +> > does anyone have any experience of this controller? +> > its an additional =A3345 for this controller, i'd be interested to know +> what +> > people think - my other option is to buy the raid controller separately, +> > which appeals to me but i wouldnt know what to look for in a raid +> > controller. +> > +> > that raid controller review site sounds like a good idea :) +> > +> > Richard. +>=20 +>=20 +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 4: Don't 'kill -9' the postmaster + + +--=-uw30WTvJqovo+0f2oQ+1 +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: This is a digitally signed message part + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.0.7 (GNU/Linux) + +iD8DBQA/YgNoZr3R5kgOZd0RAhpMAKCWM28FruonXwRUhbFHaWMsNP7FigCgijuA +mXyX7+AAj7urPCifu3sKrI8= +=TtYQ +-----END PGP SIGNATURE----- + +--=-uw30WTvJqovo+0f2oQ+1-- + + +From pgsql-performance-owner@postgresql.org Fri Sep 12 16:03:50 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id AABDBD1B4EB + for ; + Fri, 12 Sep 2003 19:03:49 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 37447-08 + for ; + Fri, 12 Sep 2003 16:03:19 -0300 (ADT) +Received: from lorax.kciLink.com (lorax.kciLink.com [206.112.95.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 070AFD1B4E7 + for ; + Fri, 12 Sep 2003 16:03:17 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id 90DEB3EC2 + for ; + Fri, 12 Sep 2003 15:03:18 -0400 (EDT) +Received: from lorax.kciLink.com ([127.0.0.1]) + by localhost (lorax.kciLink.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 38441-02-2 for ; + Fri, 12 Sep 2003 15:03:08 -0400 (EDT) +Received: from lorax.kciLink.com (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id 037493E9D + for ; + Fri, 12 Sep 2003 15:03:07 -0400 (EDT) +Received: (from news@localhost) + by lorax.kciLink.com (8.12.8p1/8.12.8/Submit) id h8CJ37WO018998 + for pgsql-performance@postgresql.org; + Fri, 12 Sep 2003 15:03:07 -0400 (EDT) +To: pgsql-performance@postgresql.org +Path: not-for-mail +From: Vivek Khera +Newsgroups: ml.postgres.performance +Subject: Re: software vs hw hard on linux +Date: Fri, 12 Sep 2003 15:03:07 -0400 +Organization: Khera Communications, Inc., Rockville, MD +Lines: 26 +Message-ID: +References: + <20030912144924.GB26895@neteconomist.com> +NNTP-Posting-Host: yertle.kcilink.com +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Trace: lorax.kciLink.com 1063393387 1178 216.194.193.105 (12 Sep 2003 + 19:03:07 GMT) +X-Complaints-To: daemon@kciLink.com +NNTP-Posting-Date: Fri, 12 Sep 2003 19:03:07 +0000 (UTC) +User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Portable Code, + berkeley-unix) +Cancel-Lock: sha1:4ayc6uHNANc/Ws/bHKvPFRAxpCw= +X-Virus-Scanned: by amavisd-new at kciLink.com +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/207 +X-Sequence-Number: 3573 + +>>>>> "a" == aturner writes: + +a> you need a good size cache too. If you don't have it, RAID 5 +a> performance will suck big time. If you need speed, RAID 10 seems +a> to be the only way to go, but of course that means you are gonna +a> spend $$s on drives and chasis. I wish someone would start a + +I disagree on your RAID level assertions. Check back about 10 or 15 +days on this list for some numbers I posted on restore times for a 20+ +GB database with different RAID levels. RAID5 came out fastest +compared with RAID10 and RAID50 across 14 disks. On my 5 disk system, +I run RAID10 plus a spare in preference to RAID5 as it is faster for +that. So the answer is "it depends". ;-) + +Both systems use SCSI hardware RAID controllers, one is LSI and the +other Adaptec, all hardware from Dell. + +But if you're budget limited, spend every last penny you have on the +fastest disks you can get, and then boost memory. Any current CPU +will be more than enough for Postgres. + +-- +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Vivek Khera, Ph.D. Khera Communications, Inc. +Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 +AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ + +From pgsql-performance-owner@postgresql.org Fri Sep 12 16:05:04 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 6BD25D1B4F1 + for ; + Fri, 12 Sep 2003 19:05:02 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 36433-06 + for ; + Fri, 12 Sep 2003 16:04:31 -0300 (ADT) +Received: from lorax.kciLink.com (lorax.kciLink.com [206.112.95.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 2D404D1B4E8 + for ; + Fri, 12 Sep 2003 16:04:30 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id A0CEF3E9D + for ; + Fri, 12 Sep 2003 15:04:31 -0400 (EDT) +Received: from lorax.kciLink.com ([127.0.0.1]) + by localhost (lorax.kciLink.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 38441-02-4 for ; + Fri, 12 Sep 2003 15:04:21 -0400 (EDT) +Received: from lorax.kciLink.com (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id 24DE83E8B + for ; + Fri, 12 Sep 2003 15:04:21 -0400 (EDT) +Received: (from news@localhost) + by lorax.kciLink.com (8.12.8p1/8.12.8/Submit) id h8CJ4LSV028045 + for pgsql-performance@postgresql.org; + Fri, 12 Sep 2003 15:04:21 -0400 (EDT) +To: pgsql-performance@postgresql.org +Path: not-for-mail +From: Vivek Khera +Newsgroups: ml.postgres.performance +Subject: Re: software vs hw hard on linux +Date: Fri, 12 Sep 2003 15:04:20 -0400 +Organization: Khera Communications, Inc., Rockville, MD +Lines: 17 +Message-ID: +References: +NNTP-Posting-Host: yertle.kcilink.com +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Trace: lorax.kciLink.com 1063393461 1178 216.194.193.105 (12 Sep 2003 + 19:04:21 GMT) +X-Complaints-To: daemon@kciLink.com +NNTP-Posting-Date: Fri, 12 Sep 2003 19:04:21 +0000 (UTC) +User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Portable Code, + berkeley-unix) +Cancel-Lock: sha1:pTToLlSgg9Zz9vFbpDg+4RMTMmI= +X-Virus-Scanned: by amavisd-new at kciLink.com +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/208 +X-Sequence-Number: 3574 + +>>>>> "J" == Jeff writes: + +J> Due to various third party issues, and the fact PG rules, we're planning +J> on migrating our deplorable informix db to PG. It is a rather large DB +J> with a rather high amount of activity (mostly updates). So I'm going to + +If at all possible, batch your updates within transactions containing +as many of those updates as you can. You will get *much* better +performance. + +More than 2 procs is probably overkill. + +-- +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Vivek Khera, Ph.D. Khera Communications, Inc. +Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 +AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ + +From pgsql-performance-owner@postgresql.org Fri Sep 12 16:07:46 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E1BE2D1B4E5 + for ; + Fri, 12 Sep 2003 19:07:40 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 39993-01 + for ; + Fri, 12 Sep 2003 16:07:11 -0300 (ADT) +Received: from lorax.kciLink.com (lorax.kciLink.com [206.112.95.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 40B94D1B4E7 + for ; + Fri, 12 Sep 2003 16:07:09 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id B5AAD3EB1 + for ; + Fri, 12 Sep 2003 15:07:10 -0400 (EDT) +Received: from lorax.kciLink.com ([127.0.0.1]) + by localhost (lorax.kciLink.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 38441-02-6 for ; + Fri, 12 Sep 2003 15:07:00 -0400 (EDT) +Received: from lorax.kciLink.com (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id 2FCB53E8B + for ; + Fri, 12 Sep 2003 15:07:00 -0400 (EDT) +Received: (from news@localhost) + by lorax.kciLink.com (8.12.8p1/8.12.8/Submit) id h8CJ70qP004164 + for pgsql-performance@postgresql.org; + Fri, 12 Sep 2003 15:07:00 -0400 (EDT) +To: pgsql-performance@postgresql.org +Path: not-for-mail +From: Vivek Khera +Newsgroups: ml.postgres.performance +Subject: Re: best arrangement of 3 disks for (insert) performance - Dell +Date: Fri, 12 Sep 2003 15:06:59 -0400 +Organization: Khera Communications, Inc., Rockville, MD +Lines: 17 +Message-ID: +References: + +NNTP-Posting-Host: yertle.kcilink.com +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Trace: lorax.kciLink.com 1063393620 1178 216.194.193.105 (12 Sep 2003 + 19:07:00 GMT) +X-Complaints-To: daemon@kciLink.com +NNTP-Posting-Date: Fri, 12 Sep 2003 19:07:00 +0000 (UTC) +User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Portable Code, + berkeley-unix) +Cancel-Lock: sha1:wNyGduih0DrnXEYArvz89BkS84U= +X-Virus-Scanned: by amavisd-new at kciLink.com +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/209 +X-Sequence-Number: 3575 + +>>>>> "TD" == Thom Dyson writes: + +TD> The Dell PERC controllers have a very strong reputation for terrible +TD> performance. If you search the archives of the Dell Linux Power Edge list +TD> (dell.com/linux), you will find many, many people who get better +TD> performance from software RAID, rather than the hw RAID on the PERC. + +The PERC controllers are just a fancy name for a whole host of +different hardware. I have several, and some are made by LSI and some +are made by Adaptec. My latest is PERC3/DC which is an LSI MegaRAID +and is pretty darned fast. + +-- +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Vivek Khera, Ph.D. Khera Communications, Inc. +Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 +AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ + +From pgsql-performance-owner@postgresql.org Fri Sep 12 16:23:29 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 8AD69D1B4F1 + for ; + Fri, 12 Sep 2003 19:23:27 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 37281-10 + for ; + Fri, 12 Sep 2003 16:23:17 -0300 (ADT) +Received: from lorax.kciLink.com (lorax.kciLink.com [206.112.95.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 1ABE1D1B4F0 + for ; + Fri, 12 Sep 2003 16:23:16 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id 97C653E8B + for ; + Fri, 12 Sep 2003 15:23:17 -0400 (EDT) +Received: from lorax.kciLink.com ([127.0.0.1]) + by localhost (lorax.kciLink.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 26195-01-2 for ; + Fri, 12 Sep 2003 15:23:07 -0400 (EDT) +Received: from lorax.kciLink.com (localhost [127.0.0.1]) + by lorax.kciLink.com (Postfix) with ESMTP id 18E5A3E9D + for ; + Fri, 12 Sep 2003 15:23:07 -0400 (EDT) +Received: (from news@localhost) + by lorax.kciLink.com (8.12.8p1/8.12.8/Submit) id h8CJN6i7036246 + for pgsql-performance@postgresql.org; + Fri, 12 Sep 2003 15:23:06 -0400 (EDT) +To: pgsql-performance@postgresql.org +Path: not-for-mail +From: Vivek Khera +Newsgroups: ml.postgres.performance +Subject: Re: best arrangement of 3 disks for (insert) performance +Date: Fri, 12 Sep 2003 15:23:06 -0400 +Organization: Khera Communications, Inc., Rockville, MD +Lines: 17 +Message-ID: +References: + + <1063388010.31215.5.camel@lyric.ofsloans.com> +NNTP-Posting-Host: yertle.kcilink.com +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Trace: lorax.kciLink.com 1063394586 35244 216.194.193.105 (12 Sep 2003 + 19:23:06 GMT) +X-Complaints-To: daemon@kciLink.com +NNTP-Posting-Date: Fri, 12 Sep 2003 19:23:06 +0000 (UTC) +User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Portable Code, + berkeley-unix) +Cancel-Lock: sha1:JzWC1G2Sl+b/1nqTX6creHFcbcc= +X-Virus-Scanned: by amavisd-new at kciLink.com +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/210 +X-Sequence-Number: 3576 + +>>>>> "WL" == Will LaShell writes: + +WL> o the performance issues. Check the linux megaraid driver list archives +WL> to see the full description. I've seen it come up many times and +WL> basically all the problems have turned up resolved. + +I've seen this advice a couple of times, but perhaps I'm just not a +good archive searcher because I can't find such recommendations on the +linux-megaraid-devel list archives... + +Anyone have a direct pointer to right info? + +-- +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Vivek Khera, Ph.D. Khera Communications, Inc. +Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 +AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ + +From pgsql-performance-owner@postgresql.org Fri Sep 12 18:38:39 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 1294BD1B50B + for ; + Fri, 12 Sep 2003 21:38:38 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 62692-03 + for ; + Fri, 12 Sep 2003 18:38:28 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 13240D1B51F + for ; + Fri, 12 Sep 2003 18:38:26 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h8CLcPsl036310 + for ; Fri, 12 Sep 2003 21:38:25 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h8CLA1jI030442 + for pgsql-performance@postgresql.org; Fri, 12 Sep 2003 21:10:01 GMT +From: Christopher Browne +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: best arrangement of 3 disks for (insert) performance - Dell +Date: Fri, 12 Sep 2003 16:47:22 -0400 +Organization: Hub.Org Networking Services +Lines: 39 +Message-ID: <60fzj1raxx.fsf@dev6.int.libertyrms.info> +References: + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@news.hub.org +User-Agent: Gnus/5.1003 (Gnus v5.10.3) XEmacs/21.4 (Rational FORTRAN, linux) +Cancel-Lock: sha1:Qqnh0qmJIZWj0Vf00WS509rMApk= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/211 +X-Sequence-Number: 3577 + +TDyson@sybex.com ("Thom Dyson") writes: +> The Dell PERC controllers have a very strong reputation for terrible +> performance. If you search the archives of the Dell Linux Power +> Edge list (dell.com/linux), you will find many, many people who get +> better performance from software RAID, rather than the hw RAID on +> the PERC. Having said that, the 3/SC might be one of the better +> PERC controllers. I would spend and hour or two and benchmark hw +> vs. sw before I committed to either one. + +I can't agree with that. + +1. If you search the archives for messages dated a couple of years +ago, you can find lots of messages indicating terrible performance. + +Drivers are not cast in concrete; there has been a LOT of change to +them since then. + +2. The second MAJOR merit to hardware RAID is the ability to hot-swap +drives. Software RAID doesn't help with that at all. + +3. The _immense_ performance improvement that can be gotten out of +these controllers comes from having fsync() turn into a near no-op +since changes can be committed to the 128K battery-backed cache REALLY +QUICKLY. + +That is something you should avoid doing with software RAID in any +case where you actually care about your data. + +That third part is where Big Wins come. It is the very same sort of +"big win from cacheing" that we saw, years ago, when we improved +system performance _immensely_ by adding a mere 16 bytes of cache by +buying serial controller cards with cacheing UUARTs. It is akin to +the way SCSI controllers got pretty big performance improvements by +adding 256 bytes of tagged command cache. +-- +output = ("cbbrowne" "@" "libertyrms.info") + +Christopher Browne +(416) 646 3304 x124 (land) + +From pgsql-performance-owner@postgresql.org Fri Sep 12 19:11:31 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 0AE72D1B51F + for ; + Fri, 12 Sep 2003 22:11:27 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 66745-05 + for ; + Fri, 12 Sep 2003 19:10:57 -0300 (ADT) +Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) + by svr1.postgresql.org (Postfix) with ESMTP id C340FD1B50B + for ; + Fri, 12 Sep 2003 19:10:49 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by mailav.tor1.inquent.com (Postfix) with ESMTP + id ABB4D1025B; Fri, 12 Sep 2003 18:02:28 -0400 (EDT) +Received: from [192.168.1.200] (dyn-133-150.tor.dsl.tht.net [134.22.133.150]) + by mailav.tor1.inquent.com (Postfix) with ESMTP + id 6224110248; Fri, 12 Sep 2003 18:02:26 -0400 (EDT) +Subject: Re: best arrangement of 3 disks for (insert) performance +From: Rod Taylor +To: rj@last.fm +Cc: Christopher Browne , + Postgresql Performance +In-Reply-To: <200309121755.40826.rj@last.fm> +References: <200309121126.29756.rj@last.fm> + <60fzj2t4g6.fsf@dev6.int.libertyrms.info> + <200309121755.40826.rj@last.fm> +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="=-3EHiMyzjO776E21v8YAR" +Message-Id: <1063404674.66070.1.camel@jester> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Fri, 12 Sep 2003 18:11:15 -0400 +X-Virus-Scanned: by AMaViS perl-11 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/212 +X-Sequence-Number: 3578 + +--=-3EHiMyzjO776E21v8YAR +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: quoted-printable + +On Fri, 2003-09-12 at 12:55, Richard Jones wrote: +> The machine is coming from dell, and i have the option of a=20 +> PERC 3/SC RAID Controller (32MB) +> or software raid. +>=20 +> does anyone have any experience of this controller?=20 +> its an additional =A3345 for this controller, i'd be interested to know w= +hat=20 +> people think - my other option is to buy the raid controller separately,= +=20 +> which appeals to me but i wouldnt know what to look for in a raid control= +ler. + +Hardware raid with the write cache, and sell a CPU if necessary to buy +it (don't sell the ram though!). + +--=-3EHiMyzjO776E21v8YAR +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: This is a digitally signed message part + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.3 (FreeBSD) + +iD4DBQA/YkSC6DETLow6vwwRAm0LAJY6W4AoSz8iujsKMVIafMwGGlwSAJ9aU9tP +P6n8GYG1Nf5gleIU1ijdiQ== +=UbsB +-----END PGP SIGNATURE----- + +--=-3EHiMyzjO776E21v8YAR-- + + +From pgsql-performance-owner@postgresql.org Sun Sep 14 01:45:09 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A3C40D1B504 + for ; + Sun, 14 Sep 2003 04:45:05 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 42023-08 + for ; + Sun, 14 Sep 2003 01:44:55 -0300 (ADT) +Received: from internetstaff.com (internetstaff.com [63.214.174.240]) + by svr1.postgresql.org (Postfix) with ESMTP id 63203D1B4F5 + for ; + Sun, 14 Sep 2003 01:44:54 -0300 (ADT) +Received: from spank (ip68-110-79-68.ph.ph.cox.net [68.110.79.68]) + by internetstaff.com (Postfix) with ESMTP id 243A8F6A97 + for ; + Sat, 13 Sep 2003 21:41:55 -0700 (MST) +Subject: Re: best arrangement of 3 disks for (insert) performance +From: Cott Lang +To: pgsql-performance@postgresql.org +In-Reply-To: <60fzj2t4g6.fsf@dev6.int.libertyrms.info> +References: <200309121126.29756.rj@last.fm> + <60fzj2t4g6.fsf@dev6.int.libertyrms.info> +Content-Type: text/plain +Message-Id: <1063514688.27300.11.camel@blackbox> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Sat, 13 Sep 2003 21:44:48 -0700 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/213 +X-Sequence-Number: 3579 + +> Having WAL on a separate drive from the database would be something of +> a win. I'd buy that 1 disk for OS+WAL and then RAID [something] +> across the other two drives for the database would be pretty helpful. + +Just my .02, + +I did a lot of testing before I deployed our ~50GB postgresql databases +with various combinations of 6 15k SCSI drives. I did custom benchmarks +to simulate our applications, I downloaded several benchmarks, etc. + +It might be a fluke, but I never got better performance with WALs on a +different disk than I did with all 6 disks in a 0+1 configuration. +Obviously that's not an option with 3 disks. =) + +I ended up going with that for easier space maintenance. + +Obviously YMMV, benchmark for your own situation. :) + + + +From pgsql-performance-owner@postgresql.org Sun Sep 14 02:40:32 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3635BD1B519 + for ; + Sun, 14 Sep 2003 05:40:31 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 75050-01 + for ; + Sun, 14 Sep 2003 02:40:21 -0300 (ADT) +Received: from internetstaff.com (internetstaff.com [63.214.174.240]) + by svr1.postgresql.org (Postfix) with ESMTP id 22CE6D1B514 + for ; + Sun, 14 Sep 2003 02:40:20 -0300 (ADT) +Received: from spank (ip68-110-79-68.ph.ph.cox.net [68.110.79.68]) + by internetstaff.com (Postfix) with ESMTP id E4D9BF6BBE + for ; + Sat, 13 Sep 2003 22:37:26 -0700 (MST) +Subject: Re: software vs hw hard on linux +From: Cott Lang +To: pgsql-performance@postgresql.org +In-Reply-To: +References: +Content-Type: text/plain +Message-Id: <1063518020.27300.30.camel@blackbox> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Sat, 13 Sep 2003 22:40:20 -0700 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/214 +X-Sequence-Number: 3580 + +On Fri, 2003-09-12 at 07:34, Jeff wrote: + +> What I'm wondering about is what folks experience with software raid vs +> hardware raid on linux is. A friend of mine ran a set of benchmarks at +> work and found sw raid was running obscenely faster than the mylex and +> (some other brand that isn't 3ware) raids.. + +I ended up going with a hybrid: RAID-1 across sets of two disks in +hardware on Adaptec ZCR cards, and RAID-0 across the RAID-1s with Linux +software RAID. + +Although the ZCR (2010 I believe) supports 0+1, using software striping +turned in better performance for me. + +This way, I get brain dead simple dead disk replacement handled by +hardware with some speed from software RAID. + +Also, I would think mirroring on the SCSI controller should take traffic +off the PCI bus... + +I have another machine that's stuck using a Compaq 5i plus controller +with no battery backed write cache, in RAID 5. It sucks. Really bad. I'd +rather use an IDE drive. :) + + + + + + +From pgsql-performance-owner@postgresql.org Mon Sep 15 04:40:42 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 8C3D9D1B4EF + for ; + Mon, 15 Sep 2003 07:40:38 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 13816-05 + for ; + Mon, 15 Sep 2003 04:40:29 -0300 (ADT) +Received: from smtp.pspl.co.in (unknown [202.54.11.65]) + by svr1.postgresql.org (Postfix) with ESMTP id 1BB3FD1B4E5 + for ; + Mon, 15 Sep 2003 04:40:26 -0300 (ADT) +Received: (from root@localhost) + by smtp.pspl.co.in (8.12.9/8.12.9) id h8F7o1M6023053 + for ; Mon, 15 Sep 2003 13:20:01 +0530 +Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) + (authenticated bits=0) + by persistent.co.in (8.12.9/8.12.9) with ESMTP id h8F7o0sv023036 + for ; Mon, 15 Sep 2003 13:20:00 +0530 +From: "Shridhar Daithankar" +To: pgsql-performance@postgresql.org +Date: Mon, 15 Sep 2003 13:12:28 +0530 +MIME-Version: 1.0 +Subject: Re: Attempt at work around of int4 query won't touch int8 index ... +Reply-To: shridhar_daithankar@persistent.co.in +Message-ID: <3F65BABC.32672.38837688@localhost> +In-reply-to: <20901.1063248257@sss.pgh.pa.us> +References: <2756862E-E3F5-11D7-8513-000A9566A412@socialserve.com> +X-mailer: Pegasus Mail for Windows (v4.12a) +Content-type: text/plain; charset=US-ASCII +Content-transfer-encoding: 7BIT +Content-description: Mail message body +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/215 +X-Sequence-Number: 3581 + +On 10 Sep 2003 at 22:44, Tom Lane wrote: + +> James Robinson writes: +> > Is this just a dead end, or is there some variation of this that might +> > possibly work, so that ultimately an undoctored literal number, when +> > applied to an int8 column, could find an index? +> +> I think it's a dead end. What I was playing with this afternoon was +> removing the int8-and-int4 comparison operators from pg_operator. +> It works as far as making "int8col = 42" do the right thing, but I'm +> not sure yet about side-effects. + +Is it possible to follow data type upgrade model in planner? Something like in +C/C++ where data types are promoted upwards to find out better plan? + +int2->int4->int8->float4->float8 types. + + That could be a clean solution.. + +just a thought.. + +Bye + Shridhar + +-- +Hlade's Law: If you have a difficult task, give it to a lazy person -- they +will find an easier way to do it. + + +From pgsql-general-owner@postgresql.org Mon Sep 15 05:05:21 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 4566BD1B4F9 + for ; + Mon, 15 Sep 2003 08:05:20 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 13816-08 + for ; + Mon, 15 Sep 2003 05:05:11 -0300 (ADT) +Received: from lakemtao04.cox.net (lakemtao04.cox.net [68.1.17.241]) + by svr1.postgresql.org (Postfix) with ESMTP id 35BA7D1B4EF + for ; + Mon, 15 Sep 2003 05:05:09 -0300 (ADT) +Received: from lhosts ([68.11.66.83]) by lakemtao04.cox.net + (InterMail vM.5.01.06.05 201-253-122-130-105-20030824) with ESMTP + id <20030915080511.ZLHA29227.lakemtao04.cox.net@lhosts> + for ; Mon, 15 Sep 2003 04:05:11 -0400 +Subject: Re: [PERFORM] best arrangement of 3 disks for (insert) performance +From: Ron Johnson +To: PgSQL General ML +In-Reply-To: <1063514688.27300.11.camel@blackbox> +References: <200309121126.29756.rj@last.fm> + <60fzj2t4g6.fsf@dev6.int.libertyrms.info> + <1063514688.27300.11.camel@blackbox> +Content-Type: text/plain +Message-Id: <1063613110.11739.1190.camel@haggis> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Mon, 15 Sep 2003 03:05:10 -0500 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/958 +X-Sequence-Number: 49178 + +On Sat, 2003-09-13 at 23:44, Cott Lang wrote: +> > Having WAL on a separate drive from the database would be something of +> > a win. I'd buy that 1 disk for OS+WAL and then RAID [something] +> > across the other two drives for the database would be pretty helpful. +> +> Just my .02, +> +> I did a lot of testing before I deployed our ~50GB postgresql databases +> with various combinations of 6 15k SCSI drives. I did custom benchmarks +> to simulate our applications, I downloaded several benchmarks, etc. +> +> It might be a fluke, but I never got better performance with WALs on a +> different disk than I did with all 6 disks in a 0+1 configuration. +> Obviously that's not an option with 3 disks. =) + +Interesting. Where did you put the OS, and what kind of, and how +many, SCSI controllers did you have? + +PCI 32bit/33MHz or 64bit/66MHz PCI? 32bit/33MHz PCI has a max +throughput of 132MB/s, which is 60% smaller than the theoretical +bandwidth of U320 SCSI, so maybe you were saturating the PCI bus, +and that's why a separate WAL didn't show any improvement? + +(If the WAL ever becomes the vehicle for PITR, then it will have +to be on a separate disk [and preferably a separate controller], +even if it slows performance.) + +-- +----------------------------------------------------------------- +Ron Johnson, Jr. ron.l.johnson@cox.net +Jefferson, LA USA + +"Eternal vigilance is the price of liberty: power is ever +stealing from the many to the few. The manna of popular liberty +must be gathered each day, or it is rotten... The hand entrusted +with power becomes, either from human depravity or esprit de +corps, the necessary enemy of the people. Only by continual +oversight can the democrat in office be prevented from hardening +into a despot: only by unintermitted agitation can a people be +kept sufficiently awake to principle not to let liberty be +smothered in material prosperity... Never look, for an age when +the people can be quiet and safe. At such times despotism, like +a shrouding mist, steals over the mirror of Freedom" +Wendell Phillips + + +From pgsql-general-owner@postgresql.org Mon Sep 15 11:42:01 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id BB418D1B4F1 + for ; + Mon, 15 Sep 2003 14:41:58 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 83770-04 + for ; + Mon, 15 Sep 2003 11:41:30 -0300 (ADT) +Received: from internetstaff.com (internetstaff.com [63.214.174.240]) + by svr1.postgresql.org (Postfix) with ESMTP id 251A9D1B4EE + for ; + Mon, 15 Sep 2003 11:41:26 -0300 (ADT) +Received: from spank (ip68-110-79-68.ph.ph.cox.net [68.110.79.68]) + by internetstaff.com (Postfix) with ESMTP id 61261F6C0A + for ; + Mon, 15 Sep 2003 07:38:18 -0700 (MST) +Subject: Re: [PERFORM] best arrangement of 3 disks for (insert) +From: Cott Lang +To: pgsql-general@postgresql.org +In-Reply-To: <1063613110.11739.1190.camel@haggis> +References: <200309121126.29756.rj@last.fm> + <60fzj2t4g6.fsf@dev6.int.libertyrms.info> + <1063514688.27300.11.camel@blackbox> + <1063613110.11739.1190.camel@haggis> +Content-Type: text/plain +Message-Id: <1063636871.17237.28.camel@blackbox> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Mon, 15 Sep 2003 07:41:11 -0700 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/969 +X-Sequence-Number: 49189 + +On Mon, 2003-09-15 at 01:05, Ron Johnson wrote: + +> Interesting. Where did you put the OS, and what kind of, and how +> many, SCSI controllers did you have? + +I ended up with the OS on the same volume, since it didn't seem to make +any difference. I'm using a SuperMicro 6023P chassis with an Adaptec +2010S ZCR controller (64bit/66mhz). + +I wouldn't recommend SuperMicro to anyone else at this point because +instead of hooking up both U320 channels to the 6 drive backplane, they +only hook up one. Half the bandwidth, no redundancy. I already had a +burp on the SCSI channel during a single drive death take out one box. +:( + +> (If the WAL ever becomes the vehicle for PITR, then it will have +> to be on a separate disk [and preferably a separate controller], +> even if it slows performance.) + +Well, it won't have to... but it's certainly a good idea. :) + +If we ever get PITR, I'll be so happy I won't mind rebuilding my boxes, +and hopefully I'll have a better budget at that point. ;^) + +BTW, I didn't get WORSE performance with the WALs on separate disks, it +just wasn't any better. Unfortunately I lost the spreadsheet I had all +my results in, so I can't be any more specific. + + + +From pgsql-performance-owner@postgresql.org Mon Sep 15 16:16:36 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 9A494D1B501 + for ; + Mon, 15 Sep 2003 19:16:33 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 32501-05 + for ; + Mon, 15 Sep 2003 16:16:02 -0300 (ADT) +Received: from yertle.kcilink.com (yertle.kcilink.com [216.194.193.105]) + by svr1.postgresql.org (Postfix) with ESMTP id 9C7F4D1B4F1 + for ; + Mon, 15 Sep 2003 16:16:00 -0300 (ADT) +Received: by yertle.kcilink.com (Postfix, from userid 100) + id B71522178C; Mon, 15 Sep 2003 15:15:46 -0400 (EDT) +From: Vivek Khera +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +Message-ID: <16230.4066.565194.387700@yertle.int.kciLink.com> +Date: Mon, 15 Sep 2003 15:15:46 -0400 +To: pgsql-performance@postgresql.org +Subject: restore time: sort_mem vs. checkpoing_segments +X-Mailer: VM 7.14 under 21.4 (patch 12) "Portable Code" XEmacs Lucid +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/216 +X-Sequence-Number: 3582 + +And the winner is... checkpoint_segments. + +Restore of a significanly big database (~19.8GB restored) shows nearly +no time difference depending on sort_mem when checkpoint_segments is +large. There are quite a number of tables and indexes. The restore +was done from a pg_dump -Fc dump of one database. + +All tests with 16KB page size, 30k shared buffers, sort_mem=8192, PG +7.4b2 on FreeBSD 4.8. + +3 checkpoint_segments restore time: 14983 seconds +50 checkpoint_segments restore time: 11537 seconds +50 checkpoint_segments, sort_mem 131702 restore time: 11262 seconds + +There's an initdb between each test. + +For reference, the restore with 8k page size, 60k buffers, 8192 +sort_mem and 3 checkpoint buffers was 14777 seconds. + +It seems for restore that a larger number of checkpoint buffers is the +key, especially when dealing with large numbers of rows in a table. + +I notice during the restore that the disk throughput triples during +the checkpoint. + +The postgres data partition is on a 14-spindle hardware RAID5 on U320 +SCSI disks. + +From pgsql-performance-owner@postgresql.org Mon Sep 15 17:56:37 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A272CD1B4E5 + for ; + Mon, 15 Sep 2003 20:56:35 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 32499-10 + for ; + Mon, 15 Sep 2003 17:56:24 -0300 (ADT) +Received: from svr4.postgresql.org (svr4.postgresql.org [64.117.224.192]) + by svr1.postgresql.org (Postfix) with ESMTP id 1D244D1B4F2 + for ; + Mon, 15 Sep 2003 17:56:22 -0300 (ADT) +Received: from 64.117.224.192 (unknown [209.120.141.58]) + by svr4.postgresql.org (Postfix) with SMTP id 826911CB4675 + for ; + Mon, 15 Sep 2003 20:56:19 +0000 (GMT) +Received: from [78.123.235.177] by 64.117.224.192 id <2402354-78186>; + Tue, 16 Sep 2003 00:54:18 +0400 +Message-ID: +From: "Womens Breakthrough" +Reply-To: "Womens Breakthrough" +To: +Subject: L|p Treatment that makes your L|ps PLUMP +Date: Tue, 16 Sep 2003 00:54:18 +0400 +X-Mailer: CTMailer v2.0 +X-Info-Mailx: kthjoDkviulinzmxvBklhgtivhjoClit +MIME-Version: 1.0 +X-Priority: 3 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=3.4 tagged_above=0.0 required=5.0 tests=BAYES_60, + HTML_70_80, HTML_IMAGE_RATIO_08, HTML_WEB_BUGS, MIME_HTML_ONLY, + RCVD_IN_OSIRUSOFT_COM +X-Spam-Level: *** +Content-Transfer-Encoding: quoted-printable +Content-Type: text/html; +X-Archive-Number: 200309/217 +X-Sequence-Number: 3583 + +FINALLY A LIP PLUMPER THAT ACTUALLY WORKS !!! + +
+
+ +
+
+Get Plump, Sexy Lip's
In Und= +er 30 Days!
+

+ +
visit w= +ebsite

+ + + + + + + + +
+CITY LIP'S exclusive lip treatment...
>Stimulates c= +ollagen & hyaluronic moisture in your lip's resulting in BIGGER, LUSCIOUS, more SENSUOUS Lip's<= +/span>
>CITY LIP'S is used = +by men & women in 34 countries. Recommended by Plast= +ic Surgeons, Celebrities, & Movie Stars= +
> CITY LIP'S super-hydrating formula plumps &= +amp; reduces unattractive lip wr= +inkles & fine lines
> Easy to use, completely = +pain-free and GUARANTEED to work in 30 day= +s or your MONEY BACK!

+

Be the envy of all your friends!

+

retail $47.95
+ONLINE SALE $24.76
you save: = +$23.19 (48% OFF)
+ ~> BUY 2 GET 1 FREE <~

+ + + + +
+ + +
buy nowvisit website
customer= + ratings:
+
+

Women love beauty tips, forward this = +to a friend!



+

Distributors Welcome!

+ +
+

 

 

 

+ + +From pgsql-performance-owner@postgresql.org Mon Sep 15 18:22:36 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 684E5D1B4F1 + for ; + Mon, 15 Sep 2003 21:22:33 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 36020-03 + for ; + Mon, 15 Sep 2003 18:22:02 -0300 (ADT) +Received: from merlin (merlin.warpdrive.net [24.56.130.4]) + by svr1.postgresql.org (Postfix) with ESMTP id 3A1C4D1B4EE + for ; + Mon, 15 Sep 2003 18:22:00 -0300 (ADT) +Received: from mail.warpdrive.net ([24.56.130.6] helo=mail.vetstar.com) + by merlin with esmtp (Exim 4.14) id 19z0n5-0002fc-HT + for pgsql-performance@postgresql.org; Mon, 15 Sep 2003 17:21:47 -0400 +Received: from sirius.vetstar.com [66.88.86.217] by mail.vetstar.com with + ESMTP + (SMTPD32-8.02) id AD3C17B00AA; Mon, 15 Sep 2003 17:21:00 -0400 +Message-Id: <5.1.0.14.2.20030915172334.00b1fe48@mail.vetstar.com> +X-Sender: jbove@vetstar.com@mail.vetstar.com +X-Mailer: QUALCOMM Windows Eudora Version 5.1 +Date: Mon, 15 Sep 2003 17:34:12 -0400 +To: pgsql-performance@postgresql.org +From: Joseph Bove +Subject: Inconsistent performance +Mime-Version: 1.0 +Content-Type: text/plain; charset="us-ascii"; format=flowed +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/218 +X-Sequence-Number: 3584 + +To whoever can assist, + +I am working with a decent sized database on an extremely powerful machine. +The specs follow: + + OS: RedHat Linux 9.0 + PG Version 7.3 + Memory 1 gig + CPU Quad Processor - Unsure of exact CPUs + Hard Drive 80 gigs + Database Size 2 gigs + + +As you can see the server is built for overkill. + +The problem that I see is as follows. + +I do a rather simple query: select count (*) from large-table where column += some value; + +About 80% of the time, the response time is sub-second. However, at 10% of +the time, the response time is 5 - 10 seconds. + +This is nothing readily apparent at the system level that comes close to +explaining the performance hits. CPU and memory usage (as measured by top) +appear to be fine. + +Although there are certain tuning issues within the database itself, no +documentation I have seen seems to indicate that tuning issues would lead +to such inconsistent response time. + +Any ideas? + +Regards, + +Joseph + + +From pgsql-performance-owner@postgresql.org Mon Sep 15 18:35:41 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C806DD1B4F2 + for ; + Mon, 15 Sep 2003 21:35:37 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 35756-09 + for ; + Mon, 15 Sep 2003 18:35:04 -0300 (ADT) +Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) + by svr1.postgresql.org (Postfix) with ESMTP id 79B01D1B4EE + for ; + Mon, 15 Sep 2003 18:35:02 -0300 (ADT) +Received: by megazone.bigpanda.com (Postfix, from userid 1001) + id 69F6E35244; Mon, 15 Sep 2003 14:34:49 -0700 (PDT) +Received: from localhost (localhost [127.0.0.1]) + by megazone.bigpanda.com (Postfix) with ESMTP + id 68D5635240; Mon, 15 Sep 2003 14:34:49 -0700 (PDT) +Date: Mon, 15 Sep 2003 14:34:49 -0700 (PDT) +From: Stephan Szabo +To: Joseph Bove +Cc: pgsql-performance@postgresql.org +Subject: Re: Inconsistent performance +In-Reply-To: <5.1.0.14.2.20030915172334.00b1fe48@mail.vetstar.com> +Message-ID: <20030915143308.S75006@megazone.bigpanda.com> +References: <5.1.0.14.2.20030915172334.00b1fe48@mail.vetstar.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/219 +X-Sequence-Number: 3585 + +On Mon, 15 Sep 2003, Joseph Bove wrote: + +> I am working with a decent sized database on an extremely powerful machine. +> The specs follow: +> +> OS: RedHat Linux 9.0 +> PG Version 7.3 +> Memory 1 gig +> CPU Quad Processor - Unsure of exact CPUs +> Hard Drive 80 gigs +> Database Size 2 gigs +> +> +> As you can see the server is built for overkill. +> +> The problem that I see is as follows. +> +> I do a rather simple query: select count (*) from large-table where column +> = some value; +> +> About 80% of the time, the response time is sub-second. However, at 10% of +> the time, the response time is 5 - 10 seconds. + +Is it consistant for various values of "some value"? If so, it's possible +that it's switching plans based on the apparent selectivity of the column +for that value. + +From pgsql-performance-owner@postgresql.org Mon Sep 15 18:36:28 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 1842FD1B510 + for ; + Mon, 15 Sep 2003 21:36:22 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 42490-07 + for ; + Mon, 15 Sep 2003 18:35:52 -0300 (ADT) +Received: from wolff.to (wolff.to [66.93.249.74]) + by svr1.postgresql.org (Postfix) with SMTP id 487C5D1B4E5 + for ; + Mon, 15 Sep 2003 18:35:49 -0300 (ADT) +Received: (qmail 17665 invoked by uid 500); 15 Sep 2003 21:42:28 -0000 +Date: Mon, 15 Sep 2003 16:42:28 -0500 +From: Bruno Wolff III +To: Joseph Bove +Cc: pgsql-performance@postgresql.org +Subject: Re: Inconsistent performance +Message-ID: <20030915214228.GA17642@wolff.to> +Mail-Followup-To: Joseph Bove , + pgsql-performance@postgresql.org +References: <5.1.0.14.2.20030915172334.00b1fe48@mail.vetstar.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <5.1.0.14.2.20030915172334.00b1fe48@mail.vetstar.com> +User-Agent: Mutt/1.5.4i +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/220 +X-Sequence-Number: 3586 + +On Mon, Sep 15, 2003 at 17:34:12 -0400, + Joseph Bove wrote: +> +> I do a rather simple query: select count (*) from large-table where column +> = some value; +> +> About 80% of the time, the response time is sub-second. However, at 10% of +> the time, the response time is 5 - 10 seconds. +> +> This is nothing readily apparent at the system level that comes close to +> explaining the performance hits. CPU and memory usage (as measured by top) +> appear to be fine. +> +> Although there are certain tuning issues within the database itself, no +> documentation I have seen seems to indicate that tuning issues would lead +> to such inconsistent response time. + +Looking at the output from explain analyze for the query would be useful. +It may be that there are a lot of rows that have the value in the problem +queries. + +From pgsql-performance-owner@postgresql.org Mon Sep 15 18:44:50 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 031BFD1B50E + for ; + Mon, 15 Sep 2003 21:44:49 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 45603-01 + for ; + Mon, 15 Sep 2003 18:44:36 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id 07567D1B4EE + for ; + Mon, 15 Sep 2003 18:44:34 -0300 (ADT) +Received: from [66.219.92.2] (HELO temoku) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3643770; Mon, 15 Sep 2003 14:45:06 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Vivek Khera , pgsql-performance@postgresql.org +Subject: Re: restore time: sort_mem vs. checkpoing_segments +Date: Mon, 15 Sep 2003 14:42:59 -0700 +User-Agent: KMail/1.4.3 +References: <16230.4066.565194.387700@yertle.int.kciLink.com> +In-Reply-To: <16230.4066.565194.387700@yertle.int.kciLink.com> +MIME-Version: 1.0 +Content-Transfer-Encoding: quoted-printable +Message-Id: <200309151442.59523.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/221 +X-Sequence-Number: 3587 + +Vivek, + +> And the winner is... checkpoint_segments. +>=20 +> Restore of a significanly big database (~19.8GB restored) shows nearly +> no time difference depending on sort_mem when checkpoint_segments is +> large. There are quite a number of tables and indexes. The restore +> was done from a pg_dump -Fc dump of one database. + +Cool! Thank you for posting this. + +--=20 +-Josh Berkus + Aglio Database Solutions + San Francisco + + +From pgsql-performance-owner@postgresql.org Mon Sep 15 19:16:59 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id AAEB1D1B4F0 + for ; + Mon, 15 Sep 2003 22:16:57 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 44922-09 + for ; + Mon, 15 Sep 2003 19:16:48 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id D1A19D1B527 + for ; + Mon, 15 Sep 2003 19:16:43 -0300 (ADT) +Received: from [66.219.92.2] (HELO temoku) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3643867; Mon, 15 Sep 2003 15:17:17 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Joseph Bove , pgsql-performance@postgresql.org +Subject: Re: Inconsistent performance +Date: Mon, 15 Sep 2003 15:15:09 -0700 +User-Agent: KMail/1.4.3 +References: <5.1.0.14.2.20030915182422.00a8a2d8@mail.vetstar.com> +In-Reply-To: <5.1.0.14.2.20030915182422.00a8a2d8@mail.vetstar.com> +MIME-Version: 1.0 +Content-Transfer-Encoding: quoted-printable +Message-Id: <200309151515.09835.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/223 +X-Sequence-Number: 3589 + +Joseph, + +Please see this web page before posting anything else: +http://techdocs.postgresql.org/guides/SlowQueryPostingGuidelines + +Currently, you are not posting enough data for anyone to be of meaningful= +=20 +help. + +--=20 +-Josh Berkus + Aglio Database Solutions + San Francisco + + +From pgsql-performance-owner@postgresql.org Mon Sep 15 20:39:37 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 853F2D1B510 + for ; + Mon, 15 Sep 2003 23:39:36 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 64092-10 + for ; + Mon, 15 Sep 2003 20:39:08 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 88581D1B532 + for ; + Mon, 15 Sep 2003 20:39:05 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h8FNd5sl048358 + for ; Mon, 15 Sep 2003 23:39:05 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h8FN9xqq044408 + for pgsql-performance@postgresql.org; Mon, 15 Sep 2003 23:09:59 GMT +From: Christopher Browne +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: Inconsistent performance +Date: Mon, 15 Sep 2003 18:18:50 -0400 +Organization: Hub.Org Networking Services +Lines: 32 +Message-ID: <60d6e1lmph.fsf@dev6.int.libertyrms.info> +References: <5.1.0.14.2.20030915172334.00b1fe48@mail.vetstar.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@news.hub.org +User-Agent: Gnus/5.1003 (Gnus v5.10.3) XEmacs/21.4 (Rational FORTRAN, linux) +Cancel-Lock: sha1:dqFxijw7WzYpZSBX4n94KN+o/Hg= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/226 +X-Sequence-Number: 3592 + +jbove@vetstar.com (Joseph Bove) writes: +> I do a rather simple query: select count (*) from large-table where +> column = some value; +> +> About 80% of the time, the response time is sub-second. However, at +> 10% of the time, the response time is 5 - 10 seconds. + +Does it seem data-dependent? + +That is, does the time vary for different values of "some value?" + +If a particular value is particularly common, the system might well +revert to a sequential scan, making the assumption that it is quicker +to look at every page in the table rather than to walk through +Enormous Numbers of records. + +I had a case very similar to this where a table had _incredible_ +skewing of this sort where there were a small number of column values +that occurred hundreds of thousands of times, and other column values +only occurred a handful of times. + +I was able to get Excellent Performance back by setting up two partial +indices: + - One for WHERE THIS_COLUMN > VITAL_VALUE; + - One for WHERE THIS_COLUMN < VITAL_VALUE; + +The REALLY COMMON values were in the range < VITAL_VALUE. +-- +output = ("cbbrowne" "@" "libertyrms.info") + +Christopher Browne +(416) 646 3304 x124 (land) + +From pgsql-performance-owner@postgresql.org Mon Sep 15 19:12:12 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 03B92D1B4F0 + for ; + Mon, 15 Sep 2003 22:12:10 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 46763-03 + for ; + Mon, 15 Sep 2003 19:12:01 -0300 (ADT) +Received: from merlin (merlin.warpdrive.net [24.56.130.4]) + by svr1.postgresql.org (Postfix) with ESMTP id 0FA73D1B522 + for ; + Mon, 15 Sep 2003 19:11:59 -0300 (ADT) +Received: from mail.warpdrive.net ([24.56.130.6] helo=mail.vetstar.com) + by merlin with esmtp (Exim 4.14) id 19z1Zh-0003e1-W4 + for pgsql-performance@postgresql.org; Mon, 15 Sep 2003 18:12:01 -0400 +Received: from sirius.vetstar.com [66.88.86.217] by mail.vetstar.com with + ESMTP + (SMTPD32-8.02) id A90233B00A6; Mon, 15 Sep 2003 18:11:14 -0400 +Message-Id: <5.1.0.14.2.20030915182422.00a8a2d8@mail.vetstar.com> +X-Sender: jbove@vetstar.com@mail.vetstar.com +X-Mailer: QUALCOMM Windows Eudora Version 5.1 +Date: Mon, 15 Sep 2003 18:24:27 -0400 +To: pgsql-performance@postgresql.org +From: Joseph Bove +Subject: Re: Inconsistent performance +Mime-Version: 1.0 +Content-Type: text/plain; charset="us-ascii"; format=flowed +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/222 +X-Sequence-Number: 3588 + +Stephan, + +Actually, it's inconsistent with the exact same command. I've now +replicated the problem by doing the following command: + +select count (*) from table; + +The table in question has 88899 rows. + +The response time is anywhere from 1 second to 12 seconds. Different +response times can occur in the same minute of testing! + +Regards, + +Joseph + + + +At 02:34 PM 9/15/2003 -0700, you wrote: +>On Mon, 15 Sep 2003, Joseph Bove wrote: +> +> > I am working with a decent sized database on an extremely powerful machine. +> > The specs follow: +> > +> > OS: RedHat Linux 9.0 +> > PG Version 7.3 +> > Memory 1 gig +> > CPU Quad Processor - Unsure of exact CPUs +> > Hard Drive 80 gigs +> > Database Size 2 gigs +> > +> > +> > As you can see the server is built for overkill. +> > +> > The problem that I see is as follows. +> > +> > I do a rather simple query: select count (*) from large-table where column +> > = some value; +> > +> > About 80% of the time, the response time is sub-second. However, at 10% of +> > the time, the response time is 5 - 10 seconds. +> +>Is it consistant for various values of "some value"? If so, it's possible +>that it's switching plans based on the apparent selectivity of the column +>for that value. + + + +From pgsql-performance-owner@postgresql.org Mon Sep 15 19:49:43 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DFE8ED1B535 + for ; + Mon, 15 Sep 2003 22:49:41 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 53755-04 + for ; + Mon, 15 Sep 2003 19:49:11 -0300 (ADT) +Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) + by svr1.postgresql.org (Postfix) with ESMTP id 4B8B1D1B52B + for ; + Mon, 15 Sep 2003 19:49:08 -0300 (ADT) +Received: by megazone.bigpanda.com (Postfix, from userid 1001) + id 820D33521D; Mon, 15 Sep 2003 15:49:10 -0700 (PDT) +Received: from localhost (localhost [127.0.0.1]) + by megazone.bigpanda.com (Postfix) with ESMTP + id 80F1F3520B; Mon, 15 Sep 2003 15:49:10 -0700 (PDT) +Date: Mon, 15 Sep 2003 15:49:10 -0700 (PDT) +From: Stephan Szabo +To: Joseph Bove +Cc: pgsql-performance@postgresql.org +Subject: Re: Inconsistent performance +In-Reply-To: <5.1.0.14.2.20030915182422.00a8a2d8@mail.vetstar.com> +Message-ID: <20030915154131.I76677@megazone.bigpanda.com> +References: <5.1.0.14.2.20030915182422.00a8a2d8@mail.vetstar.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/224 +X-Sequence-Number: 3590 + + +On Mon, 15 Sep 2003, Joseph Bove wrote: + +> Stephan, +> +> Actually, it's inconsistent with the exact same command. I've now +> replicated the problem by doing the following command: +> +> select count (*) from table; +> +> The table in question has 88899 rows. +> +> The response time is anywhere from 1 second to 12 seconds. Different +> response times can occur in the same minute of testing! + +Well, that's really only got one valid plan right now (seqscan and +aggregate). It'd be mildly interesting to see what explain analyze says in +slow and fast states, although I'd be willing to bet that it's just going +to effectively show that the seqscan is taking more or less time. + +I think we're going to need to see the configuration settings for the +server and possibly some info on how big the table is (say relpages for +the pg_class row associated with the table after a vacuum full). + +From pgsql-performance-owner@postgresql.org Mon Sep 15 20:16:24 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C51EDD1B4F6 + for ; + Mon, 15 Sep 2003 23:16:22 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 56977-04 + for ; + Mon, 15 Sep 2003 20:16:14 -0300 (ADT) +Received: from merlin (merlin.warpdrive.net [24.56.130.4]) + by svr1.postgresql.org (Postfix) with ESMTP id 93321D1B520 + for ; + Mon, 15 Sep 2003 20:16:11 -0300 (ADT) +Received: from mail.warpdrive.net ([24.56.130.6] helo=mail.vetstar.com) + by merlin with esmtp (Exim 4.14) id 19z2Zr-0004h5-1I + for pgsql-performance@postgresql.org; Mon, 15 Sep 2003 19:16:15 -0400 +Received: from sirius.vetstar.com [66.88.86.217] by mail.vetstar.com with + ESMTP + (SMTPD32-8.02) id A80F42E00A6; Mon, 15 Sep 2003 19:15:27 -0400 +Message-Id: <5.1.0.14.2.20030915191708.00a6a0d8@mail.vetstar.com> +X-Sender: jbove@vetstar.com@mail.vetstar.com +X-Mailer: QUALCOMM Windows Eudora Version 5.1 +Date: Mon, 15 Sep 2003 19:28:40 -0400 +To: pgsql-performance@postgresql.org +From: Joseph Bove +Subject: Re: Inconsistent performance +In-Reply-To: <20030915154131.I76677@megazone.bigpanda.com> +References: <5.1.0.14.2.20030915182422.00a8a2d8@mail.vetstar.com> + <5.1.0.14.2.20030915182422.00a8a2d8@mail.vetstar.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset="us-ascii"; format=flowed +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/225 +X-Sequence-Number: 3591 + +Stephan, + +I've run explain analyze a number of times and have gotten results between +5.5 and 7.5 seconds + +Attached is a typical output + + QUERY PLAN +------------------------------------- + Aggregate (cost=9993.92..9993.92 rows=1 width=0) + (actual time=7575.59..7575.59 rows=1 loops=1) +-> Seq Scan on vetapview (cost=0.00..9771.34 rows=89034 width=0) + (actual time=0.06..7472.20 +rows=88910 loops=1) + Total runtime: 7575.67 msec +(3 rows) + +The only things changing are the actual time. The costs are constant. + +The relpages from pg_class for vetapview (the table in question) is 8881. + +At the end of this message is the exhaustive contents of postgresql.conf. +The only settings I have attempted tuning are as follows: + +tcpip_socket = true +max_connections = 100 +shared_buffers = 5000 +sort_mem = 8192 +fsync = false + +I did have shared_buffers and sort_mem both set higher originally (15000, +32168) but decreased them in case over-utilization of memory was the problem. + +The kernel setting shmmax is set to 256,000,000 (out of 1 gig) + +Regards, + +Joseph + +postgresql.conf + +# +# Connection Parameters +# +tcpip_socket = true +#ssl = false + +max_connections = 100 +#superuser_reserved_connections = 2 + +#port = 5432 +#hostname_lookup = false +#show_source_port = false + +#unix_socket_directory = '' +#unix_socket_group = '' +#unix_socket_permissions = 0777 # octal + +#virtual_host = '' + +#krb_server_keyfile = '' + + +# +# Shared Memory Size +# +#shared_buffers = 15000 # min max_connections*2 or 16, 8KB each +shared_buffers = 5000 +#max_fsm_relations = 1000 # min 10, fsm is free space map, ~40 bytes +#max_fsm_pages = 10000 # min 1000, fsm is free space map, ~6 bytes +#max_locks_per_transaction = 64 # min 10 +#wal_buffers = 8 # min 4, typically 8KB each + +# +# Non-shared Memory Sizes +# +#sort_mem = 32168 # min 64, size in KB +sort_mem = 8192 +#vacuum_mem = 8192 # min 1024, size in KB +# + +# Write-ahead log (WAL) +# +#checkpoint_segments = 3 # in logfile segments, min 1, 16MB each +#checkpoint_timeout = 300 # range 30-3600, in seconds +# +#commit_delay = 0 # range 0-100000, in microseconds +#commit_siblings = 5 # range 1-1000 +# +fsync = false +#wal_sync_method = fsync # the default varies across platforms: +# # fsync, fdatasync, open_sync, or open_datasync +#wal_debug = 0 # range 0-16 + + +# +# Optimizer Parameters +# +#enable_seqscan = true +#enable_indexscan = true +#enable_tidscan = true +#enable_sort = true#enable_tidscan = true +#enable_sort = true +#enable_nestloop = true +#enable_mergejoin = true +#enable_hashjoin = true + +#effective_cache_size = 1000 # typically 8KB each +#random_page_cost = 4 # units are one sequential page fetch cost +#cpu_tuple_cost = 0.01 # (same) +#cpu_index_tuple_cost = 0.001 # (same) +#cpu_operator_cost = 0.0025 # (same) + +#default_statistics_target = 10 # range 1-1000 + +# +# GEQO Optimizer Parameters +# +#geqo = true +#geqo_selection_bias = 2.0 # range 1.5-2.0 +#geqo_threshold = 11 +#geqo_pool_size = 0 # default based on tables in statement, + # range 128-1024 +#geqo_effort = 1 +#geqo_generations = 0#geqo_random_seed = -1 # auto-compute seed + + +# +# Message display +# +#server_min_messages = notice # Values, in order of decreasing detail: + # debug5, debug4, debug3, debug2, debug1, + # info, notice, warning, error, log, fatal, + # panic +#client_min_messages = notice # Values, in order of decreasing detail: + # debug5, debug4, debug3, debug2, debug1, + # log, info, notice, warning, error +#silent_mode = false + +#log_connections = false +#log_pid = false +#log_statement = false +#log_duration = false +#log_timestamp = false + +#log_min_error_statement = error # Values in order of increasing severity: + +#log_min_error_statement = error # Values in order of increasing severity: + # debug5, debug4, debug3, debug2, debug1, + # info, notice, warning, error, panic(off) + +#debug_print_parse = false +#debug_print_rewritten = false +#debug_print_plan = false +#debug_pretty_print = false + +#explain_pretty_print = true + +# requires USE_ASSERT_CHECKING +#debug_assertions = true + + +# +# Syslog +# +#syslog = 0 # range 0-2 +#syslog_facility = 'LOCAL0' +#syslog_ident = 'postgres' + +# + +# Statistics +# +#show_parser_stats = false +#show_planner_stats = false +#show_executor_stats = false +#show_statement_stats = false + +# requires BTREE_BUILD_STATS +#show_btree_build_stats = false + + +# +# Access statistics collection +# +#stats_start_collector = true +#stats_reset_on_server_start = true +#stats_command_string = false +#stats_row_level = false +#stats_block_level = false + +# + +# Lock Tracing +# +#trace_notify = false + +# requires LOCK_DEBUG +#trace_locks = false +#trace_userlocks = false +#trace_lwlocks = false +#debug_deadlocks = false +#trace_lock_oidmin = 16384 +#trace_lock_table = 0 + + +# +# Misc +# +#autocommit = true +#dynamic_library_path = '$libdir' +#search_path = '$user,public' +#datestyle = 'iso, us' +#timezone = unknown # actually, defaults to TZ environment setting +#datestyle = 'iso, us' +#timezone = unknown # actually, defaults to TZ environment setting +#australian_timezones = false +#client_encoding = sql_ascii # actually, defaults to database encoding +#authentication_timeout = 60 # 1-600, in seconds +#deadlock_timeout = 1000 # in milliseconds +#default_transaction_isolation = 'read committed' +#max_expr_depth = 10000 # min 10 +#max_files_per_process = 1000 # min 25 +#password_encryption = true +#sql_inheritance = true +#transform_null_equals = false +#statement_timeout = 0 # 0 is disabled, in milliseconds +#db_user_namespace = false + + + +# +# Locale settings +# +# (initialized by initdb -- may be changed) +LC_MESSAGES = 'en_US.UTF-8' +LC_MONETARY = 'en_US.UTF-8' +LC_NUMERIC = 'en_US.UTF-8' +LC_TIME = 'en_US.UTF-8' + +At 03:49 PM 9/15/2003 -0700, Stephan Szabo wrote: + +>On Mon, 15 Sep 2003, Joseph Bove wrote: +> +> > Stephan, +> > +> > Actually, it's inconsistent with the exact same command. I've now +> > replicated the problem by doing the following command: +> > +> > select count (*) from table; +> > +> > The table in question has 88899 rows. +> > +> > The response time is anywhere from 1 second to 12 seconds. Different +> > response times can occur in the same minute of testing! +> +>Well, that's really only got one valid plan right now (seqscan and +>aggregate). It'd be mildly interesting to see what explain analyze says in +>slow and fast states, although I'd be willing to bet that it's just going +>to effectively show that the seqscan is taking more or less time. +> +>I think we're going to need to see the configuration settings for the +>server and possibly some info on how big the table is (say relpages for +>the pg_class row associated with the table after a vacuum full). +> +>---------------------------(end of broadcast)--------------------------- +>TIP 6: Have you searched our list archives? +> +> http://archives.postgresql.org + + + +From pgsql-performance-owner@postgresql.org Mon Sep 15 21:27:02 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 67BEDD1B4F0 + for ; + Tue, 16 Sep 2003 00:26:58 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 67945-04 + for ; + Mon, 15 Sep 2003 21:26:29 -0300 (ADT) +Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) + by svr1.postgresql.org (Postfix) with ESMTP id 29346D1B4E5 + for ; + Mon, 15 Sep 2003 21:26:22 -0300 (ADT) +Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) + by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h8G0PsMc026809; + Mon, 15 Sep 2003 18:25:54 -0600 (MDT) +Date: Mon, 15 Sep 2003 18:22:34 -0600 (MDT) +From: "scott.marlowe" +To: Joseph Bove +Cc: +Subject: Re: Inconsistent performance +In-Reply-To: <5.1.0.14.2.20030915191708.00a6a0d8@mail.vetstar.com> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-IHS-MailScanner: Found to be clean +X-IHS-MailScanner-SpamCheck: +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/227 +X-Sequence-Number: 3593 + +On Mon, 15 Sep 2003, Joseph Bove wrote: + +> Stephan, +> +> I've run explain analyze a number of times and have gotten results between +> 5.5 and 7.5 seconds +> +> Attached is a typical output +> +> QUERY PLAN +> ------------------------------------- +> Aggregate (cost=9993.92..9993.92 rows=1 width=0) +> (actual time=7575.59..7575.59 rows=1 loops=1) +> -> Seq Scan on vetapview (cost=0.00..9771.34 rows=89034 width=0) +> (actual time=0.06..7472.20 +> rows=88910 loops=1) +> Total runtime: 7575.67 msec +> (3 rows) +> +> The only things changing are the actual time. The costs are constant. +> +> The relpages from pg_class for vetapview (the table in question) is 8881. +> +> At the end of this message is the exhaustive contents of postgresql.conf. +> The only settings I have attempted tuning are as follows: +> +> tcpip_socket = true +> max_connections = 100 +> shared_buffers = 5000 +> sort_mem = 8192 +> fsync = false + +A couple of things. + +1: Is there an index on the parts of the query used for the where clause? +2: What is your effect_cache_size set to? It needs to be set right for +your postgresql server to be able to take advantage of the kernel's cache +(i.e. use an index scan when the kernel is likely to have that data in +memory.) + + +From pgsql-performance-owner@postgresql.org Mon Sep 15 21:43:57 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 6ACB2D1B4ED + for ; + Tue, 16 Sep 2003 00:43:55 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 68454-09 + for ; + Mon, 15 Sep 2003 21:43:26 -0300 (ADT) +Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) + by svr1.postgresql.org (Postfix) with ESMTP id 2AC07D1B4E5 + for ; + Mon, 15 Sep 2003 21:43:23 -0300 (ADT) +Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) + by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h8G0gSMc027781; + Mon, 15 Sep 2003 18:42:29 -0600 (MDT) +Date: Mon, 15 Sep 2003 18:39:08 -0600 (MDT) +From: "scott.marlowe" +To: Joseph Bove +Cc: +Subject: Re: Inconsistent performance +In-Reply-To: +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-IHS-MailScanner: Found to be clean +X-IHS-MailScanner-SpamCheck: +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/229 +X-Sequence-Number: 3595 + +On Mon, 15 Sep 2003, scott.marlowe wrote: + +> On Mon, 15 Sep 2003, Joseph Bove wrote: +> +> > Stephan, +> > +> > I've run explain analyze a number of times and have gotten results between +> > 5.5 and 7.5 seconds +> > +> > Attached is a typical output +> > +> > QUERY PLAN +> > ------------------------------------- +> > Aggregate (cost=9993.92..9993.92 rows=1 width=0) +> > (actual time=7575.59..7575.59 rows=1 loops=1) +> > -> Seq Scan on vetapview (cost=0.00..9771.34 rows=89034 width=0) +> > (actual time=0.06..7472.20 +> > rows=88910 loops=1) +> > Total runtime: 7575.67 msec +> > (3 rows) +> > +> > The only things changing are the actual time. The costs are constant. +> > +> > The relpages from pg_class for vetapview (the table in question) is 8881. +> > +> > At the end of this message is the exhaustive contents of postgresql.conf. +> > The only settings I have attempted tuning are as follows: +> > +> > tcpip_socket = true +> > max_connections = 100 +> > shared_buffers = 5000 +> > sort_mem = 8192 +> > fsync = false +> +> A couple of things. +> +> 1: Is there an index on the parts of the query used for the where clause? +> 2: What is your effect_cache_size set to? It needs to be set right for +> your postgresql server to be able to take advantage of the kernel's cache +> (i.e. use an index scan when the kernel is likely to have that data in +> memory.) + +Sorry, that should be effective_cache_size, not effect_cache_size. It's +set in 8k blocks and is usually about how much buffer / cache you have +left over after the machines "settles" after being up and running for a +while. Fer instance, on my server, I show 784992K cache, and 42976K buff +under top, so, that's 827968k/8k=103496 blocks. Note that if you've +recompiled you may have somehow set block size larger, but installations +with postgresql block sizes ~=8k are pretty uncommon, and you'd know if +you had done that, so it's probably 8k blocks. + + +From pgsql-performance-owner@postgresql.org Mon Sep 15 21:40:24 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 8BF46D1B4ED + for ; + Tue, 16 Sep 2003 00:40:22 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 75785-04 + for ; + Mon, 15 Sep 2003 21:39:53 -0300 (ADT) +Received: from mail.berkhirt.com (homer.berkhirt.com [207.88.49.100]) + by svr1.postgresql.org (Postfix) with ESMTP id E6C92D1B510 + for ; + Mon, 15 Sep 2003 21:39:49 -0300 (ADT) +Received: from mobygames.com (homer [127.0.0.1]) (authenticated bits=0) + by mail.berkhirt.com (8.12.9/8.12.9) with ESMTP id h8G0dkGL007470; + Mon, 15 Sep 2003 19:39:49 -0500 +Date: Mon, 15 Sep 2003 18:39:53 -0600 +Subject: Re: Inconsistent performance +Content-Type: text/plain; charset=US-ASCII; format=flowed +Mime-Version: 1.0 (Apple Message framework v552) +Cc: pgsql-performance@postgresql.org +To: Joseph Bove +From: Brian Hirt +In-Reply-To: <5.1.0.14.2.20030915191708.00a6a0d8@mail.vetstar.com> +Message-Id: <49883D3B-E7DE-11D7-A695-000393D9FD00@mobygames.com> +Content-Transfer-Encoding: 7bit +X-Mailer: Apple Mail (2.552) +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/228 +X-Sequence-Number: 3594 + +it seems like the difference is probably related to caching. you say +you have 1gb of ram, and the database is 2gb. Obviously the entire +database isn't cached, but maybe your query runs fast when the table is +in memory, and they it gets swapped out of cache because some other +piece of information moves into memory. In that circumstance, it has +to load the information from disk and is therefor slow. + +how busy is the system? what other programs are running on the +machine? how big (on disk) is the table in question? what kind of load +does the system have? is it a single 80gb ide drive? Even though +you have 4 CPU's a small amount of memory and bad IO system will kill +the database. + + +On Monday, September 15, 2003, at 05:28 PM, Joseph Bove wrote: + +> Stephan, +> +> I've run explain analyze a number of times and have gotten results +> between 5.5 and 7.5 seconds +> +> Attached is a typical output +> +> QUERY PLAN +> ------------------------------------- +> Aggregate (cost=9993.92..9993.92 rows=1 width=0) +> (actual time=7575.59..7575.59 rows=1 loops=1) +> -> Seq Scan on vetapview (cost=0.00..9771.34 rows=89034 width=0) +> (actual time=0.06..7472.20 +> rows=88910 loops=1) +> Total runtime: 7575.67 msec +> (3 rows) +> +> The only things changing are the actual time. The costs are constant. +> +> The relpages from pg_class for vetapview (the table in question) is +> 8881. +> +> At the end of this message is the exhaustive contents of +> postgresql.conf. The only settings I have attempted tuning are as +> follows: +> +> tcpip_socket = true +> max_connections = 100 +> shared_buffers = 5000 +> sort_mem = 8192 +> fsync = false +> +> I did have shared_buffers and sort_mem both set higher originally +> (15000, 32168) but decreased them in case over-utilization of memory +> was the problem. +> +> The kernel setting shmmax is set to 256,000,000 (out of 1 gig) +> +> Regards, +> +> Joseph +> +> postgresql.conf +> +> # +> # Connection Parameters +> # +> tcpip_socket = true +> #ssl = false +> +> max_connections = 100 +> #superuser_reserved_connections = 2 +> +> #port = 5432 +> #hostname_lookup = false +> #show_source_port = false +> +> #unix_socket_directory = '' +> #unix_socket_group = '' +> #unix_socket_permissions = 0777 # octal +> +> #virtual_host = '' +> +> #krb_server_keyfile = '' +> +> +> # +> # Shared Memory Size +> # +> #shared_buffers = 15000 # min max_connections*2 or 16, 8KB each +> shared_buffers = 5000 +> #max_fsm_relations = 1000 # min 10, fsm is free space map, ~40 +> bytes +> #max_fsm_pages = 10000 # min 1000, fsm is free space map, ~6 +> bytes +> #max_locks_per_transaction = 64 # min 10 +> #wal_buffers = 8 # min 4, typically 8KB each +> +> # +> # Non-shared Memory Sizes +> # +> #sort_mem = 32168 # min 64, size in KB +> sort_mem = 8192 +> #vacuum_mem = 8192 # min 1024, size in KB +> # +> # Write-ahead log (WAL) +> # +> #checkpoint_segments = 3 # in logfile segments, min 1, 16MB each +> #checkpoint_timeout = 300 # range 30-3600, in seconds +> # +> #commit_delay = 0 # range 0-100000, in microseconds +> #commit_siblings = 5 # range 1-1000 +> # +> fsync = false +> #wal_sync_method = fsync # the default varies across platforms: +> # # fsync, fdatasync, open_sync, or +> open_datasync +> #wal_debug = 0 # range 0-16 +> +> +> # +> # Optimizer Parameters +> # +> #enable_seqscan = true +> #enable_indexscan = true +> #enable_tidscan = true +> #enable_sort = true#enable_tidscan = true +> #enable_sort = true +> #enable_nestloop = true +> #enable_mergejoin = true +> #enable_hashjoin = true +> +> #effective_cache_size = 1000 # typically 8KB each +> #random_page_cost = 4 # units are one sequential page fetch +> cost +> #cpu_tuple_cost = 0.01 # (same) +> #cpu_index_tuple_cost = 0.001 # (same) +> #cpu_operator_cost = 0.0025 # (same) +> +> #default_statistics_target = 10 # range 1-1000 +> +> # +> # GEQO Optimizer Parameters +> # +> #geqo = true +> #geqo_selection_bias = 2.0 # range 1.5-2.0 +> #geqo_threshold = 11 +> #geqo_pool_size = 0 # default based on tables in statement, +> # range 128-1024 +> #geqo_effort = 1 +> #geqo_generations = 0#geqo_random_seed = -1 # auto-compute +> seed +> +> +> # +> # Message display +> # +> #server_min_messages = notice # Values, in order of decreasing +> detail: +> # debug5, debug4, debug3, debug2, +> debug1, +> # info, notice, warning, error, log, +> fatal, +> # panic +> #client_min_messages = notice # Values, in order of decreasing +> detail: +> # debug5, debug4, debug3, debug2, +> debug1, +> # log, info, notice, warning, error +> #silent_mode = false +> +> #log_connections = false +> #log_pid = false +> #log_statement = false +> #log_duration = false +> #log_timestamp = false +> +> #log_min_error_statement = error # Values in order of increasing +> severity: +> +> #log_min_error_statement = error # Values in order of increasing +> severity: +> # debug5, debug4, debug3, debug2, +> debug1, +> # info, notice, warning, error, +> panic(off) +> +> #debug_print_parse = false +> #debug_print_rewritten = false +> #debug_print_plan = false +> #debug_pretty_print = false +> +> #explain_pretty_print = true +> +> # requires USE_ASSERT_CHECKING +> #debug_assertions = true +> +> +> # +> # Syslog +> # +> #syslog = 0 # range 0-2 +> #syslog_facility = 'LOCAL0' +> #syslog_ident = 'postgres' +> +> # +> # Statistics +> # +> #show_parser_stats = false +> #show_planner_stats = false +> #show_executor_stats = false +> #show_statement_stats = false +> +> # requires BTREE_BUILD_STATS +> #show_btree_build_stats = false +> +> +> # +> # Access statistics collection +> # +> #stats_start_collector = true +> #stats_reset_on_server_start = true +> #stats_command_string = false +> #stats_row_level = false +> #stats_block_level = false +> +> # +> # Lock Tracing +> # +> #trace_notify = false +> +> # requires LOCK_DEBUG +> #trace_locks = false +> #trace_userlocks = false +> #trace_lwlocks = false +> #debug_deadlocks = false +> #trace_lock_oidmin = 16384 +> #trace_lock_table = 0 +> +> +> # +> # Misc +> # +> #autocommit = true +> #dynamic_library_path = '$libdir' +> #search_path = '$user,public' +> #datestyle = 'iso, us' +> #timezone = unknown # actually, defaults to TZ environment +> setting +> #datestyle = 'iso, us' +> #timezone = unknown # actually, defaults to TZ environment +> setting +> #australian_timezones = false +> #client_encoding = sql_ascii # actually, defaults to database +> encoding +> #authentication_timeout = 60 # 1-600, in seconds +> #deadlock_timeout = 1000 # in milliseconds +> #default_transaction_isolation = 'read committed' +> #max_expr_depth = 10000 # min 10 +> #max_files_per_process = 1000 # min 25 +> #password_encryption = true +> #sql_inheritance = true +> #transform_null_equals = false +> #statement_timeout = 0 # 0 is disabled, in milliseconds +> #db_user_namespace = false +> +> +> +> # +> # Locale settings +> # +> # (initialized by initdb -- may be changed) +> LC_MESSAGES = 'en_US.UTF-8' +> LC_MONETARY = 'en_US.UTF-8' +> LC_NUMERIC = 'en_US.UTF-8' +> LC_TIME = 'en_US.UTF-8' +> +> At 03:49 PM 9/15/2003 -0700, Stephan Szabo wrote: +> +>> On Mon, 15 Sep 2003, Joseph Bove wrote: +>> +>> > Stephan, +>> > +>> > Actually, it's inconsistent with the exact same command. I've now +>> > replicated the problem by doing the following command: +>> > +>> > select count (*) from table; +>> > +>> > The table in question has 88899 rows. +>> > +>> > The response time is anywhere from 1 second to 12 seconds. Different +>> > response times can occur in the same minute of testing! +>> +>> Well, that's really only got one valid plan right now (seqscan and +>> aggregate). It'd be mildly interesting to see what explain analyze +>> says in +>> slow and fast states, although I'd be willing to bet that it's just +>> going +>> to effectively show that the seqscan is taking more or less time. +>> +>> I think we're going to need to see the configuration settings for the +>> server and possibly some info on how big the table is (say relpages +>> for +>> the pg_class row associated with the table after a vacuum full). +>> +>> ---------------------------(end of +>> broadcast)--------------------------- +>> TIP 6: Have you searched our list archives? +>> +>> http://archives.postgresql.org +> +> +> +> ---------------------------(end of +> broadcast)--------------------------- +> TIP 4: Don't 'kill -9' the postmaster + + +From pgsql-performance-owner@postgresql.org Mon Sep 15 23:39:43 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id D41C6D1B4E5 + for ; + Tue, 16 Sep 2003 02:39:37 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 87640-05 + for ; + Mon, 15 Sep 2003 23:39:09 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id C927DD1B526 + for ; + Mon, 15 Sep 2003 23:39:05 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h8G2d5sn072901 + for ; Tue, 16 Sep 2003 02:39:05 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h8G2SHnv071555 + for pgsql-performance@postgresql.org; Tue, 16 Sep 2003 02:28:17 GMT +From: Christopher Browne +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: Inconsistent performance +Date: Mon, 15 Sep 2003 22:26:45 -0400 +Organization: cbbrowne Computing Inc +Lines: 26 +Message-ID: +References: <5.1.0.14.2.20030915182422.00a8a2d8@mail.vetstar.com> +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.1002 (Gnus v5.10.2) XEmacs/21.4 (Rational FORTRAN, linux) +Cancel-Lock: sha1:xSM3pT2iRyjRx5hC07zUdxr/GuM= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/230 +X-Sequence-Number: 3596 + +The world rejoiced as jbove@vetstar.com (Joseph Bove) wrote: +> Actually, it's inconsistent with the exact same command. I've now +> replicated the problem by doing the following command: +> +> select count (*) from table; +> +> The table in question has 88899 rows. +> +> The response time is anywhere from 1 second to 12 seconds. Different +> response times can occur in the same minute of testing! + +The only possible plan for THAT query will involve a seq scan of the +whole table. If the postmaster already has the data in cache, it +makes sense for it to run in 1 second. If it has to read it from +disk, 12 seconds makes a lot of sense. + +You might want to increase the "shared_buffers" parameter in +postgresql.conf; that should lead to increased stability of times as +it should be more likely that the data in "table" will remain in +cache. +-- +(reverse (concatenate 'string "gro.gultn" "@" "enworbbc")) +http://www3.sympatico.ca/cbbrowne/x.html +Signs of a Klingon Programmer - 8. "Debugging? Klingons do not +debug. Our software does not coddle the weak. Bugs are good for +building character in the user." + +From pgsql-performance-owner@postgresql.org Tue Sep 16 02:19:15 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B4B8CD1B4E2 + for ; + Tue, 16 Sep 2003 05:19:12 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 29345-01 + for ; + Tue, 16 Sep 2003 02:19:03 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id BA5FDD1B4F1 + for ; + Tue, 16 Sep 2003 02:19:01 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h8G5J04A014071; + Tue, 16 Sep 2003 01:19:00 -0400 (EDT) +To: Vivek Khera +Cc: pgsql-performance@postgresql.org +Subject: Re: restore time: sort_mem vs. checkpoing_segments +In-reply-to: <16230.4066.565194.387700@yertle.int.kciLink.com> +References: <16230.4066.565194.387700@yertle.int.kciLink.com> +Comments: In-reply-to Vivek Khera + message dated "Mon, 15 Sep 2003 15:15:46 -0400" +Date: Tue, 16 Sep 2003 01:19:00 -0400 +Message-ID: <14070.1063689540@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/231 +X-Sequence-Number: 3597 + +Vivek Khera writes: +> Restore of a significanly big database (~19.8GB restored) shows nearly +> no time difference depending on sort_mem when checkpoint_segments is +> large. There are quite a number of tables and indexes. The restore +> was done from a pg_dump -Fc dump of one database. + +I was just bugging Marc for some useful data, so I'll ask you too: +could you provide a trace of the pg_restore execution? log_statement +plus log_duration output would do it. I am curious to understand +exactly which steps in the restore are significant time sinks. + +> I notice during the restore that the disk throughput triples during +> the checkpoint. + +Hm, better make sure the log includes some indication of when +checkpoints happen. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Sep 16 04:07:34 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 54948D1B500 + for ; + Tue, 16 Sep 2003 07:07:29 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 29980-09 + for ; + Tue, 16 Sep 2003 04:06:57 -0300 (ADT) +Received: from email03.aon.at (WARSL402PIP6.highway.telekom.at [195.3.96.93]) + by svr1.postgresql.org (Postfix) with SMTP id 3376FD1B4F2 + for ; + Tue, 16 Sep 2003 04:06:55 -0300 (ADT) +Received: (qmail 458234 invoked from network); 16 Sep 2003 07:06:54 -0000 +Received: from m155p015.dipool.highway.telekom.at (HELO cantor) ([62.46.9.79]) + (envelope-sender ) + by qmail3rs.highway.telekom.at (qmail-ldap-1.03) with SMTP + for ; 16 Sep 2003 07:06:54 -0000 +From: Manfred Koizar +To: Christopher Browne +Cc: pgsql-performance@postgresql.org, Joseph Bove +Subject: Re: Inconsistent performance +Date: Tue, 16 Sep 2003 09:09:05 +0200 +Message-ID: +References: <5.1.0.14.2.20030915182422.00a8a2d8@mail.vetstar.com> + +In-Reply-To: +X-Mailer: Forte Agent 1.93/32.576 English (American) +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/232 +X-Sequence-Number: 3598 + +On Mon, 15 Sep 2003 22:26:45 -0400, Christopher Browne + wrote: +>> select count (*) from table; +>The only possible plan for THAT query will involve a seq scan of the +>whole table. If the postmaster already has the data in cache, it +>makes sense for it to run in 1 second. If it has to read it from +>disk, 12 seconds makes a lot of sense. + +Yes. And note that the main difference is between having the data in +memory and having to fetch it from disk. I don't believe that this +difference can be explained by 9000 read calls hitting the operating +system's cache. + +>You might want to increase the "shared_buffers" parameter in +>postgresql.conf; that should lead to increased stability of times as +>it should be more likely that the data in "table" will remain in +>cache. + +Let's not jump to this conclusion before we know what's going on. + +Joseph Bove wrote in another message above: +| I did have shared_buffers and sort_mem both set higher originally (15000, +| 32168) + +As I read this I think he meant "... and had the same performance +problem." + +Joseph, what do you get, if you run that + EXPLAIN ANALYSE SELECT count(*) ... +several times? What do vmstat and top show while the query is +running? Are there other processes active during or between the runs? +What kind of processes? Postgres backends? Web server? ... + +Servus + Manfred + +From pgsql-performance-owner@postgresql.org Tue Sep 16 04:45:24 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DB338D1B4F2 + for ; + Tue, 16 Sep 2003 07:45:22 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 41487-04 + for ; + Tue, 16 Sep 2003 04:44:53 -0300 (ADT) +Received: from curry.tmsl.demon.co.uk (tmsl-adsl.demon.co.uk [80.177.114.181]) + by svr1.postgresql.org (Postfix) with ESMTP id D0361D1B500 + for ; + Tue, 16 Sep 2003 04:44:50 -0300 (ADT) +Received: from bacon.tmsl.demon.co.uk (bacon.tmsl.demon.co.uk [192.168.7.102]) + by curry.tmsl.demon.co.uk (8.11.6/8.11.6) with ESMTP id h8G7ina09299 + for ; + Tue, 16 Sep 2003 08:44:50 +0100 +Date: Tue, 16 Sep 2003 08:44:48 +0100 +From: Paul Thomas +To: "pgsql-performance @ postgresql . org" +Subject: Re: Attempt at work around of int4 query won't touch int8 index ... +Message-ID: <20030916084448.A24702@bacon> +References: <2756862E-E3F5-11D7-8513-000A9566A412@socialserve.com> + <20901.1063248257@sss.pgh.pa.us> + <3F65BABC.32672.38837688@localhost> +Mime-Version: 1.0 +Content-Type: text/plain; format=flowed; charset=ISO-8859-1 +In-Reply-To: <3F65BABC.32672.38837688@localhost>; + from shridhar_daithankar@persistent.co.in on Mon, Sep 15, 2003 at + 08:42:28 +0100 +X-Mailer: Balsa 1.2.3 +Lines: 27 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/233 +X-Sequence-Number: 3599 + + +On 15/09/2003 08:42 Shridhar Daithankar wrote: +> +> Is it possible to follow data type upgrade model in planner? Something +> like in +> C/C++ where data types are promoted upwards to find out better plan? +> +> int2->int4->int8->float4->float8 types. +> +> That could be a clean solution.. +> +> just a thought.. +> + +Interestingly, float8 indexes do work OK (float8col = 99). I spend a large +part of yesterday grepping through the sources to try and find out why +this should be so. No luck so far but I'm going to keep on trying! + + +-- +Paul Thomas ++------------------------------+---------------------------------------------+ +| Thomas Micro Systems Limited | Software Solutions for the Smaller +Business | +| Computer Consultants | +http://www.thomas-micro-systems-ltd.co.uk | ++------------------------------+---------------------------------------------+ + +From pgsql-performance-owner@postgresql.org Tue Sep 16 05:31:34 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id F342AD1B500 + for ; + Tue, 16 Sep 2003 08:31:32 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 29468-10 + for ; + Tue, 16 Sep 2003 05:31:03 -0300 (ADT) +Received: from wight.ymogen.net (unknown [217.27.240.153]) + by svr1.postgresql.org (Postfix) with SMTP id 3165FD1B4F2 + for ; + Tue, 16 Sep 2003 05:31:00 -0300 (ADT) +Received: (qmail 11531 invoked from network); 16 Sep 2003 08:31:01 -0000 +Received: from dsl-217-155-239-51.zen.co.uk (HELO finisterre) (217.155.239.51) + by wight.ymogen.net with SMTP; 16 Sep 2003 08:31:01 -0000 +From: "Matt Clark" +To: "Joseph Bove" , + +Subject: Re: Inconsistent performance +Date: Tue, 16 Sep 2003 09:31:01 +0100 +Message-ID: +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 IMO, Build 9.0.2416 (9.0.2910.0) +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +In-reply-to: <5.1.0.14.2.20030915191708.00a6a0d8@mail.vetstar.com> +Importance: Normal +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/234 +X-Sequence-Number: 3600 + +... +> #effective_cache_size = 1000 # typically 8KB each + +That's horribly wrong. It's telling PG that your OS is only likely to cache +8MB of the DB in RAM. If you've got 1GB of memory it should be between +64000 and 96000 + + + + +From pgsql-performance-owner@postgresql.org Tue Sep 16 10:59:53 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 828C5D1B50F + for ; + Tue, 16 Sep 2003 13:59:48 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 06646-05 + for ; + Tue, 16 Sep 2003 10:59:21 -0300 (ADT) +Received: from yertle.kcilink.com (yertle.kcilink.com [216.194.193.105]) + by svr1.postgresql.org (Postfix) with ESMTP id 3F152D1B4EB + for ; + Tue, 16 Sep 2003 10:59:17 -0300 (ADT) +Received: by yertle.kcilink.com (Postfix, from userid 100) + id E794B217B2; Tue, 16 Sep 2003 09:59:14 -0400 (EDT) +From: Vivek Khera +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +Message-ID: <16231.5938.817522.359405@yertle.int.kciLink.com> +Date: Tue, 16 Sep 2003 09:59:14 -0400 +To: Tom Lane +Cc: pgsql-performance@postgresql.org +Subject: Re: restore time: sort_mem vs. checkpoing_segments +In-Reply-To: <14070.1063689540@sss.pgh.pa.us> +References: <16230.4066.565194.387700@yertle.int.kciLink.com> + <14070.1063689540@sss.pgh.pa.us> +X-Mailer: VM 7.14 under 21.4 (patch 12) "Portable Code" XEmacs Lucid +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/235 +X-Sequence-Number: 3601 + +>>>>> "TL" == Tom Lane writes: + +TL> I was just bugging Marc for some useful data, so I'll ask you too: +TL> could you provide a trace of the pg_restore execution? log_statement +TL> plus log_duration output would do it. I am curious to understand +TL> exactly which steps in the restore are significant time sinks. + +Sure... machine isn't gonna do much of anything until 7.4 is released +(or I hear a promise of no more dump/reload). + +>> I notice during the restore that the disk throughput triples during +>> the checkpoint. + +TL> Hm, better make sure the log includes some indication of when +TL> checkpoints happen. + +That it does. + +I'll post the results in the next couple of days, as each run takes +about 4 hours ;-) + +From pgsql-performance-owner@postgresql.org Tue Sep 16 11:05:19 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B552DD1B4FC + for ; + Tue, 16 Sep 2003 14:05:13 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 06655-09 + for ; + Tue, 16 Sep 2003 11:05:06 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 8CEFED1B4EF + for ; + Tue, 16 Sep 2003 11:05:02 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h8GE56pr016842; + Tue, 16 Sep 2003 10:05:06 -0400 (EDT) +To: Paul Thomas +Cc: "pgsql-performance @ postgresql . org" +Subject: Re: Attempt at work around of int4 query won't touch int8 index ... +In-reply-to: <20030916084448.A24702@bacon> +References: <2756862E-E3F5-11D7-8513-000A9566A412@socialserve.com> + <20901.1063248257@sss.pgh.pa.us> + <3F65BABC.32672.38837688@localhost> <20030916084448.A24702@bacon> +Comments: In-reply-to Paul Thomas + message dated "Tue, 16 Sep 2003 08:44:48 +0100" +Date: Tue, 16 Sep 2003 10:05:06 -0400 +Message-ID: <16841.1063721106@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/236 +X-Sequence-Number: 3602 + +Paul Thomas writes: +> On 15/09/2003 08:42 Shridhar Daithankar wrote: +>> Is it possible to follow data type upgrade model in planner? + +We have one, more or less. It's not explicitly coded, it emerges from +the fact that certain casts are implicit and others are not. For +instance, int4->float8 is implicit but float8->int4 is not. + +> Interestingly, float8 indexes do work OK (float8col = 99). I spend a large +> part of yesterday grepping through the sources to try and find out why +> this should be so. No luck so far but I'm going to keep on trying! + +The reason that case works is that there is no float8 = int4 operator. +The parser can find no other interpretation than promoting the int4 to +float8 and using float8 = float8. (The dual possibility, coerce float8 +to int4 and use int4 = int4, is not considered because that coercion +direction is not implicit.) So you end up with an operator that matches +the float8 index, and all is well. + +The int8 case fails because there is a cross-type operator int8 = int4, +and the parser prefers that since it's an exact match to the initial +data types. But it doesn't match the int8 index. + +We've floated various proposals for solving this, such as getting rid of +cross-type operators, but none so far have passed the test of not having +bad side-effects. See the pg_hackers archives for details (and *please* +don't waste this list's bandwidth with speculating about solutions until +you've absorbed some of the history. This topic has been heard of +before ;-).) + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Sep 16 12:09:18 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3AA8AD1B4EB + for ; + Tue, 16 Sep 2003 15:09:11 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 20116-04 + for ; + Tue, 16 Sep 2003 12:08:39 -0300 (ADT) +Received: from merlin (merlin.warpdrive.net [24.56.130.4]) + by svr1.postgresql.org (Postfix) with ESMTP id 90F77D1B4EE + for ; + Tue, 16 Sep 2003 12:08:36 -0300 (ADT) +Received: from mail.warpdrive.net ([24.56.130.6] helo=mail.vetstar.com) + by merlin with esmtp (Exim 4.14) id 19zHRO-0003Ck-V2 + for pgsql-performance@postgresql.org; Tue, 16 Sep 2003 11:08:30 -0400 +Received: from sirius.vetstar.com [66.88.86.217] by mail.vetstar.com with + ESMTP + (SMTPD32-8.02) id A740300140; Tue, 16 Sep 2003 11:07:44 -0400 +Message-Id: <5.1.0.14.2.20030916104829.00acbff0@mail.vetstar.com> +X-Sender: jbove@vetstar.com@mail.vetstar.com +X-Mailer: QUALCOMM Windows Eudora Version 5.1 +Date: Tue, 16 Sep 2003 11:21:00 -0400 +To: pgsql-performance@postgresql.org +From: Joseph Bove +Subject: Re: Inconsistent performance +In-Reply-To: +References: + <5.1.0.14.2.20030915182422.00a8a2d8@mail.vetstar.com> + +Mime-Version: 1.0 +Content-Type: text/plain; charset="us-ascii"; format=flowed +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/237 +X-Sequence-Number: 3603 + +Dear list, + +First and foremost, thanks to the great number of people who have responded +with various tips and suggestions. I am now starting to fully appreciate +the various cache settings and what they can do for performance. + +I just want to redefine the problem based on the knowledge of it that I now +have. + +In my example, I am purposefully forcing a full table scan - select count +(*) from table. This table has only 90,000 rows. Each row is comprised of +about 300 bytes of data. + +If the table has not been cached, I was seeing response times from 5 to 18 +seconds to read the table. If it had been cached, then the response time +dropped to sub-second response. + +Obviously, I can tune the caching so as to make sure that as much data that +can be reasonably cached is cached. However, I don't think that a hit of +even 5 seconds to read a table of 90,000 rows is acceptable. + +One thing that has been tried with some success was to dump the table and +recreate it. After this exercise, selecting all rows from the table when it +is not in cache takes about 3 seconds. (Of course, when in cache, the same +sub-second response time is seen.) + +I still think that 3 seconds is not acceptable. However, I reserve the +right to be wrong. Does it sound unrealistic to expect PostgreSQL to be +able to read 90,000 rows with 300 bytes per row in under a second? + +Based on suggestions from the list, I am also thinking of making the +following tuning changes: + +shared_buffers = 15000 +sort_mem = 32168 +effective_cache_size = 64000 + +This is based on one gig of memory. + +Does anyone have any feedback on these values? Also, realizing that no two +database are the same, etc., etc... does anyone have a good formula for +setting these values? + +Thanks in advance, + +Joseph + +At 09:09 AM 9/16/2003 +0200, Manfred Koizar wrote: +>On Mon, 15 Sep 2003 22:26:45 -0400, Christopher Browne +> wrote: +> >> select count (*) from table; +> >The only possible plan for THAT query will involve a seq scan of the +> >whole table. If the postmaster already has the data in cache, it +> >makes sense for it to run in 1 second. If it has to read it from +> >disk, 12 seconds makes a lot of sense. +> +>Yes. And note that the main difference is between having the data in +>memory and having to fetch it from disk. I don't believe that this +>difference can be explained by 9000 read calls hitting the operating +>system's cache. +> +> >You might want to increase the "shared_buffers" parameter in +> >postgresql.conf; that should lead to increased stability of times as +> >it should be more likely that the data in "table" will remain in +> >cache. +> +>Let's not jump to this conclusion before we know what's going on. +> +>Joseph Bove wrote in another message above: +>| I did have shared_buffers and sort_mem both set higher originally (15000, +>| 32168) +> +>As I read this I think he meant "... and had the same performance +>problem." +> +>Joseph, what do you get, if you run that +> EXPLAIN ANALYSE SELECT count(*) ... +>several times? What do vmstat and top show while the query is +>running? Are there other processes active during or between the runs? +>What kind of processes? Postgres backends? Web server? ... +> +>Servus +> Manfred +> +>---------------------------(end of broadcast)--------------------------- +>TIP 9: 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 Tue Sep 16 12:39:08 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 4F082D1B4E2 + for ; + Tue, 16 Sep 2003 15:39:05 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 29745-01 + for ; + Tue, 16 Sep 2003 12:38:33 -0300 (ADT) +Received: from jefftrout.com (h00a0cc4084e5.ne.client2.attbi.com + [24.128.241.68]) + by svr1.postgresql.org (Postfix) with SMTP id AA547D1B4EB + for ; + Tue, 16 Sep 2003 12:38:14 -0300 (ADT) +Received: (qmail 2480 invoked from network); 16 Sep 2003 15:38:12 -0000 +Received: from unknown (HELO torgo) (threshar@10.10.10.10) + by 10.10.10.10 with SMTP; 16 Sep 2003 15:38:12 -0000 +Date: Tue, 16 Sep 2003 11:38:12 -0400 (EDT) +From: Jeff +To: Joseph Bove +Cc: "pgsql-performance@postgresql.org" +Subject: Re: Inconsistent performance +In-Reply-To: <5.1.0.14.2.20030916104829.00acbff0@mail.vetstar.com> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/238 +X-Sequence-Number: 3604 + +On Tue, 16 Sep 2003, Joseph Bove wrote: + +> I still think that 3 seconds is not acceptable. However, I reserve the +> right to be wrong. Does it sound unrealistic to expect PostgreSQL to be +> able to read 90,000 rows with 300 bytes per row in under a second? +> +first, check to see what your max throughput on your disk is using a +benchmark such as Bonnie (Making sure to use a size LARGER than phsyical +memory. 2x physical is veyr optimial). + +next, run your query again with a vmstat 1 running in another term. + +See how close the vmstat "bi" numbers correspond to your max according to +bonnie. You could have an IO bottleneck. (I once went running around +trying to figure it out and then discovered the issue was IO). + + + +-- +Jeff Trout +http://www.jefftrout.com/ +http://www.stuarthamm.net/ + + + +From pgsql-performance-owner@postgresql.org Tue Sep 16 21:22:09 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 274C5D1B52B + for ; + Wed, 17 Sep 2003 00:21:49 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 83278-03 + for ; + Tue, 16 Sep 2003 21:21:19 -0300 (ADT) +Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) + by svr1.postgresql.org (Postfix) with ESMTP id 1D6BBD1B4F0 + for ; + Tue, 16 Sep 2003 21:21:16 -0300 (ADT) +Received: from ibm-e.pdx.osdl.net (ibm-e.pdx.osdl.net [172.20.1.71]) + by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h8H0L4o11077; + Tue, 16 Sep 2003 17:21:04 -0700 +Subject: Re: [GENERAL] how to get accurate values in pg_statistic +From: Mary Edie Meredith +To: pgsql-performance , + osdldbt-general +Content-Type: text/plain +Organization: Open Source Development Lab +Message-Id: <1063758041.5730.549.camel@ibm-e.pdx.osdl.net> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.2.2 +Date: 16 Sep 2003 17:21:04 -0700 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/239 +X-Sequence-Number: 3605 + +Yesterday Jenny and I started to look at plan changes with different +seed and default_statistics_sample changes. + +Since we have 21 plans to check, it takes a long time to determine if +the plans were different. We had to do it visually with xxdiff. Diff +will always show a difference since the costs are almost always +different. + +Is there any option to remove the cost numbers from the plan so we can +just use "diff" to automate the plan comparisons? Otherwise it will be +very tedious to do this experiment. + + + + +On Sun, 2003-09-07 at 17:32, Tom Lane wrote: +> Greg Stark writes: +> > Perhaps the default of 10 is simply way +> > too small and should be raised? +> +> I've suspected since the default existed that it might be too small ;-). +> No one's yet done any experiments to try to establish a better default, +> though. I suppose the first hurdle is to find a representative dataset. +> +> regards, tom lane +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 8: explain analyze is your friend + +-- +Mary Edie Meredith +Open Source Development Lab + + +From pgsql-performance-owner@postgresql.org Wed Sep 17 01:58:34 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 8DE44D1B50C + for ; + Wed, 17 Sep 2003 04:58:33 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 25028-06 + for ; + Wed, 17 Sep 2003 01:58:23 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 58DDFD1B4FC + for ; + Wed, 17 Sep 2003 01:58:22 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h8H4wHpr029312; + Wed, 17 Sep 2003 00:58:18 -0400 (EDT) +To: Mary Edie Meredith +Cc: pgsql-performance , + osdldbt-general +Subject: Re: [GENERAL] how to get accurate values in pg_statistic +In-reply-to: <1063758041.5730.549.camel@ibm-e.pdx.osdl.net> +References: <1063758041.5730.549.camel@ibm-e.pdx.osdl.net> +Comments: In-reply-to Mary Edie Meredith + message dated "16 Sep 2003 17:21:04 -0700" +Date: Wed, 17 Sep 2003 00:58:17 -0400 +Message-ID: <29311.1063774697@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/240 +X-Sequence-Number: 3606 + +Mary Edie Meredith writes: +> Is there any option to remove the cost numbers from the plan so we can +> just use "diff" to automate the plan comparisons? + +No, but a few moments with sed or perl should get the job done for you. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Sep 17 07:49:31 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DDB3DD1B513 + for ; + Wed, 17 Sep 2003 10:49:28 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 87732-03 + for ; + Wed, 17 Sep 2003 07:49:20 -0300 (ADT) +Received: from webbased16.localdomain (unknown [213.152.63.91]) + by svr1.postgresql.org (Postfix) with ESMTP id A219CD1B50E + for ; + Wed, 17 Sep 2003 07:49:12 -0300 (ADT) +Received: from webbased10 (firewall [213.152.63.90]) + by webbased16.localdomain (8.11.6/8.11.6) with ESMTP id h8HAs3Y06213 + for ; Wed, 17 Sep 2003 11:54:03 +0100 +From: "Nick Barr" +To: +Subject: Effective Cache Size +Date: Wed, 17 Sep 2003 11:48:57 +0100 +Message-ID: <8F4A22E017460A458DB7BBAB65CA6AE502AA15@webbased9> +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 +Importance: Normal +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/241 +X-Sequence-Number: 3607 + +Hi, + +I have been following a thread on this list "Inconsistent performance" +and had a few questions especially the bits about effective_cache_size. +I have read some of the docs, and some other threads on this setting, +and it seems to used by the planner to either choose a sequential or +index scan. So it will not necessarily increase performance I suppose +but instead choose the most optimal plan. Is this correct? + +We are not that we are suffering massive performance issues at the +moment but it is expected that our database is going to grow +considerably in the next couple of years, both in terms of load and +size. + +Also what would an appropriate setting be? + + From what I read of Scott Marlowes email, and from the information below +I reckon it should be somewhere in the region of 240,000. + +Danger maths ahead. Beware!!!! + + + 141816K buff ++ 1781764K cached +----------------- + 1923580K total + +effective_cache_size = 1923580 / 8 = 240447.5 + + +Here is some information on the server in question. If any more +information is required then please say. It is a dedicated PG machine +with no other services being hosted off it. As you can see from the +uptime, its load average is 0.00, and is currently so chilled its almost +frozen!!!!! That will change though :-( + + +Hardware +======== +Dual PIII 1.4GHz +2Gb RAM +1Tb SAN with hardware RAID 5 using 1Gbps Fibre channel. + + +OS +== +Linux webbasedth5 2.4.18-18.7.xsmp #1 SMP Wed Nov 13 19:01:42 EST 2002 +i686 +Red Hat Linux release 7.3 (Valhalla) + + +PG +== +PostgreSQL 7.3.1 on i686-pc-linux-gnu, compiled by GCC 2.96 + + +Database +======== +This includes all indexes and tables. I can provide more information on +how this is chopped up if needed. + +Size : 1,141.305 Mb +Tuples : 13,416,397 + + +Uptime +====== +11:15am up 197 days, 16:50, 1 user, load average: 0.00, 0.00, 0.00 + + +Top +=== +Mem: 2064836K av, 2018648K used, 46188K free, 0K shrd, 141816K +buff +Swap: 2096472K av, 4656K used, 2091816K free 1781764K +cached + + +Postgresql.conf (all defaults except) +===================================== +max_connections = 1000 +shared_buffers = 16000 (128 Mb) +max_fsm_relations = 5000 +max_fsm_pages = 500000 +vacuum_mem = 65535 + + + +Kind Regards, + +Nick Barr + + +This email and any attachments are confidential to the intended +recipient and may also be privileged. If you are not the intended +recipient please delete it from your system and notify the sender. You +should not copy it or use it for any purpose nor disclose or distribute +its contents to any other person. + + + + + + +From pgsql-performance-owner@postgresql.org Wed Sep 17 08:01:23 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 5A481D1B4FE + for ; + Wed, 17 Sep 2003 11:01:21 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 85749-09 + for ; + Wed, 17 Sep 2003 08:01:13 -0300 (ADT) +Received: from smtp.pspl.co.in (unknown [202.54.11.65]) + by svr1.postgresql.org (Postfix) with ESMTP id 93A55D1B4EF + for ; + Wed, 17 Sep 2003 08:01:08 -0300 (ADT) +Received: (from root@localhost) + by smtp.pspl.co.in (8.12.9/8.12.9) id h8HBBJmE009476 + for ; Wed, 17 Sep 2003 16:41:19 +0530 +Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) + (authenticated bits=0) + by persistent.co.in (8.12.9/8.12.9) with ESMTP id h8HBBICl009463 + for ; Wed, 17 Sep 2003 16:41:18 +0530 +From: "Shridhar Daithankar" +To: +Date: Wed, 17 Sep 2003 16:33:09 +0530 +MIME-Version: 1.0 +Subject: Re: Effective Cache Size +Reply-To: shridhar_daithankar@persistent.co.in +Message-ID: <3F688CC5.12621.4EBFDCC@localhost> +In-reply-to: <8F4A22E017460A458DB7BBAB65CA6AE502AA15@webbased9> +X-mailer: Pegasus Mail for Windows (v4.12a) +Content-type: text/plain; charset=US-ASCII +Content-transfer-encoding: 7BIT +Content-description: Mail message body +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/242 +X-Sequence-Number: 3608 + +On 17 Sep 2003 at 11:48, Nick Barr wrote: + +> Hi, +> +> I have been following a thread on this list "Inconsistent performance" +> and had a few questions especially the bits about effective_cache_size. +> I have read some of the docs, and some other threads on this setting, +> and it seems to used by the planner to either choose a sequential or +> index scan. So it will not necessarily increase performance I suppose +> but instead choose the most optimal plan. Is this correct? + +That is correct. + +> Danger maths ahead. Beware!!!! +> +> +> 141816K buff +> + 1781764K cached +> ----------------- +> 1923580K total +> +> effective_cache_size = 1923580 / 8 = 240447.5 +> + +That would be bit too aggressive. I would say set it around 200K to leave room +for odd stuff. + +Rest seems fine with your configuration. Of course a latest version of +postgresql is always good though.. + +Bye + Shridhar + +-- +Power is danger. -- The Centurion, "Balance of Terror", stardate 1709.2 + + +From pgsql-performance-owner@postgresql.org Wed Sep 17 15:57:28 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id AFA8AD1B4EF + for ; + Wed, 17 Sep 2003 18:57:26 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 74265-03 + for ; + Wed, 17 Sep 2003 15:56:57 -0300 (ADT) +Received: from reva.sixgirls.org (unknown [66.250.131.200]) + by svr1.postgresql.org (Postfix) with ESMTP id 02657D1B501 + for ; + Wed, 17 Sep 2003 15:56:52 -0300 (ADT) +Received: from reva.sixgirls.org (localhost [127.0.0.1]) + by reva.sixgirls.org (8.12.9/8.12.9) with ESMTP id h8HItgFl001892 + for ; + Wed, 17 Sep 2003 14:56:34 -0400 (EDT) +Received: from localhost (adler@localhost) + by reva.sixgirls.org (8.12.9/8.12.9/Submit) with ESMTP id + h8HItf7m001889 for ; + Wed, 17 Sep 2003 14:55:41 -0400 (EDT) +X-Authentication-Warning: reva.sixgirls.org: adler owned process doing -bs +Date: Wed, 17 Sep 2003 14:55:40 -0400 (EDT) +From: Michael Adler +X-X-Sender: adler@reva.sixgirls.org +Reply-To: adler@pobox.com +To: pgsql-performance@postgresql.org +Subject: inferior SCSI performance +In-Reply-To: <3F688CC5.12621.4EBFDCC@localhost> +Message-ID: +References: <3F688CC5.12621.4EBFDCC@localhost> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/243 +X-Sequence-Number: 3609 + + +I have been experimenting with a new Seagate Cheetah 10k-RPM SCSI to +compare with a cheaper Seagate Barracuda 7200-RPM IDE (each in a +single-drive configuration). The Cheetah definately dominates the generic +IO tests such as bonnie++, but fares poorly with pgbench (and other +postgresql operations). + +I don't understand why switching to a SCSI drive in an otherwise identical +setup would so seriously degrade performance. I would have expected the +opposite. vmstat does not reveal (to me) any bottlenecks in the SCSI +configuration. + +The only difference between the two test scenarios is that I stopped the +postmaster, copied the data dir to the other drive and put a symlink to +point to the new path. I ran the tests several times, so these are not +flukes. + +Can anyone explain why this might be happening and how to better leverage +this 10k drive? + +thanks, +Mike Adler + + +System info: + +Box is a Dell 600SC with Adaptec 39160 SCSI controller. +Linux 2.4.18-bf2.4 +CPU: Intel(R) Celeron(R) CPU 2.00GHz stepping 09 +Memory: 512684k/524224k available (1783k kernel code, 11156k reserved, +549k data, 280k init, 0k highmem) + +postgresql.conf settings: +shared_buffers = 10000 +random_page_cost = 0.3 +sort_mem = 4096 + +################################################## +TEST 1: + +IDE Seagate Baracuda +hde: ST340014A, ATA DISK drive +hde: 78165360 sectors (40021 MB) w/2048KiB Cache, CHS=77545/16/63 + +bonnie++ -f: +Version 1.02b ------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 +dellmar 1G 27001 10 11863 4 20867 3 161.7 0 + +sample vmstat 1 output during bonnie++: + procs memory swap io system cpu + r b w swpd free buff cache si so bi bo in cs us sy id + 1 0 0 9332 4456 5056 467728 0 0 20864 0 429 698 0 5 95 + 0 1 1 9332 4380 5056 467728 0 0 5248 27056 361 207 1 4 95 + 0 1 1 9332 4376 5056 467728 0 0 384 26936 338 55 0 0 100 + 0 1 0 9332 4416 5064 468368 0 0 10112 9764 385 350 0 4 96 + 1 0 0 9332 4408 5056 468120 0 0 20608 0 427 684 1 7 92 + 1 0 0 9332 4392 5056 467864 0 0 20992 0 431 692 0 5 95 + + +pgbench: +starting vacuum...end. +transaction type: TPC-B (sort of) +scaling factor: 1 +number of clients: 2 +number of transactions per client: 400 +number of transactions actually processed: 800/800 +tps = 110.213013(including connections establishing) +tps = 110.563927(excluding connections establishing) + +sample "vmstat 1" output during pgbench: + procs memory swap io system cpu + r b w swpd free buff cache si so bi bo in cs us sy id + 2 0 0 160 4348 50032 419320 0 0 240 3432 514 3849 34 7 59 + 0 2 0 160 4392 50764 418544 0 0 224 3348 500 3701 33 6 61 + 2 0 0 160 4364 51652 417688 0 0 240 3908 573 4411 43 8 50 + 2 0 0 160 4364 52508 416832 0 0 160 3708 548 4273 44 8 49 + 1 1 1 160 4420 53332 415944 0 0 160 3604 541 4174 40 13 48 + 0 1 1 160 4420 54160 415120 0 0 104 3552 526 4048 42 14 45 + 1 0 0 160 4964 54720 414576 0 0 128 4328 645 5819 69 7 24 + + + +######################################################## +TEST 2: + +SCSI Drive Seagate Cheetah 10k.6 + Vendor: SEAGATE Model: ST336607LW Rev: DS08 + +bonnie++ -f: +Version 1.02b ------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 +dellmar 1G 40249 14 21177 7 46620 7 365.8 0 + +sample vmstat 1 output during bonnie++: + 0 1 1 8916 4400 1844 467216 0 0 384 42348 475 80 0 0 100 + 0 1 1 8916 4392 1844 467216 0 0 512 46420 472 103 0 2 98 + 1 0 0 8916 4364 1852 469392 0 0 7168 26552 507 268 0 3 97 + 1 0 0 8916 4452 1868 469392 0 0 28544 12312 658 947 1 15 84 + 1 0 0 8916 4416 1860 468888 0 0 47744 4 850 1534 0 18 82 + 1 0 0 8916 4436 1796 468312 0 0 48384 0 859 1555 0 19 81 + 1 0 0 8916 4452 1744 467724 0 0 48640 0 863 1569 2 20 78 + + +pgbench (sounds thrashy): +starting vacuum...end. +transaction type: TPC-B (sort of) +scaling factor: 1 +number of clients: 2 +number of transactions per client: 400 +number of transactions actually processed: 800/800 +tps = 33.274922(including connections establishing) +tps = 33.307125(excluding connections establishing) + +sample "vmstat 1" output during pgbench: + procs memory swap io system cpu + r b w swpd free buff cache si so bi bo in cs us sy id + 0 1 1 160 4356 36568 432772 0 0 0 1120 232 1325 12 2 86 + 0 1 1 160 4452 36592 432652 0 0 0 1108 229 1295 14 2 84 + 0 1 1 160 4428 36616 432652 0 0 0 1168 234 1370 9 4 87 + 0 1 1 160 4392 36636 432668 0 0 0 1120 231 1303 12 3 85 + 0 1 0 160 4364 36664 432668 0 0 0 1084 230 1361 16 5 79 + 0 1 0 160 4456 36696 432548 0 0 0 1196 234 1300 13 2 85 + + +Mike Adler + +From pgsql-performance-owner@postgresql.org Wed Sep 17 16:09:09 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 4C182D1B50F + for ; + Wed, 17 Sep 2003 19:09:08 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 72696-10 + for ; + Wed, 17 Sep 2003 16:08:36 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 07FDAD1B4EB + for ; + Wed, 17 Sep 2003 16:08:35 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h8HJ8Xpr004694; + Wed, 17 Sep 2003 15:08:33 -0400 (EDT) +To: adler@pobox.com +Cc: pgsql-performance@postgresql.org +Subject: Re: inferior SCSI performance +In-reply-to: +References: <3F688CC5.12621.4EBFDCC@localhost> + +Comments: In-reply-to Michael Adler + message dated "Wed, 17 Sep 2003 14:55:40 -0400" +Date: Wed, 17 Sep 2003 15:08:33 -0400 +Message-ID: <4693.1063825713@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/244 +X-Sequence-Number: 3610 + +Michael Adler writes: +> I have been experimenting with a new Seagate Cheetah 10k-RPM SCSI to +> compare with a cheaper Seagate Barracuda 7200-RPM IDE (each in a +> single-drive configuration). The Cheetah definately dominates the generic +> IO tests such as bonnie++, but fares poorly with pgbench (and other +> postgresql operations). + +It's fairly common for ATA drives to be configured to lie about write +completion (ie, claim write-complete as soon as data is accepted into +their onboard RAM buffer), whereas SCSI drives usually report write +complete only when the data is actually down to disk. The performance +differential may thus be coming at the expense of reliability. If you +run Postgres with fsync off, does the differential go away? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Sep 17 16:44:42 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id CCD6CD1B50B + for ; + Wed, 17 Sep 2003 19:40:49 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 85049-05 + for ; + Wed, 17 Sep 2003 16:40:20 -0300 (ADT) +Received: from wight.ymogen.net (unknown [217.27.240.153]) + by svr1.postgresql.org (Postfix) with SMTP id 7414AD1B502 + for ; + Wed, 17 Sep 2003 16:40:16 -0300 (ADT) +Received: (qmail 2029 invoked from network); 17 Sep 2003 19:40:16 -0000 +Received: from dsl-217-155-239-51.zen.co.uk (HELO finisterre) (217.155.239.51) + by wight.ymogen.net with SMTP; 17 Sep 2003 19:40:16 -0000 +From: "Matt Clark" +To: +Subject: Is there a reason _not_ to vacuum continuously? +Date: Wed, 17 Sep 2003 20:40:16 +0100 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +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.2800.1165 +Importance: Normal +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/245 +X-Sequence-Number: 3611 + +I'm running a load of stress scripts against my staging environment to +simulate user interactions, and watching the various boxen as time goes by. + +I noticed that the CPU utilisation on the DB server (PG 7.2.3, RH7.3, Dual +PII 550MHz, 1GB RAM, 1GB database on disk, Single 10k SCSI drive) was +increasing over time, and manually launched a vacuum analyze verbose. + +A typical output from the VAV is: + +NOTICE: --Relation mobilepm-- +NOTICE: Index mobilepm_ownerid_idx: Pages 1103; Tuples 32052: Deleted +46012. + CPU 0.15s/0.66u sec elapsed 14.82 sec. +NOTICE: Index mobilepm_id_idx: Pages 1113; Tuples 32143: Deleted 46012. + CPU 0.33s/1.08u sec elapsed 45.89 sec. +NOTICE: Index mobilepm_ownerid_status_idx: Pages 1423; Tuples 32319: +Deleted 46 +012. + CPU 0.52s/1.05u sec elapsed 54.59 sec. +NOTICE: Index mobilepm_number_idx: Pages 1141; Tuples 32413: Deleted 46012. + CPU 0.26s/0.61u sec elapsed 16.13 sec. +NOTICE: Removed 46012 tuples in 2548 pages. + CPU 0.88s/0.79u sec elapsed 75.57 sec. +NOTICE: Pages 3188: Changed 10, Empty 0; Tup 32007: Vac 46012, Keep 11, +UnUsed +0. + Total CPU 2.56s/4.25u sec elapsed 216.50 sec. +NOTICE: --Relation pg_toast_112846940-- +NOTICE: Pages 0: Changed 0, Empty 0; Tup 0: Vac 0, Keep 0, UnUsed 0. + Total CPU 0.00s/0.00u sec elapsed 0.00 sec. +NOTICE: Analyzing mobilepm + +So you can see that some tables are seeing a hell of a lot of updates. +That's life, and yes, I do need all those indexes :-) + +Now I see no drop in performance while the VAV is running, the CPU +utilisation gradually drops from 80% to 30% on the DB server, and life in +general improves. + +On the live server (PG 7.2.3, RH7.3, Quad Xeon 700Mhz 1MB cache, 4Gb RAM, +256MB write-back RAID10 over 4 10K disks) I vacuum analyze daily, and vacuum +analyze a couple of key tables every 15 minutes, but my question is... + +*** THE QUESTION(S) *** +Is there any reason for me not to run continuous sequential vacuum analyzes? +At least for the 6 tables that see a lot of updates? +I hear 10% of tuples updated as a good time to vac-an, but does my typical +count of 3 indexes per table affect that? + +Cheers + +Matt + + +Postscript: I may have answered my own question while writing this mail. +Under the current stress test load about 10% of the key tables' tuples are +updated between sequential vacuum-analyzes, so the received wisdom on +intervals suggests '0' in my case anyway... + + + + +From pgsql-performance-owner@postgresql.org Wed Sep 17 17:00:28 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id D7D35D1B4FE + for ; + Wed, 17 Sep 2003 20:00:26 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 88081-06 + for ; + Wed, 17 Sep 2003 17:00:17 -0300 (ADT) +Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) + by svr1.postgresql.org (Postfix) with ESMTP id A2C8DD1B4EB + for ; + Wed, 17 Sep 2003 17:00:15 -0300 (ADT) +Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) + by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h8HJwmMc028412; + Wed, 17 Sep 2003 13:58:48 -0600 (MDT) +Date: Wed, 17 Sep 2003 13:54:42 -0600 (MDT) +From: "scott.marlowe" +To: Matt Clark +Cc: +Subject: Re: Is there a reason _not_ to vacuum continuously? +In-Reply-To: +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-IHS-MailScanner: Found to be clean +X-IHS-MailScanner-SpamCheck: +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/246 +X-Sequence-Number: 3612 + +On Wed, 17 Sep 2003, Matt Clark wrote: + +> *** THE QUESTION(S) *** +> Is there any reason for me not to run continuous sequential vacuum analyzes? +> At least for the 6 tables that see a lot of updates? +> I hear 10% of tuples updated as a good time to vac-an, but does my typical +> count of 3 indexes per table affect that? + +Generally, the only time continuous vacuuming is a bad thing is when you +are I/O bound. If you are CPU bound, then continuous vacuuming is usually +acceptable. + + +From pgsql-performance-owner@postgresql.org Wed Sep 17 17:15:23 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 9BAE9D1B4E1 + for ; + Wed, 17 Sep 2003 20:15:20 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 87902-10 + for ; + Wed, 17 Sep 2003 17:15:10 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id 5AD4FD1B4EF + for ; + Wed, 17 Sep 2003 17:15:08 -0300 (ADT) +Received: from [66.219.92.2] (HELO temoku) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3651204; Wed, 17 Sep 2003 13:15:40 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: "Matt Clark" , + +Subject: Re: Is there a reason _not_ to vacuum continuously? +Date: Wed, 17 Sep 2003 13:13:31 -0700 +User-Agent: KMail/1.4.3 +References: +In-Reply-To: +MIME-Version: 1.0 +Content-Transfer-Encoding: quoted-printable +Message-Id: <200309171313.31078.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/247 +X-Sequence-Number: 3613 + +Matt, + +> Is there any reason for me not to run continuous sequential vacuum analyz= +es? +> At least for the 6 tables that see a lot of updates? + +No. You've already proven that the performance gain on queries offsets the= +=20 +loss from the vacuuming. There is no other "gotcha".=20=20=20 + +However:=20 +1) You may be able to decrease the required frequency of vacuums by adjusti= +ng=20 +your FSM_relations parameter. Have you played with this at all? The defau= +lt=20 +is very low. +2) Are you sure that ANALYZE is needed? Vacuum is required whenever lots = +of=20 +rows are updated, but analyze is needed only when the *distribution* of=20 +values changes significantly. +3) using PG 7.3 or less, you will also need to REINDEX these tables+indexes= +=20 +often (daily?). This issue will go away in 7.4, which should make you an= +=20 +early adopter of 7.4. + +> I hear 10% of tuples updated as a good time to vac-an, but does my typical +> count of 3 indexes per table affect that? + +Not until 7.4. + +--=20 +-Josh Berkus + Aglio Database Solutions + San Francisco + + +From pgsql-performance-owner@postgresql.org Wed Sep 17 17:16:27 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 0E917D1B4FE + for ; + Wed, 17 Sep 2003 20:16:24 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 94921-05 + for ; + Wed, 17 Sep 2003 17:15:53 -0300 (ADT) +Received: from localhost.localdomain (unknown [65.217.53.66]) + by svr1.postgresql.org (Postfix) with ESMTP id 7867BD1B4EB + for ; + Wed, 17 Sep 2003 17:15:46 -0300 (ADT) +Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) + by localhost.localdomain (8.12.8/8.12.8) with ESMTP id h8HJ7Dqd026386; + Wed, 17 Sep 2003 15:07:13 -0400 +Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [192.168.3.55]) + by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id h8HKFkZ02372; + Wed, 17 Sep 2003 16:15:46 -0400 +Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP + (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) + id Q65SMD2H; Wed, 17 Sep 2003 16:15:44 -0400 +Subject: Re: restore time: sort_mem vs. checkpoing_segments +From: Robert Treat +To: Vivek Khera +Cc: pgsql-performance@postgresql.org +In-Reply-To: <16230.4066.565194.387700@yertle.int.kciLink.com> +References: <16230.4066.565194.387700@yertle.int.kciLink.com> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +X-Mailer: Ximian Evolution 1.0.8 +Date: 17 Sep 2003 16:15:46 -0400 +Message-Id: <1063829746.25694.91.camel@camel> +Mime-Version: 1.0 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/248 +X-Sequence-Number: 3614 + +On Mon, 2003-09-15 at 15:15, Vivek Khera wrote: +> And the winner is... checkpoint_segments. +> +> Restore of a significanly big database (~19.8GB restored) shows nearly +> no time difference depending on sort_mem when checkpoint_segments is +> large. There are quite a number of tables and indexes. The restore +> was done from a pg_dump -Fc dump of one database. +> +> All tests with 16KB page size, 30k shared buffers, sort_mem=8192, PG +> 7.4b2 on FreeBSD 4.8. + +hmm... i wonder what would happen if you pushed your sort_mem higher... +on some of our development boxes and upgrade scripts, i push the +sort_mem to 102400 and sometimes even higher depending on the box. this +really speeds up my restores quit a bit (and is generally safe as i make +sure there isn't any other activity going on at the time) + +another thing i like to do is turn of fsync, as if the system crashes in +the middle of reload i'm pretty sure i'd be starting all over anyway... + +Robert Treat +-- +Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL + + +From pgsql-performance-owner@postgresql.org Wed Sep 17 17:20:18 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 57E33D1B4EB + for ; + Wed, 17 Sep 2003 20:20:14 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 95101-02 + for ; + Wed, 17 Sep 2003 17:20:04 -0300 (ADT) +Received: from wight.ymogen.net (unknown [217.27.240.153]) + by svr1.postgresql.org (Postfix) with SMTP id BAC23D1B4E1 + for ; + Wed, 17 Sep 2003 17:20:01 -0300 (ADT) +Received: (qmail 10191 invoked from network); 17 Sep 2003 20:20:03 -0000 +Received: from dsl-217-155-239-51.zen.co.uk (HELO finisterre) (217.155.239.51) + by wight.ymogen.net with SMTP; 17 Sep 2003 20:20:03 -0000 +From: "Matt Clark" +To: "scott.marlowe" +Cc: +Subject: Re: Is there a reason _not_ to vacuum continuously? +Date: Wed, 17 Sep 2003 21:20:02 +0100 +Message-ID: +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 IMO, Build 9.0.2416 (9.0.2910.0) +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +In-reply-to: +Importance: Normal +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/249 +X-Sequence-Number: 3615 + +Yes, that makes sense. My worry is really the analyzes. I gather/imagine +that: + +1) Indexes on fields that are essentially random gain little from being +analyzed. +2) Fields that increase monotonically with insertion order have a problem +with index growth in 7.2. There may be a performance issue connected with +this, although indexes on these fields also gain little from analysis. So +if I can't vacuum full I'm SOL anyway and should upgrade to 7.4.1 when +available? + +Further data: When I run a vacuum analyze my app servers do see an increase +in response time from PG, even though the DB server is under no more +apparent load. I can only assume some kind of locking issue. Is that fair? + +M + + + + + +> -----Original Message----- +> From: pgsql-performance-owner@postgresql.org +> [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of +> scott.marlowe +> Sent: 17 September 2003 20:55 +> To: Matt Clark +> Cc: pgsql-performance@postgresql.org +> Subject: Re: [PERFORM] Is there a reason _not_ to vacuum continuously? +> +> +> On Wed, 17 Sep 2003, Matt Clark wrote: +> +> > *** THE QUESTION(S) *** +> > Is there any reason for me not to run continuous sequential +> vacuum analyzes? +> > At least for the 6 tables that see a lot of updates? +> > I hear 10% of tuples updated as a good time to vac-an, but does +> my typical +> > count of 3 indexes per table affect that? +> +> Generally, the only time continuous vacuuming is a bad thing is when you +> are I/O bound. If you are CPU bound, then continuous vacuuming +> is usually +> acceptable. +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: 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 Wed Sep 17 17:22:24 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 80FDBD1B4E1 + for ; + Wed, 17 Sep 2003 20:22:22 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 95138-03 + for ; + Wed, 17 Sep 2003 17:21:52 -0300 (ADT) +Received: from yertle.kcilink.com (yertle.kcilink.com [216.194.193.105]) + by svr1.postgresql.org (Postfix) with ESMTP id F3538D1B4EF + for ; + Wed, 17 Sep 2003 17:21:49 -0300 (ADT) +Received: by yertle.kcilink.com (Postfix, from userid 100) + id 7F4B8217B3; Wed, 17 Sep 2003 16:21:46 -0400 (EDT) +From: Vivek Khera +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +Message-ID: <16232.49754.420785.943263@yertle.int.kciLink.com> +Date: Wed, 17 Sep 2003 16:21:46 -0400 +To: Robert Treat +Cc: pgsql-performance@postgresql.org +Subject: Re: restore time: sort_mem vs. checkpoing_segments +In-Reply-To: <1063829746.25694.91.camel@camel> +References: <16230.4066.565194.387700@yertle.int.kciLink.com> + <1063829746.25694.91.camel@camel> +X-Mailer: VM 7.14 under 21.4 (patch 12) "Portable Code" XEmacs Lucid +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/250 +X-Sequence-Number: 3616 + +>>>>> "RT" == Robert Treat writes: + +RT> hmm... i wonder what would happen if you pushed your sort_mem higher... +RT> on some of our development boxes and upgrade scripts, i push the +RT> sort_mem to 102400 and sometimes even higher depending on the box. this +RT> really speeds up my restores quit a bit (and is generally safe as i make +RT> sure there isn't any other activity going on at the time) + +Ok... just two more tests to run, no big deal ;-) + + +RT> another thing i like to do is turn of fsync, as if the system crashes in +RT> the middle of reload i'm pretty sure i'd be starting all over anyway... + +I'll test it and see what happens. I suspect not a big improvement on +a hardware RAID card with 128Mb backed up cache, though. But never +say never! + +From pgsql-performance-owner@postgresql.org Wed Sep 17 17:24:54 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 8C0C8D1B509 + for ; + Wed, 17 Sep 2003 20:24:49 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 95966-02 + for ; + Wed, 17 Sep 2003 17:24:39 -0300 (ADT) +Received: from wight.ymogen.net (unknown [217.27.240.153]) + by svr1.postgresql.org (Postfix) with SMTP id 8F7CED1B4FE + for ; + Wed, 17 Sep 2003 17:24:36 -0300 (ADT) +Received: (qmail 11363 invoked from network); 17 Sep 2003 20:24:38 -0000 +Received: from dsl-217-155-239-51.zen.co.uk (HELO finisterre) (217.155.239.51) + by wight.ymogen.net with SMTP; 17 Sep 2003 20:24:38 -0000 +From: "Matt Clark" +To: , +Subject: Re: Is there a reason _not_ to vacuum continuously? +Date: Wed, 17 Sep 2003 21:24:37 +0100 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +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.2800.1165 +In-reply-to: <200309171313.31078.josh@agliodbs.com> +Importance: Normal +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/251 +X-Sequence-Number: 3617 + +> 2) Are you sure that ANALYZE is needed? Vacuum is required +> whenever lots of +> rows are updated, but analyze is needed only when the *distribution* of +> values changes significantly. + +You are right. I have a related qn in this thread about random vs. monotonic +values in indexed fields. + +> 3) using PG 7.3 or less, you will also need to REINDEX these +> tables+indexes +> often (daily?). This issue will go away in 7.4, which should +> make you an +> early adopter of 7.4. + +I understand this needs an exclusive lock on the whole table, which is +simply not possible more than once a month, if that... Workarounds/hack +suggestions are more than welcome :-) + +Ta + +M + + +From pgsql-performance-owner@postgresql.org Tue Sep 30 23:52:16 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 27791D1CA0D + for ; + Wed, 1 Oct 2003 02:52:14 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 05615-05 + for ; + Tue, 30 Sep 2003 23:51:25 -0300 (ADT) +Received: from www.postgresql.com (unknown [64.117.225.209]) + by svr1.postgresql.org (Postfix) with ESMTP id 12EF5D1D3B9 + for ; + Tue, 30 Sep 2003 23:22:25 -0300 (ADT) +Received: from reva.sixgirls.org (reva.sixgirls.org [66.250.131.180]) + by www.postgresql.com (Postfix) with ESMTP id 6A38DCF7FC5 + for ; + Tue, 30 Sep 2003 19:49:10 -0300 (ADT) +Received: from reva.sixgirls.org (localhost [127.0.0.1]) + by reva.sixgirls.org (8.12.10/8.12.9) with ESMTP id h8UMlxru028535; + Tue, 30 Sep 2003 18:48:49 -0400 (EDT) +Received: from localhost (adler@localhost) + by reva.sixgirls.org (8.12.9/8.12.9/Submit) with ESMTP id + h8HKk0Ep003651; Wed, 17 Sep 2003 16:46:07 -0400 (EDT) +X-Authentication-Warning: reva.sixgirls.org: adler owned process doing -bs +Date: Wed, 17 Sep 2003 16:46:00 -0400 (EDT) +From: Michael Adler +X-X-Sender: adler@reva.sixgirls.org +Reply-To: adler@pobox.com +To: Tom Lane +Cc: pgsql-performance@postgresql.org +Subject: Re: inferior SCSI performance +In-Reply-To: <4693.1063825713@sss.pgh.pa.us> +Message-ID: +References: <3F688CC5.12621.4EBFDCC@localhost> + + <4693.1063825713@sss.pgh.pa.us> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/382 +X-Sequence-Number: 3748 + + + +On Wed, 17 Sep 2003, Tom Lane wrote: +> Michael Adler writes: +> > I have been experimenting with a new Seagate Cheetah 10k-RPM SCSI to +> > compare with a cheaper Seagate Barracuda 7200-RPM IDE (each in a +> > single-drive configuration). The Cheetah definately dominates the generic +> > IO tests such as bonnie++, but fares poorly with pgbench (and other +> > postgresql operations). +> +> It's fairly common for ATA drives to be configured to lie about write +> completion (ie, claim write-complete as soon as data is accepted into +> their onboard RAM buffer), whereas SCSI drives usually report write +> complete only when the data is actually down to disk. The performance +> differential may thus be coming at the expense of reliability. If you +> run Postgres with fsync off, does the differential go away? + +Yes, they both perform equally at about 190 tps with fsync off. + +The culprit turns out to be write-caching on the IDE drive. It is enabled +by default, but can be disabled with "hdparm -W0 /dev/hdx". After it is +disabled, the tps are proportional to rpms. + +There's an (2001) Linux thread on this if anyone is interested: +http://www.ussg.iu.edu/hypermail/linux/kernel/0103.0/0331.html + +So the quesiton is whether it is ever sensible to use write-caching and +expect comparable persistence. + +Thanks, + +Michael Adler + +From pgsql-performance-owner@postgresql.org Wed Sep 17 19:19:22 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C4AA6D1B507 + for ; + Wed, 17 Sep 2003 22:19:19 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 18964-01 + for ; + Wed, 17 Sep 2003 19:19:08 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id 15484D1B4F0 + for ; + Wed, 17 Sep 2003 19:19:03 -0300 (ADT) +Received: from [66.219.92.2] (HELO temoku) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3651602; Wed, 17 Sep 2003 15:19:35 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: "Matt Clark" , + +Subject: Re: Is there a reason _not_ to vacuum continuously? +Date: Wed, 17 Sep 2003 15:17:26 -0700 +User-Agent: KMail/1.4.3 +References: +In-Reply-To: +MIME-Version: 1.0 +Content-Transfer-Encoding: quoted-printable +Message-Id: <200309171517.26841.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/253 +X-Sequence-Number: 3619 + +Matt, + +> I understand this needs an exclusive lock on the whole table, which is +> simply not possible more than once a month, if that... Workarounds/hack +> suggestions are more than welcome :-) + +Would it be reasonable to use partial indexes on the table? + +--=20 +-Josh Berkus + +______AGLIO DATABASE SOLUTIONS___________________________ + Josh Berkus + Complete information technology josh@agliodbs.com + and data management solutions (415) 565-7293 + for law firms, small businesses fax 621-2533 + and non-profit organizations. San Francisco + + +From pgsql-performance-owner@postgresql.org Wed Sep 17 19:18:06 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id CE6D6D1B4FC + for ; + Wed, 17 Sep 2003 22:18:03 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 13556-02 + for ; + Wed, 17 Sep 2003 19:17:52 -0300 (ADT) +Received: from host2.hostseguro.com (unknown [200.198.188.133]) + by svr1.postgresql.org (Postfix) with ESMTP id 7B038D1B4EC + for ; + Wed, 17 Sep 2003 19:17:49 -0300 (ADT) +Received: from cpanel by host2.hostseguro.com with local (Exim 4.20) + id 19zkcN-0001UT-Da + for pgsql-performance@postgresql.org; Wed, 17 Sep 2003 19:17:47 -0300 +Received: from 200.203.32.180 ([200.203.32.180]) + by sistemica.info (IMP) with HTTP + for ; Wed, 17 Sep 2003 19:17:47 -0300 +Message-ID: <1063837067.3f68dd8b5a62b@sistemica.info> +Date: Wed, 17 Sep 2003 19:17:47 -0300 +From: Rhaoni Chiu Pereira +To: PostgreSQL Performance +Subject: How to force an Index ? +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.2.1 +X-Originating-IP: 200.203.32.180 +X-MailScanner-Information: Verificado pelo McAfee VirusScan / Scanned by + McAfee VirusScan +X-MailScanner: Nao infectado / Found to be clean +X-AntiAbuse: This header was added to track abuse, + please include it with any abuse report +X-AntiAbuse: Primary Hostname - host2.hostseguro.com +X-AntiAbuse: Original Domain - postgresql.org +X-AntiAbuse: Originator/Caller UID/GID - [32001 32001] / [47 12] +X-AntiAbuse: Sender Address Domain - sistemica.info +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/252 +X-Sequence-Number: 3618 + +Hi list, + + I have a table like this: + +CREATE TABLE "gsames00" ( + "ano_mes" varchar(6) NOT NULL, + "descricao" varchar(30), + PRIMARY KEY ("ano_mes") +); + +and an index like this: + +CREATE INDEX GSAMES01 ON GSAMES00 (ANO_MES); + + When I run a explain analyze with this where clause: + + ... gsames00.ano_mes = to_char(ftnfco00.data_emissao,'YYYYMM') AND ... + + ftnfco00.data_emissao is a timestamp. When I run the explain analyze it says: + +... + -> Seq Scan on gsames00 (cost=100000000.00..100000006.72 rows=372 width=10) +(actual time=0.01..0.96 rows=372 loops=19923) +... + + So it is not using the index, and it makes the query too slow to return the +result. If a run the same query without this clause it gets about 1 minute +faster. You you're wondering : If you can run this query without this clause, +Why don't you take it out ? + I must use it because this query is created by a BI software and to +change it, I'll have to make a lot of changes in the BI software source. In the +Oracle DB it works fine 'cuz Oracle use the index and do it instantly. + Any suggestion on how to force PostgreSQL to use this index ??? + I run Vaccum Full Analyze many time before posting this ... + +Here follow the whole query and the whole explain: + +Query: + +SELECT /*+ */ +ftnfco00.estado_cliente , +ftcofi00.grupo_faturamento , +SUM( DECODE( ftcofi00.atual_fatura, '-', -(NVL +(ftnfpr00.qtde_duzias,0)), '+', NVL(ftnfpr00.qtde_duzias,0), 0) ) , +SUM( DECODE( ftcofi00.atual_fatura, '-', -(NVL(ftnfpr00.vlr_liquido,0)), '+', +NVL(ftnfpr00.vlr_liquido,0), 0) ) , +ftprod00.tipo_cadastro||ftprod00.codigo_produto , +ftprod00.descricao_produto , +DIVIDE( SUM( DECODE( ftcofi00.atual_fatura, '-', -(NVL +(ftnfpr00.vlr_liquido,0)), '+', NVL(ftnfpr00.vlr_liquido,0), 0) +*ftnfpr00.margem_comercial ), + SUM( DECODE( ftcofi00.atual_fatura, '-', -(NVL +(ftnfpr00.vlr_liquido,0)), '+', NVL(ftnfpr00.vlr_liquido,0), 0)) ) , +SUM( DECODE( ftcofi00.nf_prodgratis, 'S', NVL(ftnfpr00.qtde_duzias,0), 0 ) ) , +SUM( DECODE( ftcofi00.nf_prodgratis, 'S', NVL(ftnfpr00.vlr_liquido,0), 0 ) ) +FROM +ftprod00 , +ftnfco00 , +ftcgma00 , +ftcgca00 , +ftspro00 , +ftclcr00 , +gsames00 , +ftcofi00 , +ftrepr00 , +gsesta00 , +ftsupv00 , +ftgrep00 , +ftclgr00 , +ftband00 , +fttcli00 , +ftredc00 , +ftnfpr00 +WHERE +ftnfco00.emp = 909 AND +ftnfpr00.fil IN ('101') AND +ftnfco00.situacao_nf = 'N' AND +ftnfco00.data_emissao >= CAST('01-JAN-2003' AS DATE) AND +ftnfco00.data_emissao <= CAST('31-MAR-2003' AS DATE) AND +ftcofi00.grupo_faturamento >= '01' AND +(ftcofi00.atual_fatura IN ('+','-') OR ftcofi00.nf_prodgratis = 'S') AND +ftcgma00.emp = ftprod00.emp AND +ftcgma00.fil = ftprod00.fil AND +ftcgma00.codigo = ftprod00.cla_marca AND +ftcgca00.emp = ftprod00.emp AND +ftcgca00.fil = ftprod00.fil AND +ftcgca00.codigo = ftprod00.cla_categoria AND +ftspro00.emp = ftprod00.emp AND +ftspro00.fil = ftprod00.fil AND +ftspro00.codigo = ftprod00.situacao AND +ftclcr00.emp = ftnfco00.emp AND +ftclcr00.fil = ftnfco00.empfil AND +ftclcr00.tipo_cadastro = ftnfco00.tipo_cad_clicre AND +ftclcr00.codigo = ftnfco00.cod_cliente AND +gsames00.ano_mes = TO_CHAR(ftnfco00.data_emissao,'YYYYMM') AND +ftcofi00.emp = ftnfco00.emp AND +ftcofi00.fil = ftnfco00.empfil AND +ftcofi00.codigo_fiscal = ftnfco00.cod_fiscal AND +ftrepr00.emp = ftnfco00.emp AND +ftrepr00.fil = ftnfco00.empfil AND +ftrepr00.codigo_repr = ftnfco00.cod_repres AND +gsesta00.estado_sigla = ftnfco00.estado_cliente AND +ftsupv00.emp = ftrepr00.emp AND +ftsupv00.fil = ftrepr00.fil AND +ftsupv00.codigo_supervisor = ftrepr00.codigo_supervisor AND +ftgrep00.emp = ftrepr00.emp AND +ftgrep00.fil = ftrepr00.fil AND +ftgrep00.codigo_grupo_rep = ftrepr00.codigo_grupo_rep AND +ftclgr00.emp = ftclcr00.emp AND +ftclgr00.fil = ftclcr00.fil AND +ftclgr00.codigo = ftclcr00.codigo_grupo_cliente AND +ftband00.emp = ftclcr00.emp AND +ftband00.fil = ftclcr00.fil AND +ftband00.codigo = ftclcr00.bandeira_cliente AND +fttcli00.emp = ftclcr00.emp AND +fttcli00.fil = ftclcr00.fil AND +fttcli00.cod_tipocliente = ftclcr00.codigo_tipo_cliente AND +ftredc00.emp = ftclcr00.emp AND +ftredc00.fil = ftclcr00.fil AND +ftredc00.tipo_contribuinte = ftclcr00.tipo_contribuinte AND +ftredc00.codigo_rede = ftclcr00.codigo_rede AND +gsesta00.estado_sigla = ftclcr00.emp_estado AND +ftnfco00.emp = ftnfpr00.emp AND +ftnfco00.fil = ftnfpr00.fil AND +ftnfco00.nota_fiscal = ftnfpr00.nota_fiscal AND +ftnfco00.serie = ftnfpr00.serie AND +ftnfco00.data_emissao = ftnfpr00.data_emissao AND +ftprod00.emp = ftnfpr00.emp AND +ftprod00.fil = ftnfpr00.empfil AND +ftprod00.tipo_cadastro = ftnfpr00.tipo_cad_promat AND +ftprod00.codigo_produto= ftnfpr00.cod_produto +GROUP BY +ftnfco00.estado_cliente , +ftcofi00.grupo_faturamento , +ftprod00.tipo_cadastro||ftprod00.codigo_produto , +ftprod00.descricao_produto + + + +Explain: + + + + QUERY +PLAN + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +--------------------------------------------------------- + Aggregate (cost=100027780.66..100027780.69 rows=1 width=818) (actual +time=101278.24..105839.69 rows=363 loops=1) + -> Group (cost=100027780.66..100027780.68 rows=1 width=818) (actual +time=101272.08..101761.18 rows=19923 loops=1) + -> Sort (cost=100027780.66..100027780.67 rows=1 width=818) (actual +time=101272.05..101299.09 rows=19923 loops=1) + Sort Key: ftnfco00.estado_cliente, ftcofi00.grupo_faturamento, +((ftprod00.tipo_cadastro)::text || (ftprod00.codigo_produto)::text), +ftprod00.descricao_produto + -> Nested Loop (cost=100025960.94..100027780.65 rows=1 +width=818) (actual time=3476.87..99606.77 rows=19923 loops=1) + Join Filter: (("outer".emp = "inner".emp) AND ("outer".fil += "inner".fil) AND ("outer".codigo_supervisor = "inner".codigo_supervisor) AND +("outer".codigo_grupo_rep = "inner".codigo_grupo_rep)) + -> Nested Loop (cost=100025960.94..100027775.22 rows=1 +width=765) (actual time=3476.74..97802.69 rows=19923 loops=1) + Join Filter: (("inner".ano_mes)::text = to_char +("outer".data_emissao, 'YYYYMM'::text)) + -> Nested Loop (cost=25960.94..27762.92 rows=1 +width=755) (actual time=3475.14..32090.12 rows=19923 loops=1) + Join Filter: (("inner".emp = "outer".emp) AND +("outer".fil = "inner".fil) AND ("outer".codigo = "inner".cla_categoria) AND +("outer".codigo = "inner".cla_marca) AND ("outer".codigo = "inner".situacao)) + -> Nested Loop (cost=25960.94..27705.22 +rows=10 width=665) (actual time=3474.12..17734.21 rows=199230 loops=1) + Join Filter: (("outer".emp += "inner".emp) AND ("inner".fil = "outer".fil)) + -> Nested Loop +(cost=25960.94..27699.30 rows=1 width=638) (actual time=3474.02..6030.09 +rows=19923 loops=1) + Join Filter: (("inner".emp += "outer".emp) AND ("inner".empfil = "outer".fil)) + -> Merge Join +(cost=25960.94..26128.25 rows=265 width=526) (actual time=3473.78..3841.18 +rows=6358 loops=1) + Merge Cond: (("outer".emp += "inner".emp) AND ("outer".fil = "inner".fil) AND ("outer".codigo_fiscal += "inner".cod_fiscal)) + -> Index Scan using +ftcofi01 on ftcofi00 (cost=0.00..151.73 rows=72 width=52) (actual +time=0.15..6.40 rows=64 loops=1) + Filter: +((grupo_faturamento >= '01'::character varying) AND ((atual_fatura += '+'::character varying) OR (atual_fatura = '-'::character varying) OR +(nf_prodgratis = 'S'::character varying))) + -> Sort +(cost=25960.94..25965.34 rows=1760 width=474) (actual time=3471.17..3486.98 +rows=7666 loops=1) + Sort Key: +ftnfco00.emp, ftredc00.fil, ftnfco00.cod_fiscal + -> Nested Loop +(cost=25687.75..25866.07 rows=1760 width=474) (actual time=2981.05..3241.15 +rows=7666 loops=1) + Join Filter: +(("inner".emp = "outer".emp) AND ("inner".fil = "outer".fil) AND +("outer".codigo = "inner".codigo_grupo_cliente)) + -> Index Scan +using ftclgr01 on ftclgr00 (cost=0.00..4.68 rows=1 width=32) (actual +time=0.04..0.06 rows=1 loops=1) + -> Materialize +(cost=25830.59..25830.59 rows=1760 width=442) (actual time=2980.93..2990.31 +rows=7666 loops=1) + -> Hash +Join (cost=25687.75..25830.59 rows=1760 width=442) (actual +time=2507.55..2945.35 rows=7666 loops=1) + Hash +Cond: ("outer".emp_estado = "inner".estado_sigla) + -> +Nested Loop (cost=25683.33..25790.98 rows=1760 width=436) (actual +time=2507.09..2711.66 rows=7666 loops=1) + + Join Filter: (("inner".emp = "outer".emp) AND ("inner".fil = "outer".fil)) + + -> Index Scan using ftgrep01 on ftgrep00 (cost=0.00..4.68 rows=1 width=32) +(actual time=0.05..0.07 rows=1 loops=1) + + -> Materialize (cost=25759.91..25759.91 rows=1760 width=404) (actual +time=2506.98..2516.14 rows=7666 loops=1) + + -> Nested Loop (cost=25683.33..25759.91 rows=1760 width=404) (actual +time=2288.68..2474.11 rows=7666 loops=1) + + Join Filter: (("inner".emp = "outer".emp) AND ("inner".fil += "outer".fil)) + + -> Index Scan using ftsupv01 on ftsupv00 (cost=0.00..4.68 rows=1 +width=32) (actual time=0.04..0.05 rows=1 loops=1) + + -> Materialize (cost=25728.83..25728.83 rows=1760 width=372) +(actual time=2288.58..2297.79 rows=7666 loops=1) + + -> Merge Join (cost=25683.33..25728.83 rows=1760 +width=372) (actual time=2086.89..2265.03 rows=7666 loops=1) + + Merge Cond: (("outer".emp = "inner".emp) AND +("outer".fil = "inner".fil) AND ("outer".cod_tipocliente += "inner".codigo_tipo_cliente)) + + -> Index Scan using fttcli01 on fttcli00 +(cost=0.00..5.85 rows=17 width=33) (actual time=0.03..0.25 rows=17 loops=1) + + -> Sort (cost=25683.33..25687.73 rows=1760 +width=339) (actual time=2086.71..2095.86 rows=7666 loops=1) + + Sort Key: ftnfco00.emp, ftredc00.fil, +ftclcr00.codigo_tipo_cliente + + -> Nested Loop (cost=25389.10..25588.46 +rows=1760 width=339) (actual time=1729.53..1897.73 rows=7666 loops=1) + + Join Filter: (("inner".emp = "outer".emp) +AND ("inner".fil = "outer".fil) AND ("outer".codigo = "inner".bandeira_cliente)) + + -> Index Scan using ftband01 on ftband00 +(cost=0.00..4.68 rows=1 width=32) (actual time=0.04..0.06 rows=1 loops=1) + + -> Materialize (cost=25552.99..25552.99 +rows=1760 width=307) (actual time=1729.44..1738.69 rows=7666 loops=1) + + -> Nested Loop +(cost=25389.10..25552.99 rows=1760 width=307) (actual time=1566.24..1705.51 +rows=7666 loops=1) + + Join Filter: (("inner".emp += "outer".emp) AND ("inner".fil = "outer".fil)) + + -> Index Scan using ftcgma01 +on ftcgma00 (cost=0.00..4.68 rows=1 width=32) (actual time=0.03..0.05 rows=1 +loops=1) + + -> Materialize +(cost=25521.91..25521.91 rows=1760 width=275) (actual time=1566.16..1575.29 +rows=7666 loops=1) + + -> Merge Join +(cost=25389.10..25521.91 rows=1760 width=275) (actual time=1320.59..1542.54 +rows=7666 loops=1) + + Merge Cond: +(("outer".codigo = "inner".cod_cliente) AND ("outer".emp_estado += "inner".estado_cliente) AND ("outer".tipo_cadastro = "inner".tipo_cad_clicre) +AND ("outer".fil = "inner".empfil) AND ("outer".emp = "inner".emp)) + + -> Sort +(cost=6241.05..6269.31 rows=11304 width=166) (actual time=1093.04..1105.44 +rows=10478 loops=1) + + Sort Key: +ftclcr00.codigo, ftclcr00.emp_estado, ftclcr00.tipo_cadastro, ftredc00.fil, +ftredc00.emp + + -> Merge +Join (cost=3920.20..5480.05 rows=11304 width=166) (actual time=516.40..951.73 +rows=10956 loops=1) + + Merge +Cond: (("outer".emp = "inner".emp) AND ("outer".fil = "inner".fil) AND +("outer".tipo_contribuinte = "inner".tipo_contribuinte) AND +("outer".codigo_rede = "inner".codigo_rede)) + + -> +Merge Join (cost=0.00..1256.74 rows=8906 width=72) (actual time=0.13..180.25 +rows=8906 loops=1) + + +Merge Cond: ("outer".emp = "inner".emp) + + - +> Index Scan using ftredc01 on ftredc00 (cost=0.00..1118.47 rows=8906 +width=40) (actual time=0.05..72.02 rows=8906 loops=1) + + - +> Index Scan using ftcgca01 on ftcgca00 (cost=0.00..4.68 rows=1 width=32) +(actual time=0.04..19.14 rows=1 loops=1) + + -> +Sort (cost=3920.20..3947.59 rows=10956 width=94) (actual time=516.19..529.77 +rows=10956 loops=1) + + +Sort Key: ftclcr00.emp, ftclcr00.fil, ftclcr00.tipo_contribuinte, +ftclcr00.codigo_rede + + - +> Index Scan using ftclcr07 on ftclcr00 (cost=0.00..3185.08 rows=10956 +width=94) (actual time=0.09..146.20 rows=10956 loops=1) + + -> Sort +(cost=19148.05..19167.27 rows=7688 width=109) (actual time=227.46..237.00 +rows=7668 loops=1) + + Sort Key: +ftnfco00.cod_cliente, ftnfco00.estado_cliente, ftnfco00.tipo_cad_clicre, +ftnfco00.empfil, ftnfco00.emp + + -> Index +Scan using ftnfco06 on ftnfco00 (cost=0.00..18651.88 rows=7688 width=109) +(actual time=0.16..116.43 rows=7668 loops=1) + + Index +Cond: ((emp = 909::numeric) AND (situacao_nf = 'N'::character varying) AND +(data_emissao >= '2002-10-01 00:00:00'::timestamp without time zone) AND +(data_emissao <= '2003-03-31 00:00:00'::timestamp without time zone)) + -> +Hash (cost=4.33..4.33 rows=33 width=6) (actual time=0.23..0.23 rows=0 loops=1) + + -> Index Scan using gsesta01 on gsesta00 (cost=0.00..4.33 rows=33 width=6) +(actual time=0.04..0.15 rows=33 loops=1) + -> Index Scan using ftnfpr05 on +ftnfpr00 (cost=0.00..5.91 rows=1 width=112) (actual time=0.06..0.15 rows=3 +loops=6358) + Index Cond: (("outer".emp = +ftnfpr00.emp) AND ("outer".fil = ftnfpr00.fil) AND (ftnfpr00.fil = +101::numeric) AND ("outer".data_emissao = ftnfpr00.data_emissao) AND +("outer".nota_fiscal = ftnfpr00.nota_fiscal) AND ("outer".serie = +ftnfpr00.serie)) + -> Index Scan using ftspro01 on +ftspro00 (cost=0.00..5.78 rows=10 width=27) (actual time=0.01..0.07 rows=10 +loops=19923) + -> Index Scan using ftprod01 on ftprod00 +(cost=0.00..5.74 rows=1 width=90) (actual time=0.04..0.05 rows=1 loops=199230) + Index Cond: ((ftprod00.emp += "outer".emp) AND (ftprod00.fil = "outer".empfil) AND (ftprod00.tipo_cadastro += "outer".tipo_cad_promat) AND (ftprod00.codigo_produto = "outer".cod_produto)) + -> Seq Scan on gsames00 +(cost=100000000.00..100000006.72 rows=372 width=10) (actual time=0.01..0.96 +rows=372 loops=19923) + -> Index Scan using ftrepr01 on ftrepr00 +(cost=0.00..5.41 rows=1 width=53) (actual time=0.04..0.05 rows=1 loops=19923) + Index Cond: ((ftrepr00.emp = "outer".emp) AND +(ftrepr00.fil = "outer".empfil) AND (ftrepr00.codigo_repr = "outer".cod_repres)) + Total runtime: 105885.43 msec +(75 rows) + + + +The Oracle functions like NVL, DECODE, and others had been created in +PostgreSQL. + + +Atenciosamente, + +Rhaoni Chiu Pereira +Sist�mica Computadores + +Visite-nos na Web: http://sistemica.info +Fone/Fax : +55 51 3328 1122 + + + + + + +From pgsql-performance-owner@postgresql.org Wed Sep 17 19:40:25 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 1724ED1B4FC + for ; + Wed, 17 Sep 2003 22:40:23 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 13295-05 + for ; + Wed, 17 Sep 2003 19:40:12 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id B25B4D1B502 + for ; + Wed, 17 Sep 2003 19:40:09 -0300 (ADT) +Received: from [66.219.92.2] (HELO temoku) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3651667; Wed, 17 Sep 2003 15:40:42 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Rhaoni Chiu Pereira , + PostgreSQL Performance +Subject: Re: How to force an Index ? +Date: Wed, 17 Sep 2003 15:38:33 -0700 +User-Agent: KMail/1.4.3 +References: <1063837067.3f68dd8b5a62b@sistemica.info> +In-Reply-To: <1063837067.3f68dd8b5a62b@sistemica.info> +MIME-Version: 1.0 +Content-Transfer-Encoding: quoted-printable +Message-Id: <200309171538.33515.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/254 +X-Sequence-Number: 3620 + +Rhaoni, + +First off, thanks for posting such complete info. + +> ... gsames00.ano_mes =3D to_char(ftnfco00.data_emissao,'YYYYMM') AND .= +.. +>=20 +> ftnfco00.data_emissao is a timestamp. When I run the explain analyze i= +t=20 +says: +>=20 +> ... +> -> Seq Scan on gsames00 (cost=3D100000000.00..100000006.72 rows=3D372= +=20 +width=3D10)=20 +> (actual time=3D0.01..0.96 rows=3D372 loops=3D19923) +> ... + +Your problem is that you're comparing against a calculated expression based= + on=20 +ftnfco00, which is being filtered in about 18 other ways. As a result, the= +=20 +planner doesn't know what to estimate (see the cost estimate of 100000000,= +=20 +which is a "blind guess" values) and goes for a seq scan. + + Can I ask you to try this workaround, to create an expressional index on= +=20 +ftnfco00 (assuming that data_emmisao is of type DATE) + +create function date_to_yyyymm( date ) returns text as +'select to_char($1, ''YYYYMM''); +' language sql immutable strict; + +create index idx_data_yyyymm on ftnfco00(date_to_yyyymm(data_emmisao)); + +--=20 +-Josh Berkus + Aglio Database Solutions + San Francisco + + +From pgsql-performance-owner@postgresql.org Wed Sep 17 23:09:46 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 0890BD1B4E1 + for ; + Thu, 18 Sep 2003 02:09:43 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 51035-02 + for ; + Wed, 17 Sep 2003 23:09:36 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 9ACB7D1B510 + for ; + Wed, 17 Sep 2003 23:09:31 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h8I29Vsl055047 + for ; Thu, 18 Sep 2003 02:09:31 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h8I24Y3P054578 + for pgsql-performance@postgresql.org; Thu, 18 Sep 2003 02:04:34 GMT +From: Christopher Browne +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: Is there a reason _not_ to vacuum continuously? +Date: Wed, 17 Sep 2003 21:59:43 -0400 +Organization: cbbrowne Computing Inc +Lines: 46 +Message-ID: +References: + <200309171517.26841.josh@agliodbs.com> +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.1002 (Gnus v5.10.2) XEmacs/21.4 (Rational FORTRAN, linux) +Cancel-Lock: sha1:zN2CXeO+4gmmSDIDQhpAG/dQUQo= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/255 +X-Sequence-Number: 3621 + +Oops! josh@agliodbs.com (Josh Berkus) was seen spray-painting on a wall: +>> I understand this needs an exclusive lock on the whole table, which is +>> simply not possible more than once a month, if that... Workarounds/hack +>> suggestions are more than welcome :-) +> +> Would it be reasonable to use partial indexes on the table? + +Dumb question... + +... If you create a partial index, does this lock the whole table +while it is being built, or only those records that are affected by +the index definition? + +I expect that the answer to that is "Yes, it locks the whole table," +which means that a partial index won't really help very much, except +insofar as you might, by having it be restrictive in range, lock the +table for a somewhat shorter period of time. + +An alternative that may or may not be viable would be to have a series +of tables: + + create table t1 (); + create table t2 (); + create table t3 (); + create table t4 (); + +Then create a view: + + create view t as select * from t1 union all select * from t2 union + all select * from t13 union all select * from t4; + +Then you set this view to be updatable, by having a function that +rotates between the 4 tables based on a sequence. + +You do SELECT NEXTVAL('t_controller') and the entries start flooding +into t2 rather than t1, or into t3, or into t4, and after t4, they go +back into t1. + +When you need to reindex t1, you switch over to load entries into t2, +do maintenance on t1, and then maybe roll back to t1 so you can do the +same maintenance on t2. +-- +If this was helpful, rate me +http://www3.sympatico.ca/cbbrowne/lisp.html +Linux is like a Vorlon. It is incredibly powerful, gives terse, +cryptic answers and has a lot of things going on in the background. + +From pgsql-performance-owner@postgresql.org Thu Sep 18 02:00:06 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id BA17FD1B4F6 + for ; + Thu, 18 Sep 2003 05:00:01 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 73906-10 + for ; + Thu, 18 Sep 2003 01:59:30 -0300 (ADT) +Received: from swan.mail.pas.earthlink.net (swan.mail.pas.earthlink.net + [207.217.120.123]) + by svr1.postgresql.org (Postfix) with ESMTP id C5DEFD1B4F0 + for ; + Thu, 18 Sep 2003 01:59:29 -0300 (ADT) +Received: from rowlf.psp.pas.earthlink.net ([207.217.78.187]) + by swan.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) + id 19zqt7-0000Wo-00 + for pgsql-performance@postgresql.org; Wed, 17 Sep 2003 21:59:29 -0700 +Message-ID: <20399973.1063861169740.JavaMail.root@rowlf.psp.pas.earthlink.net> +Date: Wed, 17 Sep 2003 21:59:29 -0700 (GMT-07:00) +From: LN Cisneros +Reply-To: LN Cisneros +To: pgsql-performance@postgresql.org +Subject: rewrite in to exists? +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Mailer: Earthlink Zoo Mail 1.0 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests=BAYES_30, + LARGE_COLLECTION, RCVD_IN_OSIRUSOFT_COM +X-Spam-Level: +X-Archive-Number: 200309/256 +X-Sequence-Number: 3622 + + +I'm on 7.3.4 and this query gets horrible performance. Is there a way to rewrite it with an exists or some way to get better performance? + +select code, id, name, date_of_service + from tbl +where date_of_service in + (select date_of_service + from tbl + where xxx >= '29800' + and xxx <= '29909' + and code = 'XX') + and client_code = 'XX' +order by id, date_of_service; + +Thanks! + + + + +From pgsql-performance-owner@postgresql.org Thu Sep 18 02:22:34 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 98F4DD1B50F + for ; + Thu, 18 Sep 2003 05:22:32 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 94462-02 + for ; + Thu, 18 Sep 2003 02:22:01 -0300 (ADT) +Received: from houston.familyhealth.com.au (fhnet.arach.net.au + [203.22.197.21]) + by svr1.postgresql.org (Postfix) with ESMTP id 6D171D1B501 + for ; + Thu, 18 Sep 2003 02:21:59 -0300 (ADT) +Received: from mars (work-40.internal [192.168.0.40]) + by houston.familyhealth.com.au (8.12.9/8.12.9) with SMTP id + h8I5LRa3029315; Thu, 18 Sep 2003 13:21:28 +0800 (WST) + (envelope-from chriskl@familyhealth.com.au) +Message-ID: <08cd01c37da5$04cd5ff0$2800a8c0@mars> +From: "Christopher Kings-Lynne" +To: "LN Cisneros" , + +References: <20399973.1063861169740.JavaMail.root@rowlf.psp.pas.earthlink.net> +Subject: Re: rewrite in to exists? +Date: Thu, 18 Sep 2003 13:23:37 +0800 +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.1158 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 + tests=LARGE_COLLECTION, REFERENCES +X-Spam-Level: +X-Archive-Number: 200309/257 +X-Sequence-Number: 3623 + +> I'm on 7.3.4 and this query gets horrible performance. Is there a way to +rewrite it with an exists or some way to get better performance? +> +> select code, id, name, date_of_service +> from tbl +> where date_of_service in +> (select date_of_service +> from tbl +> where xxx >= '29800' +> and xxx <= '29909' +> and code = 'XX') +> and client_code = 'XX' +> order by id, date_of_service; + +???? + +Why can't you just go: + +select code, id, name, date_of_service from tbl where xxx <= 29800 and xx >= +29909 and code='XX' and client_code='XX' order by id, date_of_service; + +Or use a between clause is nice: + +select code, id, name, date_of_service from tbl where xxx between 29800 and +29909 and code='XX' and client_code='XX' order by id, date_of_service; + +But seriously - your query above is referencing 'tbl' twice - is that +correct, or is the tbl in the subselect supposed to be something different? + +Chris + + +From pgsql-performance-owner@postgresql.org Thu Sep 18 05:11:09 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 0DC31D1B4EE + for ; + Thu, 18 Sep 2003 08:11:08 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 06401-04 + for ; + Thu, 18 Sep 2003 05:10:57 -0300 (ADT) +Received: from mail.cict.nl (vnd-7521.mxs.adsl.euronet.nl [62.234.149.33]) + by svr1.postgresql.org (Postfix) with ESMTP id E932AD1B4EB + for ; + Thu, 18 Sep 2003 05:10:54 -0300 (ADT) +Received: from APR ([192.168.150.182]) + by mail.cict.nl (Merak 6.0.5) with SMTP id DUC73886 + for ; Thu, 18 Sep 2003 10:10:54 +0200 +Message-ID: <008901c37dbc$b3615550$b696a8c0@APR> +From: "Alexander Priem" +To: +References: <20399973.1063861169740.JavaMail.root@rowlf.psp.pas.earthlink.net> +Subject: Many fields in one table or many tables? +Date: Thu, 18 Sep 2003 10:13:11 +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.1106 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests=BAYES_30, + RCVD_IN_OSIRUSOFT_COM, REFERENCES +X-Spam-Level: +X-Archive-Number: 200309/258 +X-Sequence-Number: 3624 + +Hi guys, + +I am in the process of creating a database design in which LOTS of data need +to be modelled. + +For instance, I need to store data about products. Every product has LOTS of +properties, well over a hundred. + +So I'm wondering. What's the best approach here, performance wise? Just +create one Product table with well over a hundred columns? Or would it be +better to divide this over more tables and link them together via ID's? I +could for instance create tables Product, PriceInfo, Logistics, StorageInfo, +PackagingInfo and link them together via the same ID. This would be easier +to document (try to visualize a 100+ column table in a document!), but would +it impact performance? I tihnk maybe it would impact Select performance, but +Updating of products would maybe speed up a little... + +All info about a product is unique for this product so records in PriceInfo, +Logistics, StorageInfo, PackagingInfo tables would map one to one to records +in the Product table. + +Do any of you know if and how PostgreSQL would prefer one approach over the +other? + +Thanks in advance, +Alexander Priem. + + +From pgsql-performance-owner@postgresql.org Thu Sep 18 05:18:52 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 772F4D1B4F0 + for ; + Thu, 18 Sep 2003 08:18:51 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 04931-10 + for ; + Thu, 18 Sep 2003 05:18:20 -0300 (ADT) +Received: from deun2kex01.REALGARANT.DE (mail.realgarant.de [195.143.134.176]) + by svr1.postgresql.org (Postfix) with ESMTP id 21244D1B4EE + for ; + Thu, 18 Sep 2003 05:18:18 -0300 (ADT) +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Is there a reason _not_ to vacuum continuously? +X-MimeOLE: Produced By Microsoft Exchange V6.0.6375.0 +Date: Thu, 18 Sep 2003 10:18:27 +0200 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Is there a reason _not_ to vacuum continuously? +Thread-Index: AcN9WKApLCj8GvE7R1KQR/ryYT8+RgAZHoBg +From: "Oliver Scheit" +To: +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/259 +X-Sequence-Number: 3625 + +3) using PG 7.3 or less, you will also need to REINDEX these + tables+indexes often (daily?). This issue will go away + in 7.4, which should make you an early adopter of 7.4. + +Is this true? Haven't heard of this before. +If so, how can this be managed in a cronjob? +For the hourly VACUUM there's vacuumdb, but is +there somehting similar like reindexdb ? + +regards, +Oliver Scheit + +From pgsql-performance-owner@postgresql.org Thu Sep 18 05:25:18 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C4012D1B4F0 + for ; + Thu, 18 Sep 2003 08:25:14 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 11037-04 + for ; + Thu, 18 Sep 2003 05:24:43 -0300 (ADT) +Received: from houston.familyhealth.com.au (fhnet.arach.net.au + [203.22.197.21]) + by svr1.postgresql.org (Postfix) with ESMTP id 0CB4AD1B4EE + for ; + Thu, 18 Sep 2003 05:24:40 -0300 (ADT) +Received: from mars (work-40.internal [192.168.0.40]) + by houston.familyhealth.com.au (8.12.9/8.12.9) with SMTP id + h8I8ONa3031285; Thu, 18 Sep 2003 16:24:25 +0800 (WST) + (envelope-from chriskl@familyhealth.com.au) +Message-ID: <003f01c37dbe$4b6f9d10$2800a8c0@mars> +From: "Christopher Kings-Lynne" +To: "Oliver Scheit" , + +References: +Subject: Re: Is there a reason _not_ to vacuum continuously? +Date: Thu, 18 Sep 2003 16:24:32 +0800 +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.1158 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/260 +X-Sequence-Number: 3626 + + +> 3) using PG 7.3 or less, you will also need to REINDEX these +> tables+indexes often (daily?). This issue will go away +> in 7.4, which should make you an early adopter of 7.4. + +Try monthly maybe. + +> Is this true? Haven't heard of this before. +> If so, how can this be managed in a cronjob? +> For the hourly VACUUM there's vacuumdb, but is +> there somehting similar like reindexdb ? + +Yes, there is reindexdb :) + +Chris + + +From pgsql-performance-owner@postgresql.org Thu Sep 18 05:29:31 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 2381ED1B4FC + for ; + Thu, 18 Sep 2003 08:29:30 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 17386-04 + for ; + Thu, 18 Sep 2003 05:29:20 -0300 (ADT) +Received: from deun2kex01.REALGARANT.DE (mail.realgarant.de [195.143.134.176]) + by svr1.postgresql.org (Postfix) with ESMTP id D3AB8D1B4EF + for ; + Thu, 18 Sep 2003 05:29:17 -0300 (ADT) +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Is there a reason _not_ to vacuum continuously? +X-MimeOLE: Produced By Microsoft Exchange V6.0.6375.0 +Date: Thu, 18 Sep 2003 10:29:42 +0200 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Is there a reason _not_ to vacuum continuously? +Thread-Index: AcN9vmIqcymyK3F8S4eigwKgYhYQlQAABzWg +From: "Oliver Scheit" +To: +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/261 +X-Sequence-Number: 3627 + +> Yes, there is reindexdb :) + +Not on my machine. (RH 7.3) + +#rpm -qa|grep postgres +postgresql-server-7.2.3-5.73 +postgresql-libs-7.2.3-5.73 +postgresql-devel-7.2.3-5.73 +postgresql-7.2.3-5.73 + +What package am I missing? + +regards, +Oliver Scheit + +From pgsql-performance-owner@postgresql.org Thu Sep 18 05:49:10 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3FC12D1B4F0 + for ; + Thu, 18 Sep 2003 08:48:59 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 15142-07 + for ; + Thu, 18 Sep 2003 05:48:47 -0300 (ADT) +Received: from houston.familyhealth.com.au (fhnet.arach.net.au + [203.22.197.21]) + by svr1.postgresql.org (Postfix) with ESMTP id 3075DD1B4EE + for ; + Thu, 18 Sep 2003 05:48:43 -0300 (ADT) +Received: from mars (work-40.internal [192.168.0.40]) + by houston.familyhealth.com.au (8.12.9/8.12.9) with SMTP id + h8I8mWa3031472; Thu, 18 Sep 2003 16:48:40 +0800 (WST) + (envelope-from chriskl@familyhealth.com.au) +Message-ID: <005301c37dc1$af6b49b0$2800a8c0@mars> +From: "Christopher Kings-Lynne" +To: "Oliver Scheit" , + +References: +Subject: Re: Is there a reason _not_ to vacuum continuously? +Date: Thu, 18 Sep 2003 16:48:42 +0800 +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.1158 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=0.9 tagged_above=0.0 required=5.0 + tests=RCVD_IN_OSIRUSOFT_COM, REFERENCES +X-Spam-Level: +X-Archive-Number: 200309/262 +X-Sequence-Number: 3628 + +> #rpm -qa|grep postgres +> postgresql-server-7.2.3-5.73 +> postgresql-libs-7.2.3-5.73 +> postgresql-devel-7.2.3-5.73 +> postgresql-7.2.3-5.73 +> +> What package am I missing? + +It's part of postgresql 7.3. Just get it from the 7.3 contrib dir - it +works fine with 7.2 + +Note that this index growth problem has been basically solved as of +postgresql 7.4 - so that is your other option. + +Chris + + + + +From pgsql-performance-owner@postgresql.org Thu Sep 18 06:14:28 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B30C2D1B4F0 + for ; + Thu, 18 Sep 2003 09:14:22 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 28011-02 + for ; + Thu, 18 Sep 2003 06:13:52 -0300 (ADT) +Received: from email06.aon.at (WARSL402PIP3.highway.telekom.at [195.3.96.75]) + by svr1.postgresql.org (Postfix) with SMTP id 035DDD1B515 + for ; + Thu, 18 Sep 2003 06:13:49 -0300 (ADT) +Received: (qmail 459350 invoked from network); 18 Sep 2003 09:13:45 -0000 +Received: from m161p028.dipool.highway.telekom.at (HELO cantor) + ([62.46.10.28]) (envelope-sender ) + by qmail6rs.highway.telekom.at (qmail-ldap-1.03) with SMTP + for ; 18 Sep 2003 09:13:45 -0000 +From: Manfred Koizar +To: "Christopher Kings-Lynne" +Cc: "LN Cisneros" , + +Subject: Re: rewrite in to exists? +Date: Thu, 18 Sep 2003 11:16:03 +0200 +Message-ID: +References: <20399973.1063861169740.JavaMail.root@rowlf.psp.pas.earthlink.net> + <08cd01c37da5$04cd5ff0$2800a8c0@mars> +In-Reply-To: <08cd01c37da5$04cd5ff0$2800a8c0@mars> +X-Mailer: Forte Agent 1.93/32.576 English (American) +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/263 +X-Sequence-Number: 3629 + +On Thu, 18 Sep 2003 13:23:37 +0800, "Christopher Kings-Lynne" + wrote: +>Why can't you just go: +> +>select code, id, name, date_of_service from tbl where xxx <= 29800 and xx >= +>29909 and code='XX' and client_code='XX' order by id, date_of_service; + +Because (ignoring conditions on code and client_code for a moment) if +for a given date there is at least one row satisfying the condition on +xxx, the original query returns *all* rows having this date, +regardless of their xxx value. For example: + + id | date | xxx +----+------------+------- + 1 | 2003-01-01 | 10000 * + 2 | 2003-01-01 | 29800 * * + 3 | 2003-01-01 | 30000 * + 4 | 2003-02-02 | 20000 + 5 | 2003-03-03 | 29900 * * + + +>> select code, id, name, date_of_service +>> from tbl +>> where date_of_service in +>> (select date_of_service +>> from tbl +>> where xxx >= '29800' +>> and xxx <= '29909' +>> and code = 'XX') +>> and client_code = 'XX' +>> order by id, date_of_service; + +To the original poster: You did not provide a lot of information, but +the following suggestions might give you an idea ... + +SELECT code, id, date_of_service + FROM tbl + WHERE EXISTS (SELECT * + FROM tbl t2 + WHERE t2.xxx >= '29800' AND t2.xxx <= '29909' + AND t2.code = 'XX' + AND tbl.date_of_service = t2.date_of_service) + AND client_code = 'XX' + ORDER BY id, date_of_service; + +SELECT t1.code, t1.id, t1.date_of_service + FROM tbl t1 INNER JOIN + (SELECT DISTINCT date_of_service + FROM tbl + WHERE xxx >= '29800' AND xxx <= '29909' + AND code = 'XX' + ) AS t2 ON (t1.date_of_service = t2.date_of_service) + WHERE t1.client_code = 'XX' + ORDER BY id, date_of_service; + +SELECT DISTINCT t1.code, t1.id, t1.date_of_service + FROM tbl AS t1 INNER JOIN tbl AS t2 + ON (t1.date_of_service = t2.date_of_service + AND t2.xxx >= '29800' AND t2.xxx <= '29909' + AND t2.code = 'XX') + WHERE t1.client_code = 'XX' -- might as well put this + -- condition into the ON clause + ORDER BY id, date_of_service; + +The last one assumes that there are no duplicates on code, id, +date_of_service in the desired result. + +Servus + Manfred + +From pgsql-performance-owner@postgresql.org Thu Sep 18 06:29:19 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DE518D1B4EB + for ; + Thu, 18 Sep 2003 09:29:15 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 23514-09 + for ; + Thu, 18 Sep 2003 06:29:01 -0300 (ADT) +Received: from deun2kex01.REALGARANT.DE (mail.realgarant.de [195.143.134.176]) + by svr1.postgresql.org (Postfix) with ESMTP id 3077ED1B4E2 + for ; + Thu, 18 Sep 2003 06:28:58 -0300 (ADT) +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Is there a reason _not_ to vacuum continuously? +X-MimeOLE: Produced By Microsoft Exchange V6.0.6375.0 +Date: Thu, 18 Sep 2003 11:29:23 +0200 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Is there a reason _not_ to vacuum continuously? +Thread-Index: AcN9xS1D4FMVHlNMT/mLH61uJ/f2egAAH28g +From: "Oliver Scheit" +To: "Christopher Kings-Lynne" +Cc: +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/264 +X-Sequence-Number: 3630 + +>> > It's part of postgresql 7.3. Just get it from the 7.3 +>> > contrib dir - it works fine with 7.2 +>> That's nice to hear. Thanx for that info. + +> That's alright - cron job it for once a month - that's what +> I do. Basically the problem is that in certain cases +> (monotonically increasing serial indexes) for instance, +> PosgreSQL < 7.4 is unable to fully reclaim all the +> space after a page split. This means that your indexes +> just gradually grow really large. + +Uhm, I'm unable to find reindexdb. I have postgres 7.3.4 +on another server, but there's no reindexdb. Can you point +me to the right direction? + +Here's what's installed on that machine: +# rpm -qa|grep postgres +postgresql-perl-7.2.3-5.73 +postgresql-libs-7.3.4-2PGDG +postgresql-pl-7.3.4-2PGDG +postgresql-7.3.4-2PGDG +postgresql-contrib-7.3.4-2PGDG +postgresql-server-7.3.4-2PGDG + +> Yeah - 7.4 beta3 will be out very shortly, you'll probably +> have to wait a month or so for a final 7.4 release. + +Old version is rockstable and quite fast, so no problem with +that. + +> Even then, ugprading postgresql is always a pain in the neck. + +Upgrading to 7.3.4 was quite easy here. dumped the dbs, +uninstalled 7.2, installed 7.3 and let it read the dump. done. + +regards, +Oli + +From pgsql-admin-owner@postgresql.org Thu Sep 18 11:46:06 2003 +X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP + id 16CB5D1B518; Thu, 18 Sep 2003 14:45:41 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) + with ESMTP id 81643-01; Thu, 18 Sep 2003 11:45:32 -0300 (ADT) +Received: from host2.hostseguro.com (unknown [200.198.188.133]) + by svr1.postgresql.org (Postfix) with ESMTP + id C6302D1B513; Thu, 18 Sep 2003 11:45:27 -0300 (ADT) +Received: from cpanel by host2.hostseguro.com with local (Exim 4.20) + id 1A001t-0002hk-T3; Thu, 18 Sep 2003 11:45:09 -0300 +Received: from 200.180.173.173 ([200.180.173.173]) + by sistemica.info (IMP) with HTTP + for ; Thu, 18 Sep 2003 11:45:09 -0300 +Message-ID: <1063896309.3f69c4f5cd16a@sistemica.info> +Date: Thu, 18 Sep 2003 11:45:09 -0300 +From: Rhaoni Chiu Pereira +To: josh@agliodbs.com +Cc: PostgreSQL ADMIN , + PostgreSQL Performance +Subject: Re: [PERFORM] How to force an Index ? +References: <1063837067.3f68dd8b5a62b@sistemica.info> + <200309171538.33515.josh@agliodbs.com> +In-Reply-To: <200309171538.33515.josh@agliodbs.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.2.1 +X-Originating-IP: 200.180.173.173 +X-MailScanner-Information: Verificado pelo McAfee VirusScan / Scanned by + McAfee VirusScan +X-MailScanner: Nao infectado / Found to be clean +X-AntiAbuse: This header was added to track abuse, + please include it with any abuse report +X-AntiAbuse: Primary Hostname - host2.hostseguro.com +X-AntiAbuse: Original Domain - postgresql.org +X-AntiAbuse: Originator/Caller UID/GID - [32001 32001] / [47 12] +X-AntiAbuse: Sender Address Domain - sistemica.info +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/308 +X-Sequence-Number: 10396 + +I solve this problem doing this: + + create function date_to_yyyymm( timestamp ) returns gsames00.ano_mes%type as + 'select to_char($1, ''YYYYMM''); + ' language sql immutable strict; + +And changing the SQL where clause: + + ... gsames00.ano_mes = to_char(ftnfco00.data_emissao,'YYYYMM') AND ... + +to: + + ... gsames00.ano_mes = date_to_yyyymm(ftnfco00.data_emissao) AND ... + + Then it uses the gsames00 index instead of a SeqScan 'cuz it is camparing +same data type, but .. I don't want to create this function 'cuz this aplication +is used with Oracle too. +I need to know if there is a way to set the to_char output to varchar instead of +text ! + Any Idea ? So, this way I wont have to change my aplication source. + + + +Atenciosamente, + +Rhaoni Chiu Pereira +Sist�mica Computadores + +Visite-nos na Web: http://sistemica.info +Fone/Fax : +55 51 3328 1122 + + + +Citando Josh Berkus : + +<> Rhaoni, +<> +<> First off, thanks for posting such complete info. +<> +<> > ... gsames00.ano_mes = to_char(ftnfco00.data_emissao,'YYYYMM') AND ... +<> > +<> > ftnfco00.data_emissao is a timestamp. When I run the explain analyze it +<> +<> says: +<> > +<> > ... +<> > -> Seq Scan on gsames00 (cost=100000000.00..100000006.72 rows=372 +<> width=10) +<> > (actual time=0.01..0.96 rows=372 loops=19923) +<> > ... +<> +<> Your problem is that you're comparing against a calculated expression based +<> on +<> ftnfco00, which is being filtered in about 18 other ways. As a result, the +<> +<> planner doesn't know what to estimate (see the cost estimate of 100000000, +<> which is a "blind guess" values) and goes for a seq scan. +<> +<> Can I ask you to try this workaround, to create an expressional index on +<> ftnfco00 (assuming that data_emmisao is of type DATE) +<> +<> create function date_to_yyyymm( date ) returns text as +<> 'select to_char($1, ''YYYYMM''); +<> ' language sql immutable strict; +<> +<> create index idx_data_yyyymm on ftnfco00(date_to_yyyymm(data_emmisao)); +<> +<> -- +<> -Josh Berkus +<> Aglio Database Solutions +<> San Francisco +<> +<> +<> ---------------------------(end of broadcast)--------------------------- +<> TIP 4: Don't 'kill -9' the postmaster +<> + + +From pgsql-performance-owner@postgresql.org Thu Sep 18 11:47:37 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 4470AD1B528 + for ; + Thu, 18 Sep 2003 14:47:31 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 79385-03 + for ; + Thu, 18 Sep 2003 11:47:23 -0300 (ADT) +Received: from houston.familyhealth.com.au (fhnet.arach.net.au + [203.22.197.21]) + by svr1.postgresql.org (Postfix) with ESMTP id 050A9D1B518 + for ; + Thu, 18 Sep 2003 11:47:18 -0300 (ADT) +Received: from houston.familyhealth.com.au (chriskl@localhost [127.0.0.1]) + by houston.familyhealth.com.au (8.12.9/8.12.9) with ESMTP id + h8IEl3a3033825 for ; + Thu, 18 Sep 2003 22:47:04 +0800 (WST) + (envelope-from chriskl@familyhealth.com.au) +Received: from localhost (chriskl@localhost) + by houston.familyhealth.com.au (8.12.9/8.12.9/Submit) with ESMTP id + h8IEl3sj033822 for ; + Thu, 18 Sep 2003 22:47:03 +0800 (WST) +X-Authentication-Warning: houston.familyhealth.com.au: chriskl owned process + doing -bs +Date: Thu, 18 Sep 2003 22:47:03 +0800 (WST) +From: Christopher Kings-Lynne +To: pgsql-performance@postgresql.org +Subject: Re: Is there a reason _not_ to vacuum continuously? +In-Reply-To: +Message-ID: <20030918224644.Q33706-100000@houston.familyhealth.com.au> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/266 +X-Sequence-Number: 3632 + +(I've sent him reindexdb off-list) + +Chris + +On Thu, 18 Sep 2003, Oliver Scheit wrote: + +> >> > It's part of postgresql 7.3. Just get it from the 7.3 +> >> > contrib dir - it works fine with 7.2 +> >> That's nice to hear. Thanx for that info. +> +> > That's alright - cron job it for once a month - that's what +> > I do. Basically the problem is that in certain cases +> > (monotonically increasing serial indexes) for instance, +> > PosgreSQL < 7.4 is unable to fully reclaim all the +> > space after a page split. This means that your indexes +> > just gradually grow really large. +> +> Uhm, I'm unable to find reindexdb. I have postgres 7.3.4 +> on another server, but there's no reindexdb. Can you point +> me to the right direction? +> +> Here's what's installed on that machine: +> # rpm -qa|grep postgres +> postgresql-perl-7.2.3-5.73 +> postgresql-libs-7.3.4-2PGDG +> postgresql-pl-7.3.4-2PGDG +> postgresql-7.3.4-2PGDG +> postgresql-contrib-7.3.4-2PGDG +> postgresql-server-7.3.4-2PGDG +> +> > Yeah - 7.4 beta3 will be out very shortly, you'll probably +> > have to wait a month or so for a final 7.4 release. +> +> Old version is rockstable and quite fast, so no problem with +> that. +> +> > Even then, ugprading postgresql is always a pain in the neck. +> +> Upgrading to 7.3.4 was quite easy here. dumped the dbs, +> uninstalled 7.2, installed 7.3 and let it read the dump. done. +> +> regards, +> Oli +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 5: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faqs/FAQ.html +> + + +From pgsql-performance-owner@postgresql.org Thu Sep 18 12:01:03 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 01317D1B535 + for ; + Thu, 18 Sep 2003 15:00:58 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 80082-06 + for ; + Thu, 18 Sep 2003 12:00:26 -0300 (ADT) +Received: from falcon.mail.pas.earthlink.net (falcon.mail.pas.earthlink.net + [207.217.120.74]) + by svr1.postgresql.org (Postfix) with ESMTP id B934DD1B52C + for ; + Thu, 18 Sep 2003 12:00:25 -0300 (ADT) +Received: from statler.psp.pas.earthlink.net ([207.217.78.21]) + by falcon.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) + id 1A00GB-0006dZ-00; Thu, 18 Sep 2003 07:59:55 -0700 +Message-ID: + <24864010.1063897195181.JavaMail.root@statler.psp.pas.earthlink.net> +Date: Thu, 18 Sep 2003 07:59:54 -0700 (GMT-07:00) +From: LN Cisneros +Reply-To: LN Cisneros +To: Manfred Koizar , + Christopher Kings-Lynne +Subject: Re: rewrite in to exists? +Cc: LN Cisneros , pgsql-performance@postgresql.org +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Mailer: Earthlink Zoo Mail 1.0 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/267 +X-Sequence-Number: 3633 + + +On Thu, 18 Sep 2003 13:23:37 +0800, "Christopher Kings-Lynne" + + +>To the original poster: You did not provide a lot of information, but +>the following suggestions might give you an idea ... + +> + +Yes, sorry about that. But in my query for a set of dates returned from the subquery I would then like to get all records that match this set of dates (ordered). + +I believe this query will work and hopefully speed it up (the "IN" query is extremely slow)...I give this one a try: + +>SELECT t1.code, t1.id, t1.date_of_service +> FROM tbl t1 INNER JOIN +> (SELECT DISTINCT date_of_service +> FROM tbl +> WHERE xxx >= '29800' AND xxx <= '29909' +> AND code = 'XX' +> ) AS t2 ON (t1.date_of_service = t2.date_of_service) +> WHERE t1.client_code = 'XX' +> ORDER BY id, date_of_service; + +A question I have is is the "DISTINCT" really going to help or is it just going to throw another sort into the mix making it slower? + +Thanks for the help! + +Laurette + + + +From pgsql-admin-owner@postgresql.org Thu Sep 18 13:16:24 2003 +X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 38EBBD1B503 + for ; + Thu, 18 Sep 2003 16:16:22 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 01075-03 + for ; + Thu, 18 Sep 2003 13:16:12 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 5F1FCD1B4F6 + for ; Thu, 18 Sep 2003 13:16:11 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h8IGGAiP029874; + Thu, 18 Sep 2003 12:16:11 -0400 (EDT) +To: Rhaoni Chiu Pereira +Cc: josh@agliodbs.com, PostgreSQL ADMIN , + PostgreSQL Performance +Subject: Re: [PERFORM] How to force an Index ? +In-reply-to: <1063896309.3f69c4f5cd16a@sistemica.info> +References: <1063837067.3f68dd8b5a62b@sistemica.info> + <200309171538.33515.josh@agliodbs.com> + <1063896309.3f69c4f5cd16a@sistemica.info> +Comments: In-reply-to Rhaoni Chiu Pereira + message dated "Thu, 18 Sep 2003 11:45:09 -0300" +Date: Thu, 18 Sep 2003 12:16:10 -0400 +Message-ID: <29873.1063901770@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/311 +X-Sequence-Number: 10399 + +Rhaoni Chiu Pereira writes: +> I need to know if there is a way to set the to_char output to varchar instead of +> text ! + +Why don't you change the datatype of ano_mes to text, instead? It's +unlikely your application would notice the difference. (You could set +a CHECK constraint on the length if you really want to duplicate the +behavior of varchar(6).) + +Alternatively, try 7.4 beta. I believe this issue goes away in 7.4, +because varchar no longer has separate comparison operators. + +Of course there's also the option of modifying to_char's result type +in pg_proc, but I won't promise that doing so wouldn't break things. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Sep 18 14:27:26 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E9FC1D1B4F6 + for ; + Thu, 18 Sep 2003 17:27:24 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 11045-06 + for ; + Thu, 18 Sep 2003 14:27:15 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id EB911D1B4F0 + for ; + Thu, 18 Sep 2003 14:27:13 -0300 (ADT) +Received: from [63.195.55.98] (HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3653889; Thu, 18 Sep 2003 10:27:43 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Organization: Aglio Database Solutions +To: "Alexander Priem" , + +Subject: Re: Many fields in one table or many tables? +Date: Thu, 18 Sep 2003 10:27:12 -0700 +User-Agent: KMail/1.4.3 +References: <20399973.1063861169740.JavaMail.root@rowlf.psp.pas.earthlink.net> + <008901c37dbc$b3615550$b696a8c0@APR> +In-Reply-To: <008901c37dbc$b3615550$b696a8c0@APR> +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-Id: <200309181027.12195.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/269 +X-Sequence-Number: 3635 + +Alexander, + +> I am in the process of creating a database design in which LOTS of data +> need to be modelled. +> +> For instance, I need to store data about products. Every product has LOTS +> of properties, well over a hundred. + +> Do any of you know if and how PostgreSQL would prefer one approach over the +> other? + +Queston 1: Do all products have all of these properties, or do some/many/most +not have some properties? If the answer is the former, then a single table, +however broad, is the logical construct. If the latter, than several tables +makes more sense: why create NULL columns for stuff you could just leave out? + +Question 2: Is it true that some properties will be updated *much* (100x) more +frequently than others? If so, it would make sense from a +performance/postgresql standpoint to isolate those properties to related +table(s). Keep in mind that this recommendation is strictly performance +related, and is not necessarily the best relational design. + +Suggestion 3: There was an issue in 7.3 with table rows which are overly broad +-- some problems with PSQL, I believe. It would be worth searching for, as +I cannot remember what the limit is where problems occurred. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Sep 18 14:30:53 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 77F7DD1B4F0 + for ; + Thu, 18 Sep 2003 17:30:51 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 13567-01 + for ; + Thu, 18 Sep 2003 14:30:41 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id 68894D1B500 + for ; + Thu, 18 Sep 2003 14:30:40 -0300 (ADT) +Received: from [63.195.55.98] (HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3653901; Thu, 18 Sep 2003 10:31:09 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Organization: Aglio Database Solutions +To: "Christopher Kings-Lynne" , + "Oliver Scheit" , + +Subject: Re: Is there a reason _not_ to vacuum continuously? +Date: Thu, 18 Sep 2003 10:30:38 -0700 +User-Agent: KMail/1.4.3 +References: + <005301c37dc1$af6b49b0$2800a8c0@mars> +In-Reply-To: <005301c37dc1$af6b49b0$2800a8c0@mars> +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-Id: <200309181030.38126.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/270 +X-Sequence-Number: 3636 + +Guys, + +I also wrote a perl script that reindexes all tables, if anyone can't get +reindexdb working or find it for 7.2. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Sep 18 14:34:26 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id EB2CDD1B507 + for ; + Thu, 18 Sep 2003 17:34:25 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 12836-03 + for ; + Thu, 18 Sep 2003 14:34:16 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id E5723D1B503 + for ; + Thu, 18 Sep 2003 14:34:14 -0300 (ADT) +Received: from [63.195.55.98] (HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3653912; Thu, 18 Sep 2003 10:34:44 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Organization: Aglio Database Solutions +To: LN Cisneros , LN Cisneros , + Manfred Koizar , + Christopher Kings-Lynne +Subject: Re: rewrite in to exists? +Date: Thu, 18 Sep 2003 10:34:13 -0700 +User-Agent: KMail/1.4.3 +Cc: LN Cisneros , pgsql-performance@postgresql.org +References: + <24864010.1063897195181.JavaMail.root@statler.psp.pas.earthlink.net> +In-Reply-To: + <24864010.1063897195181.JavaMail.root@statler.psp.pas.earthlink.net> +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-Id: <200309181034.13414.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/271 +X-Sequence-Number: 3637 + +Laurette, + +> >SELECT t1.code, t1.id, t1.date_of_service +> > FROM tbl t1 INNER JOIN +> > (SELECT DISTINCT date_of_service +> > FROM tbl +> > WHERE xxx >= '29800' AND xxx <= '29909' +> > AND code = 'XX' +> > ) AS t2 ON (t1.date_of_service = t2.date_of_service) +> > WHERE t1.client_code = 'XX' +> > ORDER BY id, date_of_service; +> +> A question I have is is the "DISTINCT" really going to help or is it just +> going to throw another sort into the mix making it slower? + +It's required if you expect the subquery to return multiple rows for each +date_of_service match. Of course, you can also put the DISTINCT in the main +query instead; it depends on how many results you expect the subquery to +have. + +Still, I'd suggest trying the EXISTS version first .... under most +circumstances, DISTINCT is pretty slow. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-admin-owner@postgresql.org Fri Sep 19 11:55:23 2003 +X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP + id 39603D1B500; Thu, 18 Sep 2003 17:51:07 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) + with ESMTP id 11045-09; Thu, 18 Sep 2003 14:50:37 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP + id B3657D1B509; Thu, 18 Sep 2003 14:50:35 -0300 (ADT) +Received: from [63.195.55.98] (HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3653958; Thu, 18 Sep 2003 10:51:05 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Organization: Aglio Database Solutions +To: Rhaoni Chiu Pereira +Subject: Re: [PERFORM] How to force an Index ? +Date: Thu, 18 Sep 2003 10:50:34 -0700 +User-Agent: KMail/1.4.3 +Cc: PostgreSQL ADMIN , + PostgreSQL Performance +References: <1063837067.3f68dd8b5a62b@sistemica.info> + <200309171538.33515.josh@agliodbs.com> + <1063896309.3f69c4f5cd16a@sistemica.info> +In-Reply-To: <1063896309.3f69c4f5cd16a@sistemica.info> +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-Id: <200309181050.34270.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/319 +X-Sequence-Number: 10407 + +Rhaoni, + +> ... gsames00.ano_mes = to_char(ftnfco00.data_emissao,'YYYYMM') AND ... + +> Then it uses the gsames00 index instead of a SeqScan 'cuz it is +> camparing same data type, but .. I don't want to create this function 'cuz +> this aplication is used with Oracle too. + +You should have said that earlier .... + +> I need to know if there is a way to set the to_char output to varchar +> instead of text ! + +Did you try: + +... gsames00.ano_mes = (to_char(ftnfco00.data_emissao,'YYYYMM')::VARCHAR) AND +... + + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Sep 18 14:54:32 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 7C1CCD1B4F6 + for ; + Thu, 18 Sep 2003 17:54:31 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 14006-03 + for ; + Thu, 18 Sep 2003 14:54:00 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id 54378D1B4F0 + for ; + Thu, 18 Sep 2003 14:53:59 -0300 (ADT) +Received: from [63.195.55.98] (HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3653966; Thu, 18 Sep 2003 10:54:29 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Organization: Aglio Database Solutions +To: Joseph Bove , pgsql-performance@postgresql.org +Subject: Re: Find one record +Date: Thu, 18 Sep 2003 10:53:57 -0700 +User-Agent: KMail/1.4.3 +References: + <24864010.1063897195181.JavaMail.root@statler.psp.pas.earthlink.net> + <5.1.0.14.2.20030918135557.03ab89d8@mail.vetstar.com> +In-Reply-To: <5.1.0.14.2.20030918135557.03ab89d8@mail.vetstar.com> +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-Id: <200309181053.57709.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/274 +X-Sequence-Number: 3640 + +Joseph, + +> I hope this to be a simple question. I have need to simply read the first +> row in a given table. Right now, I have some legacy code that selects all +> rows in a table just to see if the first row has a certain value. + +Your problem is conceptual: in SQL, there is no "first" row. + +If you want to just pick a single row at random, do +SELECT * FROM table LIMIT 1; + +Or if you have a primary key id, you could for example return the row with the +lowest id: + +SELECT * FROM table ORDER BY id LIMIT 1; + +> The code is seeking to see if an update has been run or not. A hypothetical +> scenario would be: has an update been run to populate data into a new +> column in a table. Neither the data nor any of the rows are consistently +> known. So the test selects all rows, tests the first row and then ends if +> the column has a value. + +I'd write an ON UPDATE trigger, personally, to fire and write data somewhere +else whenever the table is updated. Much more reliable .... + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Sep 18 14:48:59 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 2718DD1B50F + for ; + Thu, 18 Sep 2003 17:48:58 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 11582-06 + for ; + Thu, 18 Sep 2003 14:48:28 -0300 (ADT) +Received: from merlin (merlin.warpdrive.net [24.56.130.4]) + by svr1.postgresql.org (Postfix) with ESMTP id EF9DCD1B4F0 + for ; + Thu, 18 Sep 2003 14:48:26 -0300 (ADT) +Received: from mail.warpdrive.net ([24.56.130.6] helo=mail.vetstar.com) + by merlin with esmtp (Exim 4.14) id 1A02tC-0004Xf-IS + for pgsql-performance@postgresql.org; Thu, 18 Sep 2003 13:48:22 -0400 +Received: from sirius.vetstar.com [66.88.86.217] by mail.vetstar.com with + ESMTP + (SMTPD32-8.02) id AFB9385013C; Thu, 18 Sep 2003 13:47:37 -0400 +Message-Id: <5.1.0.14.2.20030918135557.03ab89d8@mail.vetstar.com> +X-Sender: jbove@vetstar.com@mail.vetstar.com +X-Mailer: QUALCOMM Windows Eudora Version 5.1 +Date: Thu, 18 Sep 2003 14:01:05 -0400 +To: pgsql-performance@postgresql.org +From: Joseph Bove +Subject: Find one record +In-Reply-To: <200309181034.13414.josh@agliodbs.com> +References: + <24864010.1063897195181.JavaMail.root@statler.psp.pas.earthlink.net> + <24864010.1063897195181.JavaMail.root@statler.psp.pas.earthlink.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset="us-ascii"; format=flowed +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/272 +X-Sequence-Number: 3638 + +Dear list, + +I hope this to be a simple question. I have need to simply read the first +row in a given table. Right now, I have some legacy code that selects all +rows in a table just to see if the first row has a certain value. + +The code is seeking to see if an update has been run or not. A hypothetical +scenario would be: has an update been run to populate data into a new +column in a table. Neither the data nor any of the rows are consistently +known. So the test selects all rows, tests the first row and then ends if +the column has a value. + +Does anyone have a better way to do this? + +Regards + + +From pgsql-performance-owner@postgresql.org Thu Sep 18 15:02:31 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 77135D1B500 + for ; + Thu, 18 Sep 2003 18:02:30 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 15963-04 + for ; + Thu, 18 Sep 2003 15:02:20 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id 253FDD1B4EB + for ; + Thu, 18 Sep 2003 15:02:19 -0300 (ADT) +Received: from [63.195.55.98] (HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3654001; Thu, 18 Sep 2003 11:02:41 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Organization: Aglio Database Solutions +To: Rhaoni Chiu Pereira +Subject: Re: How to force an Index ? +Date: Thu, 18 Sep 2003 11:02:10 -0700 +User-Agent: KMail/1.4.3 +References: <1063837067.3f68dd8b5a62b@sistemica.info> + <200309181050.34270.josh@agliodbs.com> + <1063907803.3f69f1db83d91@sistemica.info> +In-Reply-To: <1063907803.3f69f1db83d91@sistemica.info> +Cc: pgsql-performance@postgresql.org +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-Id: <200309181102.10288.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/275 +X-Sequence-Number: 3641 + +Rhaoni, + +> I could .. but this way I wont be used because Oracle doesn't accept such +> sintax ! I changed gsames00.ano_mes from varchar to text ! But it still not +> fast enough to take Oracle's place !!! +> I still trying to do so ... + +Well, your basic problem is that performance tuning for *any* database often +requires use of database-specific syntax. You would be having the same +problem, in the opposite direction, if you were trying to port a PostgreSQL +app to Oracle without changing any syntax. + +Here's syntax Oracle should accept: + +... gsames00.ano_mes = (CAST(to_char(ftnfco00.data_emissao,'YYYYMM') AS +VARCHAR)) AND +... + + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Sep 18 15:20:53 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 19D9CD1B508 + for ; + Thu, 18 Sep 2003 18:20:50 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 23991-03 + for ; + Thu, 18 Sep 2003 15:20:40 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 7599CD1B500 + for ; + Thu, 18 Sep 2003 15:20:37 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h8IIKXiP001009; + Thu, 18 Sep 2003 14:20:33 -0400 (EDT) +To: Josh Berkus +Cc: "Alexander Priem" , pgsql-performance@postgresql.org +Subject: Re: Many fields in one table or many tables? +In-reply-to: <200309181027.12195.josh@agliodbs.com> +References: <20399973.1063861169740.JavaMail.root@rowlf.psp.pas.earthlink.net> + <008901c37dbc$b3615550$b696a8c0@APR> + <200309181027.12195.josh@agliodbs.com> +Comments: In-reply-to Josh Berkus + message dated "Thu, 18 Sep 2003 10:27:12 -0700" +Date: Thu, 18 Sep 2003 14:20:33 -0400 +Message-ID: <1008.1063909233@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/276 +X-Sequence-Number: 3642 + +Josh Berkus writes: +> Suggestion 3: There was an issue in 7.3 with table rows which are overly broad +> -- some problems with PSQL, I believe. + +Not sure about PSQL, but I think there still are some performance issues +in the backend with SELECTs involving more than a couple hundred +targetlist entries. These are probably fixable at not-very-large effort +but we haven't made any consistent push to find and fix the trouble +spots. The issues that I recall are O(N^2) problems (doubly nested +loops) so the performance with ~100 entries is no problem but it gets +rapidly worse above that. You could hit this even with ~100-column +tables if you try to select all columns from a join of two or more. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Sep 18 16:29:26 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id F15FAD1B503 + for ; + Thu, 18 Sep 2003 19:29:24 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 30503-05 + for ; + Thu, 18 Sep 2003 16:29:15 -0300 (ADT) +Received: from conure.mail.pas.earthlink.net (conure.mail.pas.earthlink.net + [207.217.120.54]) + by svr1.postgresql.org (Postfix) with ESMTP id 3690DD1B4F0 + for ; + Thu, 18 Sep 2003 16:29:14 -0300 (ADT) +Received: from waldorf.psp.pas.earthlink.net ([207.217.78.20]) + by conure.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) + id 1A04R2-000091-00; Thu, 18 Sep 2003 12:27:24 -0700 +Message-ID: + <14897881.1063913244318.JavaMail.root@waldorf.psp.pas.earthlink.net> +Date: Thu, 18 Sep 2003 12:27:23 -0700 (GMT-07:00) +From: LN Cisneros +Reply-To: LN Cisneros +To: Josh Berkus , LN Cisneros , + LN Cisneros , Manfred Koizar , + Christopher Kings-Lynne +Subject: Re: rewrite in to exists? +Cc: LN Cisneros , pgsql-performance@postgresql.org +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Mailer: Earthlink Zoo Mail 1.0 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/277 +X-Sequence-Number: 3643 + + +Thanks Josh! + +But, the EXISTS version doesn't really give me what I want...all rows in tbl that match the date of the subquery. + +But, using the DISTINCT does make sense. + +Thanks again to all who helped! + +-----Original Message----- +From: Josh Berkus +Sent: Sep 18, 2003 10:34 AM +To: LN Cisneros , LN Cisneros , + Manfred Koizar , + Christopher Kings-Lynne +Cc: LN Cisneros , pgsql-performance@postgresql.org +Subject: Re: [PERFORM] rewrite in to exists? + +Laurette, + +> >SELECT t1.code, t1.id, t1.date_of_service +> > FROM tbl t1 INNER JOIN +> > (SELECT DISTINCT date_of_service +> > FROM tbl +> > WHERE xxx >= '29800' AND xxx <= '29909' +> > AND code = 'XX' +> > ) AS t2 ON (t1.date_of_service = t2.date_of_service) +> > WHERE t1.client_code = 'XX' +> > ORDER BY id, date_of_service; +> +> A question I have is is the "DISTINCT" really going to help or is it just +> going to throw another sort into the mix making it slower? + +It's required if you expect the subquery to return multiple rows for each +date_of_service match. Of course, you can also put the DISTINCT in the main +query instead; it depends on how many results you expect the subquery to +have. + +Still, I'd suggest trying the EXISTS version first .... under most +circumstances, DISTINCT is pretty slow. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + + + + +From pgsql-performance-owner@postgresql.org Thu Sep 18 19:29:32 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3A7ADD1B502 + for ; + Thu, 18 Sep 2003 22:29:31 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 61372-09 + for ; + Thu, 18 Sep 2003 19:29:01 -0300 (ADT) +Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) + by svr1.postgresql.org (Postfix) with ESMTP id 77C70D1B4E8 + for ; + Thu, 18 Sep 2003 19:28:58 -0300 (ADT) +Received: from ibm-a.pdx.osdl.net (ibm-a.pdx.osdl.net [172.20.1.50]) + by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h8IMT0U27314 + for ; Thu, 18 Sep 2003 15:29:00 -0700 +Subject: osdl-dbt3 run results - puzzled by the execution plans +From: Jenny Zhang +To: pgsql-performance@postgresql.org +Content-Type: text/plain +Organization: osdl +Message-Id: <1063924610.31150.75.camel@ibm-a.pdx.osdl.net> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Thu, 18 Sep 2003 15:36:50 -0700 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/278 +X-Sequence-Number: 3644 + +Our hardware/software configuration: +kernel: 2.5.74 +distro: RH7.2 +pgsql: 7.3.3 +CPUS: 8 +MHz: 700.217 +model: Pentium III (Cascades) +memory: 8298888 kB +shmmax: 3705032704 + +We did several sets of runs(repeating runs with the same database +parameters) and have the following observation: + +1. With everything else the same, we did two run sets with +small effective_cache_size (default=1000) and large (655360 i.e. 5GB +or 60% of the system memory 8GB). It seems to me that small +effective_cache_size favors the choice of nested loop joins (NLJ) +while the big effective_cache_size is in favor of merge joins (MJ). +We thought the large effective_cache_size should lead us to better +plans. But we found the opposite. + +Three plans out of 22 are different. Two of those plans are worse +in execution time by 2 times and 8 times. For example, one plan, +that included NLJ ran in 4 seconds but the other, switching to an +MJ, ran in 32 seconds. Please refer to the link at the end of +this mail for the query and plans. Did we miss something, or +improvements are needed for the optimizer? + +2. Thanks to all the response we got from this mailing list, we +decided to use SETSEED(0) default_statistics_target=1000 to reduce +the variation. We get now the exact the same execution plans +and costs with repeated runs and that reduced the variation a lot. +However, within the same run set consist of 6 runs, we see 2-3% +standard deviation for the run metrics associated with the multiple +stream part of the test (as opposed to the single stream part). + +We would like to reduce the variation to be less than 1% so that a +2% change between two different kernels would be significant. +Is there anything else we can do? + +query: http://developer.osdl.org/~jenny/11.sql +plan with small effective_cache_size: +http://developer.osdl.org/~jenny/small_effective_cache_size_plan +plan with large effective_cache_size: +http://developer.osdl.org/~jenny/large_effective_cache_size_plan + +Thanks, +Jenny + + +From pgsql-performance-owner@postgresql.org Thu Sep 18 20:19:56 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id D0F27D1B53F + for ; + Thu, 18 Sep 2003 23:19:38 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 89676-03 + for ; + Thu, 18 Sep 2003 20:19:09 -0300 (ADT) +Received: from wight.ymogen.net (unknown [217.27.240.153]) + by svr1.postgresql.org (Postfix) with SMTP id B80AED1B502 + for ; + Thu, 18 Sep 2003 20:19:05 -0300 (ADT) +Received: (qmail 25034 invoked from network); 18 Sep 2003 23:19:02 -0000 +Received: from dsl-217-155-239-51.zen.co.uk (HELO finisterre) (217.155.239.51) + by wight.ymogen.net with SMTP; 18 Sep 2003 23:19:02 -0000 +From: "Matt Clark" +To: "Jenny Zhang" , + +Subject: Re: osdl-dbt3 run results - puzzled by the execution plans +Date: Fri, 19 Sep 2003 00:19:00 +0100 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +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.2800.1165 +In-reply-to: <1063924610.31150.75.camel@ibm-a.pdx.osdl.net> +Importance: Normal +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/279 +X-Sequence-Number: 3645 + +> We thought the large effective_cache_size should lead us to better +> plans. But we found the opposite. + +Maybe it's inappropriate for little old me to jump in here, but the plan +isn't usually that important compared to the actual runtime. The links you +give show the output of 'explain' but not 'explain analyze', so it's not +clear wich plan is actually _faster_. + +If you really do have only 8MB of FS cache, then either plan will run +slowly. If you really do have 5GB of FS cache then either plan will run a +lot faster. Why would you deliberately give the planner false information +about this? + +PG obviously thinks plan 1 is 'better' when pages have to be fetched from +disk, and plan 2 is 'better' when they don't. Which is really better +depends on whether those pages do have to be fetched from disk or not, and +PG can only know what you tell it about that, so changing ECS without +actually removing the RAM from the system seems a little pointless to me... + +M + + + + + +From pgsql-performance-owner@postgresql.org Thu Sep 18 21:45:28 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 52E6ED1B509 + for ; + Fri, 19 Sep 2003 00:45:24 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 04186-03 + for ; + Thu, 18 Sep 2003 21:44:55 -0300 (ADT) +Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) + by svr1.postgresql.org (Postfix) with ESMTP id AA151D1B4FC + for ; + Thu, 18 Sep 2003 21:44:51 -0300 (ADT) +Received: from ibm-a.pdx.osdl.net (ibm-a.pdx.osdl.net [172.20.1.50]) + by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h8J0ipU21733; + Thu, 18 Sep 2003 17:44:51 -0700 +Subject: Re: osdl-dbt3 run results - puzzled by the execution +From: Jenny Zhang +To: Matt Clark , josh@agliodbs.com +Cc: perf-pgsql +In-Reply-To: +References: +Content-Type: text/plain +Organization: osdl +Message-Id: <1063932761.31150.90.camel@ibm-a.pdx.osdl.net> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Thu, 18 Sep 2003 17:52:41 -0700 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/280 +X-Sequence-Number: 3646 + +Thanks for your prompt reply. + +On Thu, 2003-09-18 at 16:19, Matt Clark wrote: +> > We thought the large effective_cache_size should lead us to better +> > plans. But we found the opposite. +> +> Maybe it's inappropriate for little old me to jump in here, but the plan +> isn't usually that important compared to the actual runtime. The links you +> give show the output of 'explain' but not 'explain analyze', so it's not +> clear wich plan is actually _faster_. +> +I put the EXPLAIN ANALYZE output at: +http://developer.osdl.org/~jenny/large_explain_analyze +http://developer.osdl.org/~jenny/small_explain_analyze +The actual execution time is 37 seconds(large) vs 5 seconds (small). + +I concluded the one with nested loop one is faster since we saw it +consistently faster than the merge join one in our runs. +> If you really do have only 8MB of FS cache, then either plan will run +> slowly. If you really do have 5GB of FS cache then either plan will run a +> lot faster. Why would you deliberately give the planner false information +> about this? +> +We did not. A little history of our runs: +When we first started, not knowing PG well, we just used the default ECS +value(1000). +Then we realized since we have 8G of RAM, we should set ECS to 655360. +But this leads the optimizer to pick a bad plan. This is the reason why +we post this message. +> PG obviously thinks plan 1 is 'better' when pages have to be fetched from +> disk, and plan 2 is 'better' when they don't. Which is really better +> depends on whether those pages do have to be fetched from disk or not, and +> PG can only know what you tell it about that, so changing ECS without +> actually removing the RAM from the system seems a little pointless to me... +> +> M +> +> +> +Regards, +Jenny + + +From pgsql-performance-owner@postgresql.org Fri Sep 19 00:21:02 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 8017AD1B4EB + for ; + Fri, 19 Sep 2003 03:20:51 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 33326-02 + for ; + Fri, 19 Sep 2003 00:20:41 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 83208D1B4E9 + for ; + Fri, 19 Sep 2003 00:20:40 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h8J3KciP008225; + Thu, 18 Sep 2003 23:20:38 -0400 (EDT) +To: Jenny Zhang +Cc: pgsql-performance@postgresql.org +Subject: Re: osdl-dbt3 run results - puzzled by the execution plans +In-reply-to: <1063924610.31150.75.camel@ibm-a.pdx.osdl.net> +References: <1063924610.31150.75.camel@ibm-a.pdx.osdl.net> +Comments: In-reply-to Jenny Zhang + message dated "Thu, 18 Sep 2003 15:36:50 -0700" +Date: Thu, 18 Sep 2003 23:20:37 -0400 +Message-ID: <8224.1063941637@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/281 +X-Sequence-Number: 3647 + +Jenny Zhang writes: +> ... It seems to me that small +> effective_cache_size favors the choice of nested loop joins (NLJ) +> while the big effective_cache_size is in favor of merge joins (MJ). + +No, I wouldn't think that, because a nestloop plan will involve repeated +fetches of the same tuples whereas a merge join doesn't (at least not +when it sorts its inner input, as this plan does). Larger cache +improves the odds of a repeated fetch not having to do I/O. In practice +a larger cache area would also have some effects on access costs for the +sort's temp file, but I don't think the planner's cost model for sorting +takes that into account. + +As Matt Clark points out nearby, the real question is whether these +planner estimates have anything to do with reality. EXPLAIN ANALYZE +results would be far more interesting than plain EXPLAIN. + +> However, within the same run set consist of 6 runs, we see 2-3% +> standard deviation for the run metrics associated with the multiple +> stream part of the test (as opposed to the single stream part). + + Och, laddie, we useta *dream* of 2-3% variation + +> We would like to reduce the variation to be less than 1% so that a +> 2% change between two different kernels would be significant. + +I think this is a pipe dream. Variation in where the data gets laid +down on your disk drive would alone create more than that kind of delta. +I'm frankly amazed you could get repeatability within 2-3%. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Sep 19 05:55:28 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E3169D1B4E9 + for ; + Fri, 19 Sep 2003 08:55:26 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 89337-04 + for ; + Fri, 19 Sep 2003 05:54:57 -0300 (ADT) +Received: from email04.aon.at (WARSL402PIP2.highway.telekom.at [195.3.96.74]) + by svr1.postgresql.org (Postfix) with SMTP id 71517D1B509 + for ; + Fri, 19 Sep 2003 05:54:54 -0300 (ADT) +Received: (qmail 56846 invoked from network); 19 Sep 2003 08:54:49 -0000 +Received: from m161p014.dipool.highway.telekom.at (HELO cantor) + ([62.46.10.14]) (envelope-sender ) + by qmail7rs.highway.telekom.at (qmail-ldap-1.03) with SMTP + for ; 19 Sep 2003 08:54:49 -0000 +From: Manfred Koizar +To: LN Cisneros +Cc: Josh Berkus , LN Cisneros , + LN Cisneros , + Christopher Kings-Lynne , + LN Cisneros , pgsql-performance@postgresql.org +Subject: Re: rewrite in to exists? +Date: Fri, 19 Sep 2003 10:57:10 +0200 +Message-ID: <6eglmvc6h739mvth5qjueqsv9363n2c494@email.aon.at> +References: + <14897881.1063913244318.JavaMail.root@waldorf.psp.pas.earthlink.net> +In-Reply-To: + <14897881.1063913244318.JavaMail.root@waldorf.psp.pas.earthlink.net> +X-Mailer: Forte Agent 1.93/32.576 English (American) +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/282 +X-Sequence-Number: 3648 + +On Thu, 18 Sep 2003 12:27:23 -0700 (GMT-07:00), LN Cisneros + wrote: +>But, the EXISTS version doesn't + +Laurette, +looking at that SELECT statement again I can't see what's wrong with +it. One of us is missing something ;-) + +> really give me what I want... + +Can you elaborate? + +SELECT code, id, date_of_service + FROM tbl + WHERE EXISTS (SELECT * + FROM tbl t2 + WHERE t2.xxx >= '29800' AND t2.xxx <= '29909' + AND t2.code = 'XX' + AND tbl.date_of_service = t2.date_of_service) -- (!) + AND client_code = 'XX' + ORDER BY id, date_of_service; + +>all rows in tbl that + ^^^ +Well, all that have client_code = 'XX', as in your original query. + +> match the date of the subquery. + +The matching is done by the line with the (!) comment. + +Servus + Manfred + +From pgsql-performance-owner@postgresql.org Fri Sep 19 07:43:29 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id CA980D1B4FE + for ; + Fri, 19 Sep 2003 10:43:24 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 11734-05 + for ; + Fri, 19 Sep 2003 07:42:55 -0300 (ADT) +Received: from wight.ymogen.net (unknown [217.27.240.153]) + by svr1.postgresql.org (Postfix) with SMTP id E9C5DD1B4F6 + for ; + Fri, 19 Sep 2003 07:42:51 -0300 (ADT) +Received: (qmail 11089 invoked from network); 19 Sep 2003 10:42:49 -0000 +Received: from host213-123-217-162.in-addr.btopenworld.com (HELO solent) + (213.123.217.162) + by wight.ymogen.net with SMTP; 19 Sep 2003 10:42:49 -0000 +From: "Matt Clark" +To: "Jenny Zhang" , +Cc: "perf-pgsql" +Subject: Re: osdl-dbt3 run results - puzzled by the execution +Date: Fri, 19 Sep 2003 11:41:55 +0100 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +Importance: Normal +In-Reply-To: <1063932761.31150.90.camel@ibm-a.pdx.osdl.net> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/283 +X-Sequence-Number: 3649 + +> I put the EXPLAIN ANALYZE output at: +> http://developer.osdl.org/~jenny/large_explain_analyze +> http://developer.osdl.org/~jenny/small_explain_analyze +> The actual execution time is 37 seconds(large) vs 5 seconds (small). +> + +There's an obvious row count misestimation in the 'large' plan: + +-> Sort (cost=519.60..520.60 rows=400 width=31) (actual time=106.88..143.49 rows=30321 loops=1) + +but I'm not good enough at reading these things to tell if that's the cause of the problem, or if so how to fix it :-( + + + + +From pgsql-performance-owner@postgresql.org Fri Sep 19 10:13:07 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 727E4D1B50F + for ; + Fri, 19 Sep 2003 13:12:58 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 34570-06 + for ; + Fri, 19 Sep 2003 10:12:29 -0300 (ADT) +Received: from smtp.istop.com (dci.doncaster.on.ca [66.11.168.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 7EA4ED1B4E5 + for ; + Fri, 19 Sep 2003 10:12:25 -0300 (ADT) +Received: from stark.dyndns.tv (gsstark.mtl.istop.com [66.11.160.162]) + by smtp.istop.com (Postfix) with ESMTP + id 1D24136956; Fri, 19 Sep 2003 09:12:29 -0400 (EDT) +Received: from localhost ([127.0.0.1] helo=stark.dyndns.tv ident=foobar) + by stark.dyndns.tv with smtp (Exim 3.36 #1 (Debian)) + id 1A0L3k-0004c7-00; Fri, 19 Sep 2003 09:12:28 -0400 +To: Tom Lane +Cc: Jenny Zhang , pgsql-performance@postgresql.org +Subject: Re: osdl-dbt3 run results - puzzled by the execution plans +References: <1063924610.31150.75.camel@ibm-a.pdx.osdl.net> + <8224.1063941637@sss.pgh.pa.us> +In-Reply-To: <8224.1063941637@sss.pgh.pa.us> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 19 Sep 2003 09:12:27 -0400 +Message-ID: <87fzis2a84.fsf@stark.dyndns.tv> +Lines: 24 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/284 +X-Sequence-Number: 3650 + + +Tom Lane writes: + +> I think this is a pipe dream. Variation in where the data gets laid +> down on your disk drive would alone create more than that kind of delta. +> I'm frankly amazed you could get repeatability within 2-3%. + +I think the reason he gets good repeatability is because he's talking about +the aggregate results for a whole test run. Not individual queries. In theory +you could just run the whole test multiple times. The more times you run it +the lower the variation in the total run time would be. + +Actually, the variation in run time is also a useful statistic, both for +postgres and the kernel. It might be useful to do multiple complete runs and +keep track of the average standard deviation of the time required for each +step. + +Higher standard deviation implies queries can't be reliably depended on not to +take inordinately long, which can be a problem for some working models. For +the kernel it could mean latency issues or it could mean the swapper or buffer +cache was overly aggressive. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Fri Sep 19 12:07:27 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id CCF23D1B555 + for ; + Fri, 19 Sep 2003 15:06:40 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 67556-03 + for ; + Fri, 19 Sep 2003 12:06:08 -0300 (ADT) +Received: from email04.aon.at (WARSL402PIP2.highway.telekom.at [195.3.96.74]) + by svr1.postgresql.org (Postfix) with SMTP id 0AB21D1B543 + for ; + Fri, 19 Sep 2003 12:06:08 -0300 (ADT) +Received: (qmail 305610 invoked from network); 19 Sep 2003 15:06:04 -0000 +Received: from m156p003.dipool.highway.telekom.at (HELO cantor) ([62.46.9.99]) + (envelope-sender ) + by qmail7rs.highway.telekom.at (qmail-ldap-1.03) with SMTP + for ; 19 Sep 2003 15:06:04 -0000 +From: Manfred Koizar +To: Jenny Zhang +Cc: pgsql-performance@postgresql.org, "Matt Clark" +Subject: Re: osdl-dbt3 run results - puzzled by the execution plans +Date: Fri, 19 Sep 2003 17:08:26 +0200 +Message-ID: <3c6mmvcmvlr59kng6tnee2a0q4vf4spctt@email.aon.at> +References: <1063924610.31150.75.camel@ibm-a.pdx.osdl.net> +In-Reply-To: <1063924610.31150.75.camel@ibm-a.pdx.osdl.net> +X-Mailer: Forte Agent 1.93/32.576 English (American) +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/285 +X-Sequence-Number: 3651 + +On Thu, 18 Sep 2003 15:36:50 -0700, Jenny Zhang +wrote: +>We thought the large effective_cache_size should lead us to better +>plans. But we found the opposite. + +The common structure of your query plans is: + + Sort + Sort Key: sum((partsupp.ps_supplycost * partsupp.ps_availqty)) + InitPlan + -> Aggregate + -> SubPlan + -> Aggregate + Filter: (sum((ps_supplycost * ps_availqty)) > $0) + -> Group + -> Sort + Sort Key: partsupp.ps_partkey + -> SubPlan (same as above) + +where the SubPlan is + + -> Merge Join (cost=519.60..99880.05 rows=32068 width=65) + (actual time=114.78..17435.28 rows=30400 loops=1) + ctr=5.73 + Merge Cond: ("outer".ps_suppkey = "inner".s_suppkey) + -> Index Scan using i_ps_suppkey on partsupp + (cost=0.00..96953.31 rows=801712 width=34) + (actual time=0.42..14008.92 rows=799361 loops=1) + ctr=6.92 + -> Sort (cost=519.60..520.60 rows=400 width=31) + (actual time=106.88..143.49 rows=30321 loops=1) + ctr=3.63 + Sort Key: supplier.s_suppkey + -> SubSubPlan + +for large effective_cache_size and + + -> Nested Loop (cost=0.00..130168.30 rows=32068 width=65) + (actual time=0.56..1374.41 rows=30400 loops=1) + ctr=94.71 + -> SubSubPlan + -> Index Scan using i_ps_suppkey on partsupp + (cost=0.00..323.16 rows=80 width=34) + (actual time=0.16..2.98 rows=80 loops=380) + ctr=108.44 + Index Cond: (partsupp.ps_suppkey = "outer".s_suppkey) + +for small effective_cache_size. Both subplans have an almost +identical subsubplan: + +-> Nested Loop (cost=0.00..502.31 rows=400 width=31) + (actual time=0.23..110.51 rows=380 loops=1) + ctr=4.55 + Join Filter: ("inner".s_nationkey = "outer".n_nationkey) + -> Seq Scan on nation (cost=0.00..1.31 rows=1 width=10) + (actual time=0.08..0.14 rows=1 loops=1) + ctr=9.36 + Filter: (n_name = 'ETHIOPIA'::bpchar) + -> Seq Scan on supplier (cost=0.00..376.00 rows=10000 width=21) + (actual time=0.10..70.72 rows=10000 loops=1) + ctr=5.32 + +I have added the ctr (cost:time ratio) for each plan node. These +values are mostly between 5 and 10 with two notable exceptions: + +1) -> Sort (cost=519.60..520.60 rows=400 width=31) + (actual time=106.88..143.49 rows=30321 loops=1) + ctr=3.63 + +It has already been noticed by Matt Clark that this is the only plan +node where the row count estimation looks wrong. However, I don't +believe that this has great influence on the total cost of the plan, +because the ctr is not far from the usual range and if it were a bit +higher, it would only add a few hundred cost units to a branch costing +almost 100000 units. BTW I vaguely remember that there is something +strange with the way actual rows are counted inside a merge join. +Look at the branch below this plan node: It shows an actual row count +of 380. + +2) -> Index Scan using i_ps_suppkey on partsupp + (cost=0.00..323.16 rows=80 width=34) + (actual time=0.16..2.98 rows=80 loops=380) + ctr=108.44 + +Here we have the only plan node where loops > 1, and it is the only +one where the ctr is far off. The planner computes the cost for one +loop and multiplies it by the number of loops (which it estimates +quite accurately to be 400), thus getting a total cost of ca. 130000. +We have no reason to believe that the single loop cost is very far +from reality (for a *single* index scan), but the planner does not +account for additional index scans hitting pages in the cache that +have been brought in by preceding scans. This is a known problem, Tom +has mentioned it several times, IIRC. + +Now I'm very interested in getting a better understanding of this +problem, so could you please report the results of + +. \d i_ps_suppkey + +. VACUUM VERBOSE ANALYSE partsupp; + VACUUM VERBOSE ANALYSE supplier; + +. SELECT attname, null_frac, avg_witdh, n_distinct, correlation + FROM pg_stats + WHERE tablename = 'partsupp' AND attname IN ('ps_suppkey', ...); + + Please insert other interesting column names for ..., especially + those contained in i_ps_suppkey, if any. + +. SELECT relname, relpages, reltuples + FROM pg_class + WHERE relname IN ('partsupp', 'supplier', ...); + ^^^ + Add relevant index names here. + +. EXPLAIN ANALYSE + SELECT ps_partkey, ps_supplycost, ps_availqty + FROM partsupp, supplier + WHERE ps_suppkey = s_suppkey AND s_nationkey = ''; + + The idea is to eliminate parts of the plan that are always the same. + Omitting nation is possibly to much a simplification. In this case + please re-add it. + Do this test for small and large effective_cache_size. + Force the use of other join methods by setting enable_ + to off. Post all results. + + +Jenny, I understand that this long message contains more questions +than answers and is not of much help for you. OTOH your tests might +be very helpful for Postgres development ... + +Servus + Manfred + +From pgsql-performance-owner@postgresql.org Fri Sep 19 15:28:03 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id EC92DD1B4F6 + for ; + Fri, 19 Sep 2003 18:28:01 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 07797-05 + for ; + Fri, 19 Sep 2003 15:27:52 -0300 (ADT) +Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) + by svr1.postgresql.org (Postfix) with ESMTP id 6DD54D1B537 + for ; + Fri, 19 Sep 2003 15:27:50 -0300 (ADT) +Received: from ibm-a.pdx.osdl.net (ibm-a.pdx.osdl.net [172.20.1.50]) + by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h8JIRhU14046; + Fri, 19 Sep 2003 11:27:43 -0700 +Subject: Re: osdl-dbt3 run results - puzzled by the execution +From: Jenny Zhang +To: Manfred Koizar +Cc: perf-pgsql , + Matt Clark +In-Reply-To: <3c6mmvcmvlr59kng6tnee2a0q4vf4spctt@email.aon.at> +References: <1063924610.31150.75.camel@ibm-a.pdx.osdl.net> + <3c6mmvcmvlr59kng6tnee2a0q4vf4spctt@email.aon.at> +Content-Type: text/plain +Organization: osdl +Message-Id: <1063996535.32392.9.camel@ibm-a.pdx.osdl.net> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Fri, 19 Sep 2003 11:35:35 -0700 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/286 +X-Sequence-Number: 3652 + +I posted more results as you requested: + +On Fri, 2003-09-19 at 08:08, Manfred Koizar wrote: +> On Thu, 18 Sep 2003 15:36:50 -0700, Jenny Zhang +> wrote: +> >We thought the large effective_cache_size should lead us to better +> >plans. But we found the opposite. +> +> The common structure of your query plans is: +> +> Sort +> Sort Key: sum((partsupp.ps_supplycost * partsupp.ps_availqty)) +> InitPlan +> -> Aggregate +> -> SubPlan +> -> Aggregate +> Filter: (sum((ps_supplycost * ps_availqty)) > $0) +> -> Group +> -> Sort +> Sort Key: partsupp.ps_partkey +> -> SubPlan (same as above) +> +> where the SubPlan is +> +> -> Merge Join (cost=519.60..99880.05 rows=32068 width=65) +> (actual time=114.78..17435.28 rows=30400 loops=1) +> ctr=5.73 +> Merge Cond: ("outer".ps_suppkey = "inner".s_suppkey) +> -> Index Scan using i_ps_suppkey on partsupp +> (cost=0.00..96953.31 rows=801712 width=34) +> (actual time=0.42..14008.92 rows=799361 loops=1) +> ctr=6.92 +> -> Sort (cost=519.60..520.60 rows=400 width=31) +> (actual time=106.88..143.49 rows=30321 loops=1) +> ctr=3.63 +> Sort Key: supplier.s_suppkey +> -> SubSubPlan +> +> for large effective_cache_size and +> +> -> Nested Loop (cost=0.00..130168.30 rows=32068 width=65) +> (actual time=0.56..1374.41 rows=30400 loops=1) +> ctr=94.71 +> -> SubSubPlan +> -> Index Scan using i_ps_suppkey on partsupp +> (cost=0.00..323.16 rows=80 width=34) +> (actual time=0.16..2.98 rows=80 loops=380) +> ctr=108.44 +> Index Cond: (partsupp.ps_suppkey = "outer".s_suppkey) +> +> for small effective_cache_size. Both subplans have an almost +> identical subsubplan: +> +> -> Nested Loop (cost=0.00..502.31 rows=400 width=31) +> (actual time=0.23..110.51 rows=380 loops=1) +> ctr=4.55 +> Join Filter: ("inner".s_nationkey = "outer".n_nationkey) +> -> Seq Scan on nation (cost=0.00..1.31 rows=1 width=10) +> (actual time=0.08..0.14 rows=1 loops=1) +> ctr=9.36 +> Filter: (n_name = 'ETHIOPIA'::bpchar) +> -> Seq Scan on supplier (cost=0.00..376.00 rows=10000 width=21) +> (actual time=0.10..70.72 rows=10000 loops=1) +> ctr=5.32 +> +> I have added the ctr (cost:time ratio) for each plan node. These +> values are mostly between 5 and 10 with two notable exceptions: +> +> 1) -> Sort (cost=519.60..520.60 rows=400 width=31) +> (actual time=106.88..143.49 rows=30321 loops=1) +> ctr=3.63 +> +> It has already been noticed by Matt Clark that this is the only plan +> node where the row count estimation looks wrong. However, I don't +> believe that this has great influence on the total cost of the plan, +> because the ctr is not far from the usual range and if it were a bit +> higher, it would only add a few hundred cost units to a branch costing +> almost 100000 units. BTW I vaguely remember that there is something +> strange with the way actual rows are counted inside a merge join. +> Look at the branch below this plan node: It shows an actual row count +> of 380. +> +> 2) -> Index Scan using i_ps_suppkey on partsupp +> (cost=0.00..323.16 rows=80 width=34) +> (actual time=0.16..2.98 rows=80 loops=380) +> ctr=108.44 +> +> Here we have the only plan node where loops > 1, and it is the only +> one where the ctr is far off. The planner computes the cost for one +> loop and multiplies it by the number of loops (which it estimates +> quite accurately to be 400), thus getting a total cost of ca. 130000. +> We have no reason to believe that the single loop cost is very far +> from reality (for a *single* index scan), but the planner does not +> account for additional index scans hitting pages in the cache that +> have been brought in by preceding scans. This is a known problem, Tom +> has mentioned it several times, IIRC. +> +> Now I'm very interested in getting a better understanding of this +> problem, so could you please report the results of +> +> . \d i_ps_suppkey +> +http://developer.osdl.org/~jenny/pgsql-optimizer/disc_i_ps_suppkey +> . VACUUM VERBOSE ANALYSE partsupp; +> VACUUM VERBOSE ANALYSE supplier; +> +http://developer.osdl.org/~jenny/pgsql-optimizer/vacuum_verbose_analyze_partsupp +http://developer.osdl.org/~jenny/pgsql-optimizer/vacuum_verbose_analyze_suppler +> . SELECT attname, null_frac, avg_witdh, n_distinct, correlation +> FROM pg_stats +> WHERE tablename = 'partsupp' AND attname IN ('ps_suppkey', ...); +> +> Please insert other interesting column names for ..., especially +> those contained in i_ps_suppkey, if any. +> +I put all the related columns +http://developer.osdl.org/~jenny/pgsql-optimizer/info_partsupp_col + +> . SELECT relname, relpages, reltuples +> FROM pg_class +> WHERE relname IN ('partsupp', 'supplier', ...); +> ^^^ +> Add relevant index names here. +> +I put all the related tables +http://developer.osdl.org/~jenny/pgsql-optimizer/info_table + +> . EXPLAIN ANALYSE +> SELECT ps_partkey, ps_supplycost, ps_availqty +> FROM partsupp, supplier +> WHERE ps_suppkey = s_suppkey AND s_nationkey = ''; +> +> The idea is to eliminate parts of the plan that are always the same. +> Omitting nation is possibly to much a simplification. In this case +> please re-add it. +> Do this test for small and large effective_cache_size. +> Force the use of other join methods by setting enable_ +> to off. Post all results. +> +http://developer.osdl.org/~jenny/pgsql-optimizer/explain_query_mk +> +> Jenny, I understand that this long message contains more questions +> than answers and is not of much help for you. OTOH your tests might +> be very helpful for Postgres development ... +Let me know if you need anything else + +Jenny + + +From pgsql-performance-owner@postgresql.org Fri Sep 19 19:54:24 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id CE3E1D1B559 + for ; + Fri, 19 Sep 2003 21:28:06 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 63043-03 + for ; + Fri, 19 Sep 2003 18:27:58 -0300 (ADT) +Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) + by svr1.postgresql.org (Postfix) with ESMTP id 6271AD1B4E3 + for ; + Fri, 19 Sep 2003 18:27:55 -0300 (ADT) +Received: from ibm-a.pdx.osdl.net (ibm-a.pdx.osdl.net [172.20.1.50]) + by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h8JLRoU18866; + Fri, 19 Sep 2003 14:27:50 -0700 +Subject: Re: osdl-dbt3 run results - puzzled by the execution +From: Jenny Zhang +To: Tom Lane +Cc: perf-pgsql +In-Reply-To: <8224.1063941637@sss.pgh.pa.us> +References: <1063924610.31150.75.camel@ibm-a.pdx.osdl.net> + <8224.1063941637@sss.pgh.pa.us> +Content-Type: text/plain +Organization: osdl +Message-Id: <1064007341.442.45.camel@ibm-a.pdx.osdl.net> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Fri, 19 Sep 2003 14:35:41 -0700 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/287 +X-Sequence-Number: 3653 + +On Thu, 2003-09-18 at 20:20, Tom Lane wrote: +> Jenny Zhang writes: +> > ... It seems to me that small +> > effective_cache_size favors the choice of nested loop joins (NLJ) +> > while the big effective_cache_size is in favor of merge joins (MJ). +> +> No, I wouldn't think that, because a nestloop plan will involve repeated +> fetches of the same tuples whereas a merge join doesn't (at least not +> when it sorts its inner input, as this plan does). Larger cache +> improves the odds of a repeated fetch not having to do I/O. In practice +> a larger cache area would also have some effects on access costs for the +> sort's temp file, but I don't think the planner's cost model for sorting +> takes that into account. +I think there is some misunderstanding here. What I meant to say is: +>From the plans we got, the optimizer favors the choice of nested loop +joins (NLJ) while the big effective_cache_size is in favor of merge +joins (MJ). Which we think is not appropriate. We verified that +sort_mem has no impact on the plans. Though it would be nice to take +that into account. +> +> As Matt Clark points out nearby, the real question is whether these +> planner estimates have anything to do with reality. EXPLAIN ANALYZE +> results would be far more interesting than plain EXPLAIN. +> +> > However, within the same run set consist of 6 runs, we see 2-3% +> > standard deviation for the run metrics associated with the multiple +> > stream part of the test (as opposed to the single stream part). +> +> Och, laddie, we useta *dream* of 2-3% variation +> +BTW, I am a she :-) +> > We would like to reduce the variation to be less than 1% so that a +> > 2% change between two different kernels would be significant. +> +> I think this is a pipe dream. Variation in where the data gets laid +> down on your disk drive would alone create more than that kind of delta. +> I'm frankly amazed you could get repeatability within 2-3%. +> +Greg is right. The repeatability is due to the aggregate results for a +whole test run. As for individual query, the power test(single stream) +is very consistent, and the throughput test(multiple streams), any given +query execution time varies up to 15% if no swapping. If we set +sort_mem too high and swapping occurs, the variation is bigger. + +Jenny + + +From pgsql-performance-owner@postgresql.org Fri Sep 19 20:19:27 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DBBA8D1B51D + for ; + Fri, 19 Sep 2003 23:19:25 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 90392-09 + for ; + Fri, 19 Sep 2003 20:19:18 -0300 (ADT) +Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) + by svr1.postgresql.org (Postfix) with ESMTP id 665D7D1B57C + for ; + Fri, 19 Sep 2003 20:19:13 -0300 (ADT) +Received: from ibm-a.pdx.osdl.net (ibm-a.pdx.osdl.net [172.20.1.50]) + by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h8JNJ2U08433; + Fri, 19 Sep 2003 16:19:02 -0700 +Subject: Re: osdl-dbt3 run results - puzzled by the execution +From: Jenny Zhang +To: Greg Stark +Cc: Tom Lane , + perf-pgsql +In-Reply-To: <87fzis2a84.fsf@stark.dyndns.tv> +References: <1063924610.31150.75.camel@ibm-a.pdx.osdl.net> + <8224.1063941637@sss.pgh.pa.us> <87fzis2a84.fsf@stark.dyndns.tv> +Content-Type: text/plain +Organization: osdl +Message-Id: <1064014014.442.189.camel@ibm-a.pdx.osdl.net> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Fri, 19 Sep 2003 16:26:54 -0700 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/288 +X-Sequence-Number: 3654 + +On Fri, 2003-09-19 at 06:12, Greg Stark wrote: +> Tom Lane writes: +> +> > I think this is a pipe dream. Variation in where the data gets laid +> > down on your disk drive would alone create more than that kind of delta. +> > I'm frankly amazed you could get repeatability within 2-3%. +> +> I think the reason he gets good repeatability is because he's talking about +> the aggregate results for a whole test run. Not individual queries. In theory +> you could just run the whole test multiple times. The more times you run it +> the lower the variation in the total run time would be. +> +That is right. The repeatability is due to the aggregate results for a +whole test run. As for individual query, the power test(single stream) +is very consistent, and the throughput test(multiple streams), any given +query execution time varies up to 15% if no swapping. If we set +sort_mem too high and swapping occurs, the variation is bigger. + +> Actually, the variation in run time is also a useful statistic, both for +> postgres and the kernel. It might be useful to do multiple complete runs and +> keep track of the average standard deviation of the time required for each +> step. +> +I created a page with the execution time(in seconds), average, and +stddev for each query and each steps. The data is collected from 6 dbt3 +runs. +http://developer.osdl.org/~jenny/pgsql-optimizer/exetime.html + +> Higher standard deviation implies queries can't be reliably depended on not to +> take inordinately long, which can be a problem for some working models. For +> the kernel it could mean latency issues or it could mean the swapper or buffer +> cache was overly aggressive. +I agree. I can think of another reason why the performance varies even +the swapper and buffer cache is not overly aggressive. Since PG depends +on OS to manage the buffer cache(correct me if I am wrong), it is up to +OS to decide what to keep in the cache. And OS can not anticipate what +is likely needed next. + +Thanks, +Jenny + + +From pgsql-performance-owner@postgresql.org Sat Sep 20 13:19:55 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 0AEBDD1B53E + for ; + Sat, 20 Sep 2003 16:19:55 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 81055-06 + for ; + Sat, 20 Sep 2003 13:19:23 -0300 (ADT) +Received: from 64.117.224.193 (unknown [209.120.141.44]) + by svr1.postgresql.org (Postfix) with SMTP id 12037D1B543 + for ; + Sat, 20 Sep 2003 13:19:21 -0300 (ADT) +Received: from (HELO 1111p) [8.151.78.235] by 64.117.224.193; + Sat, 20 Sep 2003 15:21:26 -0200 +Message-ID: +From: "Beauty Center" +Reply-To: "Beauty Center" +To: +Subject: Sexier, Plumper L|ps can be yours only $24.76 +Date: Sat, 20 Sep 2003 15:21:26 -0200 +X-Mailer: Jinfengmailer_v2.2 +X-Info-Mailx: kthjoDkviulinzmxvBklhgtivhjoClit +MIME-Version: 1.0 +X-Priority: 3 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=4.4 tagged_above=0.0 required=5.0 tests=HTML_70_80, + HTML_IMAGE_RATIO_08, HTML_WEB_BUGS, MIME_HTML_ONLY, RATWARE_HASH_2, + RATWARE_HASH_2_V2 +X-Spam-Level: **** +Content-Transfer-Encoding: quoted-printable +Content-Type: text/html; +X-Archive-Number: 200309/289 +X-Sequence-Number: 3655 + +FINALLY A LIP PLUMPER THAT ACTUALLY WORKS !!! + + +
+ +
+
+Get Plump, Sexy Lip's
In Und= +er 30 Days!
+

+ +
visit we= +bsite

+ + + + + + + + +
+CITY LIP'S exclusive lip treatment...
>Stimulates c= +ollagen & hyaluronic moisture in your lip's resulting in BIGGER, LUSCIOUS, more SENSUOUS Lip's<= +/span>
>CITY LIP'S is used = +by men & women in 34 countries. Recommended by Plast= +ic Surgeons, Celebrities, & Movie Stars= +
> CITY LIP'S super-hydrating formula plumps &= +amp; reduces unattractive lip wr= +inkles & fine lines
> Easy to use, completely = +pain-free and GUARANTEED to work in 30 day= +s or your MONEY BACK!

+

Be the envy of all your friends!

+

retail $47.95
+ONLINE SALE $24.76
you save: = +$23.19 (48% OFF)
+ ~> BUY 2 GET 1 FREE <~

+ + + + +
+ + +
buy nowvisit website<= +/td>
customer= + ratings:
+
+

Women love beauty tips, forward this = +to a friend!



+

Distributors Welcome!

+ +
+

 

 

 

+ + +From pgsql-performance-owner@postgresql.org Tue Sep 23 21:28:59 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 12D1BD1C9E4 + for ; + Mon, 22 Sep 2003 20:18:25 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 95214-04 + for ; + Mon, 22 Sep 2003 17:17:55 -0300 (ADT) +Received: from yertle.kcilink.com (yertle.kcilink.com [216.194.193.105]) + by svr1.postgresql.org (Postfix) with ESMTP id 1CEF2D1B4EB + for ; + Mon, 22 Sep 2003 17:17:53 -0300 (ADT) +Received: by yertle.kcilink.com (Postfix, from userid 100) + id 9D2F3217B2; Mon, 22 Sep 2003 16:17:54 -0400 (EDT) +From: Vivek Khera +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +Message-ID: <16239.22770.504961.514819@yertle.int.kciLink.com> +Date: Mon, 22 Sep 2003 16:17:54 -0400 +To: Robert Treat +Cc: pgsql-performance@postgresql.org +Subject: Re: restore time: sort_mem vs. checkpoing_segments +In-Reply-To: <1063829746.25694.91.camel@camel> +References: <16230.4066.565194.387700@yertle.int.kciLink.com> + <1063829746.25694.91.camel@camel> +X-Mailer: VM 7.14 under 21.4 (patch 12) "Portable Code" XEmacs Lucid +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/292 +X-Sequence-Number: 3658 + +>>>>> "RT" == Robert Treat writes: + +RT> hmm... i wonder what would happen if you pushed your sort_mem higher... +RT> on some of our development boxes and upgrade scripts, i push the +RT> sort_mem to 102400 and sometimes even higher depending on the box. this +RT> really speeds up my restores quit a bit (and is generally safe as i make +RT> sure there isn't any other activity going on at the time) + +I was just checking, and I already ran test with larger sort_mem. the +checkpoint segments made more of a difference... + +From pgsql-performance-owner@postgresql.org Tue Sep 23 21:27:50 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 86F4FD1C9F2 + for ; + Mon, 22 Sep 2003 20:43:43 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 98000-03 + for ; + Mon, 22 Sep 2003 17:43:13 -0300 (ADT) +Received: from shire.ontko.com (shire.ontko.com [199.164.165.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 4DB85D1B4EB + for ; + Mon, 22 Sep 2003 17:43:11 -0300 (ADT) +Received: from nick (bilbo.ontko.com [199.164.165.101]) + by shire.ontko.com (8.12.3/8.12.3/Debian-6.6) with SMTP id + h8MKhA5f027359 + for ; Mon, 22 Sep 2003 15:43:13 -0500 +Reply-To: +From: "Nick Fankhauser" +To: "Pgsql-Performance@Postgresql. Org" +Subject: How to make n_distinct more accurate. +Date: Mon, 22 Sep 2003 15:42:27 -0500 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +Importance: Normal +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/290 +X-Sequence-Number: 3656 + +Hi- + +I have a table- called "event" with a field event_date_time that is indexed. +There are 1,700,000 rows in the table and 92,000 distinct values of +event_date_time with anywhere from 1 to 400 rows sharing the same value. (I +did a count grouped by event_date_time & scanned it to get this info.) + +When I look at the pg_stats on this table, I always see 15,000 or lower in +the n_distinct column for event_date_time. (I re-ran analyze several times & +then checked pg_stats to see if the numbers varied significantly.) + +Since this is off by about a factor of 6, I think the planner is missing the +chance to use this table as the "driver" in a complex query plan that I'm +trying to optimize. + +So the question is- how can I get a better estimate of n_distinct from +analyze? + +If I alter the stats target as high as it will go, I get closer, but it +still shows the index to be about 1/2 as selective as it actually is: + +alpha=# alter table event alter column event_date_time set statistics 1000; +ALTER TABLE +alpha=# analyze event; +ANALYZE +alpha=# select n_distinct from pg_stats where tablename='event' and +attname='event_date_time'; + n_distinct +------------ + 51741 +(1 row) + +This number seems to be consistently around 51,000 if I re-run analyze a few +times. + +I guess my question is two-part: + +(1)Is there any tweak to make this estimate work better? + +(2)Since I'm getting numbers that are consistent but way off, is there a bug +here? + +(2-1/2) Or alternately, am I totally missing what n-distinct is supposed to +denote? + +Thanks! + -Nick + +--------------------------------------------------------------------- +Nick Fankhauser + + nickf@doxpop.com Phone 1.765.965.7363 Fax 1.765.962.9788 +doxpop - Court records at your fingertips - http://www.doxpop.com/ + + + +From pgsql-performance-owner@postgresql.org Tue Sep 23 21:29:06 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id ED63AD1B8A8 + for ; + Tue, 23 Sep 2003 13:59:18 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 01979-01 + for ; + Tue, 23 Sep 2003 10:59:09 -0300 (ADT) +Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) + by svr1.postgresql.org (Postfix) with ESMTP id 31951D1B580 + for ; + Tue, 23 Sep 2003 10:59:03 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id h8NDx1A01317; + Tue, 23 Sep 2003 09:59:01 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200309231359.h8NDx1A01317@candle.pha.pa.us> +Subject: Re: restore time: sort_mem vs. checkpoing_segments +In-Reply-To: <16230.4066.565194.387700@yertle.int.kciLink.com> +To: Vivek Khera +Date: Tue, 23 Sep 2003 09:59:01 -0400 (EDT) +Cc: pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL106 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/293 +X-Sequence-Number: 3659 + +Vivek Khera wrote: +> And the winner is... checkpoint_segments. +> +> Restore of a significanly big database (~19.8GB restored) shows nearly +> no time difference depending on sort_mem when checkpoint_segments is +> large. There are quite a number of tables and indexes. The restore +> was done from a pg_dump -Fc dump of one database. +> +> All tests with 16KB page size, 30k shared buffers, sort_mem=8192, PG +> 7.4b2 on FreeBSD 4.8. +> +> 3 checkpoint_segments restore time: 14983 seconds +> 50 checkpoint_segments restore time: 11537 seconds +> 50 checkpoint_segments, sort_mem 131702 restore time: 11262 seconds + +With the new warning about too-frequent checkpoints, people have actual +feedback to encourage them to increase checkpoint_segments. One issue +is that it is likely to recommend increasing checkpoint_segments during +restore, even if there is no value to it being large during normal +server operation. Should that be decumented? + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Tue Sep 23 21:29:07 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id AF959D1B56B + for ; + Tue, 23 Sep 2003 14:28:28 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 99781-09 + for ; + Tue, 23 Sep 2003 11:28:00 -0300 (ADT) +Received: from yertle.kcilink.com (yertle.kcilink.com [216.194.193.105]) + by svr1.postgresql.org (Postfix) with ESMTP id 5B6ABD1B4EB + for ; + Tue, 23 Sep 2003 11:27:56 -0300 (ADT) +Received: by yertle.kcilink.com (Postfix, from userid 100) + id 80FB5217B2; Tue, 23 Sep 2003 10:27:55 -0400 (EDT) +From: Vivek Khera +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +Message-ID: <16240.22635.390707.785148@yertle.int.kciLink.com> +Date: Tue, 23 Sep 2003 10:27:55 -0400 +To: Bruce Momjian +Cc: pgsql-performance@postgresql.org +Subject: Re: restore time: sort_mem vs. checkpoing_segments +In-Reply-To: <200309231359.h8NDx1A01317@candle.pha.pa.us> +References: <16230.4066.565194.387700@yertle.int.kciLink.com> + <200309231359.h8NDx1A01317@candle.pha.pa.us> +X-Mailer: VM 7.14 under 21.4 (patch 12) "Portable Code" XEmacs Lucid +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/294 +X-Sequence-Number: 3660 + +>>>>> "BM" == Bruce Momjian writes: + +BM> restore, even if there is no value to it being large during normal +BM> server operation. Should that be decumented? + + +Yes, right alongside the recommendation to bump sort_mem, even though +in my tests sort_mem made no significant difference in restore time +going from 8m to 128m. + +From pgsql-performance-owner@postgresql.org Tue Sep 23 21:28:58 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B6D12D1B8BC + for ; + Wed, 24 Sep 2003 00:24:50 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 70023-09 + for ; + Tue, 23 Sep 2003 21:24:22 -0300 (ADT) +Received: from rocko.cc.ndsu.nodak.edu (rocko.cc.ndsu.NoDak.edu + [134.129.106.20]) + by svr1.postgresql.org (Postfix) with ESMTP id A06E7D1B4FF + for ; + Tue, 23 Sep 2003 21:24:14 -0300 (ADT) +Received: from localhost (bladow@localhost) + by rocko.cc.ndsu.nodak.edu (8.11.6/8.11.6) with ESMTP id h8O0ORC17459 + for ; Tue, 23 Sep 2003 19:24:27 -0500 +X-Authentication-Warning: rocko.cc.ndsu.nodak.edu: bladow owned process doing + -bs +Date: Tue, 23 Sep 2003 19:24:26 -0500 (CDT) +From: Garrett Bladow +X-X-Sender: bladow@rocko.cc.ndsu.nodak.edu +Reply-To: bbladow@sendit.nodak.edu +To: pgsql-performance@postgresql.org +Subject: LIKE query running slow +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/291 +X-Sequence-Number: 3657 + +Recently we upgraded the RAM in our server. After the install a LIKE query that used to take 5 seconds now takes 5 minutes. We have tried the usual suspects, VACUUM, ANALYZE and Re-indexing. + +Any thoughts on what might have happened? + +-Garrett Bladow + + +From pgsql-performance-owner@postgresql.org Wed Sep 24 13:53:00 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3CB1ED1B4FF + for ; + Wed, 24 Sep 2003 00:38:06 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 73380-07 + for ; + Tue, 23 Sep 2003 21:37:37 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id C3C12D1C9EC + for ; + Tue, 23 Sep 2003 21:37:33 -0300 (ADT) +Received: from [66.219.92.2] (HELO temoku) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3674278; Tue, 23 Sep 2003 17:38:04 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: bbladow@sendit.nodak.edu, pgsql-performance@postgresql.org +Subject: Re: LIKE query running slow +Date: Tue, 23 Sep 2003 17:35:50 -0700 +User-Agent: KMail/1.4.3 +References: +In-Reply-To: + +MIME-Version: 1.0 +Content-Transfer-Encoding: quoted-printable +Message-Id: <200309231735.50719.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/303 +X-Sequence-Number: 3669 + +Garrett, + +> Recently we upgraded the RAM in our server. After the install a LIKE quer= +y=20 +that used to take 5 seconds now takes 5 minutes. We have tried the usual=20 +suspects, VACUUM, ANALYZE and Re-indexing. +>=20 +> Any thoughts on what might have happened? + +Bad RAM? Have you tested it? + +--=20 +-Josh Berkus + Aglio Database Solutions + San Francisco + + +From pgsql-performance-owner@postgresql.org Wed Sep 24 13:55:23 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C7743D1B507 + for ; + Wed, 24 Sep 2003 00:41:32 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 74272-03 + for ; + Tue, 23 Sep 2003 21:41:05 -0300 (ADT) +Received: from rocko.cc.ndsu.nodak.edu (rocko.cc.ndsu.NoDak.edu + [134.129.106.20]) + by svr1.postgresql.org (Postfix) with ESMTP id 876D2D1BB4B + for ; + Tue, 23 Sep 2003 21:41:01 -0300 (ADT) +Received: from localhost (bladow@localhost) + by rocko.cc.ndsu.nodak.edu (8.11.6/8.11.6) with ESMTP id h8O0fD117504; + Tue, 23 Sep 2003 19:41:13 -0500 +Date: Tue, 23 Sep 2003 19:41:13 -0500 (CDT) +From: Garrett Bladow +To: Josh Berkus +Cc: pgsql-performance@postgresql.org +Subject: Re: LIKE query running slow +In-Reply-To: <200309231735.50719.josh@agliodbs.com> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/306 +X-Sequence-Number: 3672 + +On Tue, 23 Sep 2003, Josh Berkus wrote: + +> Garrett, +> +> > Recently we upgraded the RAM in our server. After the install a LIKE query +> that used to take 5 seconds now takes 5 minutes. We have tried the usual +> suspects, VACUUM, ANALYZE and Re-indexing. +> > +> > Any thoughts on what might have happened? +> +> Bad RAM? Have you tested it? + +RAM was tested and is good. + + +From pgsql-performance-owner@postgresql.org Wed Sep 24 13:53:00 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 491F1D1B4EA + for ; + Wed, 24 Sep 2003 00:54:08 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 76707-08 + for ; + Tue, 23 Sep 2003 21:53:39 -0300 (ADT) +Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) + by svr1.postgresql.org (Postfix) with ESMTP id 254BED1B50F + for ; + Tue, 23 Sep 2003 21:53:31 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by mailav.tor1.inquent.com (Postfix) with ESMTP + id C638D10264; Tue, 23 Sep 2003 20:45:00 -0400 (EDT) +Received: from [192.168.1.200] (dyn-133-150.tor.dsl.tht.net [134.22.133.150]) + by mailav.tor1.inquent.com (Postfix) with ESMTP + id 3C16910248; Tue, 23 Sep 2003 20:44:53 -0400 (EDT) +Subject: Re: LIKE query running slow +From: Rod Taylor +To: bbladow@sendit.nodak.edu +Cc: Postgresql Performance +In-Reply-To: + +References: +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="=-7fF19BaucY+0pQmsxFqq" +Message-Id: <1064364837.18409.31.camel@jester> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Tue, 23 Sep 2003 20:53:57 -0400 +X-Virus-Scanned: by AMaViS perl-11 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/302 +X-Sequence-Number: 3668 + +--=-7fF19BaucY+0pQmsxFqq +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +On Tue, 2003-09-23 at 20:24, Garrett Bladow wrote: +> Recently we upgraded the RAM in our server. After the install a LIKE quer= +y that used to take 5 seconds now takes 5 minutes. We have tried the usual = +suspects, VACUUM, ANALYZE and Re-indexing. +>=20 +> Any thoughts on what might have happened? + +What settings did you change at that time? + +Care to share an EXPLAIN ANALYZE with us? + +--=-7fF19BaucY+0pQmsxFqq +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: This is a digitally signed message part + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.3 (FreeBSD) + +iD8DBQA/cOsl6DETLow6vwwRAouNAJ9etH4Bp5iTuKQjQ5MwSPGn3ndTOACfZJiw +UouXlGW6co1Yiz3zQ6jePAU= +=kwvg +-----END PGP SIGNATURE----- + +--=-7fF19BaucY+0pQmsxFqq-- + + +From pgsql-performance-owner@postgresql.org Wed Sep 24 13:49:56 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 959E0D1B4E2 + for ; + Wed, 24 Sep 2003 02:33:42 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 86879-01 + for ; + Tue, 23 Sep 2003 23:33:14 -0300 (ADT) +Received: from grouse.mail.pas.earthlink.net (grouse.mail.pas.earthlink.net + [207.217.120.116]) + by svr1.postgresql.org (Postfix) with ESMTP id 14033D1B897 + for ; + Tue, 23 Sep 2003 23:33:10 -0300 (ADT) +Received: from 0-1pool116-234.nas15.indianapolis1.in.us.da.qwest.net + ([65.128.116.234] helo=nick) + by grouse.mail.pas.earthlink.net with smtp (Exim 3.33 #1) + id 1A1zSq-0007OV-00 + for pgsql-performance@postgresql.org; Tue, 23 Sep 2003 19:33:13 -0700 +Reply-To: +From: "Nick Fankhauser" +To: "Pgsql-Performance@Postgresql. Org" +Subject: Re: How to make n_distinct more accurate. +Date: Tue, 23 Sep 2003 21:32:24 -0500 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) +In-reply-to: +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +Importance: Normal +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/299 +X-Sequence-Number: 3665 + + +The performance list seemed to be off-line for a while, so I posed the same +question on the admin list and Tom Lane has been helping in that forum. + +-Nick + +> -----Original Message----- +> From: pgsql-performance-owner@postgresql.org +> [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Nick +> Fankhauser +> Sent: Monday, September 22, 2003 3:42 PM +> To: Pgsql-Performance@Postgresql. Org +> Subject: [PERFORM] How to make n_distinct more accurate. +> +> +> Hi- +> +> I have a table- called "event" with a field event_date_time that +> is indexed. +> There are 1,700,000 rows in the table and 92,000 distinct values of +> event_date_time with anywhere from 1 to 400 rows sharing the same +> value. (I +> did a count grouped by event_date_time & scanned it to get this info.) +> +> When I look at the pg_stats on this table, I always see 15,000 or lower in +> the n_distinct column for event_date_time. (I re-ran analyze +> several times & +> then checked pg_stats to see if the numbers varied significantly.) +> +> Since this is off by about a factor of 6, I think the planner is +> missing the +> chance to use this table as the "driver" in a complex query plan that I'm +> trying to optimize. +> +> So the question is- how can I get a better estimate of n_distinct from +> analyze? +> +> If I alter the stats target as high as it will go, I get closer, but it +> still shows the index to be about 1/2 as selective as it actually is: +> +> alpha=# alter table event alter column event_date_time set +> statistics 1000; +> ALTER TABLE +> alpha=# analyze event; +> ANALYZE +> alpha=# select n_distinct from pg_stats where tablename='event' and +> attname='event_date_time'; +> n_distinct +> ------------ +> 51741 +> (1 row) +> +> This number seems to be consistently around 51,000 if I re-run +> analyze a few +> times. +> +> I guess my question is two-part: +> +> (1)Is there any tweak to make this estimate work better? +> +> (2)Since I'm getting numbers that are consistent but way off, is +> there a bug +> here? +> +> (2-1/2) Or alternately, am I totally missing what n-distinct is +> supposed to +> denote? +> +> Thanks! +> -Nick +> +> --------------------------------------------------------------------- +> Nick Fankhauser +> +> nickf@doxpop.com Phone 1.765.965.7363 Fax 1.765.962.9788 +> doxpop - Court records at your fingertips - http://www.doxpop.com/ +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 7: don't forget to increase your free space map settings +> + + +From pgsql-performance-owner@postgresql.org Wed Sep 24 13:45:33 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C6DE2D1B56B + for ; + Wed, 24 Sep 2003 05:21:01 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 06789-03 + for ; + Wed, 24 Sep 2003 02:20:52 -0300 (ADT) +Received: from zigo.dhs.org (as2-4-3.an.g.bonet.se [194.236.34.191]) + by svr1.postgresql.org (Postfix) with ESMTP id 4D3BCD1B4FE + for ; + Wed, 24 Sep 2003 02:20:49 -0300 (ADT) +Received: from zigo.dhs.org (zigo [127.0.0.1]) + by zigo.dhs.org (8.12.8/8.12.8) with ESMTP id h8O5Kmpf025345; + Wed, 24 Sep 2003 07:20:48 +0200 +Received: from localhost (db@localhost) + by zigo.dhs.org (8.12.8/8.12.8/Submit) with ESMTP id h8O5KiJm025336; + Wed, 24 Sep 2003 07:20:46 +0200 +Date: Wed, 24 Sep 2003 07:20:44 +0200 (CEST) +From: Dennis Bjorklund +To: Garrett Bladow +Cc: pgsql-performance@postgresql.org +Subject: Re: LIKE query running slow +In-Reply-To: + +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/295 +X-Sequence-Number: 3661 + +On Tue, 23 Sep 2003, Garrett Bladow wrote: + +> Recently we upgraded the RAM in our server. After the install a LIKE +> query that used to take 5 seconds now takes 5 minutes. We have tried the +> usual suspects, VACUUM, ANALYZE and Re-indexing. + +If you mean that you reinstalled postgresql then it's probably because you +before run the database with the "C" locale but now you run it with +something else. + +If all you did was to install the extra memory then I don't see how that +can affect it at all (especially so if you have not altered +postgresql.conf to make use of more memory). + +-- +/Dennis + + +From pgsql-performance-owner@postgresql.org Wed Sep 24 13:54:46 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3D831D1BA7B + for ; + Wed, 24 Sep 2003 05:25:05 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 08967-02 + for ; + Wed, 24 Sep 2003 02:24:55 -0300 (ADT) +Received: from zigo.dhs.org (as2-4-3.an.g.bonet.se [194.236.34.191]) + by svr1.postgresql.org (Postfix) with ESMTP id E5DB2D1B4FE + for ; + Wed, 24 Sep 2003 02:24:52 -0300 (ADT) +Received: from zigo.dhs.org (zigo [127.0.0.1]) + by zigo.dhs.org (8.12.8/8.12.8) with ESMTP id h8O5ORpf025357; + Wed, 24 Sep 2003 07:24:27 +0200 +Received: from localhost (db@localhost) + by zigo.dhs.org (8.12.8/8.12.8/Submit) with ESMTP id h8O5OQe7025353; + Wed, 24 Sep 2003 07:24:26 +0200 +Date: Wed, 24 Sep 2003 07:24:26 +0200 (CEST) +From: Dennis Bjorklund +To: Bruce Momjian +Cc: Vivek Khera , + +Subject: Re: restore time: sort_mem vs. checkpoing_segments +In-Reply-To: <200309231359.h8NDx1A01317@candle.pha.pa.us> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/304 +X-Sequence-Number: 3670 + +On Tue, 23 Sep 2003, Bruce Momjian wrote: + +> With the new warning about too-frequent checkpoints, people have actual +> feedback to encourage them to increase checkpoint_segments. One issue +> is that it is likely to recommend increasing checkpoint_segments during +> restore, even if there is no value to it being large during normal +> server operation. Should that be decumented? + +One could have a variable that turns off that warning, and have pg_dump +insert a statement to turn it off. That is, if one never want these +warnings from a restore (from a new dump). + +In any case, documentation is good and still needed. + +-- +/Dennis + + +From pgsql-performance-owner@postgresql.org Wed Sep 24 13:50:05 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DE5A5D1B956 + for ; + Wed, 24 Sep 2003 05:49:10 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 11896-03 + for ; + Wed, 24 Sep 2003 02:48:39 -0300 (ADT) +Received: from destiny.artjunction.co.nz (destiny.artjunction.co.nz + [202.89.33.11]) + by svr1.postgresql.org (Postfix) with ESMTP id E165FD1B4FE + for ; + Wed, 24 Sep 2003 02:48:22 -0300 (ADT) +Received: from huey.shine.net.nz (202-0-61-44.adsl.paradise.net.nz + [202.0.61.44]) + by destiny.artjunction.co.nz (Postfix) with ESMTP id C552B2EC7 + for ; + Wed, 24 Sep 2003 17:48:16 +1200 (NZST) +Received: from advso.com (macshine.shine.net.nz [192.168.0.7]) + by huey.shine.net.nz (Postfix) with ESMTP id 436FB61B06 + for ; + Wed, 24 Sep 2003 17:48:16 +1200 (NZST) +Date: Wed, 24 Sep 2003 17:48:15 +1200 +Mime-Version: 1.0 (Apple Message framework v552) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Subject: Performance issue +From: peter +To: pgsql-performance@postgresql.org +Content-Transfer-Encoding: 7bit +Message-Id: +X-Mailer: Apple Mail (2.552) +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/300 +X-Sequence-Number: 3666 + +Hello, + +I have been trying to get my Postgres database to do faster inserts. + +The environment is basically a single user situation. + +The part that I would like to speed up is when a User copys a Project. +A Project consists of a number of Rooms(say 60). Each room contains a +number of items. +A project will contain say 20,000 records. + +Anyway the copying process gets slower and slower, as more projects are +added to the database. + +My statistics(Athlon 1.8Ghz) +---------------- +20,000 items Takes on average 0.078seconds/room +385,000 items Takes on average .11seconds/room +690,000 items takes on average .270seconds/room +1,028,000 items Takes on average .475seconds/room + +As can be seen the time taken to process each room increases. A commit +occurs when a room has been copied. +The hard drive is not being driven very hard. The hard drive light +only flashes about twice a second when there are a million records in +the database. + +I thought that the problem could have been my plpgsql procedure because +I assume the code is interpreted. +However I have just rewriten the code using straight sql(with some temp +fields), +and the times turn out to be almost exactly the same as the plpgsql +version. + +The read speed for the Application is fine. The sql planner seems to be +doing a good job. There has been only one problem +that I have found with one huge select, which was fixed by a cross join. + + I am running Red hat 8. Some of my conf entries that I have changed +follow +shared_buffers = 3700 +effective_cache_size = 4000 +sort_mem = 32168 + +Are the increasing times reasonable? +The times themselves might look slow, but thats because there are a +number of tables involved in a Copy + +I can increase the shared buffer sizes above 32M, but would this really +help? + +TIA + +peter Mcgregor + + +From pgsql-performance-owner@postgresql.org Wed Sep 24 13:45:35 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 16215D1B56C + for ; + Wed, 24 Sep 2003 06:04:31 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 11938-05 + for ; + Wed, 24 Sep 2003 03:03:59 -0300 (ADT) +Received: from smtp.pspl.co.in (unknown [202.54.11.65]) + by svr1.postgresql.org (Postfix) with ESMTP id 94947D1B522 + for ; + Wed, 24 Sep 2003 03:03:57 -0300 (ADT) +Received: (from root@localhost) + by smtp.pspl.co.in (8.12.9/8.12.9) id h8O64fbD006110 + for ; Wed, 24 Sep 2003 11:34:41 +0530 +Received: from persistent.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) + (authenticated bits=0) + by persistent.co.in (8.12.9/8.12.9) with ESMTP id h8O64cfl006030; + Wed, 24 Sep 2003 11:34:39 +0530 +Message-ID: <3F71344A.4090605@persistent.co.in> +Date: Wed, 24 Sep 2003 11:36:02 +0530 +From: Shridhar Daithankar +Organization: Persistent Systems Pvt. Ltd. +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; + rv:1.5b) Gecko/20030917 Thunderbird/0.3a +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: bbladow@sendit.nodak.edu +Cc: pgsql-performance@postgresql.org +Subject: Re: LIKE query running slow +References: +In-Reply-To: + +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/296 +X-Sequence-Number: 3662 + +Garrett Bladow wrote: + +> Recently we upgraded the RAM in our server. After the install a LIKE query that used to take 5 seconds now takes 5 minutes. We have tried the usual suspects, VACUUM, ANALYZE and Re-indexing. +> +> Any thoughts on what might have happened? + +What all tuning you have done? Have you set effective cache size to take care of +additional RAM. + +Just check out. + + Shridhar + + +From pgsql-performance-owner@postgresql.org Wed Sep 24 13:49:41 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 367BED1B8CB + for ; + Wed, 24 Sep 2003 09:12:03 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 24977-09 + for ; + Wed, 24 Sep 2003 06:11:53 -0300 (ADT) +Received: from email06.aon.at (WARSL402PIP3.highway.telekom.at [195.3.96.75]) + by svr1.postgresql.org (Postfix) with SMTP id 06BE1D1B546 + for ; + Wed, 24 Sep 2003 06:11:51 -0300 (ADT) +Received: (qmail 367982 invoked from network); 24 Sep 2003 09:11:44 -0000 +Received: from m155p002.dipool.highway.telekom.at (HELO cantor) ([62.46.9.66]) + (envelope-sender ) + by qmail6rs.highway.telekom.at (qmail-ldap-1.03) with SMTP + for ; 24 Sep 2003 09:11:44 -0000 +From: Manfred Koizar +To: Jenny Zhang +Cc: perf-pgsql , + Matt Clark , pgsql-hackers@postgresql.org +Subject: Re: osdl-dbt3 run results - puzzled by the execution +Date: Wed, 24 Sep 2003 11:14:19 +0200 +Message-ID: <4sj2nvcla6v5v9e3cr96kopjtda7k6mq8v@email.aon.at> +References: <1063924610.31150.75.camel@ibm-a.pdx.osdl.net> + <3c6mmvcmvlr59kng6tnee2a0q4vf4spctt@email.aon.at> + <1063996535.32392.9.camel@ibm-a.pdx.osdl.net> +In-Reply-To: <1063996535.32392.9.camel@ibm-a.pdx.osdl.net> +X-Mailer: Forte Agent 1.93/32.576 English (American) +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/298 +X-Sequence-Number: 3664 + +On Fri, 19 Sep 2003 11:35:35 -0700, Jenny Zhang +wrote: +>I posted more results as you requested: + +Unfortunately they only confirm what I suspected earlier: + +>> 2) -> Index Scan using i_ps_suppkey on partsupp +>> (cost=0.00..323.16 rows=80 width=34) +>> (actual time=0.16..2.98 rows=80 loops=380) +>> ctr=108.44 + +>> the planner does not +>> account for additional index scans hitting pages in the cache that +>> have been brought in by preceding scans. This is a known problem + +PF1 = estimated number of page fetches for one loop ~ 320 +L = estimated number of loops ~ 400 +P = number of pages in relation ~ 21000 + +Cutting down the number of heap page fetches if PF1 * L > P and P < +effective_cache_size seems like an obvious improvement, but I was not +able to figure out where to make this change. Maybe it belongs into +costsize.c near + + run_cost += outer_path_rows * + (inner_path->total_cost - inner_path->startup_cost) * + joininfactor; + +in cost_nestloop() or it should be pushed into the index cost +estimation functions. Hackers? + +For now you have to keep lying about effective_cache_size to make the +planner overestimate merge joins to compensate for the planner's +overestimation of nested loops. Sorry for having no better answer. + +Servus + Manfred + +From pgsql-performance-owner@postgresql.org Wed Sep 24 13:52:04 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DC6C2D1BA87 + for ; + Wed, 24 Sep 2003 10:05:53 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 28701-09 + for ; + Wed, 24 Sep 2003 07:04:27 -0300 (ADT) +Received: from earth.virtual-domain.com (unknown [216.118.96.155]) + by svr1.postgresql.org (Postfix) with ESMTP id EC1C6D1BADD + for ; + Wed, 24 Sep 2003 07:04:10 -0300 (ADT) +Received: from rigmor (sms.finestmedia.tv [213.180.31.11]) + by earth.virtual-domain.com (8.11.4/8.11.4) with SMTP id h8OB2eN05498 + for ; + Wed, 24 Sep 2003 06:02:41 -0500 (EST) +Reply-To: +From: "Rigmor Ukuhe" +To: +Subject: Index problem +Date: Wed, 24 Sep 2003 13:09:37 +0300 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +Importance: Normal +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests=BAYES_30, + MSGID_GOOD_EXCHANGE, UPPERCASE_25_50 +X-Spam-Level: +X-Archive-Number: 200309/301 +X-Sequence-Number: 3667 + +Hi, + +I have a table containing columns: + + "END_DATE" timestamptz NOT NULL + "REO_ID" int4 NOT NULL + +and i am indexed "REO_ID" coulumn. +I have a query: + +select "REO_ID", "END_DATE" from "PRIORITY_STATISTICS" where "REO_ID" IN +('112851' ,'112859' ,'112871' ,'112883' ,'112891' ,'112904' ,'112915' +,'112924' ,'112939' ,'112947' ,'112960' ,'112984' ,'112999' ,'113013' +,'113032' ,'113059' ,'113067' ,'113084' ,'113096' ,'113103' ,'113110' +,'113117' ,'113125' ,'113132' ,'113139' ,'113146' ,'113153' ,'113160' +,'113167' ,'113174' ,'113181' ,'113188' ,'113195' ,'113204' ,'113268' +,'113279' ,'113294' ,'113302' ,'113317' ,'113340' ,'113358' ,'113385' +,'113404' ,'113412' ,'113419' ,'113429' ,'113436' ,'113443' ,'113571' +,'113636' ,'113649' ,'113689' ,'113705' ,'113744' ,'113755' ,'113724' +,'113737' ,'113812' ,'113828' ,'113762' ,'113842' ,'113869' ,'113925' +,'113976' ,'114035' ,'114044' ,'114057' ,'114070' ,'114084' ,'114094' +,'114119' ) + +and it is _not_ using that index + +But following query (notice there are less id-s in WHERE clause, but rest is +same) + +select "REO_ID", "END_DATE" from "PRIORITY_STATISTICS" where "REO_ID" IN +('112851' ,'112859' ,'112871' ,'112883' ,'112891' ,'112904' ,'112915' +,'112924' ,'112939' ,'112947' ,'112960' ,'112984' ,'112999' ,'113013' +,'113032' ,'113059' ,'113067' ,'113084' ,'113096' ,'113103' ,'113110' +,'113117' ,'113125' ,'113132' ,'113139' ,'113146' ,'113153' ,'113160' +,'113167' ,'113174' ,'113181' ,'113188' ,'113195' ,'113204' ,'113268' +,'113279' ,'113294' ,'113302' ,'113317' ,'113340' ,'113358' ,'113385' +,'113404' ,'113412' ,'113419' ,'113429' ,'113436' ,'113443' ,'113571' +,'113636' ,'113649' ,'113689' ,'113705' ,'113744' ,'113755' ,'113724' +,'113737' ) + +will _is_ using index: + +Index Scan using PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id on PRIORITY_STATISTICS (cost=0.00..394.06 +rows=102 width=12) + +What causes this behaviour? is there any workaround? Suggestions? + +best, +Rigmor Ukuhe +--- +Outgoing mail is certified Virus Free. +Checked by AVG anti-virus system (http://www.grisoft.com). +Version: 6.0.515 / Virus Database: 313 - Release Date: 01.09.2003 + + +From pgsql-performance-owner@postgresql.org Wed Sep 24 13:45:38 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 2A4F8D1B8B9 + for ; + Wed, 24 Sep 2003 12:12:56 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 38040-08 + for ; + Wed, 24 Sep 2003 09:12:21 -0300 (ADT) +Received: from jefftrout.com (h00a0cc4084e5.ne.client2.attbi.com + [24.128.241.68]) + by svr1.postgresql.org (Postfix) with SMTP id 88362D1B503 + for ; + Wed, 24 Sep 2003 09:12:12 -0300 (ADT) +Received: (qmail 80075 invoked from network); 24 Sep 2003 12:12:17 -0000 +Received: from unknown (HELO torgo) (threshar@10.10.10.10) + by 10.10.10.10 with SMTP; 24 Sep 2003 12:12:17 -0000 +Date: Wed, 24 Sep 2003 08:12:17 -0400 (EDT) +From: Jeff +To: Garrett Bladow +Cc: "pgsql-performance@postgresql.org" +Subject: Re: LIKE query running slow +In-Reply-To: + +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/297 +X-Sequence-Number: 3663 + +On Tue, 23 Sep 2003, Garrett Bladow wrote: + +> Recently we upgraded the RAM in our server. After the install a LIKE query that used to take 5 seconds now takes 5 minutes. We have tried the usual suspects, VACUUM, ANALYZE and Re-indexing. +> +> Any thoughts on what might have happened? +> +Did you reload the db? If you did perhaps you didn't use the "C" locale? +That can cause a huge slowdown. + + +-- +Jeff Trout +http://www.jefftrout.com/ +http://www.stuarthamm.net/ + + + +From pgsql-performance-owner@postgresql.org Wed Sep 24 13:54:57 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 422FDD1CA07 + for ; + Wed, 24 Sep 2003 14:01:27 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 50192-05 + for ; + Wed, 24 Sep 2003 11:01:20 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 60BF4D1B908 + for ; + Wed, 24 Sep 2003 11:01:16 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h8OE1AiP003531; + Wed, 24 Sep 2003 10:01:10 -0400 (EDT) +To: Manfred Koizar +Cc: Jenny Zhang , + perf-pgsql , + Matt Clark , pgsql-hackers@postgresql.org +Subject: Re: [HACKERS] osdl-dbt3 run results - puzzled by the execution +In-reply-to: <4sj2nvcla6v5v9e3cr96kopjtda7k6mq8v@email.aon.at> +References: <1063924610.31150.75.camel@ibm-a.pdx.osdl.net> + <3c6mmvcmvlr59kng6tnee2a0q4vf4spctt@email.aon.at> + <1063996535.32392.9.camel@ibm-a.pdx.osdl.net> + <4sj2nvcla6v5v9e3cr96kopjtda7k6mq8v@email.aon.at> +Comments: In-reply-to Manfred Koizar + message dated "Wed, 24 Sep 2003 11:14:19 +0200" +Date: Wed, 24 Sep 2003 10:01:09 -0400 +Message-ID: <3530.1064412069@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/305 +X-Sequence-Number: 3671 + +Manfred Koizar writes: +> Cutting down the number of heap page fetches if PF1 * L > P and P < +> effective_cache_size seems like an obvious improvement, but I was not +> able to figure out where to make this change. Maybe it belongs into +> costsize.c near +> run_cost += outer_path_rows * +> (inner_path->total_cost - inner_path->startup_cost) * +> joininfactor; + +I've been intending for some time to try to restructure the cost +estimator so that repeated indexscans can be costed more accurately. +Within the context of the heap-fetch-estimating algorithm, I think +the entire execution of a nestloop-with-inner-index-scan could probably +be treated as a single scan. I'm not sure how we adjust the estimates +for the index-access part, though clearly those are too high as well. + +This doesn't seem to be a localized change unfortunately. Certainly +costsize.c can't do it alone. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Sep 24 14:04:06 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E7BB4D1B4F9 + for ; + Wed, 24 Sep 2003 17:04:05 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 76190-06 + for ; + Wed, 24 Sep 2003 14:03:34 -0300 (ADT) +Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) + by svr1.postgresql.org (Postfix) with ESMTP id 2BC23D1B55D + for ; + Wed, 24 Sep 2003 14:03:33 -0300 (ADT) +Received: from klaster.net (core-1.citynet.pl [80.48.135.69]) + by serwer.skawsoft.com.pl (Postfix) with ESMTP + id 7C9D62B3CD; Wed, 24 Sep 2003 19:03:19 +0200 (CEST) +Message-ID: <3F71CE4A.2090305@klaster.net> +Date: Wed, 24 Sep 2003 19:03:06 +0200 +From: Tomasz Myrta +User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; pl-PL; + rv:1.5a) Gecko/20030718 +X-Accept-Language: pl, en-us, en +MIME-Version: 1.0 +To: rigmor.ukuhe@finestmedia.com +Cc: pgsql-performance@postgresql.org +Subject: Re: Index problem +References: +In-Reply-To: +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/308 +X-Sequence-Number: 3674 + +> Hi, +> +> I have a table containing columns: +> +> "END_DATE" timestamptz NOT NULL +> "REO_ID" int4 NOT NULL +> +> and i am indexed "REO_ID" coulumn. +> I have a query: +> +> select "REO_ID", "END_DATE" from "PRIORITY_STATISTICS" where "REO_ID" IN +> ('112851' ,'112859' ,'112871' ,'112883' ,'112891' ,'112904' ,'112915' +> ,'112924' ,'112939' ,'112947' ,'112960' ,'112984' ,'112999' ,'113013' +> ,'113032' ,'113059' ,'113067' ,'113084' ,'113096' ,'113103' ,'113110' +> ,'113117' ,'113125' ,'113132' ,'113139' ,'113146' ,'113153' ,'113160' +> ,'113167' ,'113174' ,'113181' ,'113188' ,'113195' ,'113204' ,'113268' +> ,'113279' ,'113294' ,'113302' ,'113317' ,'113340' ,'113358' ,'113385' +> ,'113404' ,'113412' ,'113419' ,'113429' ,'113436' ,'113443' ,'113571' +> ,'113636' ,'113649' ,'113689' ,'113705' ,'113744' ,'113755' ,'113724' +> ,'113737' ,'113812' ,'113828' ,'113762' ,'113842' ,'113869' ,'113925' +> ,'113976' ,'114035' ,'114044' ,'114057' ,'114070' ,'114084' ,'114094' +> ,'114119' ) +> +> and it is _not_ using that index +> +> But following query (notice there are less id-s in WHERE clause, but rest is +> same) +> +> select "REO_ID", "END_DATE" from "PRIORITY_STATISTICS" where "REO_ID" IN +> ('112851' ,'112859' ,'112871' ,'112883' ,'112891' ,'112904' ,'112915' +> ,'112924' ,'112939' ,'112947' ,'112960' ,'112984' ,'112999' ,'113013' +> ,'113032' ,'113059' ,'113067' ,'113084' ,'113096' ,'113103' ,'113110' +> ,'113117' ,'113125' ,'113132' ,'113139' ,'113146' ,'113153' ,'113160' +> ,'113167' ,'113174' ,'113181' ,'113188' ,'113195' ,'113204' ,'113268' +> ,'113279' ,'113294' ,'113302' ,'113317' ,'113340' ,'113358' ,'113385' +> ,'113404' ,'113412' ,'113419' ,'113429' ,'113436' ,'113443' ,'113571' +> ,'113636' ,'113649' ,'113689' ,'113705' ,'113744' ,'113755' ,'113724' +> ,'113737' ) +> +> will _is_ using index: + +Why not. It's just because the second query is more selective. Probably +you don't have too many rows in your table and Postgres thinks it's +better (faster) to use sequential scan than index one. + +Regards, +Tomasz Myrta + + +From pgsql-performance-owner@postgresql.org Wed Sep 24 14:06:21 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 5D77AD1B4F9 + for ; + Wed, 24 Sep 2003 17:06:19 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 76938-04 + for ; + Wed, 24 Sep 2003 14:05:49 -0300 (ADT) +Received: from cmailg3.svr.pol.co.uk (cmailg3.svr.pol.co.uk [195.92.195.173]) + by svr1.postgresql.org (Postfix) with ESMTP id 238ECD1B513 + for ; + Wed, 24 Sep 2003 14:05:43 -0300 (ADT) +Received: from user-2040.bbd23tcl.dsl.pol.co.uk ([81.77.247.248] helo=rj) + by cmailg3.svr.pol.co.uk with esmtp (Exim 4.14) id 1A2D5C-00061l-6O + for pgsql-performance@postgresql.org; Wed, 24 Sep 2003 18:05:42 +0100 +From: Richard Jones +Reply-To: rj@last.fm +Organization: Last.FM +To: pgsql-performance@postgresql.org +Subject: Re: Performance issue +Date: Wed, 24 Sep 2003 18:05:23 +0100 +User-Agent: KMail/1.5.1 +References: <5.1.0.14.2.20030924130825.035a7438@mail.vetstar.com> +In-Reply-To: <5.1.0.14.2.20030924130825.035a7438@mail.vetstar.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200309241805.23154.rj@last.fm> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/309 +X-Sequence-Number: 3675 + +get rid of any unnecessary indexes? +i've found that droping indexes and re-creating them isn't usually worth the +effort + +mount the disk with the noatime option which saves you the time involved in +updating the last access time on files + +make sure you're doing all the inserts in one transaction.. wrapping a bunch +of INSERTS in BEGIN & COMMIT speeds them up loads. + + + + +> At 05:48 PM 9/24/2003 +1200, peter wrote: +> >Hello, +> > +> >I have been trying to get my Postgres database to do faster inserts. +> > +> >The environment is basically a single user situation. +> > +> >The part that I would like to speed up is when a User copys a Project. +> >A Project consists of a number of Rooms(say 60). Each room contains a +> >number of items. +> >A project will contain say 20,000 records. +> > +> >Anyway the copying process gets slower and slower, as more projects are +> >added to the database. +> > +> >My statistics(Athlon 1.8Ghz) +> >---------------- +> >20,000 items Takes on average 0.078seconds/room +> >385,000 items Takes on average .11seconds/room +> >690,000 items takes on average .270seconds/room +> >1,028,000 items Takes on average .475seconds/room +> > +> >As can be seen the time taken to process each room increases. A commit +> >occurs when a room has been copied. +> >The hard drive is not being driven very hard. The hard drive light only +> >flashes about twice a second when there are a million records in the +> > database. +> > +> >I thought that the problem could have been my plpgsql procedure because I +> >assume the code is interpreted. +> >However I have just rewriten the code using straight sql(with some temp +> >fields), +> >and the times turn out to be almost exactly the same as the plpgsql +> > version. +> > +> >The read speed for the Application is fine. The sql planner seems to be +> >doing a good job. There has been only one problem +> >that I have found with one huge select, which was fixed by a cross join. +> > +> > I am running Red hat 8. Some of my conf entries that I have changed +> > follow shared_buffers = 3700 +> >effective_cache_size = 4000 +> >sort_mem = 32168 +> > +> >Are the increasing times reasonable? +> >The times themselves might look slow, but thats because there are a number +> >of tables involved in a Copy +> > +> >I can increase the shared buffer sizes above 32M, but would this really +> > help? +> > +> >TIA +> > +> >peter Mcgregor +> > +> > +> >---------------------------(end of broadcast)--------------------------- +> >TIP 4: Don't 'kill -9' the postmaster +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: you can get off all lists at once with the unregister command +> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) + + +From pgsql-performance-owner@postgresql.org Wed Sep 24 13:57:40 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 5C092D1B914 + for ; + Wed, 24 Sep 2003 16:57:39 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 74974-08 + for ; + Wed, 24 Sep 2003 13:57:08 -0300 (ADT) +Received: from merlin (merlin.warpdrive.net [24.56.130.4]) + by svr1.postgresql.org (Postfix) with ESMTP id 791D2D1CA59 + for ; + Wed, 24 Sep 2003 13:56:52 -0300 (ADT) +Received: from mail.warpdrive.net ([24.56.130.6] helo=mail.vetstar.com) + by merlin with esmtp (Exim 4.14) id 1A2CwP-0008KE-OJ + for pgsql-performance@postgresql.org; Wed, 24 Sep 2003 12:56:37 -0400 +Received: from sirius.vetstar.com [66.88.86.217] by mail.vetstar.com with + ESMTP + (SMTPD32-8.02) id AC9D4070118; Wed, 24 Sep 2003 12:55:57 -0400 +Message-Id: <5.1.0.14.2.20030924130825.035a7438@mail.vetstar.com> +X-Sender: jbove@vetstar.com@mail.vetstar.com +X-Mailer: QUALCOMM Windows Eudora Version 5.1 +Date: Wed, 24 Sep 2003 13:09:34 -0400 +To: pgsql-performance@postgresql.org +From: Joseph Bove +Subject: Re: Performance issue +In-Reply-To: +Mime-Version: 1.0 +Content-Type: text/plain; charset="us-ascii"; format=flowed +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/307 +X-Sequence-Number: 3673 + +Peter, + +One possibility is to drop all the indexes, do the insert and re-add the +indexes. + +The more indexes that exist and the more rows that exist, the more costly +the insert. + +Regards, + +Joseph + +At 05:48 PM 9/24/2003 +1200, peter wrote: +>Hello, +> +>I have been trying to get my Postgres database to do faster inserts. +> +>The environment is basically a single user situation. +> +>The part that I would like to speed up is when a User copys a Project. +>A Project consists of a number of Rooms(say 60). Each room contains a +>number of items. +>A project will contain say 20,000 records. +> +>Anyway the copying process gets slower and slower, as more projects are +>added to the database. +> +>My statistics(Athlon 1.8Ghz) +>---------------- +>20,000 items Takes on average 0.078seconds/room +>385,000 items Takes on average .11seconds/room +>690,000 items takes on average .270seconds/room +>1,028,000 items Takes on average .475seconds/room +> +>As can be seen the time taken to process each room increases. A commit +>occurs when a room has been copied. +>The hard drive is not being driven very hard. The hard drive light only +>flashes about twice a second when there are a million records in the database. +> +>I thought that the problem could have been my plpgsql procedure because I +>assume the code is interpreted. +>However I have just rewriten the code using straight sql(with some temp +>fields), +>and the times turn out to be almost exactly the same as the plpgsql version. +> +>The read speed for the Application is fine. The sql planner seems to be +>doing a good job. There has been only one problem +>that I have found with one huge select, which was fixed by a cross join. +> +> I am running Red hat 8. Some of my conf entries that I have changed follow +>shared_buffers = 3700 +>effective_cache_size = 4000 +>sort_mem = 32168 +> +>Are the increasing times reasonable? +>The times themselves might look slow, but thats because there are a number +>of tables involved in a Copy +> +>I can increase the shared buffer sizes above 32M, but would this really help? +> +>TIA +> +>peter Mcgregor +> +> +>---------------------------(end of broadcast)--------------------------- +>TIP 4: Don't 'kill -9' the postmaster + + + +From pgsql-performance-owner@postgresql.org Wed Sep 24 14:36:57 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 8EDECD1B4F0 + for ; + Wed, 24 Sep 2003 17:36:56 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 78652-10 + for ; + Wed, 24 Sep 2003 14:36:46 -0300 (ADT) +Received: from wight.ymogen.net (unknown [217.27.240.153]) + by svr1.postgresql.org (Postfix) with SMTP id A7553D1B546 + for ; + Wed, 24 Sep 2003 14:36:44 -0300 (ADT) +Received: (qmail 24144 invoked from network); 24 Sep 2003 17:36:29 -0000 +Received: from host213-123-217-162.in-addr.btopenworld.com (HELO solent) + (213.123.217.162) + by wight.ymogen.net with SMTP; 24 Sep 2003 17:36:29 -0000 +From: "Matt Clark" +To: , + +Subject: Re: Index problem +Date: Wed, 24 Sep 2003 18:35:34 +0100 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +Importance: Normal +In-Reply-To: +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/310 +X-Sequence-Number: 3676 + + +> What causes this behaviour? is there any workaround? Suggestions? +> + +How many rows are there in the table, and can you post the 'explain analyze' for both queries after doing a 'vacuum verbose analyze +[tablename]'? + +Cheers + +Matt + + + +From pgsql-performance-owner@postgresql.org Wed Sep 24 14:48:10 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DDBF7D1B4F0 + for ; + Wed, 24 Sep 2003 17:48:08 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 79501-09 + for ; + Wed, 24 Sep 2003 14:47:37 -0300 (ADT) +Received: from perrin.nxad.com (internal.nxad.com [69.1.70.251]) + by svr1.postgresql.org (Postfix) with ESMTP id BB247D1B589 + for ; + Wed, 24 Sep 2003 14:47:36 -0300 (ADT) +Received: by perrin.nxad.com (Postfix, from userid 1001) + id 885C421067; Wed, 24 Sep 2003 10:47:21 -0700 (PDT) +Date: Wed, 24 Sep 2003 10:47:21 -0700 +From: Sean Chittenden +To: peter +Cc: pgsql-performance@postgresql.org +Subject: Re: Performance issue +Message-ID: <20030924174721.GA11474@perrin.nxad.com> +References: +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +X-PGP-Key: finger seanc@FreeBSD.org +X-PGP-Fingerprint: 3849 3760 1AFE 7B17 11A0 83A6 DD99 E31F BC84 B341 +X-Web-Homepage: http://sean.chittenden.org/ +User-Agent: Mutt/1.5.4i +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/311 +X-Sequence-Number: 3677 + +> My statistics(Athlon 1.8Ghz) +> ---------------- +> 20,000 items Takes on average 0.078seconds/room +> 385,000 items Takes on average .11seconds/room +> 690,000 items takes on average .270seconds/room +> 1,028,000 items Takes on average .475seconds/room +[snip] +> I am running Red hat 8. Some of my conf entries that I have changed +> follow +> shared_buffers = 3700 +> effective_cache_size = 4000 +> sort_mem = 32168 + +Have you twiddled with your wal_buffers or checkpoint_segments? Might +be something to look at. + +-sc + +-- +Sean Chittenden + +From pgsql-performance-owner@postgresql.org Wed Sep 24 15:36:21 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 2AB84D1B502 + for ; + Wed, 24 Sep 2003 18:36:20 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 86558-07 + for ; + Wed, 24 Sep 2003 15:35:49 -0300 (ADT) +Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) + by svr1.postgresql.org (Postfix) with ESMTP id DEB65D1B8DE + for ; + Wed, 24 Sep 2003 15:35:32 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by mailav.tor1.inquent.com (Postfix) with ESMTP + id 8379010262; Wed, 24 Sep 2003 14:26:43 -0400 (EDT) +Received: from [10.0.2.3] (unknown [10.0.2.3]) + by mailav.tor1.inquent.com (Postfix) with ESMTP + id 7FC7910261; Wed, 24 Sep 2003 14:26:41 -0400 (EDT) +Subject: Re: Performance issue +From: Rod Taylor +To: peter +Cc: Postgresql Performance +In-Reply-To: +References: +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="=-Si7MKX4F7hhxyh/3esH9" +Message-Id: <1064428549.20881.20.camel@jester> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Wed, 24 Sep 2003 14:35:50 -0400 +X-Virus-Scanned: by AMaViS perl-11 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/312 +X-Sequence-Number: 3678 + +--=-Si7MKX4F7hhxyh/3esH9 +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +> 20,000 items Takes on average 0.078seconds/room +> 385,000 items Takes on average .11seconds/room +> 690,000 items takes on average .270seconds/room +> 1,028,000 items Takes on average .475seconds/room +>=20 +> As can be seen the time taken to process each room increases. A commit=20 +> occurs when a room has been copied. + +It probably isn't the insert that is getting slower, but a select.=20 +Foreign keys to growing tables will exhibit this behaviour. + +Since the time is doubling with the number of items, you might want to +check for a SELECT working with a sequential scan rather than an index +scan. + +--=-Si7MKX4F7hhxyh/3esH9 +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: This is a digitally signed message part + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.3 (FreeBSD) + +iD8DBQA/ceQF6DETLow6vwwRAoOhAJ4pRrBko8LkR6o5r6XfzKQOCDNjrgCfcTjA +zozEcK1q8bp5A5iuX6AYcww= +=s9HZ +-----END PGP SIGNATURE----- + +--=-Si7MKX4F7hhxyh/3esH9-- + + +From pgsql-performance-owner@postgresql.org Wed Sep 24 18:24:29 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C09B4D1B906 + for ; + Wed, 24 Sep 2003 21:24:27 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 08187-10 + for ; + Wed, 24 Sep 2003 18:24:19 -0300 (ADT) +Received: from localhost.localdomain (unknown [65.217.53.66]) + by svr1.postgresql.org (Postfix) with ESMTP id B71B8D1BB36 + for ; + Wed, 24 Sep 2003 18:24:15 -0300 (ADT) +Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) + by localhost.localdomain (8.12.8/8.12.8) with ESMTP id h8OKHMqd011216 + for ; Wed, 24 Sep 2003 16:17:23 -0400 +Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [192.168.3.55]) + by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id h8OLOEZ12772 + for ; Wed, 24 Sep 2003 17:24:15 -0400 +Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP + (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) + id TD8AT5BG; Wed, 24 Sep 2003 17:24:12 -0400 +Subject: upping checkpoints on production server +From: Robert Treat +To: pgsql-performance@postgresql.org +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +X-Mailer: Ximian Evolution 1.0.8 +Date: 24 Sep 2003 17:24:14 -0400 +Message-Id: <1064438654.25702.2076.camel@camel> +Mime-Version: 1.0 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/313 +X-Sequence-Number: 3679 + +All this talk of checkpoints got me wondering if I have them set at an +optimum level on my production servers. I noticed the following in the +docs: + + "There will be at least one 16 MB segment file, and will normally not +be more than 2 * checkpoint_segments + 1 files. You can use this to +estimate space requirements for WAL. Ordinarily, when old log segment +files are no longer needed, they are recycled (renamed to become the +next segments in the numbered sequence). If, due to a short-term peak of +log output rate, there are more than 2 * checkpoint_segments + 1 segment +files, the unneeded segment files will be deleted instead of recycled +until the system gets back under this limit." + +In .conf file I have default checkpoints set to 3, but I noticed that in +my pg_xlog directory I always seem to have at least 8 log files. Since +this is more than the suggested 7, I'm wondering if this means I ought +to bump my checkpoint segments up to 4? I don't really want to bump it +up unnecessarily as quick recover time is important on this box, however +if i would get an overall performance boost it seems like it would be +worth it, and given that I seem to be using more than the default number +anyways... I've always treated wal logs as self maintaining, am I over +analyzing this? + +Another thought popped into my head, is it just coincidence that I +always seem to have 8 files and that wal_buffers defaults to 8? Seems +like it's not but I love a good conspiracy theory. + +Robert Treat +-- +Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL + + +From pgsql-performance-owner@postgresql.org Wed Sep 24 18:57:55 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C7DC6D1B54E + for ; + Wed, 24 Sep 2003 21:57:54 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 11195-03 + for ; + Wed, 24 Sep 2003 18:57:46 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id C5ADDD1B50B + for ; + Wed, 24 Sep 2003 18:57:43 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h8OLvjiP025884; + Wed, 24 Sep 2003 17:57:46 -0400 (EDT) +To: Robert Treat +Cc: pgsql-performance@postgresql.org +Subject: Re: upping checkpoints on production server +In-reply-to: <1064438654.25702.2076.camel@camel> +References: <1064438654.25702.2076.camel@camel> +Comments: In-reply-to Robert Treat + message dated "24 Sep 2003 17:24:14 -0400" +Date: Wed, 24 Sep 2003 17:57:45 -0400 +Message-ID: <25883.1064440665@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/314 +X-Sequence-Number: 3680 + +Robert Treat writes: +> In .conf file I have default checkpoints set to 3, but I noticed that in +> my pg_xlog directory I always seem to have at least 8 log files. Since +> this is more than the suggested 7, I'm wondering if this means I ought +> to bump my checkpoint segments up to 4? + +Hm. What is the typical delta in the mod times of the log files? It +sounds like you are in a regime where checkpoints are always triggered +by checkpoint_segments and never by checkpoint_timeout, in which case +increasing the former might be a good idea. Or decrease the latter, +but that could put a drag on performance. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Sep 25 07:17:41 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id D47E5D1B553 + for ; + Thu, 25 Sep 2003 10:17:37 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 84459-06 + for ; + Thu, 25 Sep 2003 07:17:09 -0300 (ADT) +Received: from earth.virtual-domain.com (unknown [216.118.96.155]) + by svr1.postgresql.org (Postfix) with ESMTP id E815BD1B542 + for ; + Thu, 25 Sep 2003 07:17:05 -0300 (ADT) +Received: from rigmor (sms.finestmedia.tv [213.180.31.11]) + by earth.virtual-domain.com (8.11.4/8.11.4) with SMTP id h8PBFa790023; + Thu, 25 Sep 2003 06:15:36 -0500 (EST) +Reply-To: +From: "Rigmor Ukuhe" +To: "Matt Clark" , + +Subject: Re: Index problem +Date: Thu, 25 Sep 2003 13:22:40 +0300 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +Importance: Normal +In-Reply-To: +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/315 +X-Sequence-Number: 3681 + +> > What causes this behaviour? is there any workaround? Suggestions? +> > +> +> How many rows are there in the table, and can you post the +> 'explain analyze' for both queries after doing a 'vacuum verbose analyze +> [tablename]'? + +There are about 2500 rows in that table. + +1st query explain analyze: Seq Scan on PRIORITY_STATISTICS +(cost=0.00..491.44 rows=127 width=12) (actual time=98.58..98.58 rows=0 +loops=1) +Total runtime: 98.74 msec + +2nd query explain analyze: NOTICE: QUERY PLAN: + +Index Scan using PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +PRIORITY_STATISTICS_reo_id on PRIORITY_STATISTICS (cost=0.00..394.06 +rows=102 width=12) (actual time=20.93..20.93 rows=0 loops=1) +Total runtime: 21.59 msec + +Any help? + +Rigmor + + +> +> Cheers +> +> Matt +> +> +> +> --- +> Incoming mail is certified Virus Free. +> Checked by AVG anti-virus system (http://www.grisoft.com). +> Version: 6.0.515 / Virus Database: 313 - Release Date: 01.09.2003 +> +--- +Outgoing mail is certified Virus Free. +Checked by AVG anti-virus system (http://www.grisoft.com). +Version: 6.0.515 / Virus Database: 313 - Release Date: 01.09.2003 + + +From pgsql-performance-owner@postgresql.org Thu Sep 25 09:13:56 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id AE8A6D1B4FF + for ; + Thu, 25 Sep 2003 12:13:53 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 96378-04 + for ; + Thu, 25 Sep 2003 09:13:46 -0300 (ADT) +Received: from wight.ymogen.net (unknown [217.27.240.153]) + by svr1.postgresql.org (Postfix) with SMTP id 8B2A0D1B51A + for ; + Thu, 25 Sep 2003 09:13:40 -0300 (ADT) +Received: (qmail 30312 invoked from network); 25 Sep 2003 12:13:38 -0000 +Received: from 82-68-95-1.dsl.in-addr.zen.co.uk (HELO solent) (82.68.95.1) + by wight.ymogen.net with SMTP; 25 Sep 2003 12:13:38 -0000 +From: "Matt Clark" +To: , + +Subject: Re: Index problem +Date: Thu, 25 Sep 2003 13:13:32 +0100 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +Importance: Normal +In-Reply-To: +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/316 +X-Sequence-Number: 3682 + +> There are about 2500 rows in that table. +> +> 1st query explain analyze: Seq Scan on PRIORITY_STATISTICS +> (cost=0.00..491.44 rows=127 width=12) (actual time=98.58..98.58 rows=0 +> loops=1) +> Total runtime: 98.74 msec +> +> 2nd query explain analyze: NOTICE: QUERY PLAN: +> +> Index Scan using PRIORITY_STATISTICS_reo_id, PRIORITY_STATISTICS_reo_id, +[snip] +> PRIORITY_STATISTICS_reo_id on PRIORITY_STATISTICS (cost=0.00..394.06 +> rows=102 width=12) (actual time=20.93..20.93 rows=0 loops=1) +> Total runtime: 21.59 msec + +With only 2500 rows the planner could be deciding that it's going to have to read every disk block to do an index scan anyway, so it +might as well do a sequential scan. If the pages are in fact in the kernel cache then the compute time will dominate, not the IO +time, so it ends up looking like a bad plan, but it's probably not really such a bad plan... + +Is your effective_cache_size set to something sensibly large? + +You could also try decreasing cpu_index_tuple_cost and cpu_tuple_cost. These will affect all your queries though, so what you gain +on one might be lost on another. + +Matt + + + +From pgsql-performance-owner@postgresql.org Thu Sep 25 09:37:28 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 32795D1B4E1 + for ; + Thu, 25 Sep 2003 12:37:27 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 95248-08 + for ; + Thu, 25 Sep 2003 09:36:59 -0300 (ADT) +Received: from rambutan.pingpong.net (81.milagro.bahnhof.net [195.178.168.81]) + by svr1.postgresql.org (Postfix) with ESMTP id 30909D1B541 + for ; + Thu, 25 Sep 2003 09:36:53 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by rambutan.pingpong.net (8.12.8p1/8.12.8) with ESMTP id h8PCarr7002484 + for ; + Thu, 25 Sep 2003 14:36:53 +0200 (CEST) + (envelope-from girgen@pingpong.net) +Date: Thu, 25 Sep 2003 14:36:53 +0200 +From: Palle Girgensohn +To: pgsql-performance@postgresql.org +Subject: performance hit when joining with a view? +Message-ID: <31150000.1064493413@rambutan.pingpong.net> +X-Mailer: Mulberry/3.0.3 (Linux/x86) +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1; FORMAT=flowed +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/317 +X-Sequence-Number: 3683 + +Hi! + +A performance question: + +I have some tables: + + Tabell "public.person" + Kolumn | Typ | Modifierare +------------------+--------------------------+--------------- + userid | text | not null + giver | text | + first_name | text | + last_name | text | + email | text | + default_language | text | default 'sv' + created | timestamp with time zone | default now() + created_by | text | +Index: person_pkey prim=E4rnyckel btree (userid), + person_index unik btree (userid), + person_giver_idx btree (giver) +Fr=E4mmande nyckel-villkor: pp_fk9 FOREIGN KEY (giver) REFERENCES=20 +providers(giver) ON UPDATE CASCADE ON DELETE CASCADE, + pp_fk2 FOREIGN KEY (created_by) REFERENCES=20 +person(userid) ON UPDATE CASCADE ON DELETE SET NULL + + + Tabell "public.wiol" + Kolumn | Typ | Modifierare +-----------------+-----------------------------+--------------- + userid | text | not null + course_id | integer | + login_ts | timestamp without time zone | default now() + latest_event_ts | timestamp without time zone | default now() +Fr=E4mmande nyckel-villkor: pp_fk2 FOREIGN KEY (course_id) REFERENCES=20 +course(id) ON UPDATE CASCADE ON DELETE CASCADE, + pp_fk1 FOREIGN KEY (userid) REFERENCES=20 +person(userid) ON UPDATE CASCADE ON DELETE CASCADE + +and a view: + + Vy "public.person_wiol_view" + Kolumn | Typ | Modifierare +------------------+--------------------------+------------- + userid | text | + giver | text | + first_name | text | + last_name | text | + email | text | + default_language | text | + created | timestamp with time zone | + created_by | text | + course_id | integer | +Vydefinition: SELECT p.userid, p.giver, p.first_name, p.last_name, p.email,= +=20 +p.default_language, p.created, p.created_by, w.course_id FROM (person p=20 +LEFT JOIN wiol w ON ((p.userid =3D w.userid))); + + +Now, with about 30000 tuples in person and about 40 in wiol, executing a=20 +left outer join with the view gives horrible performance: + + explain analyze select p.pim_id, p.recipient, p.sender, p.message, p.ts,= +=20 +p.type, case when sender.userid is not null then sender.first_name || ' '= +=20 +|| sender.last_name else null end as sender_name, sender.course_id is not= +=20 +null as is_online from pim p left outer join person_wiol_view sender on=20 +(sender.userid =3D p.sender) where p.recipient =3D 'axto6551' and p.type >= +=3D 0=20 +limit 1; + QUERY PLAN +--------------------------------------------------------------------------- +---------------------------------------------------------- + Limit (cost=3D0.00..1331.26 rows=3D1 width=3D180) (actual time=3D866.14..= +1135.65=20 +rows=3D1 loops=3D1) + -> Nested Loop (cost=3D0.00..1331.26 rows=3D1 width=3D180) (actual=20 +time=3D866.13..1135.63 rows=3D2 loops=3D1) + Join Filter: ("inner".userid =3D "outer".sender) + -> Seq Scan on pim p (cost=3D0.00..0.00 rows=3D1 width=3D112) (a= +ctual=20 +time=3D0.05..0.18 rows=3D2 loops=3D1) + Filter: ((recipient =3D 'axto6551'::text) AND ("type" >=3D 0= +)) + -> Materialize (cost=3D956.15..956.15 rows=3D30009 width=3D68) (= +actual=20 +time=3D369.33..437.86 rows=3D22045 loops=3D2) + -> Hash Join (cost=3D0.00..956.15 rows=3D30009 width=3D68)= +=20 +(actual time=3D0.45..605.21 rows=3D30013 loops=3D1) + Hash Cond: ("outer".userid =3D "inner".userid) + -> Seq Scan on person p (cost=3D0.00..806.09=20 +rows=3D30009 width=3D32) (actual time=3D0.16..279.28 rows=3D30009 loops=3D1) + -> Hash (cost=3D0.00..0.00 rows=3D1 width=3D36) (act= +ual=20 +time=3D0.13..0.13 rows=3D0 loops=3D1) + -> Seq Scan on wiol w (cost=3D0.00..0.00 rows= +=3D1=20 +width=3D36) (actual time=3D0.02..0.09 rows=3D8 loops=3D1) + Total runtime: 1143.93 msec +(12 rader) + + +but rewriting the question with an explicit join uses the indices, and runs= +=20 +*much* faster: + +explain analyze select p.pim_id, p.recipient, p.sender, p.message, p.ts,= +=20 +p.type, case when sender.userid is not null then sender.first_name || ' '= +=20 +|| sender.last_name else null end as sender_name, w.course_id is not null= +=20 +as is_online from pim p left outer join person sender on (sender.userid =3D= +=20 +p.sender) left join wiol w on (w.userid=3Dsender.userid) where p.recipient = +=3D=20 +'axto6551' and p.type >=3D 0 limit 1; + QUERY PLAN +--------------------------------------------------------------------------- +----------------------------------------------------------------- + Limit (cost=3D0.00..6.03 rows=3D1 width=3D180) (actual time=3D0.89..1.13 = +rows=3D1=20 +loops=3D1) + -> Hash Join (cost=3D0.00..6.03 rows=3D1 width=3D180) (actual=20 +time=3D0.88..1.12 rows=3D2 loops=3D1) + Hash Cond: ("outer".userid =3D "inner".userid) + -> Nested Loop (cost=3D0.00..6.02 rows=3D1 width=3D144) (actual= +=20 +time=3D0.48..0.69 rows=3D2 loops=3D1) + -> Seq Scan on pim p (cost=3D0.00..0.00 rows=3D1 width=3D1= +12)=20 +(actual time=3D0.04..0.16 rows=3D2 loops=3D1) + Filter: ((recipient =3D 'axto6551'::text) AND ("type" = +>=3D=20 +0)) + -> Index Scan using person_pkey on person sender=20 +(cost=3D0.00..6.01 rows=3D1 width=3D32) (actual time=3D0.23..0.24 rows=3D1 = +loops=3D2) + Index Cond: (sender.userid =3D "outer".sender) + -> Hash (cost=3D0.00..0.00 rows=3D1 width=3D36) (actual=20 +time=3D0.22..0.22 rows=3D0 loops=3D1) + -> Seq Scan on wiol w (cost=3D0.00..0.00 rows=3D1 width=3D= +36)=20 +(actual time=3D0.12..0.17 rows=3D8 loops=3D1) + Total runtime: 1.39 msec +(11 rader) + + + +Tests run on postgresql-7.3.4. + +Main question is, is it bad SQL to join with a view, or is it postgresql=20 +that does something not quite optimal? If the latter, is it fixed in 7.4? + +Thanks, +Palle + + + + +From pgsql-performance-owner@postgresql.org Thu Sep 25 10:39:27 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 96D52D1B52D + for ; + Thu, 25 Sep 2003 13:39:20 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 00732-06 + for ; + Thu, 25 Sep 2003 10:38:53 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 382B3D1B525 + for ; + Thu, 25 Sep 2003 10:38:49 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h8PDcR6c002396; + Thu, 25 Sep 2003 09:38:27 -0400 (EDT) +To: rigmor.ukuhe@finestmedia.com +Cc: "Matt Clark" , pgsql-performance@postgresql.org +Subject: Re: Index problem +In-reply-to: +References: +Comments: In-reply-to "Rigmor Ukuhe" + message dated "Thu, 25 Sep 2003 13:22:40 +0300" +Date: Thu, 25 Sep 2003 09:38:27 -0400 +Message-ID: <2395.1064497107@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/318 +X-Sequence-Number: 3684 + +"Rigmor Ukuhe" writes: +>>> What causes this behaviour? is there any workaround? Suggestions? + +At some point the planner is going to decide that one seqscan is cheaper +than repeated indexscans. At some point it'll be right ... but in this +case it seems its relative cost estimates are off a bit. You might try +reducing random_page_cost to bring them more into line with reality. +(But keep in mind that the reality you are measuring appears to be +small-table-already-fully-cached reality. On a large table you might +find that small random_page_cost isn't such a hot idea after all.) + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Sep 25 10:56:08 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B2E8FD1B502 + for ; + Thu, 25 Sep 2003 13:56:05 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 00732-09 + for ; + Thu, 25 Sep 2003 10:55:37 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 8B5B9D1B4E1 + for ; + Thu, 25 Sep 2003 10:55:33 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h8PDtQ6c002588; + Thu, 25 Sep 2003 09:55:26 -0400 (EDT) +To: Palle Girgensohn +Cc: pgsql-performance@postgresql.org +Subject: Re: performance hit when joining with a view? +In-reply-to: <31150000.1064493413@rambutan.pingpong.net> +References: <31150000.1064493413@rambutan.pingpong.net> +Comments: In-reply-to Palle Girgensohn + message dated "Thu, 25 Sep 2003 14:36:53 +0200" +Date: Thu, 25 Sep 2003 09:55:26 -0400 +Message-ID: <2587.1064498126@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/319 +X-Sequence-Number: 3685 + +Palle Girgensohn writes: +> Vydefinition: SELECT p.userid, p.giver, p.first_name, p.last_name, p.email, +> p.default_language, p.created, p.created_by, w.course_id FROM (person p +> LEFT JOIN wiol w ON ((p.userid = w.userid))); + +> explain analyze select p.pim_id, p.recipient, p.sender, p.message, p.ts, +> p.type, case when sender.userid is not null then sender.first_name || ' ' +> || sender.last_name else null end as sender_name, sender.course_id is not +> null as is_online from pim p left outer join person_wiol_view sender on +> (sender.userid = p.sender) where p.recipient = 'axto6551' and p.type >= 0 +> limit 1; + +> explain analyze select p.pim_id, p.recipient, p.sender, p.message, p.ts, +> p.type, case when sender.userid is not null then sender.first_name || ' ' +> || sender.last_name else null end as sender_name, w.course_id is not null +> as is_online from pim p left outer join person sender on (sender.userid = +> p.sender) left join wiol w on (w.userid=sender.userid) where p.recipient = +> 'axto6551' and p.type >= 0 limit 1; + +These are not actually the same query. In the former case the implicit +parenthesization of the joins is + pim left join (person left join wiol) +whereas in the latter case the implicit parenthesization is left-to-right: + (pim left join person) left join wiol +Since the only restriction conditions you have provided are on pim, the +first parenthesization implies forming the entire join of person and +wiol :-(. + +If you were using plain joins then the two queries would be logically +equivalent, but outer joins are in general not associative, so the +planner will not consider re-ordering them. + +There is some work in 7.4 to make the planner smarter about outer joins, +but offhand I don't think any of it will improve results for this +particular example. + +I have seen some academic papers about how to prove that a particular +pair of outer join operators can safely be swapped (as I think is true +in this example). Some knowledge of that sort may eventually get into +the planner, but it ain't there now. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Sep 25 12:23:54 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C3BCBD1B538 + for ; + Thu, 25 Sep 2003 15:23:51 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 17149-03 + for ; + Thu, 25 Sep 2003 12:23:19 -0300 (ADT) +Received: from localhost.localdomain (unknown [65.217.53.66]) + by svr1.postgresql.org (Postfix) with ESMTP id C42CDD1B4ED + for ; + Thu, 25 Sep 2003 12:23:17 -0300 (ADT) +Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) + by localhost.localdomain (8.12.8/8.12.8) with ESMTP id h8PEGUqd018474; + Thu, 25 Sep 2003 10:16:32 -0400 +Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [192.168.3.55]) + by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id h8PFNCZ29796; + Thu, 25 Sep 2003 11:23:12 -0400 +Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP + (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) + id TD8AT88M; Thu, 25 Sep 2003 11:23:11 -0400 +Subject: Re: upping checkpoints on production server +From: Robert Treat +To: Tom Lane +Cc: pgsql-performance@postgresql.org +In-Reply-To: <25883.1064440665@sss.pgh.pa.us> +References: <1064438654.25702.2076.camel@camel> + <25883.1064440665@sss.pgh.pa.us> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +X-Mailer: Ximian Evolution 1.0.8 +Date: 25 Sep 2003 11:23:12 -0400 +Message-Id: <1064503392.30308.2160.camel@camel> +Mime-Version: 1.0 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/320 +X-Sequence-Number: 3686 + +On Wed, 2003-09-24 at 17:57, Tom Lane wrote: +> Robert Treat writes: +> > In .conf file I have default checkpoints set to 3, but I noticed that in +> > my pg_xlog directory I always seem to have at least 8 log files. Since +> > this is more than the suggested 7, I'm wondering if this means I ought +> > to bump my checkpoint segments up to 4? +> +> Hm. What is the typical delta in the mod times of the log files? It +> sounds like you are in a regime where checkpoints are always triggered +> by checkpoint_segments and never by checkpoint_timeout, in which case +> increasing the former might be a good idea. Or decrease the latter, +> but that could put a drag on performance. +> + +# ls -lht /var/lib/pgsql/data/pg_xlog/ +total 129M +-rw------- 1 postgres postgres 16M Sep 25 11:12 0000006E00000059 +-rw------- 1 postgres postgres 16M Sep 25 11:12 0000006E0000005A +-rw------- 1 postgres postgres 16M Sep 25 11:08 0000006E00000058 +-rw------- 1 postgres postgres 16M Sep 25 11:05 0000006E0000005F +-rw------- 1 postgres postgres 16M Sep 25 11:02 0000006E0000005E +-rw------- 1 postgres postgres 16M Sep 25 10:59 0000006E0000005D +-rw------- 1 postgres postgres 16M Sep 25 10:55 0000006E0000005B +-rw------- 1 postgres postgres 16M Sep 25 10:51 0000006E0000005C + +#ls -lht /var/lib/pgsql/data/pg_xlog/ +total 129M +-rw------- 1 postgres postgres 16M Sep 25 10:52 0000006E00000054 +-rw------- 1 postgres postgres 16M Sep 25 10:51 0000006E00000053 +-rw------- 1 postgres postgres 16M Sep 25 10:49 0000006E00000052 +-rw------- 1 postgres postgres 16M Sep 25 10:45 0000006E00000059 +-rw------- 1 postgres postgres 16M Sep 25 10:40 0000006E00000057 +-rw------- 1 postgres postgres 16M Sep 25 10:37 0000006E00000058 +-rw------- 1 postgres postgres 16M Sep 25 10:33 0000006E00000056 +-rw------- 1 postgres postgres 16M Sep 25 10:29 0000006E00000055 + + + + + + +from the 7.4 docs: + + "Checkpoints are fairly expensive because they force all dirty kernel +buffers to disk using the operating system sync() call. Busy servers may +fill checkpoint segment files too quickly, causing excessive +checkpointing." + +it goes on to mention checkpoint_warning, which I don't have in 7.3, but +I think this is a case where I'd likely see those warnings. The server +in question has a fairly high write/read ratio and is fairly busy (over +100 tps iirc). + +since more often than not I don't make it to 5 minutes, seems like +upping checkpoint segments is the way to go, right? + +Robert Treat +-- +Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL + + +From pgsql-general-owner@postgresql.org Thu Sep 25 13:39:04 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id D5B48D1B508 + for ; + Thu, 25 Sep 2003 16:39:03 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 22430-10 + for ; + Thu, 25 Sep 2003 13:38:32 -0300 (ADT) +Received: from web1.nexusinternetsolutions.net + (web1.nexusinternetsolutions.net [206.47.131.12]) + by svr1.postgresql.org (Postfix) with SMTP id 465F4D1B553 + for ; + Thu, 25 Sep 2003 13:38:31 -0300 (ADT) +Received: (qmail 10945 invoked from network); 25 Sep 2003 16:38:08 -0000 +Received: from unknown (HELO ws1) (65.49.236.97) + by web1.nexusinternetsolutions.net with SMTP; 25 Sep 2003 16:38:08 -0000 +From: "Dave [Hawk-Systems]" +To: +Subject: populate table with large csv file +Date: Thu, 25 Sep 2003 12:38:07 -0400 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) +Importance: Normal +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=1.8 tagged_above=0.0 required=5.0 tests=BAYES_30, + FORGED_MUA_OIMO, MSGID_GOOD_EXCHANGE +X-Spam-Level: * +X-Archive-Number: 200309/1625 +X-Sequence-Number: 49844 + +have the table "numbercheck" + Attribute | Type | Modifier + -----------+------------+---------- + svcnumber | integer | not null + svcqual | varchar(9) | + svcequip | char(1) | + svctroub | varchar(6) | + svcrate | varchar(4) | + svcclass | char(1) | + trailer | varchar(3) | + Index: numbercheck_pkey + +also have a csv file + 7057211380,Y,,,3,B + 7057216800,Y,,,3,B + 7057265038,Y,,,3,B + 7057370261,Y,,,3,B + 7057374613,Y,,,3,B + 7057371832,Y,,,3,B + 4166336554,Y,,,3,B + 4166336863,Y,,,3,B + 7057201148,Y,,,3,B + +aside from parsing the csv file through a PHP interface, what isthe easiest way +to get that csv data importted into the postgres database. thoughts? + +thanks + +Dave + + + +From pgsql-general-owner@postgresql.org Thu Sep 25 13:46:54 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id D2071D1B552 + for ; + Thu, 25 Sep 2003 16:46:53 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 25226-08 + for ; + Thu, 25 Sep 2003 13:46:22 -0300 (ADT) +Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) + by svr1.postgresql.org (Postfix) with ESMTP id CE605D1B52B + for ; + Thu, 25 Sep 2003 13:46:20 -0300 (ADT) +Received: from [206.19.64.3] (account jconway HELO joeconway.com) + by joeconway.com (CommuniGate Pro SMTP 4.1.3) + with ESMTP-TLS id 241108; Thu, 25 Sep 2003 10:11:56 -0700 +Message-ID: <3F731B3D.1030003@joeconway.com> +Date: Thu, 25 Sep 2003 09:43:41 -0700 +From: Joe Conway +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; + rv:1.3) Gecko/20030312 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Dave [Hawk-Systems]" +Cc: pgsql-general@postgresql.org +Subject: Re: populate table with large csv file +References: +In-Reply-To: +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/1626 +X-Sequence-Number: 49845 + +Dave [Hawk-Systems] wrote: +> aside from parsing the csv file through a PHP interface, what isthe easiest way +> to get that csv data importted into the postgres database. thoughts? +> + +see COPY: +http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=sql-copy.html + +Joe + + +From pgsql-general-owner@postgresql.org Thu Sep 25 13:51:33 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 8EA4ED1B52C + for ; + Thu, 25 Sep 2003 16:51:32 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 27185-04 + for ; + Thu, 25 Sep 2003 13:51:02 -0300 (ADT) +Received: from hatch.sonalysts.com (hatch.sonalysts.com [198.6.208.3]) + by svr1.postgresql.org (Postfix) with ESMTP id B61E9D1B507 + for ; + Thu, 25 Sep 2003 13:51:00 -0300 (ADT) +Received: from sonalysts.com (fwuser@sentry.sonalysts.com [198.6.208.103]) + by hatch.sonalysts.com (8.9.0/8.9.0) with ESMTP id MAA27835; + Thu, 25 Sep 2003 12:50:56 -0400 (EDT) +Message-ID: <3F731CF0.2090800@sonalysts.com> +Date: Thu, 25 Sep 2003 12:50:56 -0400 +From: "P.J. \"Josh\" Rovero" +Organization: Sonalysts, Inc. +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Dave [Hawk-Systems]" +Cc: pgsql-general@postgresql.org +Subject: Re: populate table with large csv file +References: +In-Reply-To: +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/1627 +X-Sequence-Number: 49846 + +Dave [Hawk-Systems] wrote: + +> aside from parsing the csv file through a PHP interface, what isthe easiest way +> to get that csv data importted into the postgres database. thoughts? + +Assuming the CSV file data is well formed, use psql and +the COPY command. + +In psql, create the table. Then issue command: + +copy from 'filename' using delimiters ','; +-- +P. J. "Josh" Rovero Sonalysts, Inc. +Email: rovero@sonalysts.com www.sonalysts.com 215 Parkway North +Work: (860)326-3671 or 442-4355 Waterford CT 06385 +*********************************************************************** + + +From pgsql-general-owner@postgresql.org Thu Sep 25 15:13:27 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 997DED1B4E9 + for ; + Thu, 25 Sep 2003 18:13:24 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 42836-04 + for ; + Thu, 25 Sep 2003 15:12:52 -0300 (ADT) +Received: from lakemtai07.cox.net (lakemtai07.cox.net [68.1.17.125]) + by svr1.postgresql.org (Postfix) with ESMTP id B63A2D1B546 + for ; + Thu, 25 Sep 2003 15:12:50 -0300 (ADT) +Received: from lhosts ([68.11.66.83]) by lakemtao01.cox.net + (InterMail vM.5.01.06.05 201-253-122-130-105-20030824) with ESMTP + id <20030925165758.LZTD29208.lakemtao01.cox.net@lhosts> + for ; Thu, 25 Sep 2003 12:57:58 -0400 +Subject: Re: populate table with large csv file +From: Ron Johnson +To: PgSQL General ML +In-Reply-To: +References: +Content-Type: text/plain +Message-Id: <1064509077.1441.57.camel@haggis> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Thu, 25 Sep 2003 11:57:57 -0500 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/1639 +X-Sequence-Number: 49858 + +On Thu, 2003-09-25 at 11:38, Dave [Hawk-Systems] wrote: +> have the table "numbercheck" +> Attribute | Type | Modifier +> -----------+------------+---------- +> svcnumber | integer | not null +> svcqual | varchar(9) | +> svcequip | char(1) | +> svctroub | varchar(6) | +> svcrate | varchar(4) | +> svcclass | char(1) | +> trailer | varchar(3) | +> Index: numbercheck_pkey +> +> also have a csv file +> 7057211380,Y,,,3,B +> 7057216800,Y,,,3,B +> 7057265038,Y,,,3,B +> 7057370261,Y,,,3,B +> 7057374613,Y,,,3,B +> 7057371832,Y,,,3,B +> 4166336554,Y,,,3,B +> 4166336863,Y,,,3,B +> 7057201148,Y,,,3,B +> +> aside from parsing the csv file through a PHP interface, what isthe easiest way +> to get that csv data importted into the postgres database. thoughts? + +No matter what you do, it's going to barf: svcnumber is a 32-bit +integer, and 7,057,211,380 is significantly out of range. + +Once you change svcnumber to bigint, the COPY command will easily +suck in the csv file. + +-- +----------------------------------------------------------------- +Ron Johnson, Jr. ron.l.johnson@cox.net +Jefferson, LA USA + +"Python is executable pseudocode; Perl is executable line noise" + + +From pgsql-performance-owner@postgresql.org Thu Sep 25 16:42:04 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C984FD1B513 + for ; + Thu, 25 Sep 2003 19:42:01 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 53015-02 + for ; + Thu, 25 Sep 2003 16:41:32 -0300 (ADT) +Received: from mail.waterford.org (67.107.203.158.ptr.us.xo.net + [67.107.203.158]) + by svr1.postgresql.org (Postfix) with ESMTP id 0FD44D1B541 + for ; + Thu, 25 Sep 2003 16:41:30 -0300 (ADT) +Received: by mail.waterford.org with XWall v3.27 ; + Thu, 25 Sep 2003 13:40:12 -0600 +From: Oleg Lebedev +To: "pgsql-performance@postgresql.org" +Subject: TPC-R benchmarks +Date: Thu, 25 Sep 2003 13:40:12 -0600 +X-Assembled-By: XWall v3.27 +Message-ID: <993DBE5B4D02194382EC8DF8554A52731D75CD@postoffice.waterford.org> +Mime-Version: 1.0 +Content-Type: multipart/alternative; + boundary="_NextPart_1_qmZrHLajoetbkwlTZTViemHPfyb" +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=BAYES_30, + HTML_30_40, MIME_BOUND_NEXTPART, TO_ADDRESS_EQ_REAL +X-Spam-Level: +X-Archive-Number: 200309/321 +X-Sequence-Number: 3687 + +This is a multi part message in MIME format. + +--_NextPart_1_qmZrHLajoetbkwlTZTViemHPfyb +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + +I am running TPC-R benchmarks with a scale factor of 1, which correspond +to approximately 1 GB database size on PostgreSQL 7.3.4 installed on +CygWin on Windows XP. I dedicated 128 MB of shared memory to my postrges +installation. +Most of the queries were able to complete in a matter of minutes, but +query 17 was taking hours and hours. The query is show below. Is there +any way to optimize it ? +=20 +select + sum(l_extendedprice) / 7.0 as avg_yearly +from + lineitem, + part +where + p_partkey =3D l_partkey + and p_brand =3D 'Brand#11' + and p_container =3D 'SM PKG' + and l_quantity < ( + select + 0.2 * avg(l_quantity) + from + lineitem + where + l_partkey =3D p_partkey + ); +=20 +Thanks. +=20 +Oleg + +************************************* + +This e-mail may contain privileged or confidential material intended for th= +e named recipient only. +If you are not the named recipient, delete this message and all attachments. +Unauthorized reviewing, copying, printing, disclosing, or otherwise using i= +nformation in this e-mail is prohibited. +We reserve the right to monitor e-mail sent through our network.=20 + +************************************* + +--_NextPart_1_qmZrHLajoetbkwlTZTViemHPfyb +Content-Type: text/html; charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + + +Message + + + +
I am runn= +ing TPC-R=20 +benchmarks with a scale factor of 1, which correspond to approximately 1 GB= +=20 +database size on PostgreSQL 7.3.4 installed on CygWin on Windows XP. I dedi= +cated=20 +128 MB of shared memory to my postrges installation.
+
Most of t= +he queries=20 +were able to complete in a matter of minutes, but query 17 was taking hours= + and=20 +hours. The query is show below. Is there any way to optimize it=20 +?
+
 
+
select
 sum(l_extendedprice) / 7.0 as=20 +avg_yearly
from
 lineitem,
 part
where
 p_par= +tkey=20 +=3D l_partkey
 and p_brand =3D 'Brand#11'
 and p_container = +=3D 'SM=20 +PKG'
 and l_quantity <=20 +(
  select
   0.2 *=20 +avg(l_quantity)
  from
   lineitem
 = + where
   l_partkey=20 +=3D p_partkey
 );
+
 
+
Thanks.
+
 
+
Oleg
+

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

+This e-mail may contain privileged or confidential material intended for th= +e named recipient only.
+If you are not the named recipient, delete this message and all attachments= +.
+Unauthorized reviewing, copying, printing, disclosing, or otherwise using i= +nformation in this e-mail is prohibited.
+We reserve the right to monitor e-mail sent through our network.
+

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

+ + + +--_NextPart_1_qmZrHLajoetbkwlTZTViemHPfyb-- + +From pgsql-performance-owner@postgresql.org Thu Sep 25 18:25:01 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 62383D1B8CB + for ; + Thu, 25 Sep 2003 21:25:00 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 66248-03 + for ; + Thu, 25 Sep 2003 18:24:50 -0300 (ADT) +Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) + by svr1.postgresql.org (Postfix) with ESMTP id 273F3D1B563 + for ; + Thu, 25 Sep 2003 18:24:35 -0300 (ADT) +Received: from ibm-a.pdx.osdl.net (ibm-a.pdx.osdl.net [172.20.1.50]) + by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h8PLOZ121839; + Thu, 25 Sep 2003 14:24:35 -0700 +Subject: Re: TPC-R benchmarks +From: Jenny Zhang +To: Oleg Lebedev +Cc: pgsql-performance@postgresql.org, + osdldbt-general@lists.courceforge.net +In-Reply-To: <993DBE5B4D02194382EC8DF8554A52731D75CD@postoffice.waterford.org> +References: <993DBE5B4D02194382EC8DF8554A52731D75CD@postoffice.waterford.org> +Content-Type: text/plain +Organization: osdl +Message-Id: <1064525555.2082.39.camel@ibm-a.pdx.osdl.net> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Thu, 25 Sep 2003 14:32:35 -0700 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/322 +X-Sequence-Number: 3688 + +I am running TPC-H with scale factor of 1 on RedHat7.2 with the kernel +2.5.74. Q17 can always finish in about 7 seconds on my system. The +execution plan is: +---------------------------------------------------------------------------------------------------- + Aggregate (cost=780402.43..780402.43 rows=1 width=48) + -> Nested Loop (cost=0.00..780397.50 rows=1973 width=48) + Join Filter: ("inner".l_quantity < (subplan)) + -> Seq Scan on part (cost=0.00..8548.00 rows=197 width=12) + Filter: ((p_brand = 'Brand#31'::bpchar) AND (p_container += 'LG CASE'::bpchar)) + -> Index Scan using i_l_partkey on lineitem +(cost=0.00..124.32 rows=30 width=36) + Index Cond: ("outer".p_partkey = lineitem.l_partkey) + SubPlan + -> Aggregate (cost=124.40..124.40 rows=1 width=11) + -> Index Scan using i_l_partkey on lineitem +(cost=0.00..124.32 rows=30 width=11) + Index Cond: (l_partkey = $0) +(11 rows) + +Hope this helps, +Jenny +On Thu, 2003-09-25 at 12:40, Oleg Lebedev wrote: +> I am running TPC-R benchmarks with a scale factor of 1, which correspond +> to approximately 1 GB database size on PostgreSQL 7.3.4 installed on +> CygWin on Windows XP. I dedicated 128 MB of shared memory to my postrges +> installation. +> Most of the queries were able to complete in a matter of minutes, but +> query 17 was taking hours and hours. The query is show below. Is there +> any way to optimize it ? +> +> select +> sum(l_extendedprice) / 7.0 as avg_yearly +> from +> lineitem, +> part +> where +> p_partkey = l_partkey +> and p_brand = 'Brand#11' +> and p_container = 'SM PKG' +> and l_quantity < ( +> select +> 0.2 * avg(l_quantity) +> from +> lineitem +> where +> l_partkey = p_partkey +> ); +> +> Thanks. +> +> Oleg +> +> ************************************* +> +> This e-mail may contain privileged or confidential material intended for the named recipient only. +> If you are not the named recipient, delete this message and all attachments. +> Unauthorized reviewing, copying, printing, disclosing, or otherwise using information in this e-mail is prohibited. +> We reserve the right to monitor e-mail sent through our network. +> +> ************************************* + + +From pgsql-performance-owner@postgresql.org Thu Sep 25 18:41:40 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3FE5FD1B4FF + for ; + Thu, 25 Sep 2003 21:41:39 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 66324-10 + for ; + Thu, 25 Sep 2003 18:41:10 -0300 (ADT) +Received: from mail.waterford.org (67.107.203.158.ptr.us.xo.net + [67.107.203.158]) + by svr1.postgresql.org (Postfix) with ESMTP id 3F8B2D1B52E + for ; + Thu, 25 Sep 2003 18:41:07 -0300 (ADT) +Received: by mail.waterford.org with XWall v3.27 ; + Thu, 25 Sep 2003 15:39:51 -0600 +From: Oleg Lebedev +To: Jenny Zhang +Cc: "pgsql-performance@postgresql.org" +Subject: Re: TPC-R benchmarks +Date: Thu, 25 Sep 2003 15:39:51 -0600 +X-Assembled-By: XWall v3.27 +Message-ID: <993DBE5B4D02194382EC8DF8554A52731D75DC@postoffice.waterford.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/323 +X-Sequence-Number: 3689 + +Seems like in your case postgres uses an i_l_partkey index on lineitem +table. I have a foreign key constraint defined between the lineitem and +part table, but didn't create an special indexes. Here is my query plan: + + -> Aggregate (cost=3D1517604222.32..1517604222.32 rows=3D1 width=3D31) + -> Hash Join (cost=3D8518.49..1517604217.39 rows=3D1969 width=3D= +31) + Hash Cond: ("outer".l_partkey =3D "inner".p_partkey) + Join Filter: ("outer".l_quantity < (subplan)) + -> Seq Scan on lineitem (cost=3D0.00..241889.15 +rows=3D6001215 widt +h=3D27) + -> Hash (cost=3D8518.00..8518.00 rows=3D197 width=3D4) + -> Seq Scan on part (cost=3D0.00..8518.00 rows=3D197 +width=3D4) + + Filter: ((p_brand =3D 'Brand#11'::bpchar) AND +(p_contai +ner =3D 'SM PKG'::bpchar)) + SubPlan + -> Aggregate (cost=3D256892.28..256892.28 rows=3D1 +width=3D11) + -> Seq Scan on lineitem (cost=3D0.00..256892.19 +rows=3D37 w +idth=3D11) + Filter: (l_partkey =3D $0) + +-----Original Message----- +From: Jenny Zhang [mailto:jenny@osdl.org]=20 +Sent: Thursday, September 25, 2003 3:33 PM +To: Oleg Lebedev +Cc: pgsql-performance@postgresql.org; +osdldbt-general@lists.courceforge.net +Subject: Re: [PERFORM] TPC-R benchmarks + + +I am running TPC-H with scale factor of 1 on RedHat7.2 with the kernel +2.5.74. Q17 can always finish in about 7 seconds on my system. The +execution plan is: +------------------------------------------------------------------------ +---------------------------- + Aggregate (cost=3D780402.43..780402.43 rows=3D1 width=3D48) + -> Nested Loop (cost=3D0.00..780397.50 rows=3D1973 width=3D48) + Join Filter: ("inner".l_quantity < (subplan)) + -> Seq Scan on part (cost=3D0.00..8548.00 rows=3D197 width=3D12) + Filter: ((p_brand =3D 'Brand#31'::bpchar) AND (p_container +=3D 'LG CASE'::bpchar)) + -> Index Scan using i_l_partkey on lineitem=20 +(cost=3D0.00..124.32 rows=3D30 width=3D36) + Index Cond: ("outer".p_partkey =3D lineitem.l_partkey) + SubPlan + -> Aggregate (cost=3D124.40..124.40 rows=3D1 width=3D11) + -> Index Scan using i_l_partkey on lineitem=20 +(cost=3D0.00..124.32 rows=3D30 width=3D11) + Index Cond: (l_partkey =3D $0) +(11 rows) + +Hope this helps, +Jenny +On Thu, 2003-09-25 at 12:40, Oleg Lebedev wrote: +> I am running TPC-R benchmarks with a scale factor of 1, which=20 +> correspond to approximately 1 GB database size on PostgreSQL 7.3.4=20 +> installed on CygWin on Windows XP. I dedicated 128 MB of shared memory + +> to my postrges installation. Most of the queries were able to complete + +> in a matter of minutes, but query 17 was taking hours and hours. The=20 +> query is show below. Is there any way to optimize it ? +>=20=20 +> select +> sum(l_extendedprice) / 7.0 as avg_yearly +> from +> lineitem, +> part +> where +> p_partkey =3D l_partkey +> and p_brand =3D 'Brand#11' +> and p_container =3D 'SM PKG' +> and l_quantity < ( +> select +> 0.2 * avg(l_quantity) +> from +> lineitem +> where +> l_partkey =3D p_partkey +> ); +>=20=20 +> Thanks. +>=20=20 +> Oleg +>=20 +> ************************************* +>=20 +> This e-mail may contain privileged or confidential material intended=20 +> for the named recipient only. If you are not the named recipient,=20 +> delete this message and all attachments. Unauthorized reviewing,=20 +> copying, printing, disclosing, or otherwise using information in this=20 +> e-mail is prohibited. We reserve the right to monitor e-mail sent=20 +> through our network. +>=20 +> ************************************* + +************************************* + +This e-mail may contain privileged or confidential material intended for th= +e named recipient only. +If you are not the named recipient, delete this message and all attachments. +Unauthorized reviewing, copying, printing, disclosing, or otherwise using i= +nformation in this e-mail is prohibited. +We reserve the right to monitor e-mail sent through our network.=20 + +************************************* + + +From pgsql-performance-owner@postgresql.org Thu Sep 25 19:17:16 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 6D9C4D1B50B + for ; + Thu, 25 Sep 2003 22:17:15 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 72478-07 + for ; + Thu, 25 Sep 2003 19:17:06 -0300 (ADT) +Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) + by svr1.postgresql.org (Postfix) with ESMTP id 7D7D9D1B510 + for ; + Thu, 25 Sep 2003 19:17:02 -0300 (ADT) +Received: from ibm-a.pdx.osdl.net (ibm-a.pdx.osdl.net [172.20.1.50]) + by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h8PMGx101922; + Thu, 25 Sep 2003 15:16:59 -0700 +Subject: Re: TPC-R benchmarks +From: Jenny Zhang +To: Oleg Lebedev +Cc: "pgsql-performance@postgresql.org" +In-Reply-To: <993DBE5B4D02194382EC8DF8554A52731D75DC@postoffice.waterford.org> +References: <993DBE5B4D02194382EC8DF8554A52731D75DC@postoffice.waterford.org> +Content-Type: text/plain +Organization: osdl +Message-Id: <1064528699.2082.61.camel@ibm-a.pdx.osdl.net> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Thu, 25 Sep 2003 15:24:59 -0700 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/324 +X-Sequence-Number: 3690 + +The index is created by: +create index i_l_partkey on lineitem (l_partkey); +I do not have any foreign key defined. Does the spec require foreign +keys? + +When you create a foreign key reference, does PG create an index +automatically? + +Can you try with the index? + +Jenny +On Thu, 2003-09-25 at 14:39, Oleg Lebedev wrote: +> Seems like in your case postgres uses an i_l_partkey index on lineitem +> table. I have a foreign key constraint defined between the lineitem and +> part table, but didn't create an special indexes. Here is my query plan: +> +> -> Aggregate (cost=1517604222.32..1517604222.32 rows=1 width=31) +> -> Hash Join (cost=8518.49..1517604217.39 rows=1969 width=31) +> Hash Cond: ("outer".l_partkey = "inner".p_partkey) +> Join Filter: ("outer".l_quantity < (subplan)) +> -> Seq Scan on lineitem (cost=0.00..241889.15 +> rows=6001215 widt +> h=27) +> -> Hash (cost=8518.00..8518.00 rows=197 width=4) +> -> Seq Scan on part (cost=0.00..8518.00 rows=197 +> width=4) +> +> Filter: ((p_brand = 'Brand#11'::bpchar) AND +> (p_contai +> ner = 'SM PKG'::bpchar)) +> SubPlan +> -> Aggregate (cost=256892.28..256892.28 rows=1 +> width=11) +> -> Seq Scan on lineitem (cost=0.00..256892.19 +> rows=37 w +> idth=11) +> Filter: (l_partkey = $0) +> +> -----Original Message----- +> From: Jenny Zhang [mailto:jenny@osdl.org] +> Sent: Thursday, September 25, 2003 3:33 PM +> To: Oleg Lebedev +> Cc: pgsql-performance@postgresql.org; +> osdldbt-general@lists.courceforge.net +> Subject: Re: [PERFORM] TPC-R benchmarks +> +> +> I am running TPC-H with scale factor of 1 on RedHat7.2 with the kernel +> 2.5.74. Q17 can always finish in about 7 seconds on my system. The +> execution plan is: +> ------------------------------------------------------------------------ +> ---------------------------- +> Aggregate (cost=780402.43..780402.43 rows=1 width=48) +> -> Nested Loop (cost=0.00..780397.50 rows=1973 width=48) +> Join Filter: ("inner".l_quantity < (subplan)) +> -> Seq Scan on part (cost=0.00..8548.00 rows=197 width=12) +> Filter: ((p_brand = 'Brand#31'::bpchar) AND (p_container +> = 'LG CASE'::bpchar)) +> -> Index Scan using i_l_partkey on lineitem +> (cost=0.00..124.32 rows=30 width=36) +> Index Cond: ("outer".p_partkey = lineitem.l_partkey) +> SubPlan +> -> Aggregate (cost=124.40..124.40 rows=1 width=11) +> -> Index Scan using i_l_partkey on lineitem +> (cost=0.00..124.32 rows=30 width=11) +> Index Cond: (l_partkey = $0) +> (11 rows) +> +> Hope this helps, +> Jenny +> On Thu, 2003-09-25 at 12:40, Oleg Lebedev wrote: +> > I am running TPC-R benchmarks with a scale factor of 1, which +> > correspond to approximately 1 GB database size on PostgreSQL 7.3.4 +> > installed on CygWin on Windows XP. I dedicated 128 MB of shared memory +> +> > to my postrges installation. Most of the queries were able to complete +> +> > in a matter of minutes, but query 17 was taking hours and hours. The +> > query is show below. Is there any way to optimize it ? +> > +> > select +> > sum(l_extendedprice) / 7.0 as avg_yearly +> > from +> > lineitem, +> > part +> > where +> > p_partkey = l_partkey +> > and p_brand = 'Brand#11' +> > and p_container = 'SM PKG' +> > and l_quantity < ( +> > select +> > 0.2 * avg(l_quantity) +> > from +> > lineitem +> > where +> > l_partkey = p_partkey +> > ); +> > +> > Thanks. +> > +> > Oleg +> > +> > ************************************* +> > +> > This e-mail may contain privileged or confidential material intended +> > for the named recipient only. If you are not the named recipient, +> > delete this message and all attachments. Unauthorized reviewing, +> > copying, printing, disclosing, or otherwise using information in this +> > e-mail is prohibited. We reserve the right to monitor e-mail sent +> > through our network. +> > +> > ************************************* +> +> ************************************* +> +> This e-mail may contain privileged or confidential material intended for the named recipient only. +> If you are not the named recipient, delete this message and all attachments. +> Unauthorized reviewing, copying, printing, disclosing, or otherwise using information in this e-mail is prohibited. +> We reserve the right to monitor e-mail sent through our network. +> +> ************************************* +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: you can get off all lists at once with the unregister command +> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) + + +From pgsql-performance-owner@postgresql.org Thu Sep 25 19:29:19 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 033C0D1B522 + for ; + Thu, 25 Sep 2003 22:29:18 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 73465-08 + for ; + Thu, 25 Sep 2003 19:28:48 -0300 (ADT) +Received: from smtp.dei.uc.pt (smtp.dei.uc.pt [193.137.203.228]) + by svr1.postgresql.org (Postfix) with ESMTP id 156B9D1B510 + for ; + Thu, 25 Sep 2003 19:28:44 -0300 (ADT) +Received: from student.dei.uc.pt (student.dei.uc.pt [10.1.0.1]) + by smtp.dei.uc.pt (8.11.7/8.11.7) with ESMTP id h8PMTdL12171 + for ; Thu, 25 Sep 2003 23:29:39 +0100 +Received: from Debug (mail.dei.uc.pt [193.137.203.250]) + by student.dei.uc.pt (8.12.8/8.12.8) with SMTP id h8PMSeXA009897 + for ; Thu, 25 Sep 2003 23:28:40 +0100 +Message-Id: <200309252228.h8PMSeXA009897@student.dei.uc.pt> +To: pgsql-performance@postgresql.org +From: rantunes@student.dei.uc.pt +Subject: Indices arent being used +Date: Thu, 25 Sep 2003 22:28:40 GMT +X-Mailer: Endymion MailMan Standard Edition v3.0.33 +X-UC-DEI-MailScanner-Information: Please contact helpdesk@dei.uc.pt for more + information +X-UC-DEI-MailScanner: Found to be clean +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/325 +X-Sequence-Number: 3691 + +Hi guys + +Im running a Datawarehouse benchmark (APB-1) on PostgreSql. The objective is to +choose which of the to main db (PostgreSQL, MySQL) is fastest. I've run into a +small problem which I hope could be resolved here. + +I'm trying to speed up this query: + +select count(*) from actvars, prodlevel where +actvars.product_level=prodlevel.code_level and +prodlevel.division_level='OY3S5LAPALL6'; + +ACTVARS is a fact table of aproximatly 16 million rows, PRODLEVEL has 20700 +rows. Both have btree indices. + +I executed the query and it took me almost half an hour to execute! Running the +same query on MySQL the result came 6 seconds after. As you can see there is a +large differences between execution times. + +After running an explain: + +Aggregate (cost=3123459.62..3123459.62 rows=1 width=32) + -> Merge Join (cost=3021564.79..3119827.17 rows=1452981 width=32) + Merge Cond: ("outer".product_level = "inner".code_level) + -> Sort (cost=3020875.00..3060938.81 rows=16025523 width=16) + Sort Key: actvars.product_level + -> Seq Scan on actvars (cost=0.00..365711.23 rows=16025523 +width=16) + -> Sort (cost=689.79..694.48 rows=1877 width=16) + Sort Key: prodlevel.code_level + -> Seq Scan on prodlevel (cost=0.00..587.75 rows=1877 width=16) + Filter: (division_level = 'OY3S5LAPALL6'::bpchar) + +I found that the indices werent being used. + +The database has been vacuumed and analyze has been executed. + +I tried disabling the seqscan, so as to force index usage. The planner uses +index scans but the query stil takes a very long time to execute. + +Any suggestions on resolving this would would be appreciated. + +P.S: Im running PostgrSQL +7.3.2 + +--------------------------------------------- +This message was sent using Endymion MailMan. +http://www.endymion.com/products/mailman/ + + + +From pgsql-performance-owner@postgresql.org Thu Sep 25 20:47:04 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id EA4F1D1B523 + for ; + Thu, 25 Sep 2003 23:47:01 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 80856-08 + for ; + Thu, 25 Sep 2003 20:46:33 -0300 (ADT) +Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) + by svr1.postgresql.org (Postfix) with ESMTP id B7D71D1B503 + for ; + Thu, 25 Sep 2003 20:46:14 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by mailav.tor1.inquent.com (Postfix) with ESMTP + id C67A21024D; Thu, 25 Sep 2003 19:37:30 -0400 (EDT) +Received: from [192.168.1.199] (dyn-135-183.tor.dsl.tht.net [134.22.135.183]) + by mailav.tor1.inquent.com (Postfix) with ESMTP + id 8A08A10248; Thu, 25 Sep 2003 19:37:28 -0400 (EDT) +Subject: Re: Indices arent being used +From: Rod Taylor +To: rantunes@student.dei.uc.pt +Cc: Postgresql Performance +In-Reply-To: <200309252228.h8PMSeXA009897@student.dei.uc.pt> +References: <200309252228.h8PMSeXA009897@student.dei.uc.pt> +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="=-/BT6EIApzYafjfj1DtVE" +Message-Id: <1064533600.27395.6.camel@jester> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Thu, 25 Sep 2003 19:46:41 -0400 +X-Virus-Scanned: by AMaViS perl-11 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/326 +X-Sequence-Number: 3692 + +--=-/BT6EIApzYafjfj1DtVE +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +> Im running a Datawarehouse benchmark (APB-1) on PostgreSql. The objective= + is to +> choose which of the to main db (PostgreSQL, MySQL) is fastest. I've run i= +nto a +> small problem which I hope could be resolved here. +>=20 +> I'm trying to speed up this query: +>=20 +> select count(*) from actvars, prodlevel where +> actvars.product_level=3Dprodlevel.code_level and +> prodlevel.division_level=3D'OY3S5LAPALL6'; + +How about EXPLAIN ANALYZE output? + +> ACTVARS is a fact table of aproximatly 16 million rows, PRODLEVEL has 207= +00 +> rows. Both have btree indices.=20 + +> The database has been vacuumed and analyze has been executed. + +The usual postgresql.conf adjustments have also been made? + + +--=-/BT6EIApzYafjfj1DtVE +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: This is a digitally signed message part + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.3 (FreeBSD) + +iD8DBQA/c35g6DETLow6vwwRAqcqAJ9JWOJoRYJm8tR38ZD1OB7rSvc41wCdFYU9 +QElrSbM7COK6LtjzXgbMEZ8= +=xzvg +-----END PGP SIGNATURE----- + +--=-/BT6EIApzYafjfj1DtVE-- + + +From pgsql-performance-owner@postgresql.org Fri Sep 26 00:42:13 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id D0883D1B4F2 + for ; + Fri, 26 Sep 2003 03:42:03 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 09145-02 + for ; + Fri, 26 Sep 2003 00:41:33 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id 951E2D1B4F1 + for ; + Fri, 26 Sep 2003 00:41:32 -0300 (ADT) +Received: from [63.195.55.98] (HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3682368; Thu, 25 Sep 2003 20:42:04 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Organization: Aglio Database Solutions +To: Jenny Zhang , + Oleg Lebedev +Subject: Re: TPC-R benchmarks +Date: Thu, 25 Sep 2003 20:41:15 -0700 +User-Agent: KMail/1.4.3 +Cc: "pgsql-performance@postgresql.org" +References: <993DBE5B4D02194382EC8DF8554A52731D75DC@postoffice.waterford.org> + <1064528699.2082.61.camel@ibm-a.pdx.osdl.net> +In-Reply-To: <1064528699.2082.61.camel@ibm-a.pdx.osdl.net> +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-Id: <200309252041.15743.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/327 +X-Sequence-Number: 3693 + +Jenny, + +> create index i_l_partkey on lineitem (l_partkey); +> I do not have any foreign key defined. Does the spec require foreign +> keys? +> +> When you create a foreign key reference, does PG create an index +> automatically? + +No. A index is not required to enforce a foriegn key, and is sometimes not +useful (for example, FK fields with only 3 possible values). + +So it may be that you need to create an index on that field. + + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Fri Sep 26 01:29:29 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 4141CD1B4FC + for ; + Fri, 26 Sep 2003 04:29:28 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 16722-03 + for ; + Fri, 26 Sep 2003 01:28:57 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 2C1DBD1B519 + for ; + Fri, 26 Sep 2003 01:28:56 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h8Q4Ss6c008487; + Fri, 26 Sep 2003 00:28:54 -0400 (EDT) +To: Oleg Lebedev +Cc: Jenny Zhang , + "pgsql-performance@postgresql.org" +Subject: Re: TPC-R benchmarks +In-reply-to: <993DBE5B4D02194382EC8DF8554A52731D75DC@postoffice.waterford.org> +References: <993DBE5B4D02194382EC8DF8554A52731D75DC@postoffice.waterford.org> +Comments: In-reply-to Oleg Lebedev + message dated "Thu, 25 Sep 2003 15:39:51 -0600" +Date: Fri, 26 Sep 2003 00:28:54 -0400 +Message-ID: <8486.1064550534@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/328 +X-Sequence-Number: 3694 + +Oleg Lebedev writes: +> Seems like in your case postgres uses an i_l_partkey index on lineitem +> table. I have a foreign key constraint defined between the lineitem and +> part table, but didn't create an special indexes. Here is my query plan: + +The planner is obviously unhappy with this plan (note the large cost +numbers), but it can't find a way to do better. An index on +lineitem.l_partkey would help, I think. + +The whole query seems like it's written in a very inefficient fashion; +couldn't the estimation of '0.2 * avg(l_quantity)' be amortized across +multiple join rows? But I dunno whether the TPC rules allow for +significant manual rewriting of the given query. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Sep 26 04:23:22 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 2D5B0D1B502 + for ; + Fri, 26 Sep 2003 07:23:20 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 47417-08 + for ; + Fri, 26 Sep 2003 04:23:09 -0300 (ADT) +Received: from smtp.pspl.co.in (unknown [202.54.11.65]) + by svr1.postgresql.org (Postfix) with ESMTP id 456E7D1B50A + for ; + Fri, 26 Sep 2003 04:23:07 -0300 (ADT) +Received: (from root@localhost) + by smtp.pspl.co.in (8.12.9/8.12.9) id h8Q7OQ1O024641 + for ; Fri, 26 Sep 2003 12:54:26 +0530 +Received: from persistent.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) + (authenticated bits=0) + by persistent.co.in (8.12.9/8.12.9) with ESMTP id h8Q7OOas024615; + Fri, 26 Sep 2003 12:54:25 +0530 +Message-ID: <3F73E9DB.80104@persistent.co.in> +Date: Fri, 26 Sep 2003 12:55:15 +0530 +From: Shridhar Daithankar +Organization: Persistent Systems Pvt. Ltd. +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; + rv:1.5b) Gecko/20030917 Thunderbird/0.3a +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: rantunes@student.dei.uc.pt +Cc: pgsql-performance@postgresql.org +Subject: Re: Indices arent being used +References: <200309252228.h8PMSeXA009897@student.dei.uc.pt> +In-Reply-To: <200309252228.h8PMSeXA009897@student.dei.uc.pt> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/329 +X-Sequence-Number: 3695 + +rantunes@student.dei.uc.pt wrote: +> Hi guys +> +> Im running a Datawarehouse benchmark (APB-1) on PostgreSql. The objective is to +> choose which of the to main db (PostgreSQL, MySQL) is fastest. I've run into a +> small problem which I hope could be resolved here. +> +> I'm trying to speed up this query: +> +> select count(*) from actvars, prodlevel where +> actvars.product_level=prodlevel.code_level and +> prodlevel.division_level='OY3S5LAPALL6'; +> +> ACTVARS is a fact table of aproximatly 16 million rows, PRODLEVEL has 20700 +> rows. Both have btree indices. +> +> I executed the query and it took me almost half an hour to execute! Running the +> same query on MySQL the result came 6 seconds after. As you can see there is a +> large differences between execution times. +> +> After running an explain: +> +> Aggregate (cost=3123459.62..3123459.62 rows=1 width=32) +> -> Merge Join (cost=3021564.79..3119827.17 rows=1452981 width=32) +> Merge Cond: ("outer".product_level = "inner".code_level) +> -> Sort (cost=3020875.00..3060938.81 rows=16025523 width=16) +> Sort Key: actvars.product_level +> -> Seq Scan on actvars (cost=0.00..365711.23 rows=16025523 +> width=16) + +Damn.. Seq. scan for actvars? I would say half an hour is a good throughput. + +Are there any indexes on both actvars.product_level and prodlevel.code_level? +Are they exactly compatible type? int2 and int4 are not compatible in postgresql +lingo. + +That plan should go for index scan. Can you show us the table definitions? + +And yes, what tuning you did to postgresql? + + Shridhar + + +From pgsql-performance-owner@postgresql.org Fri Sep 26 07:58:30 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 12A22D1B510 + for ; + Fri, 26 Sep 2003 10:58:25 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 76988-09 + for ; + Fri, 26 Sep 2003 07:57:55 -0300 (ADT) +Received: from smtp2.dei.uc.pt (smtp2.dei.uc.pt [193.137.203.229]) + by svr1.postgresql.org (Postfix) with ESMTP id 752FAD1B52B + for ; + Fri, 26 Sep 2003 07:57:45 -0300 (ADT) +Received: from student.dei.uc.pt (student.dei.uc.pt [10.1.0.1]) + by smtp2.dei.uc.pt (8.11.7/8.11.7) with ESMTP id h8QAwDP16343 + for ; Fri, 26 Sep 2003 11:58:13 +0100 +Received: from Debug (mail.dei.uc.pt [193.137.203.250]) + by student.dei.uc.pt (8.12.8/8.12.8) with SMTP id h8QAvSXA009541 + for ; Fri, 26 Sep 2003 11:57:28 +0100 +Message-Id: <200309261057.h8QAvSXA009541@student.dei.uc.pt> +To: pgsql-performance@postgresql.org +From: rantunes@student.dei.uc.pt +Subject: Re: Indices arent being used +Date: Fri, 26 Sep 2003 10:57:28 GMT +X-Mailer: Endymion MailMan Standard Edition v3.0.33 +X-UC-DEI-MailScanner-Information: Please contact helpdesk@dei.uc.pt for more + information +X-UC-DEI-MailScanner: Found to be clean +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/330 +X-Sequence-Number: 3696 + +>Damn.. Seq. scan for actvars? I would say half an hour is a good throughput. +> +>Are there any indexes on both actvars.product_level and prodlevel.code_level? +Are >they exactly compatible type? int2 and int4 are not compatible in +postgresql >lingo. +> +>That plan should go for index scan. Can you show us the table definitions? +> +>And yes, what tuning you did to postgresql? +> +>Shridhar +The alterations done upon postgresql.conf with 512 RAM were these: + +max_connections = 3 +shared_buffers = 6000 +wal_buffers = 32 +sort_mem = 2048 +fsync = false +effective_cache_size = 44800 +random_page_cost = 3 +default_statistics_target = 50 + +Yes I have an index on actvars.product_level and an index on +prodlevel.code_level.Both indices have character(12) data types. + + + +--------------------------------------------- +This message was sent using Endymion MailMan. +http://www.endymion.com/products/mailman/ + + + +From pgsql-general-owner@postgresql.org Fri Sep 26 08:58:37 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 1A221D1B512 + for ; + Fri, 26 Sep 2003 11:58:34 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 89389-09 + for ; + Fri, 26 Sep 2003 08:58:26 -0300 (ADT) +Received: from web1.nexusinternetsolutions.net + (web1.nexusinternetsolutions.net [206.47.131.12]) + by svr1.postgresql.org (Postfix) with SMTP id 8728FD1B50C + for ; + Fri, 26 Sep 2003 08:58:19 -0300 (ADT) +Received: (qmail 96168 invoked from network); 26 Sep 2003 11:58:17 -0000 +Received: from unknown (HELO ws1) (65.49.236.97) + by web1.nexusinternetsolutions.net with SMTP; 26 Sep 2003 11:58:17 -0000 +From: "Dave [Hawk-Systems]" +To: +Subject: Re: populate table with large csv file +Date: Fri, 26 Sep 2003 07:58:16 -0400 +Message-ID: +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 IMO, Build 9.0.6604 (9.0.2911.0) +Importance: Normal +In-Reply-To: <3F731CF0.2090800@sonalysts.com> +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=1.9 tagged_above=0.0 required=5.0 tests=BAYES_30, + FORGED_MUA_OIMO, IN_REP_TO, MSGID_GOOD_EXCHANGE, QUOTED_EMAIL_TEXT, + RCVD_IN_OSIRUSOFT_COM +X-Spam-Level: * +X-Archive-Number: 200309/1668 +X-Sequence-Number: 49887 + +>> aside from parsing the csv file through a PHP interface, what isthe +>easiest way +>> to get that csv data importted into the postgres database. thoughts? +> +>Assuming the CSV file data is well formed, use psql and +>the COPY command. +> +>In psql, create the table. Then issue command: +> +>copy from 'filename' using delimiters ','; + +perfect solution that was overlooked. + +Unfortunately processing the 143mb file which would result in a database size of +approx 500mb takes an eternity. As luck would have it we can get away with just +dropping to an exec and doing a cat/grep for any data we need... takes 2-3 +seconds. + +the copy command is definately a keeper as I am not looking at replacing code +elsewhere with a simpler model using that. + +Thanks + +Dave + + + +From pgsql-general-owner@postgresql.org Fri Sep 26 11:20:37 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 98DF1D1B513 + for ; + Fri, 26 Sep 2003 14:20:34 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 22316-04 + for ; + Fri, 26 Sep 2003 11:20:06 -0300 (ADT) +Received: from lakemtao02.cox.net (lakemtao02.cox.net [68.1.17.243]) + by svr1.postgresql.org (Postfix) with ESMTP id 31B03D1B509 + for ; + Fri, 26 Sep 2003 11:20:02 -0300 (ADT) +Received: from lhosts ([68.11.66.83]) by lakemtao01.cox.net + (InterMail vM.5.01.06.05 201-253-122-130-105-20030824) with ESMTP + id <20030926123736.VWNM29208.lakemtao01.cox.net@lhosts> + for ; Fri, 26 Sep 2003 08:37:36 -0400 +Subject: Re: populate table with large csv file +From: Ron Johnson +To: PgSQL General ML +In-Reply-To: +References: +Content-Type: text/plain +Message-Id: <1064579855.26936.57.camel@haggis> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Fri, 26 Sep 2003 07:37:35 -0500 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/1671 +X-Sequence-Number: 49890 + +On Fri, 2003-09-26 at 06:58, Dave [Hawk-Systems] wrote: +[snip] +> Unfortunately processing the 143mb file which would result in a database size of +> approx 500mb takes an eternity. As luck would have it we can get away with just + +Something's not right, then. I loaded 30GB in about 8 hours, on +a slow system, with non-optimized IO. Did you drop the indexes +first? + +-- +----------------------------------------------------------------- +Ron Johnson, Jr. ron.l.johnson@cox.net +Jefferson, LA USA + +"As the night fall does not come at once, neither does +oppression. It is in such twilight that we must all be aware of +change in the air - however slight - lest we become unwitting +victims of the darkness." +Justice William O. Douglas + + +From pgsql-performance-owner@postgresql.org Fri Sep 26 11:35:47 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E9603D1B4E1 + for ; + Fri, 26 Sep 2003 14:35:43 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 27455-05 + for ; + Fri, 26 Sep 2003 11:35:36 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 8DC0DD1B4FF + for ; + Fri, 26 Sep 2003 11:35:32 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h8QEZa6c015415; + Fri, 26 Sep 2003 10:35:36 -0400 (EDT) +To: rantunes@student.dei.uc.pt +Cc: pgsql-performance@postgresql.org +Subject: Re: Indices arent being used +In-reply-to: <200309261057.h8QAvSXA009541@student.dei.uc.pt> +References: <200309261057.h8QAvSXA009541@student.dei.uc.pt> +Comments: In-reply-to rantunes@student.dei.uc.pt + message dated "Fri, 26 Sep 2003 10:57:28 +0000" +Date: Fri, 26 Sep 2003 10:35:36 -0400 +Message-ID: <15414.1064586936@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/331 +X-Sequence-Number: 3697 + +rantunes@student.dei.uc.pt writes: +> sort_mem = 2048 + +2 meg sort_mem seems on the small side. + +> Yes I have an index on actvars.product_level and an index on +> prodlevel.code_level.Both indices have character(12) data types. + +Can you force an indexscan to be chosen by setting enable_seqscan off? +If so, what does the explain look like? + +BTW, it's always much more useful to show EXPLAIN ANALYZE output than +plain EXPLAIN. The issue is generally "why did the planner misestimate" +and so knowing how its estimates diverge from reality is always a +critical bit of information. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Sep 26 13:12:14 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B5E0AD1B533 + for ; + Fri, 26 Sep 2003 16:12:08 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 61418-02 + for ; + Fri, 26 Sep 2003 13:11:58 -0300 (ADT) +Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) + by svr1.postgresql.org (Postfix) with ESMTP id C1F4DD1B4F5 + for ; + Fri, 26 Sep 2003 13:11:51 -0300 (ADT) +Received: from ibm-e.pdx.osdl.net (ibm-e.pdx.osdl.net [172.20.1.71]) + by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h8QGBb128363; + Fri, 26 Sep 2003 09:11:37 -0700 +Subject: Re: TPC-R benchmarks +From: Mary Edie Meredith +To: Tom Lane +Cc: Oleg Lebedev , Jenny Zhang , + pgsql-performance +In-Reply-To: <8486.1064550534@sss.pgh.pa.us> +References: <993DBE5B4D02194382EC8DF8554A52731D75DC@postoffice.waterford.org> + <8486.1064550534@sss.pgh.pa.us> +Content-Type: text/plain +Organization: Open Source Development Lab +Message-Id: <1064592697.23330.265.camel@ibm-e.pdx.osdl.net> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.2.2 +Date: 26 Sep 2003 09:11:37 -0700 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/332 +X-Sequence-Number: 3698 + +The TPC-H/R rules allow only minor changes to the SQL that are necessary +due to SQL implementation differences. They do not allow changes made to +improve performance. It is their way to test optimizer's ability to +recognize an inefficient SQL statement and do the rewrite. + +The rule makes sense for the TPC-H, which is supposed to represent +ad-Hoc query. One might argue that for TPC-R, which is suppose to +represent "Reporting" with pre-knowledge of the query, that re-write +should be allowed. However, that is currently not the case. Since the +RDBMS's represented on the TPC council are competing with TPC-H, their +optimizers already do the re-write, so (IMHO) there is no motivation to +relax the rules for the TPC-R. + + +On Thu, 2003-09-25 at 21:28, Tom Lane wrote: +> Oleg Lebedev writes: +> > Seems like in your case postgres uses an i_l_partkey index on lineitem +> > table. I have a foreign key constraint defined between the lineitem and +> > part table, but didn't create an special indexes. Here is my query plan: +> +> The planner is obviously unhappy with this plan (note the large cost +> numbers), but it can't find a way to do better. An index on +> lineitem.l_partkey would help, I think. +> +> The whole query seems like it's written in a very inefficient fashion; +> couldn't the estimation of '0.2 * avg(l_quantity)' be amortized across +> multiple join rows? But I dunno whether the TPC rules allow for +> significant manual rewriting of the given query. +> +> regards, tom lane +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 3: 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 +-- +Mary Edie Meredith +Open Source Development Lab + + +From pgsql-admin-owner@postgresql.org Fri Sep 26 13:47:41 2003 +X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP + id 8E44AD1B51D; Fri, 26 Sep 2003 16:47:40 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) + with ESMTP id 72662-01; Fri, 26 Sep 2003 13:47:30 -0300 (ADT) +Received: from host2.hostseguro.com (133-188-198-200.hostseguro.com + [200.198.188.133]) by svr1.postgresql.org (Postfix) with ESMTP + id B46A5D1B4E3; Fri, 26 Sep 2003 13:47:29 -0300 (ADT) +Received: from cpanel by host2.hostseguro.com with local (Exim 4.20) + id 1A2vl9-0004v4-In; Fri, 26 Sep 2003 13:47:59 -0300 +Received: from 200.180.188.221 ([200.180.188.221]) + by sistemica.info (IMP) with HTTP + for ; Fri, 26 Sep 2003 13:47:59 -0300 +Message-ID: <1064594879.3f746dbf81696@sistemica.info> +Date: Fri, 26 Sep 2003 13:47:59 -0300 +From: Rhaoni Chiu Pereira +To: PostgreSQL ADMIN , + PostgreSQL Performance +Subject: Plan-Reading +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.2.1 +X-Originating-IP: 200.180.188.221 +X-MailScanner-Information: Verificado pelo McAfee VirusScan / Scanned by + McAfee VirusScan +X-MailScanner: Nao infectado / Found to be clean +X-AntiAbuse: This header was added to track abuse, + please include it with any abuse report +X-AntiAbuse: Primary Hostname - host2.hostseguro.com +X-AntiAbuse: Original Domain - postgresql.org +X-AntiAbuse: Originator/Caller UID/GID - [32001 32001] / [47 12] +X-AntiAbuse: Sender Address Domain - sistemica.info +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/440 +X-Sequence-Number: 10528 + + + +Hi List; + + Where can I find a plan-readinf tutorial ? + +Atenciosamente, + +Rhaoni Chiu Pereira +Sist�mica Computadores + +Visite-nos na Web: http://sistemica.info +Fone/Fax : +55 51 3328 1122 + + + + + + +From pgsql-admin-owner@postgresql.org Sun Sep 28 18:30:01 2003 +X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP + id 5325FD1B4FC; Fri, 26 Sep 2003 17:35:06 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) + with ESMTP id 82523-01; Fri, 26 Sep 2003 14:34:56 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP + id 498A0D1B4F5; Fri, 26 Sep 2003 14:34:55 -0300 (ADT) +Received: from [63.195.55.98] (HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3684082; Fri, 26 Sep 2003 10:35:00 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Organization: Aglio Database Solutions +To: Rhaoni Chiu Pereira , + PostgreSQL ADMIN , + PostgreSQL Performance +Subject: Re: [PERFORM] Plan-Reading +Date: Fri, 26 Sep 2003 10:34:07 -0700 +User-Agent: KMail/1.4.3 +References: <1064594879.3f746dbf81696@sistemica.info> +In-Reply-To: <1064594879.3f746dbf81696@sistemica.info> +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-Id: <200309261034.07732.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/458 +X-Sequence-Number: 10546 + +Rhaoni, + +> Where can I find a plan-readinf tutorial ? + +It's a little out of date, but is very well written and gives you the basics: +http://www.argudo.org/postgresql/soft-tuning.html + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-docs-owner@postgresql.org Fri Sep 26 14:47:36 2003 +X-Original-To: pgsql-docs-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id D07DCD1B535 + for ; + Fri, 26 Sep 2003 17:47:34 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 80731-08 + for ; + Fri, 26 Sep 2003 14:47:25 -0300 (ADT) +Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) + by svr1.postgresql.org (Postfix) with ESMTP id E3D74D1B4F9 + for ; Fri, 26 Sep 2003 14:47:22 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id h8QHlMT13666; + Fri, 26 Sep 2003 13:47:22 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200309261747.h8QHlMT13666@candle.pha.pa.us> +Subject: Re: [PERFORM] PostgreSQL vs. MySQL +In-Reply-To: <20030817110619.A28221@mail.libertyrms.com> +To: Andrew Sullivan +Date: Fri, 26 Sep 2003 13:47:22 -0400 (EDT) +Cc: PostgreSQL-documentation +X-Mailer: ELM [version 2.4ME+ PL106 (25)] +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary=ELM1064598442-17213-1_ +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/63 +X-Sequence-Number: 2019 + +--ELM1064598442-17213-1_ +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII + +Andrew Sullivan wrote: +> On Sat, Aug 16, 2003 at 08:36:57PM -0400, Bruce Momjian wrote: +> > +> > Do we need to add a mention of the need for tuning to the install docs? +> +> Wouldn't be a bad idea, as far as I'm concerned. + +OK, I added a 'Tuning' section to the install instructions. I can make +adjustments. + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +--ELM1064598442-17213-1_ +Content-Transfer-Encoding: 7bit +Content-Type: text/plain +Content-Disposition: inline; filename="/bjm/diff" + +Index: doc/src/sgml/installation.sgml +=================================================================== +RCS file: /cvsroot/pgsql-server/doc/src/sgml/installation.sgml,v +retrieving revision 1.143 +diff -c -c -r1.143 installation.sgml +*** doc/src/sgml/installation.sgml 13 Sep 2003 17:01:09 -0000 1.143 +--- doc/src/sgml/installation.sgml 26 Sep 2003 17:40:53 -0000 +*************** +*** 1156,1161 **** +--- 1156,1181 ---- + Post-Installation Setup + + ++ Tuning ++ ++ ++ tuning ++ ++ ++ ++ By default, PostgreSQL is configured to run on minimal ++ hardware. This allows it to start up with almost any hardware ++ configuration. However, the default configuration is not designed for ++ optimum performance. To achieve optimum performance, several server ++ variables must be adjusted, the two most common being ++ shared_buffers and sort_mem ++ mentioned in . Other ++ paramters in also affect ++ performance. ++ ++ ++ ++ + Shared Libraries + + + +--ELM1064598442-17213-1_-- + +From pgsql-performance-owner@postgresql.org Sat Sep 27 11:49:36 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 28F59D1B51A + for ; + Sat, 27 Sep 2003 14:49:34 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 35996-04 + for ; + Sat, 27 Sep 2003 11:49:07 -0300 (ADT) +Received: from smtp2.dei.uc.pt (smtp2.dei.uc.pt [193.137.203.229]) + by svr1.postgresql.org (Postfix) with ESMTP id 06B64D1B503 + for ; + Sat, 27 Sep 2003 11:49:02 -0300 (ADT) +Received: from student.dei.uc.pt (student.dei.uc.pt [10.1.0.1]) + by smtp2.dei.uc.pt (8.11.7/8.11.7) with ESMTP id h8REntP17981 + for ; Sat, 27 Sep 2003 15:49:55 +0100 +Received: from Debug (mail.dei.uc.pt [193.137.203.250]) + by student.dei.uc.pt (8.12.8/8.12.8) with SMTP id h8REmwXA008210 + for ; Sat, 27 Sep 2003 15:48:58 +0100 +Message-Id: <200309271448.h8REmwXA008210@student.dei.uc.pt> +To: pgsql-performance@postgresql.org +From: rantunes@student.dei.uc.pt +Subject: Re: Indices arent being used +Date: Sat, 27 Sep 2003 14:48:58 GMT +X-Mailer: Endymion MailMan Standard Edition v3.0.33 +X-UC-DEI-MailScanner-Information: Please contact helpdesk@dei.uc.pt for more + information +X-UC-DEI-MailScanner: Found to be clean +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/335 +X-Sequence-Number: 3701 + +Here is the explain analyze of the query: + +explain analyze select count(*) from actvars, prodlevel where +actvars.product_level=prodlevel.code_level and +prodlevel.division_level='OY3S5LAPALL6'; + + Aggregate (cost=3123459.62..3123459.62 rows=1 width=32) (actual +time=1547173.60..1547173.60 rows=1 loops=1) + -> Merge Join (cost=3021564.79..3119827.17 rows=1452981 width=32) (actual +time=1400269.29..1545793.13 rows=1918466 loops=1) + Merge Cond: ("outer".product_level = "inner".code_level) + -> Sort (cost=3020875.00..3060938.81 rows=16025523 width=16) (actual +time=1400117.06..1518059.84 rows=16020985 loops=1) + Sort Key: actvars.product_level + -> Seq Scan on actvars (cost=0.00..365711.23 rows=16025523 +width=16) (actual time=29.14..51259.82 rows=16025523 loops=1) + -> Sort (cost=689.79..694.48 rows=1877 width=16) (actual +time=92.90..1217.15 rows=1917991 loops=1) + Sort Key: prodlevel.code_level + -> Seq Scan on prodlevel (cost=0.00..587.75 rows=1877 width=16) +(actual time=16.48..82.72 rows=1802 loops=1) + Filter: (division_level = 'OY3S5LAPALL6'::bpchar) + Total runtime: 1547359.08 msec + +I have tried diabeling the seqscan: + +set enable_seqscan=false; + +explain select count(*) from actvars, prodlevel where +actvars.product_level=prodlevel.code_level and +prodlevel.division_level='OY3S5LAPALL6'; + +Aggregate (cost=6587448.25..6587448.25 rows=1 width=32) + -> Nested Loop (cost=0.00..6583815.80 rows=1452981 width=32) + -> Index Scan using division_level_prodlevel_index on prodlevel +(cost=0.00..999.13 rows=1877 width=16) + Index Cond: (division_level = 'OY3S5LAPALL6'::bpchar) + -> Index Scan using product_level_actvars_index on actvars +(cost=0.00..3492.95 rows=1161 width=16) + Index Cond: (actvars.product_level = "outer".code_level) + +This method forces the indices to work but it looks like it takes a long to +finish executing, I had to cancel the query after 10 min. Using vmstat i found +that there were alot of swap outs and swap ins, affecting the overall performance. + +How can i speed this +up? + +--------------------------------------------- +This message was sent using Endymion MailMan. +http://www.endymion.com/products/mailman/ + + + +From pgsql-performance-owner@postgresql.org Sat Sep 27 14:14:20 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 24F06D1B503 + for ; + Sat, 27 Sep 2003 17:14:19 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 56519-07 + for ; + Sat, 27 Sep 2003 14:14:09 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 3EAB3D1B502 + for ; + Sat, 27 Sep 2003 14:14:02 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h8RHE26c006355; + Sat, 27 Sep 2003 13:14:02 -0400 (EDT) +To: rantunes@student.dei.uc.pt +Cc: pgsql-performance@postgresql.org +Subject: Re: Indices arent being used +In-reply-to: <200309271448.h8REmwXA008210@student.dei.uc.pt> +References: <200309271448.h8REmwXA008210@student.dei.uc.pt> +Comments: In-reply-to rantunes@student.dei.uc.pt + message dated "Sat, 27 Sep 2003 14:48:58 +0000" +Date: Sat, 27 Sep 2003 13:14:02 -0400 +Message-ID: <6354.1064682842@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/336 +X-Sequence-Number: 3702 + +rantunes@student.dei.uc.pt writes: +> Here is the explain analyze of the query: +> explain analyze select count(*) from actvars, prodlevel where +> actvars.product_level=prodlevel.code_level and +> prodlevel.division_level='OY3S5LAPALL6'; + +> [ slow merge join ] + +I wonder whether a hash join wouldn't work better. Can you force a hash +join? (Try "enable_mergejoin = 0" and if needed "enable_nestloop = 0"; +don't disable seqscans though.) If you can get such a plan, please post +the explain analyze results for it. + +> This method forces the indices to work but it looks like it takes a long to +> finish executing, I had to cancel the query after 10 min. + +"Force use of the indexes" is not always an answer to performance issues. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sat Sep 27 14:25:13 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id AF695D1B524 + for ; + Sat, 27 Sep 2003 17:25:11 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 65149-02 + for ; + Sat, 27 Sep 2003 14:25:02 -0300 (ADT) +Received: from cmailm2.svr.pol.co.uk (cmailm2.svr.pol.co.uk [195.92.193.210]) + by svr1.postgresql.org (Postfix) with ESMTP id C2384D1B513 + for ; + Sat, 27 Sep 2003 14:24:59 -0300 (ADT) +Received: from user-2040.bbd23tcl.dsl.pol.co.uk ([81.77.247.248] helo=rj) + by cmailm2.svr.pol.co.uk with esmtp (Exim 4.14) id 1A3IoV-0002II-8N + for pgsql-performance@postgresql.org; Sat, 27 Sep 2003 18:24:59 +0100 +From: Richard Jones +Reply-To: rj@last.fm +Organization: Last.FM +To: pgsql-performance@postgresql.org +Subject: advice on raid controller +Date: Sat, 27 Sep 2003 18:24:33 +0100 +User-Agent: KMail/1.5.1 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200309271824.33351.rj@last.fm> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/337 +X-Sequence-Number: 3703 + +Hi, i'm on the verge of buying a "MegaRAID SCSI 320-2" raid controller. +I need it to build a db server using 4x ultra320 scsi disks +i'm thinking raid 1+0 but will try with raid5 too and compare + +Does anyone have any experience with this model, good or bad i'd like to +know.. thanks :) + +as seen: +http://uk.azzurri.com/product/product.cgi?productId=188 + +Regards, +Richard. + +PS: whoever mentioned starting a site with raid controller reviews, excellent +idea - its hard to find decent info on which card to buy. + + +From pgsql-performance-owner@postgresql.org Sat Sep 27 16:32:08 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 6828ED1B4E3 + for ; + Sat, 27 Sep 2003 19:32:07 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 86537-02 + for ; + Sat, 27 Sep 2003 16:31:37 -0300 (ADT) +Received: from lifeintegrity.com (h0000863d9f69.ne.client2.attbi.com + [66.30.210.76]) + by svr1.postgresql.org (Postfix) with ESMTP id 64B1FD1B4E8 + for ; + Sat, 27 Sep 2003 16:31:35 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by lifeintegrity.com (Postfix) with ESMTP + id 4282860057; Sat, 27 Sep 2003 15:31:31 -0400 (EDT) +Received: from lifeintegrity.com ([127.0.0.1]) + by localhost (pawan.lifeintegrity.com [127.0.0.1]) (amavisd-new, + port 10024) + with LMTP id 15408-03-7; Sat, 27 Sep 2003 15:31:30 -0400 (EDT) +Received: by lifeintegrity.com (Postfix, from userid 1000) + id 772B260041; Sat, 27 Sep 2003 15:31:30 -0400 (EDT) +Date: Sat, 27 Sep 2003 15:31:30 -0400 +To: Richard Jones +Cc: pgsql-performance@postgresql.org +Subject: Re: advice on raid controller +Message-ID: <20030927193130.GA13968@lifeintegrity.com> +Mail-Followup-To: Richard Jones , pgsql-performance@postgresql.org +References: <200309271824.33351.rj@last.fm> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable +In-Reply-To: <200309271824.33351.rj@last.fm> +User-Agent: Mutt/1.5.4i +From: allanwind@lifeintegrity.com (Allan Wind) +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/338 +X-Sequence-Number: 3704 + +On 2003-09-27T18:24:33+0100, Richard Jones wrote: +> i'm on the verge of buying a "MegaRAID SCSI 320-2" raid controller. + +You may want to check out the PCI-X version of this controller that +LSILogic just released (MegaRAID SCSI 320-2X). PCI-X is backwards +compatible with PCI, but also gives you greater bandwidth if your +motherboard supports it (at least, that's the marketing fluff). + +Adaptec and Intel makes (PCI) controllers with similar specs to the one +you mentioned. + +> I need it to build a db server using 4x ultra320 scsi disks +> i'm thinking raid 1+0 but will try with raid5 too and compare + +The Fujitsu 15k drives look sweet :-) + +> PS: whoever mentioned starting a site with raid controller reviews, excel= +lent=20 +> idea - its hard to find decent info on which card to buy. + +You may want to check recent archives for RAID threads. + + +/Allan +--=20 +Allan Wind +P.O. Box 2022 +Woburn, MA 01888-0022 +USA + +From pgsql-performance-owner@postgresql.org Sat Sep 27 16:54:07 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C9CE6D1B4FD + for ; + Sat, 27 Sep 2003 19:54:04 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 86889-05 + for ; + Sat, 27 Sep 2003 16:53:34 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id DD5F7D1B4E3 + for ; + Sat, 27 Sep 2003 16:53:32 -0300 (ADT) +Received: from [63.195.55.98] (HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3689644; Sat, 27 Sep 2003 12:54:05 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Organization: Aglio Database Solutions +To: rj@last.fm, pgsql-performance@postgresql.org +Subject: Re: advice on raid controller +Date: Sat, 27 Sep 2003 12:53:04 -0700 +User-Agent: KMail/1.4.3 +References: <200309271824.33351.rj@last.fm> +In-Reply-To: <200309271824.33351.rj@last.fm> +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-Id: <200309271253.04940.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/340 +X-Sequence-Number: 3706 + +RIchard, + +> Hi, i'm on the verge of buying a "MegaRAID SCSI 320-2" raid controller. +> I need it to build a db server using 4x ultra320 scsi disks +> i'm thinking raid 1+0 but will try with raid5 too and compare + +Depends on your type of database. If you're doing web or OLAP (lots of +read-only queries) RAID 5 will probably be better. If you're doing OLTP +(lots of read-write) RAID 10 will almost certainly be better. But if you +have time, testing is always best. + +> as seen: +> http://uk.azzurri.com/product/product.cgi?productId=188 + +I haven'te used it personally, but what I don't see in the docs is a +battery-backed cache. Without battery backup on the write cache, IMHO you +are better off with Linux of BSD software RAID, since you'll have to turn off +the card's write cache, lest your database get corrupted on power-out. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Sat Sep 27 16:54:03 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 4C6C0D1B4F1 + for ; + Sat, 27 Sep 2003 19:54:02 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 88550-01 + for ; + Sat, 27 Sep 2003 16:53:53 -0300 (ADT) +Received: from lakemtao04.cox.net (lakemtao04.cox.net [68.1.17.241]) + by svr1.postgresql.org (Postfix) with ESMTP id 5EEBED1B4F5 + for ; + Sat, 27 Sep 2003 16:53:51 -0300 (ADT) +Received: from lhosts ([68.11.66.83]) by lakemtao04.cox.net + (InterMail vM.5.01.06.05 201-253-122-130-105-20030824) with ESMTP + id <20030927195352.EKGP29227.lakemtao04.cox.net@lhosts> + for ; + Sat, 27 Sep 2003 15:53:52 -0400 +Subject: Re: advice on raid controller +From: Ron Johnson +To: PgSQL Performance ML +In-Reply-To: <200309271824.33351.rj@last.fm> +References: <200309271824.33351.rj@last.fm> +Content-Type: text/plain +Message-Id: <1064692431.24519.59.camel@haggis> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Sat, 27 Sep 2003 14:53:51 -0500 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/339 +X-Sequence-Number: 3705 + +On Sat, 2003-09-27 at 12:24, Richard Jones wrote: +> Hi, i'm on the verge of buying a "MegaRAID SCSI 320-2" raid controller. +> I need it to build a db server using 4x ultra320 scsi disks +> i'm thinking raid 1+0 but will try with raid5 too and compare +> +> Does anyone have any experience with this model, good or bad i'd like to +> know.. thanks :) +> +> as seen: +> http://uk.azzurri.com/product/product.cgi?productId=188 + +I don't see anything on that page regarding RAM cache. It's been +my experience that RAID 5 needs a *minimum* of 128MB cache to have +good performance. + +-- +----------------------------------------------------------------- +Ron Johnson, Jr. ron.l.johnson@cox.net +Jefferson, LA USA + +Why is cyber-crime not being effectively controlled? What is +fuelling the rampancy? +* Parental apathy & the public education system +http://www.linuxsecurity.com/feature_stories/feature_story-150.html + + +From pgsql-performance-owner@postgresql.org Sat Sep 27 20:54:43 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 2B277D1B511 + for ; + Sat, 27 Sep 2003 23:54:42 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 26826-01 + for ; + Sat, 27 Sep 2003 20:54:14 -0300 (ADT) +Received: from web40405.mail.yahoo.com (web40405.mail.yahoo.com + [66.218.78.102]) + by svr1.postgresql.org (Postfix) with SMTP id 49449D1B509 + for ; + Sat, 27 Sep 2003 20:54:11 -0300 (ADT) +Message-ID: <20030927235414.54467.qmail@web40405.mail.yahoo.com> +Received: from [66.185.84.75] by web40405.mail.yahoo.com via HTTP; + Sat, 27 Sep 2003 16:54:14 PDT +Date: Sat, 27 Sep 2003 16:54:14 -0700 (PDT) +From: "Yusuf W." +Subject: Performance: BigInt vs Decimal(19,0) +To: pgsql-performance@postgresql.org +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/341 +X-Sequence-Number: 3707 + +For the application that I'm working on, we want to +use data types that are database independent. (most +databases has decimal, but not big int). + +Anyhow, we are planning on using decimal(19,0) for our +primary keys instead of a big int, would there be a +performance difference in using a bigint over using decimals? + +__________________________________ +Do you Yahoo!? +The New Yahoo! Shopping - with improved product search +http://shopping.yahoo.com + +From pgsql-performance-owner@postgresql.org Sat Sep 27 21:26:18 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 7DCC7D1B501 + for ; + Sun, 28 Sep 2003 00:26:17 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 33985-07 + for ; + Sat, 27 Sep 2003 21:26:10 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 8C02CD1B4FF + for ; + Sat, 27 Sep 2003 21:26:06 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h8S0QA6c002126; + Sat, 27 Sep 2003 20:26:10 -0400 (EDT) +To: "Yusuf W." +Cc: pgsql-performance@postgresql.org +Subject: Re: Performance: BigInt vs Decimal(19,0) +In-reply-to: <20030927235414.54467.qmail@web40405.mail.yahoo.com> +References: <20030927235414.54467.qmail@web40405.mail.yahoo.com> +Comments: In-reply-to "Yusuf W." + message dated "Sat, 27 Sep 2003 16:54:14 -0700" +Date: Sat, 27 Sep 2003 20:26:09 -0400 +Message-ID: <2125.1064708769@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/342 +X-Sequence-Number: 3708 + +"Yusuf W." writes: +> For the application that I'm working on, we want to +> use data types that are database independent. (most +> databases has decimal, but not big int). + +Most databases have bigint, I think. + +> Anyhow, we are planning on using decimal(19,0) for our +> primary keys instead of a big int, would there be a +> performance difference in using a bigint over using decimals? + +You'll be taking a very large performance hit, for very little benefit +that I can see. How hard could it be to change the column declarations +if you ever move to a database without bigint? There's not normally +much need for apps to be explicitly aware of the column type names. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sat Sep 27 23:39:55 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 0F8B3D1B504 + for ; + Sun, 28 Sep 2003 02:39:44 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 53586-02 + for ; + Sat, 27 Sep 2003 23:39:37 -0300 (ADT) +Received: from web40408.mail.yahoo.com (web40408.mail.yahoo.com + [66.218.78.105]) + by svr1.postgresql.org (Postfix) with SMTP id 8587DD1B4EC + for ; + Sat, 27 Sep 2003 23:39:32 -0300 (ADT) +Message-ID: <20030928023936.66818.qmail@web40408.mail.yahoo.com> +Received: from [66.185.84.75] by web40408.mail.yahoo.com via HTTP; + Sat, 27 Sep 2003 19:39:36 PDT +Date: Sat, 27 Sep 2003 19:39:36 -0700 (PDT) +From: "Yusuf W." +Subject: Re: Performance: BigInt vs Decimal(19,0) +To: pgsql-performance@postgresql.org +In-Reply-To: <2125.1064708769@sss.pgh.pa.us> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/343 +X-Sequence-Number: 3709 + +Now, I've got to convince my project's software +architech, that a bigint would be better than a +decimal. + +Does anyone know where I could get some documentation +on how the int and decimal are implemented so I could +prove to him that ints are better? Can people suggest +good points to make in order to prove it? + +Thanks in advance. + +--- Tom Lane wrote: +> "Yusuf W." writes: +> > For the application that I'm working on, we want +> to +> > use data types that are database independent. +> (most +> > databases has decimal, but not big int). +> +> Most databases have bigint, I think. +> +> > Anyhow, we are planning on using decimal(19,0) for +> our +> > primary keys instead of a big int, would there be +> a +> > performance difference in using a bigint over +> using decimals? +> +> You'll be taking a very large performance hit, for +> very little benefit +> that I can see. How hard could it be to change the +> column declarations +> if you ever move to a database without bigint? +> There's not normally +> much need for apps to be explicitly aware of the +> column type names. +> +> regards, tom lane + + +__________________________________ +Do you Yahoo!? +The New Yahoo! Shopping - with improved product search +http://shopping.yahoo.com + +From pgsql-performance-owner@postgresql.org Sun Sep 28 00:10:49 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B9059D1B4EC + for ; + Sun, 28 Sep 2003 03:07:25 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 60197-01 + for ; + Sun, 28 Sep 2003 00:07:15 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id CA50ED1B4E7 + for ; + Sun, 28 Sep 2003 00:07:14 -0300 (ADT) +Received: from [63.195.55.98] (HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3690504; Sat, 27 Sep 2003 20:07:46 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Organization: Aglio Database Solutions +To: "Yusuf W." , + "pgsql-performance@postgresql.org" +Subject: Re: Performance: BigInt vs Decimal(19,0) +Date: Sat, 27 Sep 2003 20:06:42 -0700 +User-Agent: KMail/1.4.3 +References: <20030928023936.66818.qmail@web40408.mail.yahoo.com> +In-Reply-To: <20030928023936.66818.qmail@web40408.mail.yahoo.com> +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-Id: <200309272006.42462.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/344 +X-Sequence-Number: 3710 + +Yusuf, + +> Does anyone know where I could get some documentation +> on how the int and decimal are implemented so I could +> prove to him that ints are better? Can people suggest +> good points to make in order to prove it? + +RTFM: +http://www.postgresql.org/docs/7.3/interactive/datatype.html#DATATYPE-NUMERIC + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-general-owner@postgresql.org Sun Sep 28 00:42:03 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 9FCBCD1B528 + for ; + Sun, 28 Sep 2003 03:41:58 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 65466-06 + for ; + Sun, 28 Sep 2003 00:41:27 -0300 (ADT) +Received: from boats_exch01.boats.com (h209-17-182-106.gtconnect.net + [209.17.182.106]) + by svr1.postgresql.org (Postfix) with ESMTP id A1D49D1B4E9 + for ; + Sun, 28 Sep 2003 00:41:26 -0300 (ADT) +Received: by BOATS_EXCH01 with Internet Mail Service (5.5.2653.19) + id ; Sat, 27 Sep 2003 20:40:02 -0700 +Received: from GRIFFITHS2 ([192.168.12.207]) by boats_exch01.boats.com with + SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) + id TTY6TDR9; Sat, 27 Sep 2003 20:39:57 -0700 +From: David Griffiths +To: pgsql-general@postgresql.org +Message-ID: <01d201c38573$84606930$6501a8c0@griffiths2> +References: +Subject: Tuning/performance question. +Date: Sat, 27 Sep 2003 20:49:23 -0700 +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 5.50.4922.1500 +X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4925.2800 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/1730 +X-Sequence-Number: 49949 + + +We are doing some performance testing among various databases (Oracle, MySQL +and Postgres). + +One of the queries is showing Postgres lagging quite a bit: + +SELECT count(*) +FROM commercial_entity, country, user_account, address_list +LEFT JOIN state_province ON address_list.state_province_id = +state_province.state_province_id +LEFT JOIN contact_info ON address_list.contact_info_id = +contact_info.contact_info_id +WHERE address_list.address_type_id = 101 +AND commercial_entity.commercial_entity_id = +address_list.commercial_entity_id +AND address_list.country_id = country.country_id +AND commercial_entity.user_account_id = user_account.user_account_id +AND user_account.user_role_id IN (101, 101); + +I ran a "vacuum analyze" after realizing that I had loaded all the data into +the database without redoing the statistics; the query jumped from 19 +seconds to 41 seconds _after_ the analyze. + +I'd also like to make sure my query is performing correctly - I want all the +count of records where the commercial_entity matches user_account, +address_list, country, and a left-outer-join on address_list-province and +address_list-contact_info. + +Finally, I read some posts on the shared_buffers; they stated that the +shared_buffers should be set to 1/4 to 1/5 of total memory available. Is +that correct? I give the MySQL/InnoDB buffers about 70% of the 2 gig on the +machine. + + +Here's the explain (I'm not too familiar with reading a Postgres +explain...): + +---------------------------------------------------------------------------- +---------------------------------------------------------------- + Aggregate (cost=52951.09..52951.09 rows=1 width=116) + -> Merge Join (cost=52941.61..52950.83 rows=105 width=116) + Merge Cond: ("outer".country_id = "inner".country_id) + -> Index Scan using country_pkey on country (cost=0.00..7.54 +rows=231 width=11) + -> Sort (cost=52941.61..52941.88 rows=105 width=105) + Sort Key: address_list.country_id + -> Merge Join (cost=52729.54..52938.07 rows=105 width=105) + Merge Cond: ("outer".commercial_entity_id = +"inner".commercial_entity_id) + -> Sort (cost=8792.01..8792.52 rows=201 width=36) + Sort Key: commercial_entity.commercial_entity_id + -> Nested Loop (cost=0.00..8784.31 rows=201 +width=36) + -> Index Scan using usr_acc_usr_role_id_i +on user_account (cost=0.00..2403.08 rows=1401 width=12) + Index Cond: (user_role_id = +101::numeric) + -> Index Scan using comm_ent_usr_acc_id_i +on commercial_entity (cost=0.00..4.54 rows=1 width=24) + Index Cond: +(commercial_entity.user_account_id = "outer".user_account_id) + -> Sort (cost=43937.53..44173.84 rows=94526 width=69) + Sort Key: address_list.commercial_entity_id + -> Merge Join (cost=29019.03..32585.73 +rows=94526 width=69) + Merge Cond: ("outer".contact_info_id = +"inner".contact_info_id) + -> Index Scan using contact_info_pkey on +contact_info (cost=0.00..3366.76 rows=56435 width=12) + -> Sort (cost=29019.03..29255.34 +rows=94526 width=57) + Sort Key: +address_list.contact_info_id + -> Merge Join +(cost=16930.18..18354.55 rows=94526 width=57) + Merge Cond: +("outer".state_province_id = "inner".state_province_id) + -> Index Scan using +state_province_pkey on state_province (cost=0.00..3.81 rows=67 width=11) + -> Sort +(cost=16930.18..17166.50 rows=94526 width=46) + Sort Key: +address_list.state_province_id + -> Seq Scan on +address_list (cost=0.00..6882.52 rows=94526 width=46) + Filter: +(address_type_id = 101::numeric) + +What's the "Sort (cost...)"? + +I noticed that joining the address_list to country was slow; there was no +index on just country_id; there were composite indexes on multiple columns, +so I added one and did a vacuum analyze on the table, and got: + + Aggregate (cost=54115.74..54115.74 rows=1 width=116) + -> Merge Join (cost=54105.91..54115.46 rows=109 width=116) + Merge Cond: ("outer".country_id = "inner".country_id) + -> Index Scan using country_pkey on country (cost=0.00..7.54 +rows=231 width=11) + -> Sort (cost=54105.91..54106.19 rows=110 width=105) + Sort Key: address_list.country_id + -> Merge Join (cost=53884.34..54102.18 rows=110 width=105) + Merge Cond: ("outer".commercial_entity_id = +"inner".commercial_entity_id) + -> Sort (cost=8792.01..8792.52 rows=201 width=36) + Sort Key: commercial_entity.commercial_entity_id + -> Nested Loop (cost=0.00..8784.31 rows=201 +width=36) + -> Index Scan using usr_acc_usr_role_id_i +on user_account (cost=0.00..2403.08 rows=1401 width=12) + Index Cond: (user_role_id = +101::numeric) + -> Index Scan using comm_ent_usr_acc_id_i +on commercial_entity (cost=0.00..4.54 rows=1 width=24) + Index Cond: +(commercial_entity.user_account_id = "outer".user_account_id) + -> Sort (cost=45092.32..45335.37 rows=97221 width=69) + Sort Key: address_list.commercial_entity_id + -> Merge Join (cost=29770.81..33338.09 +rows=97221 width=69) + Merge Cond: ("outer".contact_info_id = +"inner".contact_info_id) + -> Index Scan using contact_info_pkey on +contact_info (cost=0.00..3366.76 rows=56435 width=12) + -> Sort (cost=29770.81..30013.86 +rows=97221 width=57) + Sort Key: +address_list.contact_info_id + -> Merge Join +(cost=17271.79..18731.55 rows=97221 width=57) + Merge Cond: +("outer".state_province_id = "inner".state_province_id) + -> Index Scan using +state_province_pkey on state_province (cost=0.00..3.81 rows=67 width=11) + -> Sort +(cost=17271.79..17514.84 rows=97221 width=46) + Sort Key: +address_list.state_province_id + -> Seq Scan on +address_list (cost=0.00..6882.52 rows=97221 width=46) + Filter: +(address_type_id = 101::numeric) + +No difference. Note that all the keys that are used in the joins are +numeric(10)'s, so there shouldn't be any cast-issues. + +When you create a primary key on a table, is an index created (I seem to +remember a message going by stating that an index would be added). + +For comparison, our production Oracle database (running on nearly identical +hardware - the Postgres machine has IDE-RAID-5 and the Oracle machine has +RAID mirroring) takes between 1 and 2 seconds. + +I've got one last question, and I really hope responses don't get +sidetracked by it; I see alot of negative comments towards MySQL, many of +them stating that it's a database layer overtop of the file system. Can +someone explain why Postgres is better than MySQL 4.0.14 using InnoDB? +MySQL, on the above query, with one less index (on address_list.country) +takes 0.20 seconds. + +David. + + +From pgsql-general-owner@postgresql.org Sun Sep 28 07:08:20 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 04373D1B4FF + for ; + Sun, 28 Sep 2003 10:08:16 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 14168-07 + for ; + Sun, 28 Sep 2003 07:08:07 -0300 (ADT) +Received: from smtp.pspl.co.in (unknown [202.54.11.65]) + by svr1.postgresql.org (Postfix) with ESMTP id 9BB6BD1B4FC + for ; + Sun, 28 Sep 2003 07:07:54 -0300 (ADT) +Received: (from root@localhost) + by smtp.pspl.co.in (8.12.9/8.12.9) id h8SA9mtQ013708 + for ; Sun, 28 Sep 2003 15:39:48 +0530 +Received: from daithan.intranet.pspl.co.in (daithan.intranet.pspl.co.in + [192.168.7.161]) (authenticated bits=0) + by persistent.co.in (8.12.9/8.12.9) with ESMTP id h8SA9ljj013695; + Sun, 28 Sep 2003 15:39:48 +0530 +From: Shridhar Daithankar +To: pgsql-general@postgresql.org +Subject: Re: Tuning/performance question. +Date: Sun, 28 Sep 2003 15:39:56 +0530 +User-Agent: KMail/1.5.2 +References: + <01d201c38573$84606930$6501a8c0@griffiths2> +In-Reply-To: <01d201c38573$84606930$6501a8c0@griffiths2> +Cc: pgsql-performance@postgresql.org +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200309281539.56558.shridhar_daithankar@persistent.co.in> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/1734 +X-Sequence-Number: 49953 + +On Sunday 28 September 2003 09:19, David Griffiths wrote: +> No difference. Note that all the keys that are used in the joins are +> numeric(10)'s, so there shouldn't be any cast-issues. + +Can you make them bigint and see? It might make some difference perhaps. + +Checking the plan in the meantime.. BTW what tuning you did to postgresql? + +Check http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html, assuming +you haven't seen earlier.. + + HTH + + Shridhar + + +From pgsql-general-owner@postgresql.org Sun Sep 28 08:22:12 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A1397D1B4FC + for ; + Sun, 28 Sep 2003 11:22:10 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 38499-03 + for ; + Sun, 28 Sep 2003 08:21:41 -0300 (ADT) +Received: from bellona.wg.saar.de (bellona.wg.saar.de [192.109.53.23]) + by svr1.postgresql.org (Postfix) with ESMTP id B6B08D1B52B + for ; + Sun, 28 Sep 2003 08:21:21 -0300 (ADT) +Received: (from uucp@localhost) + by bellona.wg.saar.de (8.10.2-20030922/8.10.2) with UUCP id + h8SBL3T27809; Sun, 28 Sep 2003 13:21:03 +0200 +Received: from localhost (userid@localhost [127.0.0.1]) + by bluebell.marzen.de (8.10.1/8.10.1) with ESMTP id h8SBDsm27752; + Sun, 28 Sep 2003 13:13:54 +0200 +Date: Sun, 28 Sep 2003 13:13:54 +0200 (CEST) +From: Holger Marzen +X-X-Sender: hm@bluebell.marzen.de +Reply-To: holger@marzen.de +To: David Griffiths +Cc: pgsql-general@postgresql.org +Subject: Re: Tuning/performance question. +In-Reply-To: <01d201c38573$84606930$6501a8c0@griffiths2> +Message-ID: +References: + <01d201c38573$84606930$6501a8c0@griffiths2> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/1735 +X-Sequence-Number: 49954 + +On Sat, 27 Sep 2003, David Griffiths wrote: + +> +> We are doing some performance testing among various databases (Oracle, MySQL +> and Postgres). +> +> One of the queries is showing Postgres lagging quite a bit: +> +> SELECT count(*) +> FROM commercial_entity, country, user_account, address_list +> LEFT JOIN state_province ON address_list.state_province_id = +> state_province.state_province_id +> LEFT JOIN contact_info ON address_list.contact_info_id = +> contact_info.contact_info_id +> WHERE address_list.address_type_id = 101 +> AND commercial_entity.commercial_entity_id = +> address_list.commercial_entity_id +> AND address_list.country_id = country.country_id +> AND commercial_entity.user_account_id = user_account.user_account_id +> AND user_account.user_role_id IN (101, 101); + +I guess that this question has been discussed very often - but I cannot +remember why exactly. Is there a pointer to a technical explanation? Has +it something to do with MVCC? But ist it one of MVCC's benefits that we +can make a consistent online backup without archiving redo locks (Oracle +can't, DB2 can). Is DB2 slower than Oracle in such cases (count(*)) as +well? + +Workaround: +We can sometimes fake a bit to avoid such costly queries and set up a +trigger that calls a function that increases a counter in a separate +counter table. Then we are lightning-fast. + +But many users compain about PostgreSQL's poor count(*) performance, +that's true and can be critical when someone wants to replace another +database product by PostgreSQL. + +From pgsql-performance-owner@postgresql.org Sun Sep 28 09:08:40 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 13906D1B4FD + for ; + Sun, 28 Sep 2003 12:08:36 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 39715-04 + for ; + Sun, 28 Sep 2003 09:08:08 -0300 (ADT) +Received: from wight.ymogen.net (unknown [217.27.240.153]) + by svr1.postgresql.org (Postfix) with SMTP id 5E8D6D1B4E6 + for ; + Sun, 28 Sep 2003 09:08:00 -0300 (ADT) +Received: (qmail 510 invoked from network); 28 Sep 2003 12:07:57 -0000 +Received: from dsl-217-155-239-51.zen.co.uk (HELO finisterre) (217.155.239.51) + by wight.ymogen.net with SMTP; 28 Sep 2003 12:07:57 -0000 +From: "Matt Clark" +To: , +Subject: Re: advice on raid controller +Date: Sun, 28 Sep 2003 13:07:57 +0100 +Message-ID: +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 IMO, Build 9.0.2416 (9.0.2910.0) +In-Reply-To: <200309271824.33351.rj@last.fm> +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +Importance: Normal +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/346 +X-Sequence-Number: 3712 + +As others have mentioned, you really ought to get battery-backed cache if +you're doing any volume of writes. The ability to do safe write-back +caching makes an *insane* difference to write performance. + +The site you link to also has that for only 15% more money: +http://uk.azzurri.com/product/product.cgi?productId=80 + +No experience with the card(s) I'm afraid. + +In general though, U320 will only be faster than U160 for large sequential +reads, or when you have silly numbers of disks on a channel (i.e. more than +4/channel). If you have silly numbers of disks, then RAID5 will probably be +better, if you have 4 disks total then RAID1+0 will probably be better. In +between it depends on all sorts of other factors. Bear in mind though that +if you *do* have silly numbers of disks then more channels and more cache +will count for more than anything else, so spend the money on that rather +than latest-and-greatest performance for a single channel. + +HTH + +Matt + +> -----Original Message----- +> From: pgsql-performance-owner@postgresql.org +> [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Richard +> Jones +> Sent: 27 September 2003 18:25 +> To: pgsql-performance@postgresql.org +> Subject: [PERFORM] advice on raid controller +> +> +> Hi, i'm on the verge of buying a "MegaRAID SCSI 320-2" raid controller. +> I need it to build a db server using 4x ultra320 scsi disks +> i'm thinking raid 1+0 but will try with raid5 too and compare +> +> Does anyone have any experience with this model, good or bad i'd like to +> know.. thanks :) +> +> as seen: +> http://uk.azzurri.com/product/product.cgi?productId=188 +> +> Regards, +> Richard. +> +> PS: whoever mentioned starting a site with raid controller +> reviews, excellent +> idea - its hard to find decent info on which card to buy. +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: the planner will ignore your desire to choose an index scan if your +> joining column's datatypes do not match +> + + +From pgsql-general-owner@postgresql.org Sun Sep 28 13:13:56 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 45075D1B503 + for ; + Sun, 28 Sep 2003 16:13:50 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 72057-10 + for ; + Sun, 28 Sep 2003 13:13:40 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 83EC4D1B4EC + for ; + Sun, 28 Sep 2003 13:13:39 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h8SGDM6c009443; + Sun, 28 Sep 2003 12:13:22 -0400 (EDT) +To: holger@marzen.de +Cc: David Griffiths , + pgsql-general@postgresql.org +Subject: Re: Tuning/performance question. +In-reply-to: +References: + <01d201c38573$84606930$6501a8c0@griffiths2> + +Comments: In-reply-to Holger Marzen + message dated "Sun, 28 Sep 2003 13:13:54 +0200" +Date: Sun, 28 Sep 2003 12:13:22 -0400 +Message-ID: <9442.1064765602@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/1737 +X-Sequence-Number: 49956 + +Holger Marzen writes: +> But many users compain about PostgreSQL's poor count(*) performance, + +I don't think that's relevant here. Some other DB's have shortcuts for +determining the total number of rows in a single table, that is they can +do "SELECT COUNT(*) FROM a_table" quickly, but David's query is messy +enough that I can't believe anyone can actually do it without forming +the join result. + +What I'd ask for is EXPLAIN ANALYZE output. Usually, if a complex query +is slower than it should be, it's because the planner is picking a bad +plan. So you need to look at how its estimates diverge from reality. +But plain EXPLAIN doesn't show the reality, only the estimates ... + +David, could we see EXPLAIN ANALYZE for the query, and also the table +schemas (psql \d displays would do)? Also, please take it to +pgsql-performance, it's not really on-topic for pgsql-general. + + regards, tom lane + +From pgsql-general-owner@postgresql.org Sun Sep 28 13:53:49 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A2730D1B544 + for ; + Sun, 28 Sep 2003 16:53:48 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 82147-09 + for ; + Sun, 28 Sep 2003 13:53:18 -0300 (ADT) +Received: from boats_exch01.boats.com (h209-17-182-106.gtconnect.net + [209.17.182.106]) + by svr1.postgresql.org (Postfix) with ESMTP id 57E0CD1B542 + for ; + Sun, 28 Sep 2003 13:53:17 -0300 (ADT) +Received: by BOATS_EXCH01 with Internet Mail Service (5.5.2653.19) + id ; Sun, 28 Sep 2003 09:51:53 -0700 +Received: from GRIFFITHS2 ([192.168.12.207]) by boats_exch01.boats.com with + SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) + id TTY6TJS0; Sun, 28 Sep 2003 09:51:45 -0700 +From: David Griffiths +To: pgsql-general@postgresql.org +Message-ID: <007f01c385e2$2264f290$6501a8c0@griffiths2> +References: + <01d201c38573$84606930$6501a8c0@griffiths2> + +Subject: Re: Tuning/performance question. +Date: Sun, 28 Sep 2003 10:01:13 -0700 +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 5.50.4922.1500 +X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4925.2800 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/1740 +X-Sequence-Number: 49959 + + +> I guess that this question has been discussed very often - but I cannot +> remember why exactly. Is there a pointer to a technical explanation? Has +> it something to do with MVCC? But ist it one of MVCC's benefits that we +> can make a consistent online backup without archiving redo locks (Oracle +> can't, DB2 can). Is DB2 slower than Oracle in such cases (count(*)) as +> well? +> +> Workaround: +> We can sometimes fake a bit to avoid such costly queries and set up a +> trigger that calls a function that increases a counter in a separate +> counter table. Then we are lightning-fast. +> +> But many users compain about PostgreSQL's poor count(*) performance, +> that's true and can be critical when someone wants to replace another +> database product by PostgreSQL. + +This is but one of many tests we're doing. The count(*) performance is not +the deciding factor. This query was pulled from our production system, and +I've +extracted the exact tables and data from the production system to test. + +MySQL with MyISAM does in fact cheat on the count(*). InnoDB does not, +however. The "explain" indicates that it's doing the work, and analyzing the +tables dropped the cost of the query from .35 seconds to .20 seconds. + +Here's the same query, but selecting data (to test the databases ability to +find a single row quicky): + +SELECT current_timestamp; +SELECT company_name, address_1, address_2, address_3, city, +address_list.state_province_id, state_province_short_desc, country_desc, +zip_code, address_list.country_id, +contact_info.email, commercial_entity.user_account_id, phone_num_1, +phone_num_fax, website, boats_website +FROM commercial_entity, country, user_account, +address_list LEFT JOIN state_province ON address_list.state_province_id = +state_province.state_province_id +LEFT JOIN contact_info ON address_list.contact_info_id = +contact_info.contact_info_id +WHERE address_list.address_type_id = 101 +AND commercial_entity.commercial_entity_id=225528 +AND commercial_entity.commercial_entity_id = +address_list.commercial_entity_id +AND address_list.country_id = country.country_id +AND commercial_entity.user_account_id = user_account.user_account_id +AND user_account.user_role_id IN (101, 101); +SELECT current_timestamp; + +Postgres takes about 33 seconds to get the row back. + +Here's the "EXPLAIN": + + Nested Loop (cost=0.00..64570.33 rows=1 width=385) + -> Nested Loop (cost=0.00..64567.30 rows=1 width=361) + -> Nested Loop (cost=0.00..64563.97 rows=1 width=349) + Join Filter: ("outer".commercial_entity_id = +"inner".commercial_entity_id) + -> Index Scan using commercial_entity_pkey on +commercial_entity (cost=0.00..5.05 rows=1 width=94) + Index Cond: (commercial_entity_id = 225528::numeric) + -> Materialize (cost=63343.66..63343.66 rows=97221 +width=255) + -> Merge Join (cost=0.00..63343.66 rows=97221 +width=255) + Merge Cond: ("outer".contact_info_id = +"inner".contact_info_id) + -> Nested Loop (cost=0.00..830457.52 rows=97221 +width=222) + Join Filter: ("outer".state_province_id = +"inner".state_province_id) + -> Index Scan using addr_list_ci_id_i on +address_list (cost=0.00..586676.65 rows=97221 width=205) + Filter: (address_type_id = +101::numeric) + -> Seq Scan on state_province +(cost=0.00..1.67 rows=67 width=17) + -> Index Scan using contact_info_pkey on +contact_info (cost=0.00..3366.76 rows=56435 width=33) + -> Index Scan using user_account_pkey on user_account +(cost=0.00..3.32 rows=1 width=12) + Index Cond: ("outer".user_account_id = +user_account.user_account_id) + Filter: (user_role_id = 101::numeric) + -> Index Scan using country_pkey on country (cost=0.00..3.01 rows=1 +width=24) + Index Cond: ("outer".country_id = country.country_id) +(20 rows) + +David. + +From pgsql-general-owner@postgresql.org Sun Sep 28 13:54:51 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 77057D1B524 + for ; + Sun, 28 Sep 2003 16:54:49 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 82147-10 + for ; + Sun, 28 Sep 2003 13:54:19 -0300 (ADT) +Received: from boats_exch01.boats.com (h209-17-182-106.gtconnect.net + [209.17.182.106]) + by svr1.postgresql.org (Postfix) with ESMTP id 4288DD1B503 + for ; + Sun, 28 Sep 2003 13:54:18 -0300 (ADT) +Received: by BOATS_EXCH01 with Internet Mail Service (5.5.2653.19) + id ; Sun, 28 Sep 2003 09:52:54 -0700 +Received: from GRIFFITHS2 ([192.168.12.207]) by boats_exch01.boats.com with + SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) + id TTY6TJTP; Sun, 28 Sep 2003 09:52:45 -0700 +From: David Griffiths +To: pgsql-general@postgresql.org +Message-ID: <008d01c385e2$463b4b60$6501a8c0@griffiths2> +References: + <01d201c38573$84606930$6501a8c0@griffiths2> + + <9442.1064765602@sss.pgh.pa.us> +Subject: Re: Tuning/performance question. +Date: Sun, 28 Sep 2003 10:02:13 -0700 +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 5.50.4922.1500 +X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4925.2800 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/1741 +X-Sequence-Number: 49960 + +> David, could we see EXPLAIN ANALYZE for the query, and also the table +> schemas (psql \d displays would do)? Also, please take it to +> pgsql-performance, it's not really on-topic for pgsql-general. +> +> regards, tom lane + +Will do. + +Thanks, +David. + + +From pgsql-general-owner@postgresql.org Sun Sep 28 15:21:37 2003 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 9FFB9D1B4E1 + for ; + Sun, 28 Sep 2003 18:21:32 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 92539-03 + for ; + Sun, 28 Sep 2003 15:21:23 -0300 (ADT) +Received: from phaze.fireserve.net (phaze.fireserve.net [207.109.249.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 1F924D1B52C + for ; + Sun, 28 Sep 2003 15:21:21 -0300 (ADT) +Received: from fireserve.net (dh0020.moore-s.fireserve.net [207.109.249.149]) + by phaze.fireserve.net (8.12.10/linuxconf) with ESMTP id + h8SIO25i026744; Sun, 28 Sep 2003 11:24:02 -0700 +Message-ID: <3F77268C.7040609@fireserve.net> +Date: Sun, 28 Sep 2003 11:21:00 -0700 +From: Dennis Gearon +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; + rv:1.4) Gecko/20030624 +X-Accept-Language: en-us, en, ru +MIME-Version: 1.0 +To: holger@marzen.de +Cc: David Griffiths , + pgsql-general@postgresql.org +Subject: Re: Tuning/performance question. +References: + <01d201c38573$84606930$6501a8c0@griffiths2> + +In-Reply-To: +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-MailScanner: Found to be clean +X-MailScanner-SpamCheck: not spam, SpamAssassin (score=-4.782, required 6, + AWL, BAYES_00) +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/1743 +X-Sequence-Number: 49962 + +Holger Marzen wrote: + +>On Sat, 27 Sep 2003, David Griffiths wrote: +> +> +> +>>We are doing some performance testing among various databases (Oracle, MySQL +>>and Postgres). +>> +>>One of the queries is showing Postgres lagging quite a bit: +>> +>>SELECT count(*) +>>FROM commercial_entity, country, user_account, address_list +>>LEFT JOIN state_province ON address_list.state_province_id = +>>state_province.state_province_id +>>LEFT JOIN contact_info ON address_list.contact_info_id = +>>contact_info.contact_info_id +>>WHERE address_list.address_type_id = 101 +>>AND commercial_entity.commercial_entity_id = +>>address_list.commercial_entity_id +>>AND address_list.country_id = country.country_id +>>AND commercial_entity.user_account_id = user_account.user_account_id +>>AND user_account.user_role_id IN (101, 101); +>> +>> +> +>I guess that this question has been discussed very often - but I cannot +>remember why exactly. Is there a pointer to a technical explanation? Has +>it something to do with MVCC? But ist it one of MVCC's benefits that we +>can make a consistent online backup without archiving redo locks (Oracle +>can't, DB2 can). Is DB2 slower than Oracle in such cases (count(*)) as +>well? +> +>Workaround: +>We can sometimes fake a bit to avoid such costly queries and set up a +>trigger that calls a function that increases a counter in a separate +>counter table. Then we are lightning-fast. +> +>But many users compain about PostgreSQL's poor count(*) performance, +>that's true and can be critical when someone wants to replace another +>database product by PostgreSQL. +> +>---------------------------(end of broadcast)--------------------------- +>TIP 6: Have you searched our list archives? +> +> http://archives.postgresql.org +> +> +> +Yup, it'd be nice to have faster count(*) performance. + + +From pgsql-performance-owner@postgresql.org Sun Sep 28 17:55:14 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3C0C2D1B4FC + for ; + Sun, 28 Sep 2003 20:55:13 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 19123-06 + for ; + Sun, 28 Sep 2003 17:54:44 -0300 (ADT) +Received: from amsfep11-int.chello.nl (amsfep11-int.chello.nl [213.46.243.20]) + by svr1.postgresql.org (Postfix) with ESMTP id 975CBD1B53E + for ; + Sun, 28 Sep 2003 17:54:41 -0300 (ADT) +Received: from palle.girgensohn.se ([213.89.138.245]) by + amsfep11-int.chello.nl + (InterMail vM.5.01.05.17 201-253-122-126-117-20021021) with ESMTP + id <20030928205442.YDUN3404.amsfep11-int.chello.nl@palle.girgensohn.se>; + Sun, 28 Sep 2003 22:54:42 +0200 +Received: from localhost (localhost [127.0.0.1]) + by palle.girgensohn.se (8.12.9/8.12.9) with ESMTP id h8SKsfNr092490; + Sun, 28 Sep 2003 22:54:41 +0200 (CEST) + (envelope-from girgen@pingpong.net) +Date: Sun, 28 Sep 2003 22:54:41 +0200 +From: Palle Girgensohn +To: pgsql-performance@postgresql.org +Subject: avoiding seqscan? +Message-ID: <95900000.1064782481@palle.girgensohn.se> +X-Mailer: Mulberry/3.0.3 (Linux/x86) +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/347 +X-Sequence-Number: 3713 + +Hi! + +I have a SQL statement that I cannot get to use the index. postgresql +insists on using a seqscan and performance is very poor. set enable_seqscan += true boost performance drastically, as you can see below. Since seqscan +is not always bad, I'd rather not turn it off completely, but rather get +the planner to do the right thing here. Is there another way to do this, +apart from setting enable_seqscan=false? + +Thanks, +Palle + + +the tables are: +person with about 30000 tuples +dyn_field_content_person, 331156 tuples +dyn_field_person, just 15 tuples +course about 700 tuples +partitcipant with ~ 7800 tuples, where ~ 60 have course_id=707... + +uu=# explain analyze +uu-# select lower(substr(p.last_name,1,1)) as letter, count(*) +uu-# FROM course c join group_data gd on (c.active_group_id = +gd.this_group_id) +uu-# join person p on (gd.item_text = p.userid) +uu-# join dyn_field_person dfp on (dfp.extern_item_id = 10 and +dfp.giver=c.giver) +uu-# join dyn_field_content_person dfcp on (dfp.id = +dfcp.dyn_field_id and dfcp.userid=p.userid) +uu-# left outer join participant pt on (pt.userid = p.userid and +pt.course_id = 707) +uu-# WHERE c.id = 707 +uu-# group by 1 +uu-# ; + +QUERY PLAN + + +--------------------------------------------------------------------------- +--------------------------------------------------------------------------- +--------------------------------------- +------------------- + Aggregate (cost=10496.30..10498.35 rows=27 width=106) (actual +time=4166.01..4167.23 rows=19 loops=1) + -> Group (cost=10496.30..10497.67 rows=273 width=106) (actual +time=4165.92..4166.80 rows=60 loops=1) + -> Sort (cost=10496.30..10496.98 rows=273 width=106) (actual +time=4165.91..4166.10 rows=60 loops=1) + Sort Key: lower(substr(p.last_name, 1, 1)) + -> Merge Join (cost=10443.75..10485.23 rows=273 width=106) +(actual time=4094.42..4165.20 rows=60 loops=1) + Merge Cond: ("outer".userid = "inner".userid) + Join Filter: ("inner".course_id = 707) + -> Sort (cost=9803.86..9804.54 rows=273 width=88) +(actual time=3823.78..3823.97 rows=60 loops=1) + Sort Key: dfcp.userid + -> Hash Join (cost=2444.22..9792.79 rows=273 +width=88) (actual time=1140.50..3822.60 rows=60 loops=1) + Hash Cond: ("outer".userid = +"inner".item_text) + Join Filter: ("inner".id = +"outer".dyn_field_id) + -> Seq Scan on dyn_field_content_person +dfcp (cost=0.00..5643.56 rows=331156 width=16) (actual time=0.01..2028.31 +rows=331156 loops=1) + -> Hash (cost=2443.54..2443.54 rows=272 +width=72) (actual time=340.24..340.24 rows=0 loops=1) + -> Nested Loop +(cost=1401.84..2443.54 rows=272 width=72) (actual time=338.76..339.91 +rows=60 loops=1) + Join Filter: ("outer".giver = +"inner".giver) + -> Seq Scan on +dyn_field_person dfp (cost=0.00..1.19 rows=1 width=16) (actual +time=0.06..0.09 rows=1 loops=1) + Filter: (extern_item_id += 10) + -> Materialize +(cost=2437.67..2437.67 rows=374 width=56) (actual time=338.64..338.82 +rows=60 loops=1) + -> Hash Join +(cost=1401.84..2437.67 rows=374 width=56) (actual time=7.74..338.36 rows=60 +loops=1) + Hash Cond: +("outer".userid = "inner".item_text) + -> Seq Scan on +person p (cost=0.00..806.09 rows=30009 width=23) (actual time=0.01..203.67 +rows=30009 loops=1) + -> Hash +(cost=1400.89..1400.89 rows=378 width=33) (actual time=1.60..1.60 rows=0 +loops=1) + -> Nested +Loop (cost=0.00..1400.89 rows=378 width=33) (actual time=0.12..1.28 +rows=60 loops=1) + -> +Index Scan using course_pkey on course c (cost=0.00..5.08 rows=1 width=16) +(actual time=0.06..0.06 rows=1 loops=1) + +Index Cond: (id = 707) + -> +Index Scan using group_data_this_idx on group_data gd (cost=0.00..1390.80 +rows=402 width=17) (actual time=0.04..0.6 +6 rows=60 loops=1) + +Index Cond: ("outer".active_group_id = gd.this_group_id) + -> Sort (cost=639.90..659.42 rows=7808 width=18) +(actual time=266.55..290.81 rows=7722 loops=1) + Sort Key: pt.userid + -> Seq Scan on participant pt +(cost=0.00..135.08 rows=7808 width=18) (actual time=0.02..50.24 rows=7808 +loops=1) + Total runtime: 4170.16 msec +(32 rader) + +Tid: 4184,68 ms +uu=# set enable_seqscan = false; +SET +Tid: 1,20 ms +uu=# explain analyze +uu-# select lower(substr(p.last_name,1,1)) as letter, count(*) +uu-# FROM course c join group_data gd on (c.active_group_id = +gd.this_group_id) +uu-# join person p on (gd.item_text = p.userid) +uu-# join dyn_field_person dfp on (dfp.extern_item_id = 10 and +dfp.giver=c.giver) +uu-# join dyn_field_content_person dfcp on (dfp.id = +dfcp.dyn_field_id and dfcp.userid=p.userid) +uu-# left outer join participant pt on (pt.userid = p.userid and +pt.course_id = 707) +uu-# WHERE c.id = 707 +uu-# group by 1 +uu-# ; + +QUERY PLAN + + +--------------------------------------------------------------------------- +--------------------------------------------------------------------------- +--------------------------------------- +--------- + Aggregate (cost=17928.32..17930.37 rows=27 width=106) (actual +time=171.37..172.58 rows=19 loops=1) + -> Group (cost=17928.32..17929.68 rows=273 width=106) (actual +time=171.27..172.14 rows=60 loops=1) + -> Sort (cost=17928.32..17929.00 rows=273 width=106) (actual +time=171.26..171.45 rows=60 loops=1) + Sort Key: lower(substr(p.last_name, 1, 1)) + -> Merge Join (cost=17545.53..17917.25 rows=273 width=106) +(actual time=36.64..170.53 rows=60 loops=1) + Merge Cond: ("outer".userid = "inner".userid) + Join Filter: ("inner".course_id = 707) + -> Sort (cost=17545.53..17546.22 rows=273 width=88) +(actual time=28.62..28.84 rows=60 loops=1) + Sort Key: dfcp.userid + -> Nested Loop (cost=0.00..17534.46 rows=273 +width=88) (actual time=7.99..27.49 rows=60 loops=1) + Join Filter: ("outer".id = +"inner".dyn_field_id) + -> Nested Loop (cost=0.00..3685.31 +rows=272 width=72) (actual time=7.67..8.95 rows=60 loops=1) + Join Filter: ("outer".giver = +"inner".giver) + -> Index Scan using +df_person_giver_id_idx on dyn_field_person dfp (cost=0.00..6.20 rows=1 +width=16) (actual time=0.14..0.17 rows=1 loops=1) + Filter: (extern_item_id = 10) + -> Materialize +(cost=3674.43..3674.43 rows=374 width=56) (actual time=7.49..7.69 rows=60 +loops=1) + -> Nested Loop +(cost=0.00..3674.43 rows=374 width=56) (actual time=0.24..7.22 rows=60 +loops=1) + -> Nested Loop +(cost=0.00..1400.89 rows=378 width=33) (actual time=0.10..1.34 rows=60 +loops=1) + -> Index Scan +using course_pkey on course c (cost=0.00..5.08 rows=1 width=16) (actual +time=0.04..0.05 rows=1 loops=1) + Index Cond: +(id = 707) + -> Index Scan +using group_data_this_idx on group_data gd (cost=0.00..1390.80 rows=402 +width=17) (actual time=0.04..0.70 rows=60 lo +ops=1) + Index Cond: +("outer".active_group_id = gd.this_group_id) + -> Index Scan using +person_pkey on person p (cost=0.00..6.01 rows=1 width=23) (actual +time=0.07..0.08 rows=1 loops=60) + Index Cond: +("outer".item_text = p.userid) + -> Index Scan using +df_content_person_userid_id_idx on dyn_field_content_person dfcp +(cost=0.00..50.75 rows=12 width=16) (actual time=0.08..0.23 rows=11 l +oops=60) + Index Cond: (dfcp.userid = +"outer".item_text) + -> Index Scan using participant_uid_cid_idx on +participant pt (cost=0.00..349.76 rows=7808 width=18) (actual +time=0.07..84.34 rows=7722 loops=1) + Total runtime: 173.37 msec +(28 rader) + +Tid: 183,37 ms + + +From pgsql-performance-owner@postgresql.org Sun Sep 28 18:35:13 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id ACDA4D1B507 + for ; + Sun, 28 Sep 2003 21:35:12 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 30546-02 + for ; + Sun, 28 Sep 2003 18:35:04 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id EA281D1B4F2 + for ; + Sun, 28 Sep 2003 18:35:01 -0300 (ADT) +Received: from [63.195.55.98] (HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3692350; Sun, 28 Sep 2003 14:35:35 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Organization: Aglio Database Solutions +To: Palle Girgensohn , + pgsql-performance@postgresql.org +Subject: Re: avoiding seqscan? +Date: Sun, 28 Sep 2003 14:34:25 -0700 +User-Agent: KMail/1.4.3 +References: <95900000.1064782481@palle.girgensohn.se> +In-Reply-To: <95900000.1064782481@palle.girgensohn.se> +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-Id: <200309281434.25881.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/348 +X-Sequence-Number: 3714 + +Palle, + +> I have a SQL statement that I cannot get to use the index. postgresql +> insists on using a seqscan and performance is very poor. set enable_seqscan +> = true boost performance drastically, as you can see below. Since seqscan +> is not always bad, I'd rather not turn it off completely, but rather get +> the planner to do the right thing here. Is there another way to do this, +> apart from setting enable_seqscan=false? + +In your postgresql.conf, try setting effective_cache_size to something like +50% of your system's RAM, and lovering random_page_cost to 2.0 or even 1.5. +Then restart PostgreSQL and try your query again. + +What version, btw? + + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Mon Sep 29 13:50:57 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E5CA3D1B51F + for ; + Mon, 29 Sep 2003 04:53:00 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 92474-08 + for ; + Mon, 29 Sep 2003 01:52:29 -0300 (ADT) +Received: from smtp.noos.fr (nan-smtp-08.noos.net [212.198.2.77]) + by svr1.postgresql.org (Postfix) with ESMTP id C75B5D1B510 + for ; + Mon, 29 Sep 2003 01:52:28 -0300 (ADT) +Received: (qmail 58436535 invoked by uid 0); 28 Sep 2003 22:54:52 -0000 +Received: from unknown (HELO bigfoot.com) ([212.198.37.110]) + (envelope-sender ) + by 212.198.2.77 (qmail-ldap-1.03) with SMTP + for ; 28 Sep 2003 22:54:52 -0000 +Message-ID: <3F7766B3.4030705@bigfoot.com> +Date: Mon, 29 Sep 2003 00:54:43 +0200 +From: Gaetano Mendola +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; + rv:1.5b) Gecko/20030901 Thunderbird/0.2 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "pgsql-performance@postgresql.org" +Cc: Palle Girgensohn +Subject: Re: avoiding seqscan? +References: <95900000.1064782481@palle.girgensohn.se> +In-Reply-To: <95900000.1064782481@palle.girgensohn.se> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/362 +X-Sequence-Number: 3728 + +Palle Girgensohn wrote: +> uu=# explain analyze +> uu-# select lower(substr(p.last_name,1,1)) as letter, count(*) +> uu-# FROM course c join group_data gd on (c.active_group_id = +> gd.this_group_id) +> uu-# join person p on (gd.item_text = p.userid) +> uu-# join dyn_field_person dfp on (dfp.extern_item_id = 10 and +> dfp.giver=c.giver) +> uu-# join dyn_field_content_person dfcp on (dfp.id = +> dfcp.dyn_field_id and dfcp.userid=p.userid) +> uu-# left outer join participant pt on (pt.userid = p.userid and +> pt.course_id = 707) +> uu-# WHERE c.id = 707 +> uu-# group by 1 +> uu-# ; + +Why are you using this form of join ? When and if is not necessary use +the implicit form. + + +Regards +Gaetano Mendola + + + + +From pgsql-performance-owner@postgresql.org Sun Sep 28 19:57:26 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 8FCC6D1B4FF + for ; + Sun, 28 Sep 2003 22:57:25 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 39314-05 + for ; + Sun, 28 Sep 2003 19:56:57 -0300 (ADT) +Received: from amsfep14-int.chello.nl (amsfep14-int.chello.nl [213.46.243.22]) + by svr1.postgresql.org (Postfix) with ESMTP id 0BF60D1B524 + for ; + Sun, 28 Sep 2003 19:56:54 -0300 (ADT) +Received: from palle.girgensohn.se ([213.89.138.245]) by + amsfep14-int.chello.nl + (InterMail vM.5.01.05.17 201-253-122-126-117-20021021) with ESMTP id + <20030928225655.CNEQ27480.amsfep14-int.chello.nl@palle.girgensohn.se>; + Mon, 29 Sep 2003 00:56:55 +0200 +Received: from localhost (localhost [127.0.0.1]) + by palle.girgensohn.se (8.12.9/8.12.9) with ESMTP id h8SMusNr092711; + Mon, 29 Sep 2003 00:56:54 +0200 (CEST) + (envelope-from girgen@pingpong.net) +Date: Mon, 29 Sep 2003 00:56:54 +0200 +From: Palle Girgensohn +To: Josh Berkus , pgsql-performance@postgresql.org +Subject: Re: avoiding seqscan? +Message-ID: <161280000.1064789814@palle.girgensohn.se> +In-Reply-To: <200309281434.25881.josh@agliodbs.com> +References: <95900000.1064782481@palle.girgensohn.se> + <200309281434.25881.josh@agliodbs.com> +X-Mailer: Mulberry/3.0.3 (Linux/x86) +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1; format=flowed +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/349 +X-Sequence-Number: 3715 + +Hi, + +Indeed, setting random_page_cost does the trick. Thanks! + +It seems to make sense to set random_page_cost to this value. Are there any= +=20 +drawbacks? + +postgresql-7.3.4 + +postgresql.conf: + +tcpip_socket =3D true +max_connections =3D 100 +superuser_reserved_connections =3D 2 + +# Performance +# +shared_buffers =3D 12000 +sort_mem =3D 8192 +vacuum_mem =3D 32768 +effective_cache_size =3D 64000 +random_page_cost =3D 2 + +... + +--On s=F6ndag, september 28, 2003 14.34.25 -0700 Josh Berkus=20 + wrote: + +> Palle, +> +>> I have a SQL statement that I cannot get to use the index. postgresql +>> insists on using a seqscan and performance is very poor. set +>> enable_seqscan =3D true boost performance drastically, as you can see +>> below. Since seqscan is not always bad, I'd rather not turn it off +>> completely, but rather get the planner to do the right thing here. Is +>> there another way to do this, apart from setting enable_seqscan=3Dfalse? +> +> In your postgresql.conf, try setting effective_cache_size to something +> like 50% of your system's RAM, and lovering random_page_cost to 2.0 or +> even 1.5. Then restart PostgreSQL and try your query again. +> +> What version, btw? +> +> +> -- +> Josh Berkus +> Aglio Database Solutions +> San Francisco +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 5: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faqs/FAQ.html + + + + + +From pgsql-performance-owner@postgresql.org Sun Sep 28 23:29:43 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id AAD81D1B507 + for ; + Mon, 29 Sep 2003 02:29:38 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 76970-07 + for ; + Sun, 28 Sep 2003 23:29:31 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id 6E378D1B4F1 + for ; + Sun, 28 Sep 2003 23:29:27 -0300 (ADT) +Received: from [63.195.55.98] (HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3692966; Sun, 28 Sep 2003 19:30:03 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Organization: Aglio Database Solutions +To: Palle Girgensohn , + pgsql-performance@postgresql.org +Subject: Re: avoiding seqscan? +Date: Sun, 28 Sep 2003 19:28:52 -0700 +User-Agent: KMail/1.4.3 +References: <95900000.1064782481@palle.girgensohn.se> + <200309281434.25881.josh@agliodbs.com> + <161280000.1064789814@palle.girgensohn.se> +In-Reply-To: <161280000.1064789814@palle.girgensohn.se> +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-Id: <200309281928.52113.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/350 +X-Sequence-Number: 3716 + +Palle, + +> Indeed, setting random_page_cost does the trick. Thanks! +> +> It seems to make sense to set random_page_cost to this value. Are there any +> drawbacks? + +Only if your server was heavily multi-tasking, and as a result had little +RAM+CPU available. Then you'd want to raise the value again. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Mon Sep 29 10:26:18 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id EAD8BD1B53B + for ; + Mon, 29 Sep 2003 13:26:14 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 86270-06 + for ; + Mon, 29 Sep 2003 10:25:47 -0300 (ADT) +Received: from durian.pingpong.net (81.milagro.bahnhof.net [195.178.168.81]) + by svr1.postgresql.org (Postfix) with ESMTP id 9070BD1B51F + for ; + Mon, 29 Sep 2003 10:25:42 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by durian.pingpong.net (8.12.8p1/8.12.8) with ESMTP id h8TDPaOj001247; + Mon, 29 Sep 2003 15:25:36 +0200 (CEST) + (envelope-from girgen@pingpong.net) +Date: Mon, 29 Sep 2003 15:25:36 +0200 +From: Palle Girgensohn +To: Gaetano Mendola , + "pgsql-performance@postgresql.org" +Subject: Re: avoiding seqscan? +Message-ID: <180710000.1064841936@durian.pingpong.net> +In-Reply-To: <3F7766B3.4030705@bigfoot.com> +References: <95900000.1064782481@palle.girgensohn.se> + <3F7766B3.4030705@bigfoot.com> +X-Mailer: Mulberry/3.0.3 (Linux/x86) +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1; format=flowed +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/351 +X-Sequence-Number: 3717 + +Will that make a difference? From what I've seen, it does not make much=20 +difference, but I have seen queries speed up when rewritten explicit joins.= +=20 +I guess it depends on other things, but is it really so that the explicit= +=20 +joins are bad somehow? Do you have any pointers to documentation about it,= +=20 +if so? + +Thanks, +Palle + +--On m=E5ndag, september 29, 2003 00.54.43 +0200 Gaetano Mendola=20 + wrote: + +> Palle Girgensohn wrote: +>> uu=3D# explain analyze +>> uu-# select lower(substr(p.last_name,1,1)) as letter, count(*) +>> uu-# FROM course c join group_data gd on (c.active_group_id =3D +>> gd.this_group_id) +>> uu-# join person p on (gd.item_text =3D p.userid) +>> uu-# join dyn_field_person dfp on (dfp.extern_item_id =3D 10 and +>> dfp.giver=3Dc.giver) +>> uu-# join dyn_field_content_person dfcp on (dfp.id =3D +>> dfcp.dyn_field_id and dfcp.userid=3Dp.userid) +>> uu-# left outer join participant pt on (pt.userid =3D p.userid and +>> pt.course_id =3D 707) +>> uu-# WHERE c.id =3D 707 +>> uu-# group by 1 +>> uu-# ; +> +> Why are you using this form of join ? When and if is not necessary use +> the implicit form. +> +> +> Regards +> Gaetano Mendola +> +> +> + + + + + +From pgsql-performance-owner@postgresql.org Mon Sep 29 14:01:55 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C0F3CD1B51A + for ; + Mon, 29 Sep 2003 13:32:57 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 87473-03 + for ; + Mon, 29 Sep 2003 10:32:32 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 4D2B7D1B4E1 + for ; + Mon, 29 Sep 2003 10:32:29 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h8TDWThK044359 + for ; Mon, 29 Sep 2003 13:32:29 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h8TDVac3044253 + for pgsql-performance@postgresql.org; Mon, 29 Sep 2003 13:31:36 GMT +From: Gaetano Mendola +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: avoiding seqscan? +Date: Mon, 29 Sep 2003 15:31:31 +0200 +Organization: PYRENET Midi-pyrenees Provider +Lines: 17 +Message-ID: <3F783433.8000006@bigfoot.com> +References: <95900000.1064782481@palle.girgensohn.se> + <3F7766B3.4030705@bigfoot.com> + <180710000.1064841936@durian.pingpong.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: abuse@pyrenet.fr +To: Palle Girgensohn +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; + rv:1.5b) Gecko/20030901 Thunderbird/0.2 +X-Accept-Language: en-us, en +In-Reply-To: <180710000.1064841936@durian.pingpong.net> +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/363 +X-Sequence-Number: 3729 + +Palle Girgensohn wrote: +> Will that make a difference? From what I've seen, it does not make much +> difference, but I have seen queries speed up when rewritten explicit +> joins. I guess it depends on other things, but is it really so that the +> explicit joins are bad somehow? Do you have any pointers to +> documentation about it, if so? +> +> Thanks, +> Palle + + +Are not absolutelly bad but sometimes that path that you choose is not +the optimal, in postgres 7.4 the think will be better. + +Regards +Gaetano Mendola + + +From pgsql-performance-owner@postgresql.org Mon Sep 29 11:03:10 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 73A3DD1B530 + for ; + Mon, 29 Sep 2003 14:02:57 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 89536-02 + for ; + Mon, 29 Sep 2003 11:02:33 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id A6DB3D1B51D + for ; + Mon, 29 Sep 2003 11:02:29 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h8TE2ThK049515 + for ; Mon, 29 Sep 2003 14:02:29 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h8TDWaRB044386 + for pgsql-performance@postgresql.org; Mon, 29 Sep 2003 13:32:36 GMT +From: Gaetano Mendola +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: avoiding seqscan? +Date: Mon, 29 Sep 2003 15:32:31 +0200 +Organization: PYRENET Midi-pyrenees Provider +Lines: 18 +Message-ID: <3F78346F.5060809@bigfoot.com> +References: <95900000.1064782481@palle.girgensohn.se> + <3F7766B3.4030705@bigfoot.com> + <180710000.1064841936@durian.pingpong.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: abuse@pyrenet.fr +To: Palle Girgensohn +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; + rv:1.5b) Gecko/20030901 Thunderbird/0.2 +X-Accept-Language: en-us, en +In-Reply-To: <180710000.1064841936@durian.pingpong.net> +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/354 +X-Sequence-Number: 3720 + +Palle Girgensohn wrote: +> Will that make a difference? From what I've seen, it does not make much +> difference, but I have seen queries speed up when rewritten explicit +> joins. I guess it depends on other things, but is it really so that the +> explicit joins are bad somehow? Do you have any pointers to +> documentation about it, if so? +> +> Thanks, +> Palle + + +Are not absolutelly bad but sometimes that path that you choose is not +the optimal, in postgres 7.4 use the explicit join will be less +limitative for the planner. + +Regards +Gaetano Mendola + + +From pgsql-performance-owner@postgresql.org Mon Sep 29 10:45:45 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 26018D1B4E1 + for ; + Mon, 29 Sep 2003 13:45:44 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 88672-02 + for ; + Mon, 29 Sep 2003 10:45:16 -0300 (ADT) +Received: from durian.pingpong.net (81.milagro.bahnhof.net [195.178.168.81]) + by svr1.postgresql.org (Postfix) with ESMTP id 6F4C8D1B51D + for ; + Mon, 29 Sep 2003 10:45:10 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by durian.pingpong.net (8.12.8p1/8.12.8) with ESMTP id h8TDj2Oj001297 + for ; + Mon, 29 Sep 2003 15:45:02 +0200 (CEST) + (envelope-from girgen@pingpong.net) +Date: Mon, 29 Sep 2003 15:45:02 +0200 +From: Palle Girgensohn +To: pgsql-performance@postgresql.org +Subject: Re: avoiding seqscan? +Message-ID: <202370000.1064843102@durian.pingpong.net> +X-Mailer: Mulberry/3.0.3 (Linux/x86) +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1; FORMAT=flowed +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/352 +X-Sequence-Number: 3718 + +--On m=E5ndag, september 29, 2003 15.32.31 +0200 Gaetano Mendola=20 + wrote: + +> Are not absolutelly bad but sometimes that path that you choose is not +> the optimal, in postgres 7.4 use the explicit join will be less +> limitative for the planner. +> +> Regards +> Gaetano Mendola + +Ah, OK. True! In this case though, the sql questions are crafted with great= +=20 +care, since we have a lot of data in a few of the tables, other are almost= +=20 +empty, so we try to limit the amount of data as early as possible. Our=20 +experience says that we often do a better job than the planner, since we=20 +know which tables are "fat". Hence, we have actually moved to exlicit joins= +=20 +in questions and sometimes gained speed. + +But, in the general case, implicit might be better, I guess. + +Regards, +Palle + + + + +From pgsql-performance-owner@postgresql.org Mon Sep 29 10:55:52 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 1C2E4D1B52A + for ; + Mon, 29 Sep 2003 13:55:51 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 87945-05 + for ; + Mon, 29 Sep 2003 10:55:23 -0300 (ADT) +Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) + by svr1.postgresql.org (Postfix) with ESMTP id E3D96D1B51D + for ; + Mon, 29 Sep 2003 10:55:14 -0300 (ADT) +Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) + by mail1.ihs.com (8.12.10/8.12.10) with ESMTP id h8TDs3vA017329; + Mon, 29 Sep 2003 07:54:04 -0600 (MDT) +Date: Mon, 29 Sep 2003 07:48:35 -0600 (MDT) +From: "scott.marlowe" +To: Matt Clark +Cc: , +Subject: Re: advice on raid controller +In-Reply-To: +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-IHS-MailScanner: Found to be clean +X-IHS-MailScanner-SpamCheck: +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/353 +X-Sequence-Number: 3719 + +I've used the megaraid / LSI cards in the past and they were pretty good +in terms of reliability, but the last one I used was the 328 model, from 4 +years ago or so. that one had a battery backup option for the cache, and +could go to 128 Meg. We tested it with 4/16 and 128 meg ram, and it was +about the same with each, but we didn't do heavy parallel testing either. + +Here's the page on the megaraid cards at lsilogic.com: + +http://www.lsilogic.com/products/stor_prod/raid/ultra320products.html + +On Sun, 28 Sep 2003, Matt Clark wrote: + +> As others have mentioned, you really ought to get battery-backed cache if +> you're doing any volume of writes. The ability to do safe write-back +> caching makes an *insane* difference to write performance. +> +> The site you link to also has that for only 15% more money: +> http://uk.azzurri.com/product/product.cgi?productId=80 +> +> No experience with the card(s) I'm afraid. +> +> In general though, U320 will only be faster than U160 for large sequential +> reads, or when you have silly numbers of disks on a channel (i.e. more than +> 4/channel). If you have silly numbers of disks, then RAID5 will probably be +> better, if you have 4 disks total then RAID1+0 will probably be better. In +> between it depends on all sorts of other factors. Bear in mind though that +> if you *do* have silly numbers of disks then more channels and more cache +> will count for more than anything else, so spend the money on that rather +> than latest-and-greatest performance for a single channel. +> +> HTH +> +> Matt +> +> > -----Original Message----- +> > From: pgsql-performance-owner@postgresql.org +> > [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Richard +> > Jones +> > Sent: 27 September 2003 18:25 +> > To: pgsql-performance@postgresql.org +> > Subject: [PERFORM] advice on raid controller +> > +> > +> > Hi, i'm on the verge of buying a "MegaRAID SCSI 320-2" raid controller. +> > I need it to build a db server using 4x ultra320 scsi disks +> > i'm thinking raid 1+0 but will try with raid5 too and compare +> > +> > Does anyone have any experience with this model, good or bad i'd like to +> > know.. thanks :) +> > +> > as seen: +> > http://uk.azzurri.com/product/product.cgi?productId=188 +> > +> > Regards, +> > Richard. +> > +> > PS: whoever mentioned starting a site with raid controller +> > reviews, excellent +> > idea - its hard to find decent info on which card to buy. +> > +> > +> > ---------------------------(end of broadcast)--------------------------- +> > TIP 9: the planner will ignore your desire to choose an index scan if your +> > joining column's datatypes do not match +> > +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: you can get off all lists at once with the unregister command +> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) +> + + +From pgsql-performance-owner@postgresql.org Mon Sep 29 11:37:37 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 6A610D1B530 + for ; + Mon, 29 Sep 2003 14:37:35 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 97325-08 + for ; + Mon, 29 Sep 2003 11:37:11 -0300 (ADT) +Received: from mail.waterford.org (67.107.203.158.ptr.us.xo.net + [67.107.203.158]) + by svr1.postgresql.org (Postfix) with ESMTP id 69383D1B52A + for ; + Mon, 29 Sep 2003 11:37:06 -0300 (ADT) +Received: by mail.waterford.org with XWall v3.27 ; + Mon, 29 Sep 2003 08:35:52 -0600 +From: Oleg Lebedev +To: Mary Edie Meredith , + Tom Lane +Cc: Jenny Zhang , + pgsql-performance +Subject: Re: TPC-R benchmarks +Date: Mon, 29 Sep 2003 08:35:51 -0600 +X-Assembled-By: XWall v3.27 +Message-ID: <993DBE5B4D02194382EC8DF8554A52731E782A@postoffice.waterford.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/355 +X-Sequence-Number: 3721 + +I left my TPC-R query #17 working over the weekend and it took 3988 mins +~ 10 hours to complete. And this is considering that I am using a TPC-R +database created with a scale factor of 1, which corresponds to ~1 GB of +data. I am running RedHat 8.0 on a dual 1 GHz processor, 512 MB RAM. + +Here is an excerpt from my postgresql.conf file (the rest of the +settings are commented out): + +# +# Shared Memory Size +# +shared_buffers =3D 16384 # 2*max_connections, min 16, typically +8KB each + +# +# Non-shared Memory Sizes +# +sort_mem =3D 32768 + +# +# Optimizer Parameters +# +effective_cache_size =3D 32000 # typically 8KB each + +Any suggestions on how to optimize these settings? + +I agree with Jenny that declaring additional indexes on the TPC-R tables +may alter the validity of the benchmarks. Are there any official TPC +benchmarks submitted by PostgreSQL?=20 + +Thanks. + +Oleg + +-----Original Message----- +From: Mary Edie Meredith [mailto:maryedie@osdl.org]=20 +Sent: Friday, September 26, 2003 10:12 AM +To: Tom Lane +Cc: Oleg Lebedev; Jenny Zhang; pgsql-performance +Subject: Re: [PERFORM] TPC-R benchmarks + + +The TPC-H/R rules allow only minor changes to the SQL that are necessary +due to SQL implementation differences. They do not allow changes made to +improve performance. It is their way to test optimizer's ability to +recognize an inefficient SQL statement and do the rewrite. + +The rule makes sense for the TPC-H, which is supposed to represent +ad-Hoc query. One might argue that for TPC-R, which is suppose to +represent "Reporting" with pre-knowledge of the query, that re-write +should be allowed. However, that is currently not the case. Since the +RDBMS's represented on the TPC council are competing with TPC-H, their +optimizers already do the re-write, so (IMHO) there is no motivation to +relax the rules for the TPC-R. + + +On Thu, 2003-09-25 at 21:28, Tom Lane wrote: +> Oleg Lebedev writes: +> > Seems like in your case postgres uses an i_l_partkey index on=20 +> > lineitem table. I have a foreign key constraint defined between the=20 +> > lineitem and part table, but didn't create an special indexes. Here=20 +> > is my query plan: +>=20 +> The planner is obviously unhappy with this plan (note the large cost=20 +> numbers), but it can't find a way to do better. An index on=20 +> lineitem.l_partkey would help, I think. +>=20 +> The whole query seems like it's written in a very inefficient fashion; + +> couldn't the estimation of '0.2 * avg(l_quantity)' be amortized across + +> multiple join rows? But I dunno whether the TPC rules allow for=20 +> significant manual rewriting of the given query. +>=20 +> regards, tom lane +>=20 +> ---------------------------(end of=20 +> broadcast)--------------------------- +> TIP 3: 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 +--=20 +Mary Edie Meredith +Open Source Development Lab + +************************************* + +This e-mail may contain privileged or confidential material intended for th= +e named recipient only. +If you are not the named recipient, delete this message and all attachments. +Unauthorized reviewing, copying, printing, disclosing, or otherwise using i= +nformation in this e-mail is prohibited. +We reserve the right to monitor e-mail sent through our network.=20 + +************************************* + + +From pgsql-performance-owner@postgresql.org Mon Sep 29 11:46:04 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A7993D1B51D + for ; + Mon, 29 Sep 2003 14:46:02 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 97967-08 + for ; + Mon, 29 Sep 2003 11:45:38 -0300 (ADT) +Received: from smtp.pspl.co.in (unknown [202.54.11.65]) + by svr1.postgresql.org (Postfix) with ESMTP id 14A0FD1B53C + for ; + Mon, 29 Sep 2003 11:45:33 -0300 (ADT) +Received: (from root@localhost) + by smtp.pspl.co.in (8.12.9/8.12.9) id h8TElqW0031656 + for ; Mon, 29 Sep 2003 20:17:52 +0530 +Received: from persistent.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) + (authenticated bits=0) + by persistent.co.in (8.12.9/8.12.9) with ESMTP id h8TElojj031591; + Mon, 29 Sep 2003 20:17:50 +0530 +Message-ID: <3F784607.5020705@persistent.co.in> +Date: Mon, 29 Sep 2003 20:17:35 +0530 +From: Shridhar Daithankar +Organization: Persistent Systems Pvt. Ltd. +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; + rv:1.5b) Gecko/20030917 Thunderbird/0.3a +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Oleg Lebedev +Cc: Mary Edie Meredith , + Tom Lane , Jenny Zhang , + pgsql-performance +Subject: Re: TPC-R benchmarks +References: <993DBE5B4D02194382EC8DF8554A52731E782A@postoffice.waterford.org> +In-Reply-To: <993DBE5B4D02194382EC8DF8554A52731E782A@postoffice.waterford.org> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/356 +X-Sequence-Number: 3722 + +Oleg Lebedev wrote: +> effective_cache_size = 32000 # typically 8KB each + +That is 256MB. You can raise it to 350+MB if nothing else is running on the box. +Also if you have fast disk drives, you can reduce random page cost to 2 or 1.5. + +I don't know how much this will make any difference to benchmark results but +usually this helps when queries are slow. + + HTH + + Shridhar + + +From pgsql-performance-owner@postgresql.org Mon Sep 29 12:00:21 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A0AE6D1B51D + for ; + Mon, 29 Sep 2003 15:00:17 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 00698-02 + for ; + Mon, 29 Sep 2003 11:59:45 -0300 (ADT) +Received: from lucifer.oficina (unknown [200.69.203.237]) + by svr1.postgresql.org (Postfix) with ESMTP id 86562D1B535 + for ; + Mon, 29 Sep 2003 11:59:44 -0300 (ADT) +Received: from [192.168.1.174] (taz.oficina [192.168.1.174] (may be forged)) + (authenticated bits=0) + by lucifer.oficina (8.12.9/8.12.9) with ESMTP id h8TEuBv2026796; + Mon, 29 Sep 2003 11:56:11 -0300 (ART) + (envelope-from franco@akyasociados.com.ar) +Subject: Re: Performance: BigInt vs Decimal(19,0) +From: Franco Bruno Borghesi +To: Josh Berkus +Cc: "Yusuf W." , + "pgsql-performance@postgresql.org" +In-Reply-To: <200309272006.42462.josh@agliodbs.com> +References: <20030928023936.66818.qmail@web40408.mail.yahoo.com> + <200309272006.42462.josh@agliodbs.com> +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="=-pHKcHuJ2SHi09Kwy+Rr5" +Organization: AK y Asociados S.R.L. +Message-Id: <1064847566.690.15.camel@taz> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.4 +Date: Mon, 29 Sep 2003 11:59:27 -0300 +X-MailScanner-Information: Please contact the ISP for more information +X-MailScanner: Found to be clean +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/357 +X-Sequence-Number: 3723 + +--=-pHKcHuJ2SHi09Kwy+Rr5 +Content-Type: multipart/alternative; boundary="=-HDPLPISq7frl/BaUncIx" + +--=-HDPLPISq7frl/BaUncIx +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +Wouldn't it be the most portable solution to work with a domain? +CREATE DOMAIN BIG_NUMBER AS BIGINT; + +If I use BIG_NUMBER everywhere I need it in my database, porting it to +other database products should be easy... any SQL 92 compliant dbms +should support domains. + +On Sun, 2003-09-28 at 00:06, Josh Berkus wrote: + +> Yusuf, +>=20 +> > Does anyone know where I could get some documentation +> > on how the int and decimal are implemented so I could +> > prove to him that ints are better? Can people suggest +> > good points to make in order to prove it? +>=20 +> RTFM: +> http://www.postgresql.org/docs/7.3/interactive/datatype.html#DATATYPE-NUM= +ERIC + +--=-HDPLPISq7frl/BaUncIx +Content-Type: text/html; charset=utf-8 +Content-Transfer-Encoding: quoted-printable + + + + + + + + +Wouldn't it be the most portable solution to work with a domain?
+CREATE DOMAIN BIG_NUMBER AS BIGINT;
+
+If I use BIG_NUMBER everywhere I need it in my database, porting it to othe= +r database products should be easy... any SQL 92 compliant dbms should supp= +ort domains.
+
+On Sun, 2003-09-28 at 00:06, Josh Berkus wrote: +
+
Yusuf,
+
+> Does anyone know where I could get some documentation
+> on how the int and decimal are implemented so I could
+> prove to him that ints are better?  Can people suggest
+> good points to make in order to prove it?
+
+RTFM:
+http://www.postgresql.org/docs/7.3/interactive/datatype.h=
+tml#DATATYPE-NUMERIC
+
+ + + +--=-HDPLPISq7frl/BaUncIx-- + +--=-pHKcHuJ2SHi09Kwy+Rr5 +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: This is a digitally signed message part + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.2 (FreeBSD) + +iD8DBQA/eEjO21dVnhLsBV0RAl3RAKCEVcENTcRP/pyK4o8ztX9NBlvvhwCfXaku +PnVAHb3cLSmhIc77kXH0K4Y= +=CyhK +-----END PGP SIGNATURE----- + +--=-pHKcHuJ2SHi09Kwy+Rr5-- + + +From pgsql-performance-owner@postgresql.org Mon Sep 29 13:41:48 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3440CD1B4FC + for ; + Mon, 29 Sep 2003 16:33:04 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 12623-06 + for ; + Mon, 29 Sep 2003 13:32:36 -0300 (ADT) +Received: from news.hub.org (unknown [64.117.224.194]) + by svr1.postgresql.org (Postfix) with ESMTP id A81E8D1B4EC + for ; + Mon, 29 Sep 2003 13:32:35 -0300 (ADT) +Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] + (may be forged)) + by news.hub.org (8.12.9/8.12.9) with ESMTP id h8TGWZhM009113 + for ; Mon, 29 Sep 2003 16:32:35 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.12.9/8.12.9/Submit) id h8TGA3Y5002996 + for pgsql-performance@postgresql.org; Mon, 29 Sep 2003 16:10:03 GMT +From: Christopher Browne +X-Newsgroups: comp.databases.postgresql.performance +Subject: Re: avoiding seqscan? +Date: Mon, 29 Sep 2003 11:12:55 -0400 +Organization: Hub.Org Networking Services +Lines: 27 +Message-ID: <60vfrbzkzs.fsf@dev6.int.libertyrms.info> +References: <95900000.1064782481@palle.girgensohn.se> + <3F7766B3.4030705@bigfoot.com> + <180710000.1064841936@durian.pingpong.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@news.hub.org +User-Agent: Gnus/5.1003 (Gnus v5.10.3) XEmacs/21.4 (Rational FORTRAN, linux) +Cancel-Lock: sha1:6QNJw1BqVlUQlGhapAbWmM2GNn8= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/361 +X-Sequence-Number: 3727 + +girgen@pingpong.net (Palle Girgensohn) writes: +> Will that make a difference? From what I've seen, it does not make +> much difference, but I have seen queries speed up when rewritten +> explicit joins. I guess it depends on other things, but is it really +> so that the explicit joins are bad somehow? Do you have any pointers +> to documentation about it, if so? + +The problem is that if you expressly specify the joins, the query +optimizer can't choose its own paths. And while that may not be +better at the moment, it is quite possible that when you upgrade to a +newer version, those queries, if "not join-specified," could +immediately get faster. + +I would expect that the query that uses implicit joins will be clearer +to read, which adds a little further merit to that direction. + +That goes along with the usual way that it is preferable to optimize +things, namely that you should start by solving the problem as simply +as you can, and only proceed to further optimization if that actually +proves necessary. Optimization efforts commonly add complexity and +make code more difficult to maintain; that's not the place to start if +you don't even know the effort is necessary. +-- +(format nil "~S@~S" "cbbrowne" "libertyrms.info") + +Christopher Browne +(416) 646 3304 x124 (land) + +From pgsql-admin-owner@postgresql.org Mon Sep 29 12:24:25 2003 +X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 1741CD1B50B + for ; + Mon, 29 Sep 2003 15:24:22 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 01799-04 + for ; + Mon, 29 Sep 2003 12:23:51 -0300 (ADT) +Received: from biglumber.com (biglumber.com [207.228.252.42]) + by svr1.postgresql.org (Postfix) with SMTP id 1F14DD1B51D + for ; Mon, 29 Sep 2003 12:23:51 -0300 (ADT) +Received: (qmail 28785 invoked from network); 29 Sep 2003 15:23:50 -0000 +Received: from biglumber.com (HELO localhost) (207.228.252.42) + by 0 with SMTP; 29 Sep 2003 15:23:50 -0000 +From: greg@turnstep.com +To: pgsql-performance@postgresql.org +Cc: pgsql-admin@postgresql.org +Cc: pgsql-admin@postgresql.org +Subject: Re: [PERFORM] Plan-Reading +X-PGP-Key: 2529 DF6A B8F7 9407 E944 45B4 BC9B 9067 1496 4AC8 +X-Request-PGP: + http://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 +In-Reply-To: <1064594879.3f746dbf81696@sistemica.info> +Date: Mon, 29 Sep 2003 15:23:49 -0000 +X-Mailer: JoyMail 1.38 +Message-ID: <4ddc197ee8addd85f5cf94c06de37f97@biglumber.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/467 +X-Sequence-Number: 10555 + + +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + + + +> Where can I find a plan-readinf tutorial? + +This covers explain plans in depth: + +http://www.gtsm.com/oscon2003/explain.html + +- -- +Greg Sabino Mullane greg@turnstep.com +PGP Key: 0x14964AC8 200309291123 + +-----BEGIN PGP SIGNATURE----- +Comment: http://www.turnstep.com/pgp.html + +iD8DBQE/eE65vJuQZxSWSsgRAiJeAJ9YPEopowDJiRgn9sXnrF2G8ddVHACfRR3F +3mwwf3V1P1XCAB6wy/LnoXc= +=5El1 +-----END PGP SIGNATURE----- + + + +From pgsql-performance-owner@postgresql.org Mon Sep 29 13:05:00 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B88C8D1B4F2 + for ; + Mon, 29 Sep 2003 16:04:58 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 10623-10 + for ; + Mon, 29 Sep 2003 13:04:26 -0300 (ADT) +Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) + by svr1.postgresql.org (Postfix) with ESMTP id AA97CD1B50E + for ; + Mon, 29 Sep 2003 13:04:25 -0300 (ADT) +Received: from ibm-e.pdx.osdl.net (ibm-e.pdx.osdl.net [172.20.1.71]) + by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h8TG49118112; + Mon, 29 Sep 2003 09:04:09 -0700 +Subject: Re: TPC-R benchmarks +From: Mary Edie Meredith +To: Oleg Lebedev +Cc: Tom Lane , Jenny Zhang , + pgsql-performance +In-Reply-To: <993DBE5B4D02194382EC8DF8554A52731E782A@postoffice.waterford.org> +References: <993DBE5B4D02194382EC8DF8554A52731E782A@postoffice.waterford.org> +Content-Type: text/plain +Organization: Open Source Development Lab +Message-Id: <1064851449.23330.2942.camel@ibm-e.pdx.osdl.net> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.2.2 +Date: 29 Sep 2003 09:04:09 -0700 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/359 +X-Sequence-Number: 3725 + +On Mon, 2003-09-29 at 07:35, Oleg Lebedev wrote: +> I left my TPC-R query #17 working over the weekend and it took 3988 mins +> ~ 10 hours to complete. And this is considering that I am using a TPC-R +> database created with a scale factor of 1, which corresponds to ~1 GB of +> data. I am running RedHat 8.0 on a dual 1 GHz processor, 512 MB RAM. + +Was this run with or without the l_partkey index that Jenny suggested? + +> +> Here is an excerpt from my postgresql.conf file (the rest of the +> settings are commented out): +> +> # +> # Shared Memory Size +> # +> shared_buffers = 16384 # 2*max_connections, min 16, typically +> 8KB each +> +> # +> # Non-shared Memory Sizes +> # +> sort_mem = 32768 +> +> # +> # Optimizer Parameters +> # +> effective_cache_size = 32000 # typically 8KB each +> +> Any suggestions on how to optimize these settings? +> +> I agree with Jenny that declaring additional indexes on the TPC-R tables +> may alter the validity of the benchmarks. Are there any official TPC +> benchmarks submitted by PostgreSQL? + +Actually, for the TPC-R you _are allowed to declare additional indexes. +With TPC-H you are restricted to a specific set listed in the spec (an +index on l_partkey is allowed for both). + +What you cannot do for either TPC-R or TPC-H is rewrite the SQL of the +query for the purposes of making the query run faster. + +Sorry if I was unclear. + +Valid TPC-R benchmark results are on the TPC web site: +http://www.tpc.org/tpcr/default.asp + +I do not see one for PostgreSQL. + + +Regards, + +Mary + +-- +Mary Edie Meredith +Open Source Development Lab + +> +> Thanks. +> +> Oleg +> +> -----Original Message----- +> From: Mary Edie Meredith [mailto:maryedie@osdl.org] +> Sent: Friday, September 26, 2003 10:12 AM +> To: Tom Lane +> Cc: Oleg Lebedev; Jenny Zhang; pgsql-performance +> Subject: Re: [PERFORM] TPC-R benchmarks +> +> +> The TPC-H/R rules allow only minor changes to the SQL that are necessary +> due to SQL implementation differences. They do not allow changes made to +> improve performance. It is their way to test optimizer's ability to +> recognize an inefficient SQL statement and do the rewrite. +> +> The rule makes sense for the TPC-H, which is supposed to represent +> ad-Hoc query. One might argue that for TPC-R, which is suppose to +> represent "Reporting" with pre-knowledge of the query, that re-write +> should be allowed. However, that is currently not the case. Since the +> RDBMS's represented on the TPC council are competing with TPC-H, their +> optimizers already do the re-write, so (IMHO) there is no motivation to +> relax the rules for the TPC-R. +> +> +> On Thu, 2003-09-25 at 21:28, Tom Lane wrote: +> > Oleg Lebedev writes: +> > > Seems like in your case postgres uses an i_l_partkey index on +> > > lineitem table. I have a foreign key constraint defined between the +> > > lineitem and part table, but didn't create an special indexes. Here +> > > is my query plan: +> > +> > The planner is obviously unhappy with this plan (note the large cost +> > numbers), but it can't find a way to do better. An index on +> > lineitem.l_partkey would help, I think. +> > +> > The whole query seems like it's written in a very inefficient fashion; +> +> > couldn't the estimation of '0.2 * avg(l_quantity)' be amortized across +> +> > multiple join rows? But I dunno whether the TPC rules allow for +> > significant manual rewriting of the given query. +> > +> > regards, tom lane +> > +> > ---------------------------(end of +> > broadcast)--------------------------- +> > TIP 3: 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 Mon Sep 29 13:26:56 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C39A7D1B4F1 + for ; + Mon, 29 Sep 2003 16:26:53 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 12548-09 + for ; + Mon, 29 Sep 2003 13:26:25 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id E6A12D1B4E1 + for ; + Mon, 29 Sep 2003 13:26:24 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h8TGQL6c025202; + Mon, 29 Sep 2003 12:26:21 -0400 (EDT) +To: Mary Edie Meredith +Cc: Oleg Lebedev , Jenny Zhang , + pgsql-performance +Subject: Re: TPC-R benchmarks +In-reply-to: <1064851449.23330.2942.camel@ibm-e.pdx.osdl.net> +References: <993DBE5B4D02194382EC8DF8554A52731E782A@postoffice.waterford.org> + <1064851449.23330.2942.camel@ibm-e.pdx.osdl.net> +Comments: In-reply-to Mary Edie Meredith + message dated "29 Sep 2003 09:04:09 -0700" +Date: Mon, 29 Sep 2003 12:26:21 -0400 +Message-ID: <25201.1064852781@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/360 +X-Sequence-Number: 3726 + +Mary Edie Meredith writes: +> Valid TPC-R benchmark results are on the TPC web site: +> http://www.tpc.org/tpcr/default.asp +> I do not see one for PostgreSQL. + +I'm pretty certain that there are no TPC-certified test results for +Postgres, because to date no organization has cared to spend the money +needed to perform a certifiable test. From what I understand you need +a pretty significant commitment of people and hardware to jump through +all the hoops involved... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Sep 29 14:41:06 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id CF9ADD1B51C + for ; + Mon, 29 Sep 2003 16:35:33 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 18639-06 + for ; + Mon, 29 Sep 2003 13:35:05 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id F275AD1B52A + for ; + Mon, 29 Sep 2003 13:35:04 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h8TGXd6c025271; + Mon, 29 Sep 2003 12:33:39 -0400 (EDT) +To: Shridhar Daithankar +Cc: Oleg Lebedev , + Mary Edie Meredith , Jenny Zhang , + pgsql-performance +Subject: Re: TPC-R benchmarks +In-reply-to: <3F784607.5020705@persistent.co.in> +References: <993DBE5B4D02194382EC8DF8554A52731E782A@postoffice.waterford.org> + <3F784607.5020705@persistent.co.in> +Comments: In-reply-to Shridhar Daithankar + + message dated "Mon, 29 Sep 2003 20:17:35 +0530" +Date: Mon, 29 Sep 2003 12:33:39 -0400 +Message-ID: <25270.1064853219@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/367 +X-Sequence-Number: 3733 + +Shridhar Daithankar writes: +> Also if you have fast disk drives, you can reduce random page cost to 2 or 1.5. + +Note however that most of the people who have found smaller +random_page_cost to be helpful are in situations where most of their +data fits in RAM. Reducing the cost towards 1 simply reflects the fact +that there's no sequential-fetch advantage when grabbing data that's +already in RAM. + +When benchmarking with data sets considerably larger than available +buffer cache, I rather doubt that small random_page_cost would be a good +idea. Still, you might as well experiment to see. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Sep 29 14:49:01 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 92E2BD1B8B7 + for ; + Mon, 29 Sep 2003 17:31:47 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 33145-06 + for ; + Mon, 29 Sep 2003 14:31:19 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id 55954D1B576 + for ; + Mon, 29 Sep 2003 14:30:43 -0300 (ADT) +Received: from [63.195.55.98] (HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3694916; Mon, 29 Sep 2003 10:20:48 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Organization: Aglio Database Solutions +To: Franco Bruno Borghesi +Subject: Re: Performance: BigInt vs Decimal(19,0) +Date: Mon, 29 Sep 2003 10:19:33 -0700 +User-Agent: KMail/1.4.3 +Cc: "Yusuf W." , + "pgsql-performance@postgresql.org" +References: <20030928023936.66818.qmail@web40408.mail.yahoo.com> + <200309272006.42462.josh@agliodbs.com> + <1064847566.690.15.camel@taz> +In-Reply-To: <1064847566.690.15.camel@taz> +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-Id: <200309291019.33153.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/369 +X-Sequence-Number: 3735 + +Franco, + +> Wouldn't it be the most portable solution to work with a domain? +> CREATE DOMAIN BIG_NUMBER AS BIGINT; +> +> If I use BIG_NUMBER everywhere I need it in my database, porting it to +> other database products should be easy... any SQL 92 compliant dbms +> should support domains. + +This is a good idea, on general principles. Abstracted design is a good +thing. + +Regrettably, though, a lot of commercial databases do not support DOMAIN. +You'll need to check which databases you are thinking of porting to first. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Mon Sep 29 14:50:17 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 9EFACD1B897 + for ; + Mon, 29 Sep 2003 17:30:51 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 33751-01 + for ; + Mon, 29 Sep 2003 14:30:21 -0300 (ADT) +Received: from isis.pcis.net (cr.pcis.net [207.18.226.3]) + by svr1.postgresql.org (Postfix) with ESMTP id C42AAD1B90B + for ; + Mon, 29 Sep 2003 14:28:44 -0300 (ADT) +Received: from lyric.ofsloans.com (unverified [209.180.142.225]) by + isis.pcis.net + (Rockliffe SMTPRA 4.5.6) with ESMTP id ; + Mon, 29 Sep 2003 12:20:35 -0500 +Subject: Re: advice on raid controller +From: Will LaShell +To: pgsql-performance@postgresql.org +Cc: rj@last.fm +In-Reply-To: +References: +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="=-LIOKaAneoVd13t11qOKu" +X-Mailer: Ximian Evolution 1.0.8 (1.0.8-11) +Date: 29 Sep 2003 10:20:14 -0700 +Message-Id: <1064856034.10565.15.camel@lyric.ofsloans.com> +Mime-Version: 1.0 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/370 +X-Sequence-Number: 3736 + +--=-LIOKaAneoVd13t11qOKu +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +On Mon, 2003-09-29 at 06:48, scott.marlowe wrote: +> I've used the megaraid / LSI cards in the past and they were pretty good= +=20 +> in terms of reliability, but the last one I used was the 328 model, from = +4=20 +> years ago or so. that one had a battery backup option for the cache, and= +=20 +> could go to 128 Meg. We tested it with 4/16 and 128 meg ram, and it was= +=20 +> about the same with each, but we didn't do heavy parallel testing either. +>=20 +> Here's the page on the megaraid cards at lsilogic.com: +>=20 +> http://www.lsilogic.com/products/stor_prod/raid/ultra320products.html +>=20 +> On Sun, 28 Sep 2003, Matt Clark wrote: +>=20 +> > As others have mentioned, you really ought to get battery-backed cache = +if +> > you're doing any volume of writes. The ability to do safe write-back +> > caching makes an *insane* difference to write performance. +> >=20 +> > The site you link to also has that for only 15% more money: +> > http://uk.azzurri.com/product/product.cgi?productId=3D80 +> >=20 +> > No experience with the card(s) I'm afraid. +> >=20 +> > In general though, U320 will only be faster than U160 for large sequent= +ial +> > reads, or when you have silly numbers of disks on a channel (i.e. more = +than +> > 4/channel). If you have silly numbers of disks, then RAID5 will probab= +ly be +> > better, if you have 4 disks total then RAID1+0 will probably be better.= + In +> > between it depends on all sorts of other factors. Bear in mind though = +that +> > if you *do* have silly numbers of disks then more channels and more cac= +he +> > will count for more than anything else, so spend the money on that rath= +er +> > than latest-and-greatest performance for a single channel. + +Just to add my thoughts, we use the MegaRaid Elite 1650 in 3 servers +here that drive our core databases. We paired up the controllers with +the Seagate Cheetah 10k drives, we could have purchased the X15's which +are Seagate's 15k version, but due to budget constraints and lack of +true performance increase from the 10k to the 15k rpm drives we didn't +opt for them. + +I have to say that I've been 100% pleased with the performance and +reliability of the Megaraid controllers. They do everything a good +controller should and they are very easy to manage. The driver is +actively maintained by the guys at LSI and their tech support personnel +are very good as well. + +If you want any specific information or have any questions about our +experience or configuration please feel free to contact me. + +Sincerely, + +Will LaShell + + + +> > HTH +> >=20 +> > Matt +> >=20 +> > > -----Original Message----- +> > > From: pgsql-performance-owner@postgresql.org +> > > [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Richard +> > > Jones +> > > Sent: 27 September 2003 18:25 +> > > To: pgsql-performance@postgresql.org +> > > Subject: [PERFORM] advice on raid controller +> > > +> > > +> > > Hi, i'm on the verge of buying a "MegaRAID SCSI 320-2" raid controlle= +r. +> > > I need it to build a db server using 4x ultra320 scsi disks +> > > i'm thinking raid 1+0 but will try with raid5 too and compare +> > > +> > > Does anyone have any experience with this model, good or bad i'd like= + to +> > > know.. thanks :) +> > > +> > > as seen: +> > > http://uk.azzurri.com/product/product.cgi?productId=3D188 +> > > +> > > Regards, +> > > Richard. +> > > +> > > PS: whoever mentioned starting a site with raid controller +> > > reviews, excellent +> > > idea - its hard to find decent info on which card to buy. + + +--=-LIOKaAneoVd13t11qOKu +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: This is a digitally signed message part + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.0.7 (GNU/Linux) + +iD8DBQA/eGnOZr3R5kgOZd0RAoToAJ4nZS/yz+2J/Gjn2WAEslFLSS5rtQCfRJqY +y3OTKz+otSgc+656KQyn/hs= +=KAwT +-----END PGP SIGNATURE----- + +--=-LIOKaAneoVd13t11qOKu-- + + +From pgsql-performance-owner@postgresql.org Mon Sep 29 14:28:27 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DA453D1B563 + for ; + Mon, 29 Sep 2003 17:25:15 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 31852-06 + for ; + Mon, 29 Sep 2003 14:24:48 -0300 (ADT) +Received: from mail.waterford.org (67.107.203.158.ptr.us.xo.net + [67.107.203.158]) + by svr1.postgresql.org (Postfix) with ESMTP id BACBCD1B549 + for ; + Mon, 29 Sep 2003 14:24:46 -0300 (ADT) +Received: by mail.waterford.org with XWall v3.27 ; + Mon, 29 Sep 2003 11:23:29 -0600 +From: Oleg Lebedev +To: Mary Edie Meredith +Cc: Jenny Zhang , + pgsql-performance +Subject: Re: TPC-R benchmarks +Date: Mon, 29 Sep 2003 11:23:29 -0600 +X-Assembled-By: XWall v3.27 +Message-ID: <993DBE5B4D02194382EC8DF8554A52731E782B@postoffice.waterford.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/365 +X-Sequence-Number: 3731 + + +It took 10 hours to compute the query without the index on +lineitem.l_partkey. +Once I created the index on lineitem.l_partkey, it took only 32 secs to +run the same query.=20=20 +After VACUUM ANALYZE it took 72 secs to run the query. +All the subsequent runs took under 3 seconds! + +That's quite amazing! + +I just checked=20=20 + +-----Original Message----- +From: Mary Edie Meredith [mailto:maryedie@osdl.org]=20 +Sent: Monday, September 29, 2003 10:04 AM +To: Oleg Lebedev +Cc: Tom Lane; Jenny Zhang; pgsql-performance +Subject: RE: [PERFORM] TPC-R benchmarks + + +On Mon, 2003-09-29 at 07:35, Oleg Lebedev wrote: +> I left my TPC-R query #17 working over the weekend and it took 3988=20 +> mins ~ 10 hours to complete. And this is considering that I am using a + +> TPC-R database created with a scale factor of 1, which corresponds to=20 +> ~1 GB of data. I am running RedHat 8.0 on a dual 1 GHz processor, 512=20 +> MB RAM. + +Was this run with or without the l_partkey index that Jenny suggested?=20 + +>=20 +> Here is an excerpt from my postgresql.conf file (the rest of the=20 +> settings are commented out): +>=20 +> # +> # Shared Memory Size +> # +> shared_buffers =3D 16384 # 2*max_connections, min 16, +typically +> 8KB each +>=20 +> # +> # Non-shared Memory Sizes +> # +> sort_mem =3D 32768 +>=20 +> # +> # Optimizer Parameters +> # +> effective_cache_size =3D 32000 # typically 8KB each +>=20 +> Any suggestions on how to optimize these settings? +>=20 +> I agree with Jenny that declaring additional indexes on the TPC-R=20 +> tables may alter the validity of the benchmarks. Are there any=20 +> official TPC benchmarks submitted by PostgreSQL? + +Actually, for the TPC-R you _are allowed to declare additional indexes.=20 +With TPC-H you are restricted to a specific set listed in the spec (an +index on l_partkey is allowed for both). + +What you cannot do for either TPC-R or TPC-H is rewrite the SQL of the +query for the purposes of making the query run faster. + +Sorry if I was unclear. + +Valid TPC-R benchmark results are on the TPC web site: +http://www.tpc.org/tpcr/default.asp=20=20 + +I do not see one for PostgreSQL. + + +Regards, + +Mary=20 + +--=20 +Mary Edie Meredith +Open Source Development Lab + +>=20 +> Thanks. +>=20 +> Oleg +>=20 +> -----Original Message----- +> From: Mary Edie Meredith [mailto:maryedie@osdl.org] +> Sent: Friday, September 26, 2003 10:12 AM +> To: Tom Lane +> Cc: Oleg Lebedev; Jenny Zhang; pgsql-performance +> Subject: Re: [PERFORM] TPC-R benchmarks +>=20 +>=20 +> The TPC-H/R rules allow only minor changes to the SQL that are=20 +> necessary due to SQL implementation differences. They do not allow=20 +> changes made to improve performance. It is their way to test=20 +> optimizer's ability to recognize an inefficient SQL statement and do=20 +> the rewrite. +>=20 +> The rule makes sense for the TPC-H, which is supposed to represent=20 +> ad-Hoc query. One might argue that for TPC-R, which is suppose to=20 +> represent "Reporting" with pre-knowledge of the query, that re-write=20 +> should be allowed. However, that is currently not the case. Since the=20 +> RDBMS's represented on the TPC council are competing with TPC-H, their + +> optimizers already do the re-write, so (IMHO) there is no motivation=20 +> to relax the rules for the TPC-R. +>=20 +>=20 +> On Thu, 2003-09-25 at 21:28, Tom Lane wrote: +> > Oleg Lebedev writes: +> > > Seems like in your case postgres uses an i_l_partkey index on +> > > lineitem table. I have a foreign key constraint defined between +the=20 +> > > lineitem and part table, but didn't create an special indexes. +Here=20 +> > > is my query plan: +> >=20 +> > The planner is obviously unhappy with this plan (note the large cost +> > numbers), but it can't find a way to do better. An index on=20 +> > lineitem.l_partkey would help, I think. +> >=20 +> > The whole query seems like it's written in a very inefficient=20 +> > fashion; +>=20 +> > couldn't the estimation of '0.2 * avg(l_quantity)' be amortized=20 +> > across +>=20 +> > multiple join rows? But I dunno whether the TPC rules allow for +> > significant manual rewriting of the given query. +> >=20 +> > regards, tom lane +> >=20 +> > ---------------------------(end of +> > broadcast)--------------------------- +> > TIP 3: 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 + +************************************* + +This e-mail may contain privileged or confidential material intended for th= +e named recipient only. +If you are not the named recipient, delete this message and all attachments. +Unauthorized reviewing, copying, printing, disclosing, or otherwise using i= +nformation in this e-mail is prohibited. +We reserve the right to monitor e-mail sent through our network.=20 + +************************************* + +From pgsql-performance-owner@postgresql.org Mon Sep 29 14:27:07 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 01B0CD1B8A3 + for ; + Mon, 29 Sep 2003 17:26:19 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 31508-08 + for ; + Mon, 29 Sep 2003 14:25:48 -0300 (ADT) +Received: from steelhead.ravensfield.com (unknown [65.222.52.254]) + by svr1.postgresql.org (Postfix) with ESMTP id 9B06BD1B4FC + for ; + Mon, 29 Sep 2003 14:25:47 -0300 (ADT) +Received: from ravensfield.com (smallmouth.oh.ia [10.1.1.7]) + by steelhead.ravensfield.com (Postfix) with ESMTP + id 97D4366142; Mon, 29 Sep 2003 13:25:47 -0400 (EDT) +Date: Mon, 29 Sep 2003 13:26:31 -0400 +Subject: Re: Performance: BigInt vs Decimal(19,0) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Mime-Version: 1.0 (Apple Message framework v552) +Cc: pgsql-performance@postgresql.org +To: "Yusuf W." +From: Andrew Rawnsley +In-Reply-To: <20030928023936.66818.qmail@web40408.mail.yahoo.com> +Message-Id: <11139366-F2A2-11D7-9577-000393A47FCC@ravensfield.com> +Content-Transfer-Encoding: 7bit +X-Mailer: Apple Mail (2.552) +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/364 +X-Sequence-Number: 3730 + + +On Saturday, September 27, 2003, at 10:39 PM, Yusuf W. wrote: + +> Now, I've got to convince my project's software +> architech, that a bigint would be better than a +> decimal. +> +> Does anyone know where I could get some documentation +> on how the int and decimal are implemented so I could +> prove to him that ints are better? Can people suggest +> good points to make in order to prove it? +> + +Print out Tom's reply and give it to him. Saying 'one of the people who +develops the thing says so' ought to carry some weight. I would hope... + + +> Thanks in advance. +> +> --- Tom Lane wrote: +>> "Yusuf W." writes: +>>> For the application that I'm working on, we want +>> to +>>> use data types that are database independent. +>> (most +>>> databases has decimal, but not big int). +>> +>> Most databases have bigint, I think. +>> +>>> Anyhow, we are planning on using decimal(19,0) for +>> our +>>> primary keys instead of a big int, would there be +>> a +>>> performance difference in using a bigint over +>> using decimals? +>> +>> You'll be taking a very large performance hit, for +>> very little benefit +>> that I can see. How hard could it be to change the +>> column declarations +>> if you ever move to a database without bigint? +>> There's not normally +>> much need for apps to be explicitly aware of the +>> column type names. +>> +>> regards, tom lane +> +> +> __________________________________ +> Do you Yahoo!? +> The New Yahoo! Shopping - with improved product search +> http://shopping.yahoo.com +> +> ---------------------------(end of +> broadcast)--------------------------- +> TIP 1: subscribe and unsubscribe commands go to +> majordomo@postgresql.org +> +-------------------- + +Andrew Rawnsley +President +The Ravensfield Digital Resource Group, Ltd. +(740) 587-0114 +www.ravensfield.com + + +From pgsql-performance-owner@postgresql.org Mon Sep 29 14:40:13 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 869F0D1B55E + for ; + Mon, 29 Sep 2003 17:40:12 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 33908-08 + for ; + Mon, 29 Sep 2003 14:39:45 -0300 (ADT) +Received: from mail.waterford.org (67.107.203.158.ptr.us.xo.net + [67.107.203.158]) + by svr1.postgresql.org (Postfix) with ESMTP id 76C4CD1B993 + for ; + Mon, 29 Sep 2003 14:38:26 -0300 (ADT) +Received: by mail.waterford.org with XWall v3.27 ; + Mon, 29 Sep 2003 11:37:11 -0600 +From: Oleg Lebedev +To: Mary Edie Meredith +Cc: Jenny Zhang , + pgsql-performance +Subject: Re: TPC-R benchmarks +Date: Mon, 29 Sep 2003 11:37:11 -0600 +X-Assembled-By: XWall v3.27 +Message-ID: <993DBE5B4D02194382EC8DF8554A52731D75EC@postoffice.waterford.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/366 +X-Sequence-Number: 3732 + + +Oops, my previous message got cut off. +Here is the end of it: +I just checked the restrictions on the TPC-R and TPC-H schemas and it +seems that all indexes are allowed in TPC-R and only those that index +parts of primary or foreign keys are allowed in TPC-H. +Thanks. + +Oleg=20 + +-----Original Message----- +From: Oleg Lebedev=20 +Sent: Monday, September 29, 2003 11:23 AM +To: Mary Edie Meredith +Cc: Jenny Zhang; pgsql-performance +Subject: Re: [PERFORM] TPC-R benchmarks +Importance: Low + + + +It took 10 hours to compute the query without the index on +lineitem.l_partkey. Once I created the index on lineitem.l_partkey, it +took only 32 secs to run the same query.=20=20 +After VACUUM ANALYZE it took 72 secs to run the query. +All the subsequent runs took under 3 seconds! + +That's quite amazing! + +I just checked=20=20 + +-----Original Message----- +From: Mary Edie Meredith [mailto:maryedie@osdl.org]=20 +Sent: Monday, September 29, 2003 10:04 AM +To: Oleg Lebedev +Cc: Tom Lane; Jenny Zhang; pgsql-performance +Subject: RE: [PERFORM] TPC-R benchmarks + + +On Mon, 2003-09-29 at 07:35, Oleg Lebedev wrote: +> I left my TPC-R query #17 working over the weekend and it took 3988 +> mins ~ 10 hours to complete. And this is considering that I am using a + +> TPC-R database created with a scale factor of 1, which corresponds to +> ~1 GB of data. I am running RedHat 8.0 on a dual 1 GHz processor, 512=20 +> MB RAM. + +Was this run with or without the l_partkey index that Jenny suggested?=20 + +>=20 +> Here is an excerpt from my postgresql.conf file (the rest of the +> settings are commented out): +>=20 +> # +> # Shared Memory Size +> # +> shared_buffers =3D 16384 # 2*max_connections, min 16, +typically +> 8KB each +>=20 +> # +> # Non-shared Memory Sizes +> # +> sort_mem =3D 32768 +>=20 +> # +> # Optimizer Parameters +> # +> effective_cache_size =3D 32000 # typically 8KB each +>=20 +> Any suggestions on how to optimize these settings? +>=20 +> I agree with Jenny that declaring additional indexes on the TPC-R +> tables may alter the validity of the benchmarks. Are there any=20 +> official TPC benchmarks submitted by PostgreSQL? + +Actually, for the TPC-R you _are allowed to declare additional indexes.=20 +With TPC-H you are restricted to a specific set listed in the spec (an +index on l_partkey is allowed for both). + +What you cannot do for either TPC-R or TPC-H is rewrite the SQL of the +query for the purposes of making the query run faster. + +Sorry if I was unclear. + +Valid TPC-R benchmark results are on the TPC web site: +http://www.tpc.org/tpcr/default.asp=20=20 + +I do not see one for PostgreSQL. + + +Regards, + +Mary=20 + +--=20 +Mary Edie Meredith +Open Source Development Lab + +>=20 +> Thanks. +>=20 +> Oleg +>=20 +> -----Original Message----- +> From: Mary Edie Meredith [mailto:maryedie@osdl.org] +> Sent: Friday, September 26, 2003 10:12 AM +> To: Tom Lane +> Cc: Oleg Lebedev; Jenny Zhang; pgsql-performance +> Subject: Re: [PERFORM] TPC-R benchmarks +>=20 +>=20 +> The TPC-H/R rules allow only minor changes to the SQL that are +> necessary due to SQL implementation differences. They do not allow=20 +> changes made to improve performance. It is their way to test=20 +> optimizer's ability to recognize an inefficient SQL statement and do=20 +> the rewrite. +>=20 +> The rule makes sense for the TPC-H, which is supposed to represent +> ad-Hoc query. One might argue that for TPC-R, which is suppose to=20 +> represent "Reporting" with pre-knowledge of the query, that re-write=20 +> should be allowed. However, that is currently not the case. Since the=20 +> RDBMS's represented on the TPC council are competing with TPC-H, their + +> optimizers already do the re-write, so (IMHO) there is no motivation +> to relax the rules for the TPC-R. +>=20 +>=20 +> On Thu, 2003-09-25 at 21:28, Tom Lane wrote: +> > Oleg Lebedev writes: +> > > Seems like in your case postgres uses an i_l_partkey index on=20 +> > > lineitem table. I have a foreign key constraint defined between +the=20 +> > > lineitem and part table, but didn't create an special indexes. +Here=20 +> > > is my query plan: +> >=20 +> > The planner is obviously unhappy with this plan (note the large cost + +> > numbers), but it can't find a way to do better. An index on=20 +> > lineitem.l_partkey would help, I think. +> >=20 +> > The whole query seems like it's written in a very inefficient +> > fashion; +>=20 +> > couldn't the estimation of '0.2 * avg(l_quantity)' be amortized +> > across +>=20 +> > multiple join rows? But I dunno whether the TPC rules allow for=20 +> > significant manual rewriting of the given query. +> >=20 +> > regards, tom lane +> >=20 +> > ---------------------------(end of +> > broadcast)--------------------------- +> > TIP 3: 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 + +************************************* + +This e-mail may contain privileged or confidential material intended for +the named recipient only. If you are not the named recipient, delete +this message and all attachments. Unauthorized reviewing, copying, +printing, disclosing, or otherwise using information in this e-mail is +prohibited. We reserve the right to monitor e-mail sent through our +network.=20 + +************************************* + +---------------------------(end of broadcast)--------------------------- +TIP 5: Have you checked our extensive FAQ? + + http://www.postgresql.org/docs/faqs/FAQ.html + +************************************* + +This e-mail may contain privileged or confidential material intended for th= +e named recipient only. +If you are not the named recipient, delete this message and all attachments. +Unauthorized reviewing, copying, printing, disclosing, or otherwise using i= +nformation in this e-mail is prohibited. +We reserve the right to monitor e-mail sent through our network.=20 + +************************************* + +From pgsql-performance-owner@postgresql.org Mon Sep 29 14:45:17 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id EDEF6D1B4FC + for ; + Mon, 29 Sep 2003 17:44:20 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 34723-06 + for ; + Mon, 29 Sep 2003 14:43:53 -0300 (ADT) +Received: from biglumber.com (biglumber.com [207.228.252.42]) + by svr1.postgresql.org (Postfix) with SMTP id C41BBD1B4E1 + for ; + Mon, 29 Sep 2003 14:43:25 -0300 (ADT) +Received: (qmail 5726 invoked from network); 29 Sep 2003 17:43:26 -0000 +Received: from biglumber.com (HELO localhost) (207.228.252.42) + by 0 with SMTP; 29 Sep 2003 17:43:26 -0000 +From: greg@turnstep.com +To: pgsql-performance@postgresql.org +Subject: Re: TPC-R benchmarks +X-PGP-Key: 2529 DF6A B8F7 9407 E944 45B4 BC9B 9067 1496 4AC8 +X-Request-PGP: + http://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 +In-Reply-To: <25201.1064852781@sss.pgh.pa.us> +Date: Mon, 29 Sep 2003 17:43:26 -0000 +X-Mailer: JoyMail 1.38 +Message-ID: <73cfb1c9d9867baf4803efa54e7c7b14@biglumber.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/368 +X-Sequence-Number: 3734 + + +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + + +> I'm pretty certain that there are no TPC-certified test results for +> Postgres, because to date no organization has cared to spend the money +> needed to perform a certifiable test. + +Anyone have a rough idea of the costs involved? + + +- -- +Greg Sabino Mullane greg@turnstep.com +PGP Key: 0x14964AC8 200309291344 +-----BEGIN PGP SIGNATURE----- +Comment: http://www.turnstep.com/pgp.html + +iD8DBQE/eG+avJuQZxSWSsgRApDFAJ4md34LacZhJbjnydjNGzqfLy2IzQCg5m/8 +XiD273M2ugzCWd7YF5zbkio= +=jGkx +-----END PGP SIGNATURE----- + + + +From pgsql-performance-owner@postgresql.org Mon Sep 29 14:59:18 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id F406FD1B522 + for ; + Mon, 29 Sep 2003 17:59:17 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 36813-02 + for ; + Mon, 29 Sep 2003 14:58:50 -0300 (ADT) +Received: from mail.libertyrms.com (unknown [209.167.124.227]) + by svr1.postgresql.org (Postfix) with ESMTP id DDBC4D1B549 + for ; + Mon, 29 Sep 2003 14:58:48 -0300 (ADT) +Received: from [10.1.2.130] (helo=dba2) + by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) + id 1A42IL-0000Wh-00 + for ; Mon, 29 Sep 2003 13:58:49 -0400 +Received: by dba2 (Postfix, from userid 1019) + id 98258CAB3; Mon, 29 Sep 2003 13:58:49 -0400 (EDT) +Date: Mon, 29 Sep 2003 13:58:49 -0400 +From: Andrew Sullivan +To: pgsql-performance@postgresql.org +Subject: Re: TPC-R benchmarks +Message-ID: <20030929175849.GA24285@libertyrms.info> +Mail-Followup-To: Andrew Sullivan , + pgsql-performance@postgresql.org +References: <25201.1064852781@sss.pgh.pa.us> + <73cfb1c9d9867baf4803efa54e7c7b14@biglumber.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <73cfb1c9d9867baf4803efa54e7c7b14@biglumber.com> +User-Agent: Mutt/1.5.4i +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/371 +X-Sequence-Number: 3737 + +On Mon, Sep 29, 2003 at 05:43:26PM -0000, greg@turnstep.com wrote: +> +> Anyone have a rough idea of the costs involved? + +I did a back-of-an-envelope calculation one day and stopped when I +got to $10,000. + +A + +-- +---- +Andrew Sullivan 204-4141 Yonge Street +Afilias Canada Toronto, Ontario Canada + M2P 2A8 + +1 416 646 3304 x110 + + +From pgsql-performance-owner@postgresql.org Mon Sep 29 15:22:01 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id CB406D1B56B + for ; + Mon, 29 Sep 2003 18:21:58 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 45935-01 + for ; + Mon, 29 Sep 2003 15:21:31 -0300 (ADT) +Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) + by svr1.postgresql.org (Postfix) with ESMTP id D1395D1B582 + for ; + Mon, 29 Sep 2003 15:21:19 -0300 (ADT) +Received: from [63.195.55.98] (HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) + with ESMTP id 3695174; Mon, 29 Sep 2003 11:12:26 -0700 +Content-Type: text/plain; + charset="iso-8859-1" +From: Josh Berkus +Organization: Aglio Database Solutions +To: Oleg Lebedev , + Mary Edie Meredith +Subject: Re: TPC-R benchmarks +Date: Mon, 29 Sep 2003 11:11:11 -0700 +User-Agent: KMail/1.4.3 +Cc: Jenny Zhang , + pgsql-performance +References: <993DBE5B4D02194382EC8DF8554A52731D75EC@postoffice.waterford.org> +In-Reply-To: <993DBE5B4D02194382EC8DF8554A52731D75EC@postoffice.waterford.org> +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-Id: <200309291111.11191.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/372 +X-Sequence-Number: 3738 + +Oleg, + +> I just checked the restrictions on the TPC-R and TPC-H schemas and it +> seems that all indexes are allowed in TPC-R and only those that index +> parts of primary or foreign keys are allowed in TPC-H. + +That would be appropriate for this case though, yes? That column is part of +a foriegn key, unless I've totally lost track. + +As I remarked before, Postgres does *not* automatically create indexes for +FKs. Many, but not all, other database products do, so comparing PostgreSQL +against those products without the index is unfair. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Mon Sep 29 15:25:51 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 14686D1B55A + for ; + Mon, 29 Sep 2003 18:25:50 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 46270-02 + for ; + Mon, 29 Sep 2003 15:25:23 -0300 (ADT) +Received: from mail.waterford.org (67.107.203.158.ptr.us.xo.net + [67.107.203.158]) + by svr1.postgresql.org (Postfix) with ESMTP id C71E3D1B575 + for ; + Mon, 29 Sep 2003 15:25:21 -0300 (ADT) +Received: by mail.waterford.org with XWall v3.27 ; + Mon, 29 Sep 2003 12:24:07 -0600 +From: Oleg Lebedev +To: Josh Berkus , + Mary Edie Meredith +Cc: Jenny Zhang , + pgsql-performance +Subject: Re: TPC-R benchmarks +Date: Mon, 29 Sep 2003 12:24:06 -0600 +X-Assembled-By: XWall v3.27 +Message-ID: <993DBE5B4D02194382EC8DF8554A52731D75EE@postoffice.waterford.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/373 +X-Sequence-Number: 3739 + +Yes Josh, +L_partkey is a part of the foreign key on the Lineitem table, and it was +ok to create an index on it according to the TPC-R specs. I just created +indices on the rest of the FK columns in the TPC-R database and will +continue my evaluations. +Thanks. + +Oleg=20 + +-----Original Message----- +From: Josh Berkus [mailto:josh@agliodbs.com]=20 +Sent: Monday, September 29, 2003 12:11 PM +To: Oleg Lebedev; Mary Edie Meredith +Cc: Jenny Zhang; pgsql-performance +Subject: Re: [PERFORM] TPC-R benchmarks + + +Oleg, + +> I just checked the restrictions on the TPC-R and TPC-H schemas and it=20 +> seems that all indexes are allowed in TPC-R and only those that index=20 +> parts of primary or foreign keys are allowed in TPC-H. + +That would be appropriate for this case though, yes? That column is +part of=20 +a foriegn key, unless I've totally lost track. + +As I remarked before, Postgres does *not* automatically create indexes +for=20 +FKs. Many, but not all, other database products do, so comparing +PostgreSQL=20 +against those products without the index is unfair. + +--=20 +Josh Berkus +Aglio Database Solutions +San Francisco + +************************************* + +This e-mail may contain privileged or confidential material intended for th= +e named recipient only. +If you are not the named recipient, delete this message and all attachments. +Unauthorized reviewing, copying, printing, disclosing, or otherwise using i= +nformation in this e-mail is prohibited. +We reserve the right to monitor e-mail sent through our network.=20 + +************************************* + +From pgsql-performance-owner@postgresql.org Mon Sep 29 16:46:37 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DA8B7D1B502 + for ; + Mon, 29 Sep 2003 19:46:34 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 56927-07 + for ; + Mon, 29 Sep 2003 16:46:04 -0300 (ADT) +Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) + by svr1.postgresql.org (Postfix) with ESMTP id 9AC60D1B51F + for ; + Mon, 29 Sep 2003 16:46:02 -0300 (ADT) +Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) + by mail1.ihs.com (8.12.10/8.12.10) with ESMTP id h8TJjkvA017674; + Mon, 29 Sep 2003 13:45:46 -0600 (MDT) +Date: Mon, 29 Sep 2003 13:40:16 -0600 (MDT) +From: "scott.marlowe" +To: Will LaShell +Cc: , +Subject: Re: advice on raid controller +In-Reply-To: <1064856034.10565.15.camel@lyric.ofsloans.com> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-IHS-MailScanner: Found to be clean +X-IHS-MailScanner-SpamCheck: +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/374 +X-Sequence-Number: 3740 + +On 29 Sep 2003, Will LaShell wrote: + +> On Mon, 2003-09-29 at 06:48, scott.marlowe wrote: +> > I've used the megaraid / LSI cards in the past and they were pretty good +> > in terms of reliability, but the last one I used was the 328 model, from 4 +> > years ago or so. that one had a battery backup option for the cache, and +> > could go to 128 Meg. We tested it with 4/16 and 128 meg ram, and it was +> > about the same with each, but we didn't do heavy parallel testing either. +> > +> > Here's the page on the megaraid cards at lsilogic.com: +> > +> > http://www.lsilogic.com/products/stor_prod/raid/ultra320products.html +> > +> > On Sun, 28 Sep 2003, Matt Clark wrote: +> > +> > > As others have mentioned, you really ought to get battery-backed cache if +> > > you're doing any volume of writes. The ability to do safe write-back +> > > caching makes an *insane* difference to write performance. +> > > +> > > The site you link to also has that for only 15% more money: +> > > http://uk.azzurri.com/product/product.cgi?productId=80 +> > > +> > > No experience with the card(s) I'm afraid. +> > > +> > > In general though, U320 will only be faster than U160 for large sequential +> > > reads, or when you have silly numbers of disks on a channel (i.e. more than +> > > 4/channel). If you have silly numbers of disks, then RAID5 will probably be +> > > better, if you have 4 disks total then RAID1+0 will probably be better. In +> > > between it depends on all sorts of other factors. Bear in mind though that +> > > if you *do* have silly numbers of disks then more channels and more cache +> > > will count for more than anything else, so spend the money on that rather +> > > than latest-and-greatest performance for a single channel. +> +> Just to add my thoughts, we use the MegaRaid Elite 1650 in 3 servers +> here that drive our core databases. We paired up the controllers with +> the Seagate Cheetah 10k drives, we could have purchased the X15's which +> are Seagate's 15k version, but due to budget constraints and lack of +> true performance increase from the 10k to the 15k rpm drives we didn't +> opt for them. +> +> I have to say that I've been 100% pleased with the performance and +> reliability of the Megaraid controllers. They do everything a good +> controller should and they are very easy to manage. The driver is +> actively maintained by the guys at LSI and their tech support personnel +> are very good as well. +> +> If you want any specific information or have any questions about our +> experience or configuration please feel free to contact me. + +To add one more feature the LSI/MegaRAIDs have that I find interesting, +you can put two in a machine, build a RAID0 or 5 on each card, then mirror +the two cards together, and should one card / RAID0 ot 5 chain die, the +other card will keep working. I.e. the work like one big card with +failover. + + +From pgsql-performance-owner@postgresql.org Mon Sep 29 18:28:21 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id EE215D1B4FC + for ; + Mon, 29 Sep 2003 21:28:20 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 75112-10 + for ; + Mon, 29 Sep 2003 18:27:52 -0300 (ADT) +Received: from amsfep12-int.chello.nl (amsfep12-int.chello.nl [213.46.243.18]) + by svr1.postgresql.org (Postfix) with ESMTP id 0B508D1B4F0 + for ; + Mon, 29 Sep 2003 18:27:49 -0300 (ADT) +Received: from palle.girgensohn.se ([213.89.138.245]) by + amsfep12-int.chello.nl + (InterMail vM.5.01.05.17 201-253-122-126-117-20021021) with ESMTP + id <20030929212750.OXTC8737.amsfep12-int.chello.nl@palle.girgensohn.se>; + Mon, 29 Sep 2003 23:27:50 +0200 +Received: from localhost (localhost [127.0.0.1]) + by palle.girgensohn.se (8.12.9/8.12.9) with ESMTP id h8TLRmNr098061; + Mon, 29 Sep 2003 23:27:49 +0200 (CEST) + (envelope-from girgen@pingpong.net) +Date: Mon, 29 Sep 2003 23:27:48 +0200 +From: Palle Girgensohn +To: Christopher Browne , + pgsql-performance@postgresql.org +Subject: Re: avoiding seqscan? +Message-ID: <33670000.1064870868@palle.girgensohn.se> +In-Reply-To: <60vfrbzkzs.fsf@dev6.int.libertyrms.info> +References: <95900000.1064782481@palle.girgensohn.se> + <3F7766B3.4030705@bigfoot.com> + <180710000.1064841936@durian.pingpong.net> + <60vfrbzkzs.fsf@dev6.int.libertyrms.info> +X-Mailer: Mulberry/3.0.3 (Linux/x86) +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1; format=flowed +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/375 +X-Sequence-Number: 3741 + + + +--On m=E5ndag, september 29, 2003 11.12.55 -0400 Christopher Browne=20 + wrote: + +> girgen@pingpong.net (Palle Girgensohn) writes: +>> Will that make a difference? From what I've seen, it does not make +>> much difference, but I have seen queries speed up when rewritten +>> explicit joins. I guess it depends on other things, but is it really +>> so that the explicit joins are bad somehow? Do you have any pointers +>> to documentation about it, if so? +> +> The problem is that if you expressly specify the joins, the query +> optimizer can't choose its own paths. And while that may not be +> better at the moment, it is quite possible that when you upgrade to a +> newer version, those queries, if "not join-specified," could +> immediately get faster. + +You've got a point here. Still, with some queries, since the data is pretty= +=20 +static and we know much about its distribution over the tables, we had to= +=20 +explicitally tell postgresql how to optimze the queries to get them fast=20 +enough. We cannot afford any queries to be more than fractions of seconds,= +=20 +really. + +> I would expect that the query that uses implicit joins will be clearer +> to read, which adds a little further merit to that direction. + +Depends, I actually don't agree on this, but I guess it depends on which=20 +syntax you're used to. + +> That goes along with the usual way that it is preferable to optimize +> things, namely that you should start by solving the problem as simply +> as you can, and only proceed to further optimization if that actually +> proves necessary. Optimization efforts commonly add complexity and +> make code more difficult to maintain; that's not the place to start if +> you don't even know the effort is necessary. + +Oh, but of course. For the queries I refer to, optimization actually proved= +=20 +necessary, believe me :-) + +Cheers, +Palle + + +From pgsql-performance-owner@postgresql.org Mon Sep 29 18:32:35 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 8A13DD1B530 + for ; + Mon, 29 Sep 2003 21:32:33 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 80367-02 + for ; + Mon, 29 Sep 2003 18:32:04 -0300 (ADT) +Received: from amsfep12-int.chello.nl (amsfep12-int.chello.nl [213.46.243.18]) + by svr1.postgresql.org (Postfix) with ESMTP id 5B3AAD1B53B + for ; + Mon, 29 Sep 2003 18:31:53 -0300 (ADT) +Received: from palle.girgensohn.se ([213.89.138.245]) by + amsfep12-int.chello.nl + (InterMail vM.5.01.05.17 201-253-122-126-117-20021021) with ESMTP + id <20030929213155.PFXG8737.amsfep12-int.chello.nl@palle.girgensohn.se>; + Mon, 29 Sep 2003 23:31:55 +0200 +Received: from localhost (localhost [127.0.0.1]) + by palle.girgensohn.se (8.12.9/8.12.9) with ESMTP id h8TLVsNr098074; + Mon, 29 Sep 2003 23:31:54 +0200 (CEST) + (envelope-from girgen@pingpong.net) +Date: Mon, 29 Sep 2003 23:31:54 +0200 +From: Palle Girgensohn +To: Matt Clark , rj@last.fm, pgsql-performance@postgresql.org +Subject: Re: advice on raid controller +Message-ID: <39060000.1064871114@palle.girgensohn.se> +In-Reply-To: +References: +X-Mailer: Mulberry/3.0.3 (Linux/x86) +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1; format=flowed +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/376 +X-Sequence-Number: 3742 + +Stupid question, perhaps, but would a battery-backed cache make it safe to= +=20 +set fsync=3Dfalse in postgresql.conf? + +/Palle + +--On s=F6ndag, september 28, 2003 13.07.57 +0100 Matt Clark =20 +wrote: + +> As others have mentioned, you really ought to get battery-backed cache if +> you're doing any volume of writes. The ability to do safe write-back +> caching makes an *insane* difference to write performance. + + + + + +From pgsql-performance-owner@postgresql.org Mon Sep 29 18:35:51 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A890D1B51F + for ; + Mon, 29 Sep 2003 21:35:50 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 79954-08 + for ; + Mon, 29 Sep 2003 18:35:21 -0300 (ADT) +Received: from amsfep12-int.chello.nl (amsfep12-int.chello.nl [213.46.243.18]) + by svr1.postgresql.org (Postfix) with ESMTP id 621C6D1B4FC + for ; + Mon, 29 Sep 2003 18:35:16 -0300 (ADT) +Received: from palle.girgensohn.se ([213.89.138.245]) by + amsfep12-int.chello.nl + (InterMail vM.5.01.05.17 201-253-122-126-117-20021021) with ESMTP + id <20030929213518.PNCW8737.amsfep12-int.chello.nl@palle.girgensohn.se>; + Mon, 29 Sep 2003 23:35:18 +0200 +Received: from localhost (localhost [127.0.0.1]) + by palle.girgensohn.se (8.12.9/8.12.9) with ESMTP id h8TLZGNr098081; + Mon, 29 Sep 2003 23:35:16 +0200 (CEST) + (envelope-from girgen@pingpong.net) +Date: Mon, 29 Sep 2003 23:35:16 +0200 +From: Palle Girgensohn +To: Matt Clark , rj@last.fm, pgsql-performance@postgresql.org +Subject: Re: advice on raid controller +Message-ID: <43690000.1064871316@palle.girgensohn.se> +In-Reply-To: <39060000.1064871114@palle.girgensohn.se> +References: + <39060000.1064871114@palle.girgensohn.se> +X-Mailer: Mulberry/3.0.3 (Linux/x86) +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1; format=flowed +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/377 +X-Sequence-Number: 3743 + +Come to think of it, I guess a battery-backed cache will make fsync as fast= +=20 +as no fsync, right? So, the q was kinda stoopid... :-/ + +/Palle + +--On m=E5ndag, september 29, 2003 23.31.54 +0200 Palle Girgensohn=20 + wrote: + +> Stupid question, perhaps, but would a battery-backed cache make it safe +> to set fsync=3Dfalse in postgresql.conf? +> +> /Palle +> +> --On s=F6ndag, september 28, 2003 13.07.57 +0100 Matt Clark +> wrote: +> +>> As others have mentioned, you really ought to get battery-backed cache if +>> you're doing any volume of writes. The ability to do safe write-back +>> caching makes an *insane* difference to write performance. +> +> +> +> + + + + + +From pgsql-performance-owner@postgresql.org Mon Sep 29 18:42:14 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 5FFD3D1B51A + for ; + Mon, 29 Sep 2003 21:42:13 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 80981-04 + for ; + Mon, 29 Sep 2003 18:41:46 -0300 (ADT) +Received: from wight.ymogen.net (unknown [217.27.240.153]) + by svr1.postgresql.org (Postfix) with SMTP id 912F1D1B4FF + for ; + Mon, 29 Sep 2003 18:41:43 -0300 (ADT) +Received: (qmail 1005 invoked from network); 29 Sep 2003 21:41:40 -0000 +Received: from dsl-217-155-239-51.zen.co.uk (HELO finisterre) (217.155.239.51) + by wight.ymogen.net with SMTP; 29 Sep 2003 21:41:40 -0000 +From: "Matt Clark" +To: "Palle Girgensohn" , , + +Subject: Re: advice on raid controller +Date: Mon, 29 Sep 2003 22:41:39 +0100 +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: <39060000.1064871114@palle.girgensohn.se> +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +Importance: Normal +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/378 +X-Sequence-Number: 3744 + +Not in general. Besides, with a write-back cache an fsync() is very nearly +'free', as the controller will report the write as completed as soon as it's +written to cache. + +I keep meaning to benchmark the difference, but I only have the facility on +a production box, so caution gets the better of me every time :-) + +AFAIK the fsync calls are used to guarantee the _ordering_ of writes to +permanent storage (i.e. fsync() is called before doing something, rather +than after doing something. So PG can be sure that before it does B, A has +definitely been written to disk). + +But I could well be wrong. And there could well be strategies exploitable +with the knowledge that a write-back cache exists that aren't currently +implemented - though intuitively I doubt it. + +M + + + + +> -----Original Message----- +> From: Palle Girgensohn [mailto:girgen@pingpong.net] +> Sent: 29 September 2003 22:32 +> To: Matt Clark; rj@last.fm; pgsql-performance@postgresql.org +> Subject: Re: [PERFORM] advice on raid controller +> +> +> Stupid question, perhaps, but would a battery-backed cache make +> it safe to +> set fsync=false in postgresql.conf? +> +> /Palle +> +> --On s�ndag, september 28, 2003 13.07.57 +0100 Matt Clark +> +> wrote: +> +> > As others have mentioned, you really ought to get +> battery-backed cache if +> > you're doing any volume of writes. The ability to do safe write-back +> > caching makes an *insane* difference to write performance. +> +> +> +> +> + + +From pgsql-performance-owner@postgresql.org Mon Sep 29 18:53:40 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id D0A37D1B538 + for ; + Mon, 29 Sep 2003 21:53:37 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 80666-07 + for ; + Mon, 29 Sep 2003 18:53:12 -0300 (ADT) +Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) + by svr1.postgresql.org (Postfix) with ESMTP id 0456CD1B52D + for ; + Mon, 29 Sep 2003 18:53:09 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id h8TLqrC23185; + Mon, 29 Sep 2003 17:52:53 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200309292152.h8TLqrC23185@candle.pha.pa.us> +Subject: Re: advice on raid controller +In-Reply-To: <43690000.1064871316@palle.girgensohn.se> +To: Palle Girgensohn +Date: Mon, 29 Sep 2003 17:52:53 -0400 (EDT) +Cc: Matt Clark , rj@last.fm, pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL106 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/379 +X-Sequence-Number: 3745 + +\Palle Girgensohn wrote: +> Come to think of it, I guess a battery-backed cache will make fsync as fast +> as no fsync, right? So, the q was kinda stoopid... :-/ + +With fsync off, the data might never get to the battery-backed RAM. :-( + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Mon Sep 29 23:37:05 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 24165D1B52D + for ; + Tue, 30 Sep 2003 02:36:43 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 29678-06 + for ; + Mon, 29 Sep 2003 23:36:16 -0300 (ADT) +Received: from boats_exch01.boats.com (h209-17-182-106.gtconnect.net + [209.17.182.106]) + by svr1.postgresql.org (Postfix) with ESMTP id BA130D1B4F1 + for ; + Mon, 29 Sep 2003 23:36:11 -0300 (ADT) +Received: by BOATS_EXCH01 with Internet Mail Service (5.5.2653.19) + id ; Mon, 29 Sep 2003 19:34:50 -0700 +Received: from GRIFFITHS2 ([192.168.12.195]) by boats_exch01.boats.com with + SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) + id TTY6T80Z; Mon, 29 Sep 2003 19:34:45 -0700 +From: David Griffiths +To: pgsql-performance@postgresql.org +Message-ID: <002701c386fc$c187aa00$6501a8c0@griffiths2> +Subject: Test... +Date: Mon, 29 Sep 2003 19:44:18 -0700 +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_NextPart_000_0024_01C386C2.121D18A0" +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 5.50.4922.1500 +X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4925.2800 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=0.7 tagged_above=0.0 required=5.0 tests=HTML_40_50 +X-Spam-Level: +X-Archive-Number: 200309/380 +X-Sequence-Number: 3746 + +This is a multi-part message in MIME format. + +------=_NextPart_000_0024_01C386C2.121D18A0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + +I've posted several emails, and have yet to see one show up (this one +might not either). +=20 +Is there a size limit to an email (it had a big analyze, and schema +information)?? + +David + +------=_NextPart_000_0024_01C386C2.121D18A0 +Content-Type: text/html; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + + + + + + + + +
I've posted several emails, and have yet t= +o see one=20 +show up (this one might not either).
+
 
+
Is there a size limit to an email (it had = +a big=20 +analyze, and schema information)??
+

David
+ +------=_NextPart_000_0024_01C386C2.121D18A0-- + +From pgsql-performance-owner@postgresql.org Tue Sep 30 01:48:59 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C1B61D1B536 + for ; + Tue, 30 Sep 2003 04:48:57 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 51492-04 + for ; + Tue, 30 Sep 2003 01:48:29 -0300 (ADT) +Received: from sss.pgh.pa.us (unknown [192.204.191.242]) + by svr1.postgresql.org (Postfix) with ESMTP id DC74AD1B52B + for ; + Tue, 30 Sep 2003 01:48:28 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h8U4mM6c016188; + Tue, 30 Sep 2003 00:48:22 -0400 (EDT) +To: David Griffiths +Cc: pgsql-performance@postgresql.org +Subject: Re: Test... +In-reply-to: <002701c386fc$c187aa00$6501a8c0@griffiths2> +References: <002701c386fc$c187aa00$6501a8c0@griffiths2> +Comments: In-reply-to David Griffiths + message dated "Mon, 29 Sep 2003 19:44:18 -0700" +Date: Tue, 30 Sep 2003 00:48:22 -0400 +Message-ID: <16187.1064897302@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200309/381 +X-Sequence-Number: 3747 + +David Griffiths writes: +> Is there a size limit to an email + +IIRC, the standard policy on the pgsql lists is that messages over 40K +or so will be delayed for moderator approval. However, you should have +gotten immediate replies from the majordomo 'bot telling you so. If you +got nothing, there's a configuration problem with the pg-perform mail +list or your subscription or something. Talk to Marc (scrappy at +hub.org) about identifying and fixing the issue. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Oct 1 00:20:30 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A95B9D1CBCE + for ; + Wed, 1 Oct 2003 03:20:29 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 18586-07 + for ; + Wed, 1 Oct 2003 00:19:42 -0300 (ADT) +Received: from www.postgresql.com (unknown [64.117.225.209]) + by svr1.postgresql.org (Postfix) with ESMTP id A378DD1D370 + for ; + Tue, 30 Sep 2003 23:22:24 -0300 (ADT) +Received: from mail.waterford.org (67.107.203.158.ptr.us.xo.net + [67.107.203.158]) + by www.postgresql.com (Postfix) with ESMTP id 66CBFCF5610 + for ; + Tue, 30 Sep 2003 15:42:30 -0300 (ADT) +Received: by mail.waterford.org with XWall v3.27 ; + Tue, 30 Sep 2003 12:40:54 -0600 +From: Oleg Lebedev +To: "pgsql-performance@postgresql.org" +Subject: Re: TPC-R benchmarks +Date: Tue, 30 Sep 2003 12:40:54 -0600 +X-Assembled-By: XWall v3.27 +Message-ID: <993DBE5B4D02194382EC8DF8554A52731D7604@postoffice.waterford.org> +Mime-Version: 1.0 +Content-Type: multipart/mixed; + boundary="_NextPart_1_qmZrHLajoetbkwlTZTViemHPfyb" +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200310/4 +X-Sequence-Number: 3752 + +This is a multi part message in MIME format. + +--_NextPart_1_qmZrHLajoetbkwlTZTViemHPfyb +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + +I continue struggling with the TPC-R benchmarks and wonder if anyone +could help me optimize the query below. ANALYZE statistics indicate that +the query should run relatively fast, but it takes hours to complete. I +attached the query plan to this posting. +Thanks. + +select + nation, + o_year, + sum(amount) as sum_profit +from + ( + select + n_name as nation, + extract(year from o_orderdate) as o_year, + l_extendedprice * (1 - l_discount) - +ps_supplycost * l_quantity as amount + from + part, + supplier, + lineitem, + partsupp, + orders, + nation + where + s_suppkey =3D l_suppkey + and ps_suppkey =3D l_suppkey + and ps_partkey =3D l_partkey + and p_partkey =3D l_partkey + and o_orderkey =3D l_orderkey + and s_nationkey =3D n_nationkey + and p_name like '%aquamarine%' + ) as profit +group by + nation, + o_year +order by + nation, + o_year desc; + +************************************* + +This e-mail may contain privileged or confidential material intended for th= +e named recipient only. +If you are not the named recipient, delete this message and all attachments. +Unauthorized reviewing, copying, printing, disclosing, or otherwise using i= +nformation in this e-mail is prohibited. +We reserve the right to monitor e-mail sent through our network.=20 + +************************************* + +--_NextPart_1_qmZrHLajoetbkwlTZTViemHPfyb +Content-Type: text/text; name="plan.txt" +Content-Disposition: attachment; filename="plan.txt" +Content-Transfer-Encoding: base64 + +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg +ICAgICAgICAgICAgICAgICAgICAgIFFVRVJZIFBMQU4gICAgICAgICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg +ICAgICAgICAgCi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t +LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t +LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t +LS0tLS0tLS0tLS0tLS0tLS0tLQogU3VicXVlcnkgU2NhbiAidGVtcCIgIChj +b3N0PTE4MjM3LjQwLi4xODIzNy40MSByb3dzPTEgd2lkdGg9MTIxKQogICAt +PiAgU29ydCAgKGNvc3Q9MTgyMzcuNDAuLjE4MjM3LjQxIHJvd3M9MSB3aWR0 +aD0xMjEpCiAgICAgICAgIFNvcnQgS2V5OiBuYXRpb24ubl9uYW1lLCBkYXRl +X3BhcnQoJ3llYXInOjp0ZXh0LCBvcmRlcnMub19vcmRlcmRhdGUpCiAgICAg +ICAgIC0+ICBBZ2dyZWdhdGUgIChjb3N0PTE4MjM3LjM4Li4xODIzNy4zOSBy +b3dzPTEgd2lkdGg9MTIxKQogICAgICAgICAgICAgICAtPiAgR3JvdXAgIChj +b3N0PTE4MjM3LjM4Li4xODIzNy4zOSByb3dzPTEgd2lkdGg9MTIxKQogICAg +ICAgICAgICAgICAgICAgICAtPiAgU29ydCAgKGNvc3Q9MTgyMzcuMzguLjE4 +MjM3LjM4IHJvd3M9MSB3aWR0aD0xMjEpCiAgICAgICAgICAgICAgICAgICAg +ICAgICAgIFNvcnQgS2V5OiBuYXRpb24ubl9uYW1lLCBkYXRlX3BhcnQoJ3ll +YXInOjp0ZXh0LCBvcmRlcnMub19vcmRlcmRhdGUpCiAgICAgICAgICAgICAg +ICAgICAgICAgICAgIC0+ICBOZXN0ZWQgTG9vcCAgKGNvc3Q9MTgyMzIuOTYu +LjE4MjM3LjM3IHJvd3M9MSB3aWR0aD0xMjEpCiAgICAgICAgICAgICAgICAg +ICAgICAgICAgICAgICAgIC0+ICBIYXNoIEpvaW4gIChjb3N0PTE4MjMyLjk2 +Li4xODIzNC4zNCByb3dzPTEgd2lkdGg9MTA5KQogICAgICAgICAgICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICBIYXNoIENvbmQ6ICgib3V0ZXIiLm5f +bmF0aW9ua2V5ID0gImlubmVyIi5zX25hdGlvbmtleSkKICAgICAgICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgLT4gIFNlcSBTY2FuIG9uIG5h +dGlvbiAgKGNvc3Q9MC4wMC4uMS4yNSByb3dzPTI1IHdpZHRoPTMzKQogICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtPiAgSGFzaCAg +KGNvc3Q9MTgyMzIuOTUuLjE4MjMyLjk1IHJvd3M9MSB3aWR0aD03NikKICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLT4g +IE5lc3RlZCBMb29wICAoY29zdD0wLjAwLi4xODIzMi45NSByb3dzPTEgd2lk +dGg9NzYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg +ICAgICAgICAgICAgIEpvaW4gRmlsdGVyOiAoImlubmVyIi5zX3N1cHBrZXkg +PSAib3V0ZXIiLmxfc3VwcGtleSkKICAgICAgICAgICAgICAgICAgICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgLT4gIE5lc3RlZCBMb29wICAo +Y29zdD0wLjAwLi4xODIyOS45MyByb3dzPTEgd2lkdGg9NjgpCiAgICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg +ICAgIEpvaW4gRmlsdGVyOiAoIm91dGVyIi5wX3BhcnRrZXkgPSAiaW5uZXIi +LmxfcGFydGtleSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgLT4gIE5lc3RlZCBMb29wICAoY29z +dD0wLjAwLi44MDIxLjE0IHJvd3M9NCB3aWR0aD0yMykKICAgICAgICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg +ICAgICAgLT4gIFNlcSBTY2FuIG9uIHBhcnQgIChjb3N0PTAuMDAuLjgwMTgu +MDAgcm93cz0xIHdpZHRoPTQpCiAgICAgICAgICAgICAgICAgICAgICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZp +bHRlcjogKHBfbmFtZSB+fiAnJWFxdWFtYXJpbmUlJzo6dGV4dCkKICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg +ICAgICAgICAgICAgLT4gIEluZGV4IFNjYW4gdXNpbmcgaV9wc19wYXJ0a2V5 +IG9uIHBhcnRzdXBwICAoY29zdD0wLjAwLi4zLjA3IHJvd3M9NSB3aWR0aD0x +OSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgSW5kZXggQ29uZDogKCJvdXRl +ciIucF9wYXJ0a2V5ID0gcGFydHN1cHAucHNfcGFydGtleSkKICAgICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg +ICAgLT4gIEluZGV4IFNjYW4gdXNpbmcgaV9sX3N1cHBrZXkgb24gbGluZWl0 +ZW0gIChjb3N0PTAuMDAuLjI1NDIuNjkgcm93cz02MzQgd2lkdGg9NDUpCiAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg +ICAgICAgICAgICAgICAgIEluZGV4IENvbmQ6ICgib3V0ZXIiLnBzX3N1cHBr +ZXkgPSBsaW5laXRlbS5sX3N1cHBrZXkpCiAgICAgICAgICAgICAgICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0+ICBJbmRleCBTY2Fu +IHVzaW5nIHBrX3N1cHBsaWVyIG9uIHN1cHBsaWVyICAoY29zdD0wLjAwLi4z +LjAxIHJvd3M9MSB3aWR0aD04KQogICAgICAgICAgICAgICAgICAgICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJbmRleCBDb25kOiAo +Im91dGVyIi5wc19zdXBwa2V5ID0gc3VwcGxpZXIuc19zdXBwa2V5KQogICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtPiAgSW5kZXggU2NhbiB1 +c2luZyBwa19vcmRlcnMgb24gb3JkZXJzICAoY29zdD0wLjAwLi4zLjAxIHJv +d3M9MSB3aWR0aD0xMikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg +ICAgICAgICAgSW5kZXggQ29uZDogKG9yZGVycy5vX29yZGVya2V5ID0gIm91 +dGVyIi5sX29yZGVya2V5KQooMjcgcm93cykKCg== + +--_NextPart_1_qmZrHLajoetbkwlTZTViemHPfyb-- + +From pgsql-performance-owner@postgresql.org Wed Oct 1 00:10:48 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E1F61D1D2B9 + for ; + Wed, 1 Oct 2003 03:10:46 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 18100-03 + for ; + Wed, 1 Oct 2003 00:10:00 -0300 (ADT) +Received: from www.postgresql.com (unknown [64.117.225.209]) + by svr1.postgresql.org (Postfix) with ESMTP id 7CDA1D1B56E + for ; + Tue, 30 Sep 2003 23:22:01 -0300 (ADT) +Received: from boats_exch01.boats.com (h209-17-182-106.gtconnect.net + [209.17.182.106]) + by www.postgresql.com (Postfix) with ESMTP id 10057CF4A3F + for ; + Tue, 30 Sep 2003 17:16:18 -0300 (ADT) +Received: by BOATS_EXCH01 with Internet Mail Service (5.5.2653.19) + id ; Tue, 30 Sep 2003 13:14:51 -0700 +Received: from GRIFFITHS2 ([192.168.12.195]) by boats_exch01.boats.com with + SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) + id TTY64KCZ; Tue, 30 Sep 2003 13:14:48 -0700 +From: David Griffiths +To: pgsql-performance@postgresql.org +Message-ID: <057501c38790$d9b9aad0$6501a8c0@griffiths2> +Subject: Tuning/performance issue... +Date: Tue, 30 Sep 2003 13:24:24 -0700 +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_NextPart_000_0572_01C38756.2A7EDC00" +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 5.50.4922.1500 +X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4925.2800 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=1.5 tagged_above=0.0 required=5.0 tests=BAYES_30, + HTML_20_30, RCVD_IN_OSIRUSOFT_COM +X-Spam-Level: * +X-Archive-Number: 200310/1 +X-Sequence-Number: 3749 + +This is a multi-part message in MIME format. + +------=_NextPart_000_0572_01C38756.2A7EDC00 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + +We're having a problem with a query during our investigation into +Postgres (as an Oracle replacement). This query Postgres takes 20-40 +seconds (multiple runs). Tom Lan recommended I post it here, with an +explain-analyze. +=20 +Here's the query: +=20 +EXPLAIN ANALYZE SELECT company_name, address_1, address_2, address_3, +city, +address_list.state_province_id, state_province_short_desc, country_desc, +zip_code, address_list.country_id, +contact_info.email, commercial_entity.user_account_id, phone_num_1, +phone_num_fax, website, boats_website +FROM commercial_entity, country, user_account, +address_list LEFT JOIN state_province ON address_list.state_province_id +=3D state_province.state_province_id +LEFT JOIN contact_info ON address_list.contact_info_id =3D +contact_info.contact_info_id +WHERE address_list.address_type_id =3D 101 +AND commercial_entity.commercial_entity_id=3D225528 +AND commercial_entity.commercial_entity_id =3D +address_list.commercial_entity_id +AND address_list.country_id =3D country.country_id +AND commercial_entity.user_account_id =3D user_account.user_account_id +AND user_account.user_role_id IN (101, 101); +=20 +Here's the explain: +=20 +------------------------------------------------------------------------ +------------------------------------------------------------------------ +------------------------------------ + Nested Loop (cost=3D0.00..64570.33 rows=3D1 width=3D385) (actual +time=3D42141.08..42152.06 rows=3D1 loops=3D1) + -> Nested Loop (cost=3D0.00..64567.30 rows=3D1 width=3D361) (actual +time=3D42140.80..42151.77 rows=3D1 loops=3D1) + -> Nested Loop (cost=3D0.00..64563.97 rows=3D1 width=3D349) (act= +ual +time=3D42140.31..42151.27 rows=3D1 loops=3D1) + Join Filter: ("outer".commercial_entity_id =3D +"inner".commercial_entity_id) + -> Index Scan using commercial_entity_pkey on +commercial_entity (cost=3D0.00..5.05 rows=3D1 width=3D94) (actual +time=3D0.57..0.58 rows=3D1 loops=3D1) + Index Cond: (commercial_entity_id =3D +225528::numeric) + -> Materialize (cost=3D63343.66..63343.66 rows=3D97221 +width=3D255) (actual time=3D41741.96..41901.17 rows=3D90527 loops=3D1) + -> Merge Join (cost=3D0.00..63343.66 rows=3D97221 +width=3D255) (actual time=3D1.44..41387.68 rows=3D90527 loops=3D1) + Merge Cond: ("outer".contact_info_id =3D +"inner".contact_info_id) + -> Nested Loop (cost=3D0.00..830457.52 +rows=3D97221 width=3D222) (actual time=3D0.95..39178.32 rows=3D90527 loops= +=3D1) + Join Filter: ("outer".state_province_id +=3D "inner".state_province_id) + -> Index Scan using addr_list_ci_id_i +on address_list (cost=3D0.00..586676.65 rows=3D97221 width=3D205) (actual +time=3D0.49..2159.90 rows=3D90527 loops=3D1) + Filter: (address_type_id =3D +101::numeric) + -> Seq Scan on state_province +(cost=3D0.00..1.67 rows=3D67 width=3D17) (actual time=3D0.00..0.21 rows=3D67 +loops=3D90527) + -> Index Scan using contact_info_pkey on +contact_info (cost=3D0.00..3366.76 rows=3D56435 width=3D33) (actual +time=3D0.44..395.75 rows=3D55916 loops=3D1) + -> Index Scan using user_account_pkey on user_account +(cost=3D0.00..3.32 rows=3D1 width=3D12) (actual time=3D0.46..0.46 rows=3D1 +loops=3D1) + Index Cond: ("outer".user_account_id =3D +user_account.user_account_id) + Filter: (user_role_id =3D 101::numeric) + -> Index Scan using country_pkey on country (cost=3D0.00..3.01 rows=3D1 +width=3D24) (actual time=3D0.25..0.25 rows=3D1 loops=3D1) + Index Cond: ("outer".country_id =3D country.country_id) + Total runtime: 42165.44 msec +(21 rows) +=20 +=20 +I will post the schema in a seperate email - the list has rejected one +big email 3 times now. +=20 +David + +------=_NextPart_000_0572_01C38756.2A7EDC00 +Content-Type: text/html; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + + + + + + + + +
+
We're having a problem with a query during= + our=20 +investigation into Postgres (as an Oracle replacement). This query Postgres= +=20 +takes 20-40 seconds (multiple runs). Tom Lan recommended I post it here, wi= +th an=20 +explain-analyze.
+
 
+
Here's the query:
+
 
+
EXPLAIN ANALYZE SELECT company_name, addre= +ss_1,=20 +address_2, address_3, city,
address_list.state_province_id,=20 +state_province_short_desc, country_desc, zip_code,=20 +address_list.country_id,
contact_info.email,=20 +commercial_entity.user_account_id, phone_num_1, phone_num_fax, website,=20 +boats_website
FROM commercial_entity, country, user_account,
address_= +list=20 +LEFT JOIN state_province ON address_list.state_province_id =3D=20 +state_province.state_province_id
LEFT JOIN contact_info ON=20 +address_list.contact_info_id =3D contact_info.contact_info_id
WHERE=20 +address_list.address_type_id =3D 101
AND=20 +commercial_entity.commercial_entity_id=3D225528
AND=20 +commercial_entity.commercial_entity_id =3D=20 +address_list.commercial_entity_id
AND address_list.country_id =3D=20 +country.country_id
AND commercial_entity.user_account_id =3D=20 +user_account.user_account_id
AND user_account.user_role_id IN (101,=20 +101);
+
 
+
Here's the explain:
+
 
+
------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------
 Nested=20 +Loop  (cost=3D0.00..64570.33 rows=3D1 width=3D385) (actual=20 +time=3D42141.08..42152.06 rows=3D1 loops=3D1)
   ->  N= +ested=20 +Loop  (cost=3D0.00..64567.30 rows=3D1 width=3D361) (actual=20 +time=3D42140.80..42151.77 rows=3D1=20 +loops=3D1)
         ->  = +Nested=20 +Loop  (cost=3D0.00..64563.97 rows=3D1 width=3D349) (actual=20 +time=3D42140.31..42151.27 rows=3D1=20 +loops=3D1)
          &= +nbsp;   =20 +Join Filter: ("outer".commercial_entity_id =3D=20 +"inner".commercial_entity_id)
       = +       =20 +->  Index Scan using commercial_entity_pkey on commercial_entity&nb= +sp;=20 +(cost=3D0.00..5.05 rows=3D1 width=3D94) (actual time=3D0.57..0.58 rows=3D1= +=20 +loops=3D1)
          &= +nbsp;         =20 +Index Cond: (commercial_entity_id =3D=20 +225528::numeric)
         &= +nbsp;    =20 +->  Materialize  (cost=3D63343.66..63343.66 rows=3D97221 width= +=3D255)=20 +(actual time=3D41741.96..41901.17 rows=3D90527=20 +loops=3D1)
          &= +nbsp;         =20 +->  Merge Join  (cost=3D0.00..63343.66 rows=3D97221 width=3D25= +5) (actual=20 +time=3D1.44..41387.68 rows=3D90527=20 +loops=3D1)
          &= +nbsp;           &nbs= +p;   =20 +Merge Cond: ("outer".contact_info_id =3D=20 +"inner".contact_info_id)
        = +;            &n= +bsp;     =20 +->  Nested Loop  (cost=3D0.00..830457.52 rows=3D97221 width=3D= +222)=20 +(actual time=3D0.95..39178.32 rows=3D90527=20 +loops=3D1)
          &= +nbsp;           &nbs= +p;         =20 +Join Filter: ("outer".state_province_id =3D=20 +"inner".state_province_id)
       &nb= +sp;            = +            =20 +->  Index Scan using addr_list_ci_id_i on address_list =20 +(cost=3D0.00..586676.65 rows=3D97221 width=3D205) (actual time=3D0.49..2159= +.90=20 +rows=3D90527=20 +loops=3D1)
          &= +nbsp;           &nbs= +p;            &= +nbsp;  =20 +Filter: (address_type_id =3D=20 +101::numeric)
         &nbs= +p;            &= +nbsp;         =20 +->  Seq Scan on state_province  (cost=3D0.00..1.67 rows=3D67 w= +idth=3D17)=20 +(actual time=3D0.00..0.21 rows=3D67=20 +loops=3D90527)
         &nb= +sp;            = +    =20 +->  Index Scan using contact_info_pkey on contact_info =20 +(cost=3D0.00..3366.76 rows=3D56435 width=3D33) (actual time=3D0.44..395.75 = +rows=3D55916=20 +loops=3D1)
         ->  = +Index=20 +Scan using user_account_pkey on user_account  (cost=3D0.00..3.32 rows= +=3D1=20 +width=3D12) (actual time=3D0.46..0.46 rows=3D1=20 +loops=3D1)
          &= +nbsp;   =20 +Index Cond: ("outer".user_account_id =3D=20 +user_account.user_account_id)
       = +       =20 +Filter: (user_role_id =3D 101::numeric)
   ->  Index S= +can=20 +using country_pkey on country  (cost=3D0.00..3.01 rows=3D1 width=3D24)= + (actual=20 +time=3D0.25..0.25 rows=3D1=20 +loops=3D1)
         Index Cond:= +=20 +("outer".country_id =3D country.country_id)
 Total runtime: 42165.4= +4=20 +msec
(21 rows)
+
 
+
 
+
I will post the schema in a seperate email - the list has rejected one= + big=20 +email 3 times now.
+
 
+
David
+ +------=_NextPart_000_0572_01C38756.2A7EDC00-- + +From pgsql-performance-owner@postgresql.org Wed Oct 1 00:16:02 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 9A7B6D1D521 + for ; + Wed, 1 Oct 2003 03:16:01 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 18508-05 + for ; + Wed, 1 Oct 2003 00:15:15 -0300 (ADT) +Received: from www.postgresql.com (unknown [64.117.225.209]) + by svr1.postgresql.org (Postfix) with ESMTP id 978DAD1B8F5 + for ; + Tue, 30 Sep 2003 23:22:02 -0300 (ADT) +Received: from boats_exch01.boats.com (h209-17-182-106.gtconnect.net + [209.17.182.106]) + by www.postgresql.com (Postfix) with ESMTP id 208A7CF4A47 + for ; + Tue, 30 Sep 2003 17:17:03 -0300 (ADT) +Received: by BOATS_EXCH01 with Internet Mail Service (5.5.2653.19) + id ; Tue, 30 Sep 2003 13:15:36 -0700 +Received: from GRIFFITHS2 ([192.168.12.195]) by boats_exch01.boats.com with + SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) + id TTY64KC9; Tue, 30 Sep 2003 13:15:30 -0700 +From: David Griffiths +To: pgsql-performance@postgresql.org +Message-ID: <058501c38790$f2525bf0$6501a8c0@griffiths2> +Subject: Tuning/performance issue (part 2) +Date: Tue, 30 Sep 2003 13:25:05 -0700 +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_NextPart_000_057D_01C38756.431EB910" +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 5.50.4922.1500 +X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4925.2800 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=0.6 tagged_above=0.0 required=5.0 tests=BAYES_30, + HTML_30_40, RCVD_IN_OSIRUSOFT_COM +X-Spam-Level: +X-Archive-Number: 200310/2 +X-Sequence-Number: 3750 + +This is a multi-part message in MIME format. + +------=_NextPart_000_057D_01C38756.431EB910 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + +Here's the schema: +=20 + Table "public.address_list" + Column | Type | Modifiers +----------------------+------------------------+----------- + address_list_id | numeric(10,0) | not null + address_1 | character varying(100) | + address_2 | character varying(100) | + address_3 | character varying(100) | + city | character varying(100) | + zip_code | character varying(20) | + phone_num_1 | character varying(100) | + phone_num_2 | character varying(100) | + phone_num_fax | character varying(100) | + state_province_id | numeric(10,0) | + user_account_id | numeric(10,0) | + marina_id | numeric(10,0) | + commercial_entity_id | numeric(10,0) | + address_type_id | numeric(10,0) | not null + distributor_id | numeric(10,0) | + contact_info_id | numeric(10,0) | + country_id | numeric(10,0) | + lang_id | numeric(10,0) | + boat_listing_id | numeric(10,0) | +Indexes: address_list_pkey primary key btree (address_list_id), + addr_list_addr_type_id_i btree (address_type_id), + addr_list_bl_id_i btree (boat_listing_id), + addr_list_bl_sp_count_i btree (boat_listing_id, +state_province_id, country_id), + addr_list_ce_sp_c_at_c_i btree (commercial_entity_id, +state_province_id, country_id, address_type_id, city), + addr_list_ce_sp_countr_addr_type_i btree (commercial_entity_id, +state_province_id, country_id, address_type_id), + addr_list_ci_id_i btree (contact_info_id), + addr_list_comm_ent_id_i btree (commercial_entity_id), + addr_list_count_lang_i btree (country_id, lang_id), + addr_list_country_id_i btree (country_id), + addr_list_cty_bl_count_i btree (city, boat_listing_id, +country_id), + addr_list_cty_i btree (city), + addr_list_distrib_id_i btree (distributor_id), + addr_list_marina_id_i btree (marina_id), + addr_list_sp_id_i btree (state_province_id), + addr_list_ua_id_i btree (user_account_id) +Foreign Key constraints: $1 FOREIGN KEY (address_type_id) REFERENCES +address_type(address_type_id) ON UPDATE NO ACTION ON DELETE NO ACTION, + $2 FOREIGN KEY (commercial_entity_id) +REFERENCES commercial_entity(commercial_entity_id) ON UPDATE NO ACTION +ON DELETE NO ACTION, + $3 FOREIGN KEY (contact_info_id) REFERENCES +contact_info(contact_info_id) ON UPDATE NO ACTION ON DELETE NO ACTION, + $4 FOREIGN KEY (user_account_id) REFERENCES +user_account(user_account_id) ON UPDATE NO ACTION ON DELETE NO ACTION, + $5 FOREIGN KEY (state_province_id) REFERENCES +state_province(state_province_id) ON UPDATE NO ACTION ON DELETE NO +ACTION + +=20 + Table +"public.commercial_entity" + Column | Type | +Modifiers +---------------------------+-----------------------------+-------------- +----------------------------------------------- + commercial_entity_id | numeric(10,0) | not null + company_name | character varying(100) | not null + website | character varying(200) | + modify_date | timestamp without time zone | + user_account_id | numeric(10,0) | + source_id | numeric(10,0) | not null + commercial_entity_type_id | numeric(10,0) | + boats_website | character varying(200) | + updated_on | timestamp without time zone | not null +default ('now'::text)::timestamp(6) with time zone + dealer_level_id | numeric(10,0) | + lang_id | numeric(10,0) | default '100' + yw_account_id | numeric(10,0) | + keybank_dealer_code | numeric(10,0) | + dnetaccess_id | numeric(10,0) | not null +default 0 + interested_in_dns | numeric(10,0) | not null +default 0 + parent_office_id | numeric(10,0) | + marinesite_welcome_msg | character varying(500) | + alt_marinesite_homepage | character varying(256) | + comments | character varying(4000) | + show_finance_yn | character varying(1) | not null +default 'Y' + show_insurance_yn | character varying(1) | not null +default 'Y' + show_shipping_yn | character varying(1) | not null +default 'Y' + yw_account_id_c | character varying(11) | + sales_id | numeric(10,0) | +Indexes: commercial_entity_pkey primary key btree +(commercial_entity_id), + comm_ent_boat_web_ui unique btree (boats_website), + comm_ent_key_dlr_cd_ui unique btree (keybank_dealer_code), + comm_ent_cny_name_i btree (company_name), + comm_ent_dlr_lvl_id_i btree (dealer_level_id, lang_id), + comm_ent_src_id_i btree (source_id), + comm_ent_type_id_i btree (commercial_entity_type_id), + comm_ent_upd_on btree (updated_on), + comm_ent_usr_acc_id_i btree (user_account_id), + comm_ent_yw_acc_id_i btree (yw_account_id) +Foreign Key constraints: $1 FOREIGN KEY (source_id) REFERENCES +source(source_id) ON UPDATE NO ACTION ON DELETE NO ACTION, + $2 FOREIGN KEY (user_account_id) REFERENCES +user_account(user_account_id) ON UPDATE NO ACTION ON DELETE NO ACTION + +=20 + Table "public.country" + Column | Type | Modifiers +--------------+------------------------+----------- + country_id | numeric(10,0) | not null + lang_id | numeric(10,0) | not null + country_desc | character varying(100) | not null +Indexes: country_pkey primary key btree (country_id) + +=20 + Table "public.user_account" + Column | Type | +Modifiers +-------------------------------+-----------------------------+---------- +------------------- + user_account_id | numeric(10,0) | not null + first_name | character varying(100) | + first_name_display_ind | numeric(1,0) | not null + last_name | character varying(100) | + last_name_display_ind | numeric(1,0) | not null + profession | character varying(100) | + profession_display_ind | numeric(1,0) | not null + self_description | character varying(100) | + self_description_display_ind | numeric(1,0) | not null + activity_interest | character varying(100) | + activity_interest_display_ind | numeric(1,0) | not null + make_brand | character varying(100) | + make_brand_display_ind | numeric(1,0) | not null + birth_date | timestamp without time zone | + birth_date_display_ind | numeric(1,0) | not null + my_boat_picture_link | character varying(200) | + user_account_name | character varying(100) | not null + password | character varying(100) | + password_ind | numeric(1,0) | not null + age | numeric(10,0) | + blacklisted_ind | numeric(1,0) | not null + auto_login_ind | numeric(1,0) | not null + email_addr | character varying(100) | + create_date | timestamp without time zone | default +('now'::text)::date + lang_id | numeric(10,0) | not null + user_role_id | numeric(10,0) | not null + seller_type_id | numeric(10,0) | + payment_method_id | numeric(10,0) | + account_status_id | numeric(10,0) | not null + source_id | numeric(10,0) | not null +default 100 + ebay_user_id | character varying(80) | + ebay_user_password | character varying(80) | +Indexes: user_account_pkey primary key btree (user_account_id), + usr_acc_acc_stat_id_i btree (account_status_id), + usr_acc_an_pass_i btree (user_account_name, "password"), + usr_acc_email_addr_i btree (email_addr), + usr_acc_first_name_i btree (first_name), + usr_acc_lang_id_i btree (lang_id), + usr_acc_last_name_i btree (last_name), + usr_acc_pay_meth_id_i btree (payment_method_id), + usr_acc_sell_type_id_i btree (seller_type_id), + usr_acc_usr_acc_name_i btree (user_account_name), + usr_acc_usr_role_id_i btree (user_role_id) +Foreign Key constraints: $1 FOREIGN KEY (lang_id) REFERENCES +lang(lang_id) ON UPDATE NO ACTION ON DELETE NO ACTION, + $2 FOREIGN KEY (source_id) REFERENCES +source(source_id) ON UPDATE NO ACTION ON DELETE NO ACTION, + $3 FOREIGN KEY (user_role_id) REFERENCES +user_role(user_role_id) ON UPDATE NO ACTION ON DELETE NO ACTION + +=20 + Table "public.contact_info" + Column | Type | Modifiers +-----------------+------------------------+----------- + contact_info_id | numeric(10,0) | not null + first_name | character varying(100) | + last_name | character varying(100) | + email | character varying(100) | + boat_listing_id | numeric(10,0) | + user_account_id | numeric(10,0) | +Indexes: contact_info_pkey primary key btree (contact_info_id), + boat_listing_id_i btree (boat_listing_id), + user_account_id_i btree (user_account_id) +Foreign Key constraints: $1 FOREIGN KEY (user_account_id) REFERENCES +user_account(user_account_id) ON UPDATE NO ACTION ON DELETE NO ACTION, + $2 FOREIGN KEY (user_account_id) REFERENCES +user_account(user_account_id) ON UPDATE NO ACTION ON DELETE NO ACTION + +=20 + Table "public.state_province" + Column | Type | Modifiers +---------------------------+------------------------+----------- + state_province_id | numeric(10,0) | not null + state_province_short_desc | character varying(2) | + state_province_desc | character varying(100) | not null + country_id | numeric(10,0) | not null + lang_id | numeric(10,0) | not null +Indexes: state_province_pkey primary key btree (state_province_id), + state_prov_count_lang_i btree (country_id, lang_id) + +=20 +=20 +All the join columns are the same type and width, and all are indexed. I +googled for what looked like the expensive parts of the query to see if +I could at least figure out where the time was being spent. +=20 +Part 3 to follow. +=20 +David + +------=_NextPart_000_057D_01C38756.431EB910 +Content-Type: text/html; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + + + + + + + + +
+
Here's the schema:
+
 
+
           = +    =20 +Table "public.address_list"
       = +=20 +Column       =20 +|         =20 +Type          |=20 +Modifiers
----------------------+------------------------+----------- address_list_id     =20 +| numeric(10,0)          | not= +=20 +null
 address_1        &nbs= +p;  =20 +| character varying(100)=20 +|
 address_2         &= +nbsp; =20 +| character varying(100)=20 +|
 address_3         &= +nbsp; =20 +| character varying(100)=20 +|
 city          = +      =20 +| character varying(100)=20 +|
 zip_code         &n= +bsp;  =20 +| character varying(20) =20 +|
 phone_num_1         = +; |=20 +character varying(100)=20 +|
 phone_num_2         = +; |=20 +character varying(100)=20 +|
 phone_num_fax        | charac= +ter=20 +varying(100) |
 state_province_id    |=20 +numeric(10,0)         =20 +|
 user_account_id      |=20 +numeric(10,0)         =20 +|
 marina_id         &= +nbsp; =20 +| numeric(10,0)         =20 +|
 commercial_entity_id |=20 +numeric(10,0)         =20 +|
 address_type_id      |=20 +numeric(10,0)          | not= +=20 +null
 distributor_id       |=20 +numeric(10,0)         =20 +|
 contact_info_id      |=20 +numeric(10,0)         =20 +|
 country_id         = + =20 +| numeric(10,0)         =20 +|
 lang_id         &nb= +sp;   =20 +| numeric(10,0)         =20 +|
 boat_listing_id      |=20 +numeric(10,0)         =20 +|
Indexes: address_list_pkey primary key btree=20 +(address_list_id),
        =20 +addr_list_addr_type_id_i btree=20 +(address_type_id),
        =20 +addr_list_bl_id_i btree=20 +(boat_listing_id),
        =20 +addr_list_bl_sp_count_i btree (boat_listing_id, state_province_id,=20 +country_id),
        =20 +addr_list_ce_sp_c_at_c_i btree (commercial_entity_id, state_province_id,=20 +country_id, address_type_id,=20 +city),
        =20 +addr_list_ce_sp_countr_addr_type_i btree (commercial_entity_id,=20 +state_province_id, country_id,=20 +address_type_id),
        =20 +addr_list_ci_id_i btree=20 +(contact_info_id),
        =20 +addr_list_comm_ent_id_i btree=20 +(commercial_entity_id),
        = +=20 +addr_list_count_lang_i btree (country_id,=20 +lang_id),
        =20 +addr_list_country_id_i btree=20 +(country_id),
        =20 +addr_list_cty_bl_count_i btree (city, boat_listing_id,=20 +country_id),
         addr_list_= +cty_i=20 +btree (city),
        =20 +addr_list_distrib_id_i btree=20 +(distributor_id),
        =20 +addr_list_marina_id_i btree=20 +(marina_id),
        =20 +addr_list_sp_id_i btree=20 +(state_province_id),
        =20 +addr_list_ua_id_i btree (user_account_id)
Foreign Key constraints: $1 FO= +REIGN=20 +KEY (address_type_id) REFERENCES address_type(address_type_id) ON UPDATE NO= +=20 +ACTION ON DELETE NO=20 +ACTION,
          &nbs= +p;            &= +nbsp;=20 +$2 FOREIGN KEY (commercial_entity_id) REFERENCES=20 +commercial_entity(commercial_entity_id) ON UPDATE NO ACTION ON DELETE NO=20 +ACTION,
          &nbs= +p;            &= +nbsp;=20 +$3 FOREIGN KEY (contact_info_id) REFERENCES contact_info(contact_info_id) O= +N=20 +UPDATE NO ACTION ON DELETE NO=20 +ACTION,
          &nbs= +p;            &= +nbsp;=20 +$4 FOREIGN KEY (user_account_id) REFERENCES user_account(user_account_id) O= +N=20 +UPDATE NO ACTION ON DELETE NO=20 +ACTION,
          &nbs= +p;            &= +nbsp;=20 +$5 FOREIGN KEY (state_province_id) REFERENCES state_province(state_province= +_id)=20 +ON UPDATE NO ACTION ON DELETE NO ACTION
+
 
+
           = +            &nb= +sp;            = +      =20 +Table=20 +"public.commercial_entity"
       &nb= +sp; =20 +Column          =20 +|           =20 +Type            = +;=20 +|            &n= +bsp;            = +;=20 +Modifiers
---------------------------+-----------------------------+----= +---------------------------------------------------------
 commerci= +al_entity_id     =20 +|=20 +numeric(10,0)          &n= +bsp;   =20 +| not=20 +null
 company_name        &= +nbsp;    =20 +| character varying(100)      | not=20 +null
 website         = +         =20 +| character varying(200)     =20 +|
 modify_date         = +;     =20 +| timestamp without time zone=20 +|
 user_account_id        &= +nbsp; =20 +|=20 +numeric(10,0)          &n= +bsp;   =20 +|
 source_id         &= +nbsp;      =20 +|=20 +numeric(10,0)          &n= +bsp;   =20 +| not null
 commercial_entity_type_id |=20 +numeric(10,0)          &n= +bsp;   =20 +|
 boats_website        &nb= +sp;   =20 +| character varying(200)     =20 +|
 updated_on         = +      =20 +| timestamp without time zone | not null default ('now'::text)::timestamp(6= +)=20 +with time=20 +zone
 dealer_level_id       &nbs= +p;  =20 +|=20 +numeric(10,0)          &n= +bsp;   =20 +|
 lang_id         &nb= +sp;        =20 +|=20 +numeric(10,0)          &n= +bsp;   =20 +| default=20 +'100'
 yw_account_id        = +;    =20 +|=20 +numeric(10,0)          &n= +bsp;   =20 +|
 keybank_dealer_code       |=20 +numeric(10,0)          &n= +bsp;   =20 +|
 dnetaccess_id        &nb= +sp;   =20 +|=20 +numeric(10,0)          &n= +bsp;   =20 +| not null default=20 +0
 interested_in_dns        = +; |=20 +numeric(10,0)          &n= +bsp;   =20 +| not null default=20 +0
 parent_office_id        = + =20 +|=20 +numeric(10,0)          &n= +bsp;   =20 +|
 marinesite_welcome_msg    | character=20 +varying(500)     =20 +|
 alt_marinesite_homepage   | character=20 +varying(256)     =20 +|
 comments         &n= +bsp;       =20 +| character varying(4000)    =20 +|
 show_finance_yn        &= +nbsp; =20 +| character varying(1)        | not null= +=20 +default=20 +'Y'
 show_insurance_yn       &nb= +sp; |=20 +character varying(1)        | not null= +=20 +default=20 +'Y'
 show_shipping_yn       &nbs= +p; =20 +| character varying(1)        | not null= +=20 +default=20 +'Y'
 yw_account_id_c        = +;  =20 +| character varying(11)      =20 +|
 sales_id         &n= +bsp;       =20 +|=20 +numeric(10,0)          &n= +bsp;   =20 +|
Indexes: commercial_entity_pkey primary key btree=20 +(commercial_entity_id),
        = +=20 +comm_ent_boat_web_ui unique btree=20 +(boats_website),
        =20 +comm_ent_key_dlr_cd_ui unique btree=20 +(keybank_dealer_code),
        = +=20 +comm_ent_cny_name_i btree=20 +(company_name),
        =20 +comm_ent_dlr_lvl_id_i btree (dealer_level_id,=20 +lang_id),
         comm_ent_src_= +id_i=20 +btree (source_id),
        =20 +comm_ent_type_id_i btree=20 +(commercial_entity_type_id),
       &= +nbsp;=20 +comm_ent_upd_on btree=20 +(updated_on),
        =20 +comm_ent_usr_acc_id_i btree=20 +(user_account_id),
        =20 +comm_ent_yw_acc_id_i btree (yw_account_id)
Foreign Key constraints: $1= +=20 +FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE NO ACTION ON= +=20 +DELETE NO=20 +ACTION,
          &nbs= +p;            &= +nbsp;=20 +$2 FOREIGN KEY (user_account_id) REFERENCES user_account(user_account_id) O= +N=20 +UPDATE NO ACTION ON DELETE NO ACTION
+
 
+
           = +  =20 +Table "public.country"
    Column   =20 +|         =20 +Type          |=20 +Modifiers
--------------+------------------------+-----------
 c= +ountry_id  =20 +| numeric(10,0)          | not= +=20 +null
 lang_id      |=20 +numeric(10,0)          | not= +=20 +null
 country_desc | character varying(100) | not null
Indexes:= +=20 +country_pkey primary key btree (country_id)
+
 
+
           = +            &nb= +sp;       =20 +Table=20 +"public.user_account"
        &n= +bsp;  =20 +Column           &nb= +sp;=20 +|           =20 +Type            = +;=20 +|         =20 +Modifiers
-------------------------------+-----------------------------+= +-----------------------------
 user_account_id   &nb= +sp;          =20 +|=20 +numeric(10,0)          &n= +bsp;   =20 +| not=20 +null
 first_name        &nb= +sp;          =20 +| character varying(100)     =20 +|
 first_name_display_ind       = + |=20 +numeric(1,0)          &nb= +sp;    =20 +| not=20 +null
 last_name        &nbs= +p;           =20 +| character varying(100)     =20 +|
 last_name_display_ind       &= +nbsp;=20 +|=20 +numeric(1,0)          &nb= +sp;    =20 +| not=20 +null
 profession        &nb= +sp;          =20 +| character varying(100)     =20 +|
 profession_display_ind       = + |=20 +numeric(1,0)          &nb= +sp;    =20 +| not=20 +null
 self_description       &nb= +sp;     =20 +| character varying(100)     =20 +|
 self_description_display_ind  |=20 +numeric(1,0)          &nb= +sp;    =20 +| not=20 +null
 activity_interest       &n= +bsp;    =20 +| character varying(100)     =20 +|
 activity_interest_display_ind |=20 +numeric(1,0)          &nb= +sp;    =20 +| not=20 +null
 make_brand        &nb= +sp;          =20 +| character varying(100)     =20 +|
 make_brand_display_ind       = + |=20 +numeric(1,0)          &nb= +sp;    =20 +| not=20 +null
 birth_date        &nb= +sp;          =20 +| timestamp without time zone=20 +|
 birth_date_display_ind       = + |=20 +numeric(1,0)          &nb= +sp;    =20 +| not=20 +null
 my_boat_picture_link       = +;  =20 +| character varying(200)     =20 +|
 user_account_name        = +;    =20 +| character varying(100)      | not=20 +null
 password         = +;            = +=20 +| character varying(100)     =20 +|
 password_ind        &nbs= +p;        =20 +|=20 +numeric(1,0)          &nb= +sp;    =20 +| not=20 +null
 age         &nbs= +p;            &= +nbsp;   =20 +|=20 +numeric(10,0)          &n= +bsp;   =20 +|
 blacklisted_ind        &= +nbsp;     =20 +|=20 +numeric(1,0)          &nb= +sp;    =20 +| not=20 +null
 auto_login_ind        = +;       =20 +|=20 +numeric(1,0)          &nb= +sp;    =20 +| not=20 +null
 email_addr        &nb= +sp;          =20 +| character varying(100)     =20 +|
 create_date         = +;         =20 +| timestamp without time zone | default=20 +('now'::text)::date
 lang_id      &nb= +sp;            = +   =20 +|=20 +numeric(10,0)          &n= +bsp;   =20 +| not=20 +null
 user_role_id        &= +nbsp;        =20 +|=20 +numeric(10,0)          &n= +bsp;   =20 +| not=20 +null
 seller_type_id        = +;       =20 +|=20 +numeric(10,0)          &n= +bsp;   =20 +|
 payment_method_id        = +;    =20 +|=20 +numeric(10,0)          &n= +bsp;   =20 +|
 account_status_id        = +;    =20 +|=20 +numeric(10,0)          &n= +bsp;   =20 +| not=20 +null
 source_id        &nbs= +p;           =20 +|=20 +numeric(10,0)          &n= +bsp;   =20 +| not null default=20 +100
 ebay_user_id        &n= +bsp;        =20 +| character varying(80)      =20 +|
 ebay_user_password       &nbs= +p;   =20 +| character varying(80)       |
Indexes:= +=20 +user_account_pkey primary key btree=20 +(user_account_id),
        =20 +usr_acc_acc_stat_id_i btree=20 +(account_status_id),
        =20 +usr_acc_an_pass_i btree (user_account_name,=20 +"password"),
        =20 +usr_acc_email_addr_i btree=20 +(email_addr),
        =20 +usr_acc_first_name_i btree=20 +(first_name),
        =20 +usr_acc_lang_id_i btree=20 +(lang_id),
        =20 +usr_acc_last_name_i btree=20 +(last_name),
        =20 +usr_acc_pay_meth_id_i btree=20 +(payment_method_id),
        =20 +usr_acc_sell_type_id_i btree=20 +(seller_type_id),
        =20 +usr_acc_usr_acc_name_i btree=20 +(user_account_name),
        =20 +usr_acc_usr_role_id_i btree (user_role_id)
Foreign Key constraints: $1= +=20 +FOREIGN KEY (lang_id) REFERENCES lang(lang_id) ON UPDATE NO ACTION ON DELET= +E NO=20 +ACTION,
          &nbs= +p;            &= +nbsp;=20 +$2 FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE NO ACTION= + ON=20 +DELETE NO=20 +ACTION,
          &nbs= +p;            &= +nbsp;=20 +$3 FOREIGN KEY (user_role_id) REFERENCES user_role(user_role_id) ON UPDATE = +NO=20 +ACTION ON DELETE NO ACTION
+
 
+
           = + =20 +Table "public.contact_info"
    =20 +Column     =20 +|         =20 +Type          |=20 +Modifiers
-----------------+------------------------+-----------
&nbs= +p;contact_info_id=20 +| numeric(10,0)          | not= +=20 +null
 first_name      | character varying(= +100)=20 +|
 last_name       | character=20 +varying(100)=20 +|
 email          = +; |=20 +character varying(100) |
 boat_listing_id |=20 +numeric(10,0)         =20 +|
 user_account_id |=20 +numeric(10,0)         =20 +|
Indexes: contact_info_pkey primary key btree=20 +(contact_info_id),
        =20 +boat_listing_id_i btree=20 +(boat_listing_id),
        =20 +user_account_id_i btree (user_account_id)
Foreign Key constraints: $1 FO= +REIGN=20 +KEY (user_account_id) REFERENCES user_account(user_account_id) ON UPDATE NO= +=20 +ACTION ON DELETE NO=20 +ACTION,
          &nbs= +p;            &= +nbsp;=20 +$2 FOREIGN KEY (user_account_id) REFERENCES user_account(user_account_id) O= +N=20 +UPDATE NO ACTION ON DELETE NO ACTION
+
 
+
           = +     =20 +Table=20 +"public.state_province"
        = + =20 +Column          =20 +|         =20 +Type          |=20 +Modifiers
---------------------------+------------------------+---------= +--
 state_province_id       &nbs= +p;=20 +| numeric(10,0)          | not= +=20 +null
 state_province_short_desc | character varying(2)  = +=20 +|
 state_province_desc       | charac= +ter=20 +varying(100) | not=20 +null
 country_id        &nb= +sp;      =20 +| numeric(10,0)          | not= +=20 +null
 lang_id         = +         =20 +| numeric(10,0)          | not= +=20 +null
Indexes: state_province_pkey primary key btree=20 +(state_province_id),
        =20 +state_prov_count_lang_i btree (country_id, lang_id)
+
 
+
 
+
All the join columns are the same type and= + width,=20 +and all are indexed. I googled for what looked like the expensive parts of = +the=20 +query to see if I could at least figure out where the time was being=20 +spent.
+
 
+
Part 3 to follow.
+
 
+
David
+ +------=_NextPart_000_057D_01C38756.431EB910-- + +From pgsql-performance-owner@postgresql.org Wed Oct 1 00:16:07 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 98FD5D1C9FA + for ; + Wed, 1 Oct 2003 03:16:04 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 18255-06 + for ; + Wed, 1 Oct 2003 00:15:17 -0300 (ADT) +Received: from www.postgresql.com (unknown [64.117.225.209]) + by svr1.postgresql.org (Postfix) with ESMTP id 903AFD1C9F7 + for ; + Tue, 30 Sep 2003 23:22:05 -0300 (ADT) +Received: from boats_exch01.boats.com (h209-17-182-106.gtconnect.net + [209.17.182.106]) + by www.postgresql.com (Postfix) with ESMTP id 0FA24CF510A + for ; + Tue, 30 Sep 2003 17:17:43 -0300 (ADT) +Received: by BOATS_EXCH01 with Internet Mail Service (5.5.2653.19) + id ; Tue, 30 Sep 2003 13:16:17 -0700 +Received: from GRIFFITHS2 ([192.168.12.195]) by boats_exch01.boats.com with + SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) + id TTY64KDL; Tue, 30 Sep 2003 13:16:15 -0700 +From: David Griffiths +To: pgsql-performance@postgresql.org +Message-ID: <058d01c38791$0d0a91b0$6501a8c0@griffiths2> +Subject: Tuning/performance issue.... +Date: Tue, 30 Sep 2003 13:25:50 -0700 +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_NextPart_000_0586_01C38756.5DD938C0" +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 5.50.4922.1500 +X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4925.2800 +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Spam-Status: No, hits=0.6 tagged_above=0.0 required=5.0 tests=BAYES_30, + HTML_30_40, RCVD_IN_OSIRUSOFT_COM +X-Spam-Level: +X-Archive-Number: 200310/3 +X-Sequence-Number: 3751 + +This is a multi-part message in MIME format. + +------=_NextPart_000_0586_01C38756.5DD938C0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + +And finally, +=20 +Here's the contents of the postgresql.conf file (I've been playing with +these setting the last couple of days, and using the guide @ +http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_conf_e.html + to make sure I didn't have it mis-tuned): +=20 +tcpip_socket =3D true +max_connections =3D 500 # We will need quite a few connections; +currently only one connection to database, however +port =3D 5432 +shared_buffers =3D 5000 # I've tried 5000 to 80,000 with no +apparent difference +wal_buffers =3D 16 +sort_mem =3D 256 # decreased this due to the large # of +connectiosn +effective_cache_size =3D 50000 # read that this can improve performance; +hasn't done anything. +=20 +The machine is a dual-Pentium 3 933mhz, with 2 gigabytes of RAM and a +3Ware RAID-5 card. +=20 +As a reference, our production Oracle database (exactly the same +hardware, but RAID-mirroring) with way more load can handle the query in +1-2 seconds. I have MySQL 4.0.14 with InnoDB on the same machine +(shutdown when I am testing Postgres, and visa versa) and it does the +query in 0.20 seconds. +=20 +Thanks for any insight. +David. + + +------=_NextPart_000_0586_01C38756.5DD938C0 +Content-Type: text/html; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + + + + + + + + +
And finally,
+
 
+
+
Here's the contents of the postgresql.conf= + file=20 +(I've been playing with these setting the last couple of days, and using th= +e=20 +guide @ http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_conf_e.= +html to=20 +make sure I didn't have it mis-tuned):
+
 
+
tcpip_socket =3D true
max_connections =3D 500        # We = +will need=20 +quite a few connections; currently only one connection to database,=20 +however
+
port =3D 5432
shared_buffers =3D=20 +5000           # I've tri= +ed=20 +5000 to 80,000 with no apparent difference
wal_buffers =3D 16
+
sort_mem =3D=20 +256            = +   =20 +    # decreased this due to the large # of=20 +connectiosn
+
effecti= +ve_cache_size=20 +=3D 50000 # read that this can impr= +ove=20 +performance; hasn't done anything.
+
 
+
The machine is a dual-Pentium 3 933mhz, wi= +th 2=20 +gigabytes of RAM and a 3Ware RAID-5 card.
+
 
+
As a reference, our production Oracle data= +base=20 +(exactly the same hardware, but RAID-mirroring) with way more load can hand= +le=20 +the query in 1-2 seconds. I have MySQL 4.0.14 with InnoDB on the same machi= +ne=20 +(shutdown when I am testing Postgres, and visa versa) and it does the query= + in=20 +0.20 seconds.
+
 
+
Thanks for any insight.
+
David.
+ +------=_NextPart_000_0586_01C38756.5DD938C0-- + +From pgsql-performance-owner@postgresql.org Thu Oct 2 11:28:10 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 38848D1CAFF + for ; + Wed, 1 Oct 2003 03:31:06 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 20629-07 + for ; + Wed, 1 Oct 2003 00:30:19 -0300 (ADT) +Received: from www.postgresql.com (unknown [64.117.225.209]) + by svr1.postgresql.org (Postfix) with ESMTP id D0146D1D38C + for ; + Tue, 30 Sep 2003 23:22:24 -0300 (ADT) +Received: from lorax.kcilink.com (lorax.kciLink.com [206.112.95.1]) + by www.postgresql.com (Postfix) with ESMTP id 62A28CF7220 + for ; + Tue, 30 Sep 2003 17:30:15 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by lorax.kcilink.com (Postfix) with ESMTP id A86043E67 + for ; + Tue, 30 Sep 2003 16:30:17 -0400 (EDT) +Received: from lorax.kcilink.com ([127.0.0.1]) + by localhost (lorax.kcilink.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 37239-05-6 for ; + Tue, 30 Sep 2003 16:30:17 -0400 (EDT) +Received: from lorax.kciLink.com (localhost [127.0.0.1]) + by lorax.kcilink.com (Postfix) with ESMTP id 9614C3E65 + for ; + Tue, 30 Sep 2003 16:30:16 -0400 (EDT) +Received: (from news@localhost) + by lorax.kciLink.com (8.12.8p1/8.12.8/Submit) id h8UKUG5a059369 + for pgsql-performance@postgresql.org; + Tue, 30 Sep 2003 16:30:16 -0400 (EDT) +To: pgsql-performance@postgresql.org +Path: not-for-mail +From: Vivek Khera +Newsgroups: ml.postgres.performance +Subject: Re: advice on raid controller +Date: Tue, 30 Sep 2003 16:30:15 -0400 +Organization: Khera Communications, Inc., Rockville, MD +Lines: 18 +Message-ID: +References: <200309271824.33351.rj@last.fm> +NNTP-Posting-Host: yertle.kcilink.com +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Trace: lorax.kcilink.com 1064953816 35290 216.194.193.105 (30 Sep 2003 + 20:30:16 GMT) +X-Complaints-To: daemon@kciLink.com +NNTP-Posting-Date: Tue, 30 Sep 2003 20:30:16 +0000 (UTC) +User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Portable Code, + berkeley-unix) +Cancel-Lock: sha1:iJTrf4vhRG+dc/djxiYprngG4E8= +X-Virus-Scanned: by amavisd-new at kciLink.com +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200310/48 +X-Sequence-Number: 3796 + +>>>>> "RJ" == Richard Jones writes: + +RJ> Hi, i'm on the verge of buying a "MegaRAID SCSI 320-2" raid controller. +RJ> I need it to build a db server using 4x ultra320 scsi disks +RJ> i'm thinking raid 1+0 but will try with raid5 too and compare + +No specific tips on that particular RAID, but in general it seems that +you want to *disable* the read-ahead and enable the write-back cache. +This is from reading on the linux megaraid developers list. + +Also, for 4 disks, go with RAID 1+0 for your best performance. I +found it faster. However, with my 14 disk system, RAID5 is fastest. + +-- +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Vivek Khera, Ph.D. Khera Communications, Inc. +Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 +AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ + +From pgsql-performance-owner@postgresql.org Thu Oct 2 11:08:02 2003 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [64.117.224.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 24371D1CAE4 + for ; + Wed, 1 Oct 2003 03:16:44 +0000 (GMT) +Received: from svr1.postgresql.org ([64.117.224.193]) + by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, + port 10024) with ESMTP id 18581-05 + for ; + Wed, 1 Oct 2003 00:15:58 -0300 (ADT) +Received: from www.postgresql.com (unknown [64.117.225.209]) + by svr1.postgresql.org (Postfix) with ESMTP id 9BE61D1CC5D + for ; + Tue, 30 Sep 2003 23:22:16 -0300 (ADT) +Received: from lorax.kcilink.com (lorax.kciLink.com [206.112.95.1]) + by www.postgresql.com (Postfix) with ESMTP id 3F403CF7468 + for ; + Tue, 30 Sep 2003 17:32:25 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by lorax.kcilink.com (Postfix) with ESMTP id 1D7553E65 + for ; + Tue, 30 Sep 2003 16:32:28 -0400 (EDT) +Received: from lorax.kcilink.com ([127.0.0.1]) + by localhost (lorax.kcilink.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 65184-03 for ; + Tue, 30 Sep 2003 16:32:27 -0400 (EDT) +Received: from lorax.kciLink.com (localhost [127.0.0.1]) + by lorax.kcilink.com (Postfix) with ESMTP id 940213E47 + for ; + Tue, 30 Sep 2003 16:32:27 -0400 (EDT) +Received: (from news@localhost) + by lorax.kciLink.com (8.12.8p1/8.12.8/Submit) id h8UKWRxo063131 + for pgsql-performance@postgresql.org; + Tue, 30 Sep 2003 16:32:27 -0400 (EDT) +To: pgsql-performance@postgresql.org +Path: not-for-mail +From: Vivek Khera +Newsgroups: ml.postgres.performance +Subject: Re: advice on raid controller +Date: Tue, 30 Sep 2003 16:32:27 -0400 +Organization: Khera Communications, Inc., Rockville, MD +Lines: 14 +Message-ID: +References: + <39060000.1064871114@palle.girgensohn.se> + <43690000.1064871316@palle.girgensohn.se> +NNTP-Posting-Host: yertle.kcilink.com +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Trace: lorax.kcilink.com 1064953947 35290 216.194.193.105 (30 Sep 2003 + 20:32:27 GMT) +X-Complaints-To: daemon@kciLink.com +NNTP-Posting-Date: Tue, 30 Sep 2003 20:32:27 +0000 (UTC) +User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Portable Code, + berkeley-unix) +Cancel-Lock: sha1:0nVVVeWvrcXKrp+JdoMB4UCdCPE= +X-Virus-Scanned: by amavisd-new at kciLink.com +X-Virus-Scanned: by amavisd-new at postgresql.org +X-Archive-Number: 200310/46 +X-Sequence-Number: 3794 + +>>>>> "PG" == Palle Girgensohn writes: + +PG> Come to think of it, I guess a battery-backed cache will make fsync as +PG> fast as no fsync, right? So, the q was kinda stoopid... :-/ + +In my testing, yes, the battery cache makes fsync=true just about as +fast as fsync=false. it was only about 2 seconds slower (out of 4 +hours) while doing a restore. + +-- +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Vivek Khera, Ph.D. Khera Communications, Inc. +Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 +AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ +