Hello!
I have encountered a problem with querry plan building:
I'd set default_statistics_target=700, run analyze. Postgres optimize had chosen plan with hash_join and it took ~1 min for qerry to complete.
Then i set default_statistics_target=500 and the plan was significantly changed and was using merge_join instead, complition time reduced in hundreds times, cost reduced drastically.
Now i can't understand why more precise statistics leads to less optimized plan and what is the right way to use default_statistics_target parameter?
I attach both good and bad querry plans and the querry itself