Re: On disable_cost

Richard Guo <guofenglinux@gmail.com>

From: Richard Guo <guofenglinux@gmail.com>
To: Alexander Lakhin <exclusion@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, David Rowley <dgrowleyml@gmail.com>, Heikki Linnakangas <hlinnaka@iki.fi>, Peter Geoghegan <pg@bowt.ie>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-09-09T04:09:26Z
Lists: pgsql-hackers
On Fri, Sep 6, 2024 at 5:27 PM Richard Guo <guofenglinux@gmail.com> wrote:
> On Fri, Sep 6, 2024 at 5:00 PM Alexander Lakhin <exclusion@gmail.com> wrote:
> > static void
> > label_sort_with_costsize(PlannerInfo *root, Sort *plan, double limit_tuples)
> > {
> > ...
> >      cost_sort(&sort_path, root, NIL,
> >                lefttree->total_cost,
> >                plan->plan.disabled_nodes,
> >                lefttree->plan_rows,
> >                lefttree->plan_width,
> >                0.0,
> >                work_mem,
> >                limit_tuples);
> >
> > Given the cost_sort() declaration:
> > void
> > cost_sort(Path *path, PlannerInfo *root,
> >            List *pathkeys, int input_disabled_nodes,
> >            Cost input_cost, double tuples, int width,
> >            Cost comparison_cost, int sort_mem,
> >            double limit_tuples)
> >
> > Aren't the input_disabled_nodes and input_cost arguments swapped in the
> > above call?
>
> Nice catch!  I checked other callers to cost_sort, and they are all
> good.

Fixed.

Thanks
Richard



Commits

  1. Doc: add detail about EXPLAIN's "Disabled" property

  2. Adjust EXPLAIN's output for disabled nodes

  3. Fix order of parameters in a cost_sort call

  4. Show number of disabled nodes in EXPLAIN ANALYZE output.

  5. Treat number of disabled nodes in a path as a separate cost metric.

  6. Remove grotty use of disable_cost for TID scan plans.