Hi! Please check the following proposal (patch in attach). The main idea is to reject only obviously worse paths (costs considerably more than compared one), and to pass pre-calculated startup cost to precheck function for more accurate comparison.
> > -- Regards, Nikita Malakhov Postgres Professional The Russian Postgres Company https://postgrespro.ru/
v1-0001-ppath-precheck.patch
Description: Binary data