1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-21 05:21:08 +03:00

Tweak dynahash.c to not allocate so many entries at once when dealing

with a table that has a small predicted size.  Avoids wasting several
hundred K on the timezone hash table, which is likely to have only one
or a few entries, but the entries use up 10Kb apiece ...
This commit is contained in:
Tom Lane
2005-06-26 23:32:34 +00:00
parent 943b396245
commit 06ae88a82e
3 changed files with 22 additions and 13 deletions

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/utils/hsearch.h,v 1.38 2005/06/18 20:51:30 tgl Exp $
* $PostgreSQL: pgsql/src/include/utils/hsearch.h,v 1.39 2005/06/26 23:32:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -97,6 +97,7 @@ typedef struct HASHHDR
Size entrysize; /* total user element size in bytes */
long max_dsize; /* 'dsize' limit if directory is fixed
* size */
int nelem_alloc; /* number of entries to allocate at once */
HASHELEMENT *freeList; /* linked list of free elements */
#ifdef HASH_STATISTICS
long accesses;
@@ -158,8 +159,8 @@ typedef struct HASHCTL
/* max_dsize value to indicate expansible directory */
#define NO_MAX_DSIZE (-1)
/* number of hash elements allocated at once */
#define HASHELEMENT_ALLOC_INCR (32)
/* max number of hash elements allocated at once */
#define HASHELEMENT_ALLOC_MAX (32)
/* hash_search operations */
typedef enum