Re: Removing "long int"-related limit on hash table sizes - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Removing "long int"-related limit on hash table sizes
Date
Msg-id 20210725013934.GA20990@momjian.us
Whole thread Raw
In response to Re: Removing "long int"-related limit on hash table sizes  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On Sat, Jul 24, 2021 at 06:25:53PM -0700, Andres Freund wrote:
> > That's because they spill to disk where they did not before.  The easy
> > answer of "raise hash_mem_multiplier" doesn't help, because on Windows
> > the product of work_mem and hash_mem_multiplier is clamped to 2GB,
> > thanks to the ancient decision to do a lot of memory-space-related
> > calculations in "long int", which is only 32 bits on Win64.
> 
> We really ought to just remove every single use of long. As Thomas
> quipped on twitter at some point, "long is the asbestos of C". I think
> we've incurred far more cost due to weird workarounds to deal with the
> difference in long width between windows and everything else, than just
> removing all use of it outright would incur.

+1

As I understand it, making long of undermined length was to allow
someone to choose a data type that _might_ be longer than int if the
compiler/OS/CPU was optimized for that, but at this point, such
optimizations just don't seem to make sense, and we know every(?) CPU
supports long-long, so why not go for something concrete?  Do we really
want our feature limits to be determined by whether we have an optimized
type longer than int?

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  If only the physical world exists, free will is an illusion.




pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Removing "long int"-related limit on hash table sizes
Next
From: Fujii Masao
Date:
Subject: Re: log_checkpoint's "WAL file(s) added" is misleading to the point of uselessness