Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id AC1D8B5DC6E for ; Sat, 22 Oct 2011 23:32:06 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 14260-05 for ; Sun, 23 Oct 2011 02:31:59 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 1754BB5DC6B for ; Sat, 22 Oct 2011 23:31:59 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p9N2VxMR020460; Sat, 22 Oct 2011 22:31:59 -0400 (EDT) To: Anthony Presley cc: pgsql-performance , Erik Van Gilder Subject: Re: 8.4.4, 9.0, and 9.1 Planner Differences In-reply-to: References: <9317.1319299106@sss.pgh.pa.us> Comments: In-reply-to Anthony Presley message dated "Sat, 22 Oct 2011 18:12:51 -0500" Date: Sat, 22 Oct 2011 22:31:59 -0400 Message-ID: <20459.1319337119@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.404 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.504 X-Spam-Level: X-Archive-Number: 201110/183 X-Sequence-Number: 45405 Anthony Presley writes: > I have tried setting the statistics on employee.user_id to be 100 and 1000, > and the rest are the default (100). > I've run both an "ANALYZE" and a "VACUUM ANALYZE" on the production system - > both "generally", and on each of the above tables (employee, app_user, > location, preference). > Here's an updated explain of the most recent attempt. About 5 minutes after > I analyzed them: > http://explain.depesz.com/s/G32 Looks like the biggest estimation errors are on the location_id joins. Maybe you should be cranking up the stats targets on those columns. regards, tom lane