Adam Brusselback <adambrusselback@xxxxxxxxx> writes: > Alright with that off I get: > ... > Way better. OK, that confirms the suspicion that beta1's FK-join-estimation logic is the culprit here. We had already decided that that logic is broken, and there's a rewrite in progress: https://www.postgresql.org/message-id/15245.1466031608%40sss.pgh.pa.us I wonder though whether the rewrite will fix your example. Could you either make some test data available, or try HEAD + aforesaid patch to see if it behaves sanely on your data? 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