Can we rely on the ordering of paths in pathlist?

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Can we rely on the ordering of paths in pathlist?
Date: 2023-04-11 03:03:27
Message-ID: CAMbWs49xR_2T1BPDw+vO4Bs7pqYiQn4aNaWdmA9BdVEaHhtktg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

As the comment above add_path() says, 'The pathlist is kept sorted by
total_cost, with cheaper paths at the front.' And it seems that
get_cheapest_parallel_safe_total_inner() relies on this ordering
(without being mentioned in the comments, which I think we should do).
I'm wondering if this is the right thing to do, as in other places
cheapest total cost is found by compare_path_costs(), which would
consider startup cost if paths have the same total cost, and that seems
more sensible.

Attach a trivial patch to make get_cheapest_parallel_safe_total_inner
act this way.

Thanks
Richard

Attachment Content-Type Size
v1-0001-Revise-get_cheapest_parallel_safe_total_inner.patch application/octet-stream 1.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Regina Obe 2023-04-11 03:09:40 RE: [PATCH] Support % wildcard in extension upgrade filenames
Previous Message Thomas Munro 2023-04-11 02:58:00 Re: Direct I/O