Reduce hash size for compute_array_stats, compute_tsvector_stats.
authorRobert Haas <rhaas@postgresql.org>
Tue, 24 Apr 2012 02:05:41 +0000 (22:05 -0400)
committerRobert Haas <rhaas@postgresql.org>
Tue, 24 Apr 2012 02:05:41 +0000 (22:05 -0400)
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.

src/backend/tsearch/ts_typanalyze.c
src/backend/utils/adt/array_typanalyze.c

index 9771415b2e46227ec1d5f42fd296ef4f234df89b..87e0bd79996475ec702ad3e06a7485dd6e0539b1 100644 (file)
@@ -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);
 
index ba9873905e2ecf4da57d8258f23699b5b1284ccb..fa79d9fa6b453da3548180fbfce597cf291d8819 100644 (file)
@@ -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);