Re: Removing "long int"-related limit on hash table sizes

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Removing "long int"-related limit on hash table sizes
Date: 2021-07-25 01:39:34
Message-ID: 20210725013934.GA20990@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

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

In response to

Browse pgsql-hackers by date

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