Re: Improve GetConfigOptionValues function - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Improve GetConfigOptionValues function
Date
Msg-id 3577627.1674058487@sss.pgh.pa.us
Whole thread Raw
In response to Improve GetConfigOptionValues function  (Nitin Jadhav <nitinjadhavpostgres@gmail.com>)
Responses Re: Improve GetConfigOptionValues function
Re: Improve GetConfigOptionValues function
List pgsql-hackers
Nitin Jadhav <nitinjadhavpostgres@gmail.com> writes:
> GetConfigOptionValues function extracts the config parameters for the
> given variable irrespective of whether it results in noshow or not.
> But the parent function show_all_settings ignores the values parameter
> if it results in noshow. It's unnecessary to fetch all the values
> during noshow. So a return statement in GetConfigOptionValues() when
> noshow is set to true is needed. Attached the patch for the same.
> Please share your thoughts.

I do not think this is an improvement: it causes GetConfigOptionValues
to be making assumptions about how its results will be used.  If
show_all_settings() were a big performance bottleneck, and there were
a lot of no-show values that we could optimize, then maybe the extra
coupling would be worthwhile.  But I don't believe either of those
things.

Possibly a better answer is to refactor into separate functions,
along the lines of

static bool
ConfigOptionIsShowable(struct config_generic *conf)

static void
GetConfigOptionValues(struct config_generic *conf, const char **values)

            regards, tom lane



pgsql-hackers by date:

Previous
From: Vik Fearing
Date:
Subject: Re: ANY_VALUE aggregate
Next
From: Robert Haas
Date:
Subject: Re: almost-super-user problems that we haven't fixed yet