diff options
| author | Tom Lane | 2022-10-14 16:26:39 +0000 |
|---|---|---|
| committer | Tom Lane | 2022-10-14 16:26:39 +0000 |
| commit | 3057465acfbea2f3dd7a914a1478064022c6eecd (patch) | |
| tree | 63de056985ef04bedf14c1baab0c53ebb3f7c326 /src/include | |
| parent | 407b50f2d421bca5b134a0033176ea8f8c68dc6b (diff) | |
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')
| -rw-r--r-- | src/include/utils/guc.h | 1 | ||||
| -rw-r--r-- | src/include/utils/guc_tables.h | 2 |
2 files changed, 1 insertions, 2 deletions
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h index c8b65c5bb8f..b3aaff9665b 100644 --- a/src/include/utils/guc.h +++ b/src/include/utils/guc.h @@ -390,7 +390,6 @@ extern int set_config_option_ext(const char *name, const char *value, extern void AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt); extern char *GetConfigOptionByName(const char *name, const char **varname, bool missing_ok); -extern int GetNumConfigOptions(void); extern void ProcessGUCArray(ArrayType *array, GucContext context, GucSource source, GucAction action); 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); |
