Jeff Amiel <becauseimjeff@xxxxxxxxx> writes: > Oddball data distribution giving me headaches. > [ 'distributor' customers have many more child customers than average ] > Does this oddball data distribution doom me to poor planning forever? The only real fix for that will require cross-column statistics, which we don't have yet --- without such, there's no way for the planner to know that distributors have an atypical number of child customers. At the moment I think the only way to work around this is to denormalize your schema a bit. For instance, if you were to include the parent customer_type directly into the customer_rel table, that would not only save one join in this query but it would expose the stats the planner needs to realize that it's going to get a lot of matches. If you don't like that particular solution there are probably other ways to get the same result, but they're all going to require schema changes. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general