Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1ULFXR-0002as-RY for pgsql-performance@arkaria.postgresql.org; Thu, 28 Mar 2013 16:18:54 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1ULFXR-0003uE-Bg for pgsql-performance@arkaria.postgresql.org; Thu, 28 Mar 2013 16:18:53 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1ULFXP-0003u8-W1 for pgsql-performance@postgresql.org; Thu, 28 Mar 2013 16:18:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1ULFXN-000498-QX for pgsql-performance@postgresql.org; Thu, 28 Mar 2013 16:18:51 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id r2SGIkNS000869; Thu, 28 Mar 2013 12:18:46 -0400 (EDT) From: Tom Lane To: Marty Frasier cc: pgsql-performance@postgresql.org, James Quinn Subject: Re: how to help the planner In-reply-to: References: Comments: In-reply-to Marty Frasier message dated "Thu, 28 Mar 2013 11:59:05 -0400" Date: Thu, 28 Mar 2013 12:18:46 -0400 Message-ID: <868.1364487526@sss.pgh.pa.us> X-Pg-Spam-Score: -3.2 (---) 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 Marty Frasier writes: > We've been using postgreSQL for a few years. This is my first post here > and first real dive into query plans. One quick thought is that it's probably worth cranking up join_collapse_limit and/or from_collapse_limit, since the number of relations in the query is considerably more than the default values of those limits. This will make planning take longer but possibly find better plans. I'm not sure it will help a lot, since most of the problem is evidently bad rowcount estimates, but it might help. Also it seems like the major rowcount failing is in the estimate for the t12 subquery. I can't tell why that particular combination of WHERE clauses is giving it such a hard time --- is there something odd about the distribution of 'cahsee_ela' tests? Why is that particular subquery grouped over school/student when all the others are grouped over just student? regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance