Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id A42A51337BF8 for ; Wed, 6 Apr 2011 10:37:09 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 70103-02 for ; Wed, 6 Apr 2011 13:37:00 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ndmsnpf02.ndc.nasa.gov (ndmsnpf02.ndc.nasa.gov [198.117.0.122]) by mail.postgresql.org (Postfix) with ESMTP id 965CB1337BFD for ; Wed, 6 Apr 2011 10:36:58 -0300 (ADT) Received: from ndmsppt05.ndc.nasa.gov (ndmsppt05.ndc.nasa.gov [198.117.0.104]) by ndmsnpf02.ndc.nasa.gov (Postfix) with ESMTP id 1BF9E1089EC; Wed, 6 Apr 2011 08:36:59 -0500 (CDT) Received: from ndmshub01.ndc.nasa.gov (ndmshub01-pub.ndc.nasa.gov [198.117.0.160]) by ndmsppt05.ndc.nasa.gov (8.14.4/8.14.4) with ESMTP id p36Daxel013057; Wed, 6 Apr 2011 08:36:59 -0500 Received: from lrc000959195.larc.nasa.gov (198.119.134.170) by smtp02.ndc.nasa.gov (198.117.0.160) with Microsoft SMTP Server (TLS) id 8.3.137.0; Wed, 6 Apr 2011 08:36:58 -0500 Message-ID: <4D9C6C7A.1060107@nasa.gov> Date: Wed, 6 Apr 2011 09:36:58 -0400 From: "Maria L. Wilson" Reply-To: Organization: SSAI User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.15) Gecko/20110303 Lightning/1.0b2 Thunderbird/3.1.9 MIME-Version: 1.0 To: "tv@fuzzy.cz" CC: "Wilson, Maria Louise (LARC-E301)[SCIENCE SYSTEMS AND APPLICATIONS, INC]" , "pgsql-performance@postgresql.org" Subject: Re: help speeding up a query in postgres 8.4.5 References: <4D9B6CBA.2050609@nasa.gov> <1b572fb7e416cc09ec31ea1a16d0442f.squirrel@sq.gransy.com> In-Reply-To: <1b572fb7e416cc09ec31ea1a16d0442f.squirrel@sq.gransy.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.2.15, 1.0.148, 0.0.0000 definitions=2011-04-06_04:2011-04-06, 2011-04-06, 1970-01-01 signatures=0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201104/47 X-Sequence-Number: 43109 thanks for the reply, Tomas. I'll test bumping up work_mem and see how that helps..... thanks again, Maria Wilson On 4/6/11 9:16 AM, tv@fuzzy.cz wrote: >> some additional info..... >> the table inventory is about 4481 MB and also has postgis types. >> the table gran_ver is about 523 MB >> the table INVSENSOR is about 217 MB >> >> the server itself has 32G RAM with the following set in the postgres conf >> shared_buffers = 3GB >> work_mem = 64MB >> maintenance_work_mem = 512MB >> wal_buffers = 6MB > Not sure how to improve the query itself - it's rather simple and the > execution plan seems reasonable. You're dealing with a lot of data, so it > takes time to process. > > Anyway, I'd try to bump up the shared buffers a bit (the tables you've > listed have about 5.5 GB, so 3GB of shared buffers won't cover it). OTOH > most of the data will be in pagecache maintained by the kernel anyway. > > Try to increase the work_mem a bit, that might speed up the hash joins > (the two hash joins consumed about 15s, the whole query took 17s). This > does not require a restart, just do > > set work_mem = '128MB' > > (or 256MB) and then run the query in the same session. Let's see if that > works. > > regards > Tomas >