Michael Lewis <mlewis@xxxxxxxxxxx> writes: > Does the plan change significantly with this- > set session work_mem='250MB'; > set session geqo_threshold = 20; > set session join_collapse_limit = 20; Yeah ... by my count there are 16 tables in this query, so raising join_collapse_limit to 15 is not enough to ensure that the planner considers all join orders. Whether use of GEQO is a big problem is harder to say, but it might be. regards, tom lane