Titus von Boxberg <titus@xxxxxxxxxxxxxxxxxx> writes: > I got the following problem for which I could not find a solution by searching the archives: > I have Tables Ta, Tb, Tc with primary keys as bigserials. > Ta references Tb references Tc. > Not all but most rows in Ta reference exactly one row in Tb. Hm, your problem query has 11 table scans (not to mention a couple of subplans) so you're oversimplifying here. Anyway, I think that increasing join_collapse_limit and/or from_collapse_limit to at least 11 might help. As-is, you're more or less at the mercy of whether your textual query structure corresponds to a good join order. 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