Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UJ9Ht-0002Nv-8O for pgsql-performance@arkaria.postgresql.org; Fri, 22 Mar 2013 21:14:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UJ9Hs-0007vt-Cx for pgsql-performance@arkaria.postgresql.org; Fri, 22 Mar 2013 21:14:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UJ9Hr-0007vn-Bx for pgsql-performance@postgresql.org; Fri, 22 Mar 2013 21:14:07 +0000 Received: from outmail148148.authsmtp.co.uk ([62.13.148.148]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UJ9Hi-0002Vu-RO for pgsql-performance@postgresql.org; Fri, 22 Mar 2013 21:14:06 +0000 Received: from mail-c226.authsmtp.com (mail-c226.authsmtp.com [62.13.128.226]) by punt5.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id r2MLDuWV010078 for ; Fri, 22 Mar 2013 21:13:56 GMT Received: from [172.47.23.103] (70-36-143-10.dsl.dynamic.sonic.net [70.36.143.10]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/) with ESMTP id r2MLDqMe068158 for ; Fri, 22 Mar 2013 21:13:53 GMT Message-ID: <514CC98E.4050903@agliodbs.com> Date: Fri, 22 Mar 2013 14:13:50 -0700 From: Josh Berkus Organization: PostgreSQL Experts Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Performance of query References: In-Reply-To: X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Server-Quench: 66dad8da-9335-11e2-98a9-0025907ec6c5 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCdyZgscClZXSx8a IioLCC5HRQ8+YBZL BAkbIhBDJB8RWB5f NVxfJ1xYPXUEQkpF VCReGBUITgIzDi13 aRUsPEdCYEpPXBVo UUJIQVhXEEtvAQIC AAAfVhpsdgVZen1v ZQggXA0nKAUHIEZ7 Sk9RHSMHZ25oJmYZ BBEMf1cFbQpJfRpY a1EqVm4EaTQOe3pg RVJiZ288NmtUdTJv T1NFHmo/e2gsJBsJ DygPBzsoB0gMQS4+ ZxsoYkcBEVwAWgAA X-Authentic-SMTP: 61633136333939.1020:706 X-AuthFastPath: 0 (Was 255) X-AuthSMTP-Origin: 70.36.143.10/23 X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 03/22/2013 12:46 PM, Cindy Makarowsky wrote: > I've tried playing around with the settings in the config file for > shared_buffers, work_mem, etc restarting Postgres each time and nothing > seems to help. Well, you're summarizing 55 million rows on an unindexed table: " -> Seq Scan on busbase (cost=0.00..6378172.28 rows=55402728 width=7) (actual time=0.004..250046.673 rows=60057057 loops=1)" ... that's where your time is going. My only suggestion would be to create a composite index which matches the group by condition on table1, and vacuum freeze the whole table so that you can use index-only scan on 9.2. -- Josh Berkus PostgreSQL Experts Inc. http://pgexperts.com -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance