> Starting with PostgreSQL 9.6, foreign keys are also used to help with
> join selectivity estimations. I see you have a suitable foreign key
> from the schema you posted. You might want to add that to the list of
> reasons to upgrade.
Apologies for the delay in response. I've had "PostgreSQL 9.6.3,
compiled by Visual C++ build 1800, 64-bit" setup at home for a while
and after importing the data across I'm still seeing the same
behaviour.
Even after upgrading my local install of PG to "PostgreSQL 12.2,
compiled by Visual C++ build 1914, 64-bit" and I'm still seeing the
same behaviour.
Plans for PG12:-
Query A: https://explain.depesz.com/s/zrVD
Query B: https://explain.depesz.com/s/ZLWe
The settings for my home setup are left at default, nothing special.
Indy