From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Replace the sorted array of GUC variables with a hash table.
Date: Fri, 14 Oct 2022 16:36:28 +0000
Message-ID: <E1ojNff-002MLy-PK@gemulon.postgresql.org> (raw)
Replace the sorted array of GUC variables with a hash table.
This gets rid of bsearch() in favor of hashed lookup. The main
advantage is that it becomes far cheaper to add new GUCs, since
we needn't re-sort the pointer array. Adding N new GUCs had
been O(N^2 log N), but now it's closer to O(N). We need to
sort only in SHOW ALL and equivalent functions, which are
hopefully not performance-critical to anybody.
Also, merge GetNumConfigOptions() into get_guc_variables(),
because in a world where the set of GUCs isn't fairly static
you really want to consider those two results as tied together
not independent.
Discussion: https://postgr.es/m/2982579.1662416866@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/3057465acfbea2f3dd7a914a1478064022c6eecd
Modified Files
--------------
src/backend/utils/misc/guc.c | 385 ++++++++++++++++++++++-------------
src/backend/utils/misc/guc_funcs.c | 39 ++--
src/backend/utils/misc/help_config.c | 5 +-
src/include/utils/guc.h | 1 -
src/include/utils/guc_tables.h | 2 +-
5 files changed, 272 insertions(+), 160 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Replace the sorted array of GUC variables with a hash table.
In-Reply-To: <E1ojNff-002MLy-PK@gemulon.postgresql.org>
References: <E1ojNff-002MLy-PK@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox