On Tue, Mar 5, 2019 at 3:00 AM Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: > apply_projection_to_path() not only jams the given tlist into the > existing path but updates its tlist eval costs appropriately except for > the cases of Gather and GatherMerge:
I had forgotten that detail, but I don't think it changes the basic picture. Once you've added a bunch of Paths to a RelOptInfo, it's too late to change their *relative* cost, because add_path() puts the list in a certain order, and adjusting the path costs won't change that ordering. You've got to have the costs already correct at the time add_path() is first called for any given Path. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company