Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 5AFE91337B67 for ; Fri, 15 Oct 2010 22:18:16 -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 98377-04 for ; Sat, 16 Oct 2010 01:18:10 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by mail.postgresql.org (Postfix) with ESMTP id 5C4DA1337B61 for ; Fri, 15 Oct 2010 22:18:08 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 17FFBAEF0C; Sat, 16 Oct 2010 09:18:08 +0800 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (mail.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 0BFXZOaXmjDx; Sat, 16 Oct 2010 09:18:01 +0800 (WST) Received: from [10.1.1.5] (203-59-65-233.dyn.iinet.net.au [203.59.65.233]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTPSA id E86E9AEF0B; Sat, 16 Oct 2010 09:18:00 +0800 (WST) Message-ID: <4CB8FD47.7090101@postnewspapers.com.au> Date: Sat, 16 Oct 2010 09:17:59 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc14 Thunderbird/3.1.4 MIME-Version: 1.0 To: Brandon Casci , "List, Postgres" Subject: Re: [PERFORM] help with understanding EXPLAIN References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201010/564 X-Sequence-Number: 168476 On 10/14/2010 05:18 AM, Brandon Casci wrote: > Hello > > I have an application hosted on Heroku. They use postgres. It's more or > less abstracted away, but I can get some performance data from New > Relic. For the most part, performance is ok, but now and then some > queries take a few seconds, and spike up to 15 or even 16 seconds! Ouch! > > This is the most detailed information I could get form New Relic. Do you > have any suggestions how I could improve the performance? That query plan is nearly illegible, and it contains no information about how the query actually executed or how many rows were fetched from various tables. I can't personally see any way to give you useful advice based on that information. I know you're going through a third party, but do think you could get them to post the original form, unmangled by mail clients and whatever else they've done to it, here? : http://explain.depesz.com Get them to use EXPLAIN ANALYZE rather than plain EXPLAIN, and to provide the text of the query that generated the plan. -- Craig Ringer