Thanks for you thorough answer!
"n_distinct affects the statistics for the table itself, while n_distinct_inherited affects the statistics
gathered for the table plus its inheritance children."
I see that this text has multiple interpretations. I read it more like: while n_distinct_inherited affects the
statisticsgathered [by analyze] for the table plus [affects the statistics of] its inheritance children.
The core problem for me was that I had to set n_distinct manually on my individual partitions for the planner to choose
asane plan for queries on the declared partition. The data for a column was so skewed that the analyzers n_distinct
wasoff by a factor of 1000X, which made all partitions do a table scan instead of index scan. In my mind, setting the
declarativepartition variable n_distinct_inherited would solve that; but obviously I am wrong on that.
Klaudie