Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 53E4663332D for ; Wed, 10 Feb 2010 16:32:11 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 94828-05 for ; Wed, 10 Feb 2010 20:32:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.155]) by mail.postgresql.org (Postfix) with ESMTP id B1717632FDB for ; Wed, 10 Feb 2010 16:32:00 -0400 (AST) Received: by fg-out-1718.google.com with SMTP id e21so38446fga.1 for ; Wed, 10 Feb 2010 12:31:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=ad8cgZZL0zPtMXepqws1kejWpFF7M2Oy6DJULgGFegM=; b=RuR4WEmPlF+LZZIUXROGWWuiqAcEtH24Bmhmob9ZaI/34tDqXuaI4iFrwx72rhuVIQ /T6Tvul9Yl81PpARj8e3CBTiqMC5YKlFaCSZd3wr7PKjhORAL0NPN+ExITnkn3PJlCV2 icHdYWniFRke1Wc/nwQAfqkCRVVjdY0rzpT8w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=VACFdKm7HYN6vhsfVgfr/jXpvpF8VaTwC2geCSfrOK/Ii/RWHd0EZ2BS91SuTBq3HB IR1cfvKZVxzwrz3QTMQmvwaIMjXPuZfZNHJB9Y1AdhKo0FVcFTkFZn/tH4Q2JS8WUXyO NC1gBBMntyqLPnqn/kyEo6UuC+fxoC4SeU/CQ= MIME-Version: 1.0 Received: by 10.239.184.75 with SMTP id x11mr87422hbg.26.1265833918404; Wed, 10 Feb 2010 12:31:58 -0800 (PST) In-Reply-To: <4B726E81.2060904@obviously.com> References: <4B723042.7090406@obviously.com> <4B726E81.2060904@obviously.com> Date: Wed, 10 Feb 2010 15:31:58 -0500 Message-ID: <603c8f071002101231k45e9161eyeacf9072219489eb@mail.gmail.com> Subject: Re: Re: 512,600ms query becomes 7500ms... but why? Postgres 8.3 query planner quirk? From: Robert Haas To: Bryce Nesbitt Cc: pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201002/164 X-Sequence-Number: 37585 On Wed, Feb 10, 2010 at 3:29 AM, Bryce Nesbitt wrote: > Or, if you want to actually read that query plan, try: > http://explain.depesz.com/s/qYq Much better, though I prefer a text attachment... anyhow, I think the root of the problem may be that both of the subquery scans under the append node are seeing hundreds of times more rows than they're expecting, which is causing the planner to choose nested loops higher up that it otherwise might have preferred to implement in some other way. I'm not quite sure why, though. ...Robert