From: Robert Haas <rhaas@postgresql.org> Date: Tue, 24 Apr 2012 02:05:41 +0000 (-0400) Subject: Reduce hash size for compute_array_stats, compute_tsvector_stats. X-Git-Tag: REL9_2_BETA1~106 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=85efd5f06593b80bbe01e541d78b336c1077213e;p=postgresql Reduce hash size for compute_array_stats, compute_tsvector_stats. The size is only a hint, but a big hint chews up a lot of memory without apparently improving performance much. Analysis and patch by Noah Misch. --- diff --git a/src/backend/tsearch/ts_typanalyze.c b/src/backend/tsearch/ts_typanalyze.c index 9771415b2e..87e0bd7999 100644 --- a/src/backend/tsearch/ts_typanalyze.c +++ b/src/backend/tsearch/ts_typanalyze.c @@ -186,7 +186,7 @@ compute_tsvector_stats(VacAttrStats *stats, hash_ctl.match = lexeme_match; hash_ctl.hcxt = CurrentMemoryContext; lexemes_tab = hash_create("Analyzed lexemes table", - bucket_width * 7, + num_mcelem, &hash_ctl, HASH_ELEM | HASH_FUNCTION | HASH_COMPARE | HASH_CONTEXT); diff --git a/src/backend/utils/adt/array_typanalyze.c b/src/backend/utils/adt/array_typanalyze.c index ba9873905e..fa79d9fa6b 100644 --- a/src/backend/utils/adt/array_typanalyze.c +++ b/src/backend/utils/adt/array_typanalyze.c @@ -282,7 +282,7 @@ compute_array_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, elem_hash_ctl.match = element_match; elem_hash_ctl.hcxt = CurrentMemoryContext; elements_tab = hash_create("Analyzed elements table", - bucket_width * 7, + num_mcelem, &elem_hash_ctl, HASH_ELEM | HASH_FUNCTION | HASH_COMPARE | HASH_CONTEXT);