Re: Decrease MAX_BACKENDS to 2^16 - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Decrease MAX_BACKENDS to 2^16
Date
Msg-id 20140426131952.GE13906@alap3.anarazel.de
Whole thread Raw
In response to Re: Decrease MAX_BACKENDS to 2^16  (David Fetter <david@fetter.org>)
Responses Re: Decrease MAX_BACKENDS to 2^16  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2014-04-26 05:40:21 -0700, David Fetter wrote:
> On Sat, Apr 26, 2014 at 12:15:40AM +0200, Andres Freund wrote:
> > Hi,
> > 
> > Currently the maximum for max_connections (+ bgworkers + autovacuum) is
> > defined by
> > #define MAX_BACKENDS    0x7fffff
> > which unfortunately means that some things like buffer reference counts
> > need a full integer to store references.
> 
> Out of curiosity, where are you finding that a 32-bit integer is
> causing problems that a 16-bit one would solve?

Save space? For one it allows to shrink some structs (into one
cacheline!). For another it allows to combine flags and refcount in
buffer descriptors into one variable, manipulated atomically.

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Decrease MAX_BACKENDS to 2^16
Next
From: Tom Lane
Date:
Subject: Re: Hashable custom types