From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Nils Dijk <me(at)thanod(dot)nl> |
Cc: | Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, Kohei KaiGai <kaigai(at)heterodb(dot)com>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Richard Guo <riguo(at)pivotal(dot)io>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: How to retain lesser paths at add_path()? |
Date: | 2022-07-31 19:10:48 |
Message-ID: | 1288421.1659294648@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Nils Dijk <me(at)thanod(dot)nl> writes:
> Attached you will find 3 patches that implement a way for extensions
> to introduce 'a figure of merit' by the means of path comparisons.
I took a brief look through this. I quite like your idea of expressing
PathComparison merging as an OR of suitably-chosen values. I do have
some minor criticisms of the patch, which potentially make for small
performance improvements so I've not bothered yet to try to measure
performance.
* I think you could do without PATH_COMPARISON_MASK. Use of the enum
already implies that we only allow valid values of the enum, and given
that the inputs of path_comparison_combine are valid, so is the output
of the "|". There's no need to expend cycles masking it, and if there
were it would be dubious whether the masking restores correctness.
What *is* needed, though, is a comment pointing out that the values of
PathComparison are chosen with malice aforethought to cause ORing of
them to give semantically-correct results.
* I'd also drop enum AddPathDecision and add_path_decision(),
and just let add_path() do what it must based on the PathComparison
result. I don't think the extra layer of mapping adds anything,
and it's probably costing some cycles.
* Perhaps it's worth explicitly marking the new small functions
as "static inline"? Probably modern compilers will do that without
being prompted, but we might as well be clear about what we want.
* Some more attention to comments is needed, eg the header comment
for compare_path_costs_fuzzily still refers to COSTS_DIFFERENT.
(However, on the whole I'm not sure s/COSTS_DIFFERENT/PATHS_DIFFERENT/
etc is an improvement. Somebody looking at this code for the first
time would probably think the answer should always be that the two
paths are "different", because one would hope we're not generating
redundant identical paths. What we want to say is that the paths'
figures of merit are different; but "PATH_FIGURES_OF_MERIT_DIFFERENT"
is way too verbose. Unless somebody has got a good proposal for
a short name I'd lean to sticking with the COSTS_XXX names.)
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2022-07-31 19:43:44 | Re: ci: update to freebsd 13.1 / remove minor versions from image names |
Previous Message | David G. Johnston | 2022-07-31 18:43:48 | Re: pg_auth_members.grantor is bunk |