diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2022-10-14 12:26:39 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2022-10-14 12:26:39 -0400 |
commit | 3057465acfbea2f3dd7a914a1478064022c6eecd (patch) | |
tree | 63de056985ef04bedf14c1baab0c53ebb3f7c326 /src/include/utils/guc_tables.h | |
parent | 407b50f2d421bca5b134a0033176ea8f8c68dc6b (diff) | |
download | postgresql-3057465acfbea2f3dd7a914a1478064022c6eecd.tar.gz postgresql-3057465acfbea2f3dd7a914a1478064022c6eecd.zip |
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
Diffstat (limited to 'src/include/utils/guc_tables.h')
-rw-r--r-- | src/include/utils/guc_tables.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/include/utils/guc_tables.h b/src/include/utils/guc_tables.h index b3d2a959c3a..99740e7e48c 100644 --- a/src/include/utils/guc_tables.h +++ b/src/include/utils/guc_tables.h @@ -281,7 +281,7 @@ extern struct config_generic **get_explain_guc_options(int *num); extern char *ShowGUCOption(struct config_generic *record, bool use_units); /* get the current set of variables */ -extern struct config_generic **get_guc_variables(void); +extern struct config_generic **get_guc_variables(int *num_vars); extern void build_guc_variables(void); |