Marty Frasier <m.frasier@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance