On 10/25/24 16:26, Ba Jinsheng wrote:
>So, I wonder if you could analyse the path-choosing logic, determine the
costs of competing paths, and explain why NestLoop wasn't chosen.
To be honest, it is a bit challenging for me.
I guess the better query plan is not considered when comparing the cost
of paths?
I personally print all the paths (adding an elog message inside the
code) and their costs for specific JOIN. Some paths are filtered on
earlier stages and not even have a leg in pathlist.
Basically, Postgres already has some extended logging for the optimiser
paths - use -DOPTIMIZER_DEBUG compilation flag.
--
regards, Andrei Lepikhov