I wrote:
> Ah. So this must be something to do with the foreign-key-driven rowcoun=
t
> estimates we added in 9.6. Will look into it, thanks for the report!
I think the answer is that we failed to consider inheritance cases at all
while developing the aforementioned logic. For the moment, I've
band-aided this by disabling the FK estimation logic when either relation
is an inheritance parent. If you need a patch immediately, see
https://git.postgresql.org/gitweb/?p=3Dpostgresql.git;a=3Dcommitdiff;h=3D2=
3c6c437f98c996092c0adfad6152d9cc699c8b0
regards, tom lane