Arnaud Lesauvage <arnaud.listes@xxxxxxxxx> writes: > I am still a bit intrigued by the different query plans. Both query look > very similar to me, so why does the planner make so different choices ? Sometime in the future they might generate the same plan. Right now the planner's ability to optimize sub-SELECTs is pretty limited, and so you typically get a nestloop-like plan even if some other join style would be faster. (It's not all the planner's fault either --- we'd need to tweak the executor so that it could throw the appropriate error for more than one join partner row, etc.) 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