Skip to content

Commit 7f1711f

Browse files
committed
Reduce the default size of the PortalHashTable in order to save a
few cycles during transaction exit. A typical session probably wouldn't have as many as half a dozen portals open at once, so the original value of 64 seems far larger than needed.
1 parent 183e8b9 commit 7f1711f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/backend/utils/mmgr/portalmem.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1994, Regents of the University of California
1313
*
1414
* IDENTIFICATION
15-
* $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.74 2004/10/12 01:50:04 neilc Exp $
15+
* $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.75 2004/11/21 22:48:01 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -26,10 +26,13 @@
2626
#include "utils/portal.h"
2727

2828
/*
29-
* estimate of the maximum number of open portals a user would have,
30-
* used in initially sizing the PortalHashTable in EnablePortalManager()
29+
* Estimate of the maximum number of open portals a user would have,
30+
* used in initially sizing the PortalHashTable in EnablePortalManager().
31+
* Since the hash table can expand, there's no need to make this overly
32+
* generous, and keeping it small avoids unnecessary overhead in the
33+
* hash_seq_search() calls executed during transaction end.
3134
*/
32-
#define PORTALS_PER_USER 64
35+
#define PORTALS_PER_USER 16
3336

3437

3538
/* ----------------

0 commit comments

Comments
 (0)