pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: bigint out of range
Date: Sat, 18 May 2019 19:16:19 -0500
Message-ID: <0bea576e-43df-9176-a5da-1aea2bb1b337@gmail.com> (raw)
In-Reply-To: <20190518223952.g5jrsyj5us7kytpb@hjp.at>
References: <BL0PR01MB518741644F902D8F4E447FF99B0A0@BL0PR01MB5187.prod.exchangelabs.com>
	<CAKFQuwbA+5nycp=GHyn3kfX++iv7TqAHLKxrywqosMjbKSUh1w@mail.gmail.com>
	<20190518093519.2kd6hyw37wcx6qwc@hjp.at>
	<CAKFQuwb5r0oWP2NFBRmhKJAW3xzK2f6z9_UxxTCnRiRxjMt1uQ@mail.gmail.com>
	<20190518192703.ml6duizgdyfyetva@hjp.at>
	<bc9cd95b-6ff8-891d-819e-6e947dec7fd1@gmail.com>
	<20190518204941.d2o5xy2b53r266ws@hjp.at>
	<55d8ce6e-2a94-1003-0fc1-66a39d6d2e8a@gmail.com>
	<20190518223952.g5jrsyj5us7kytpb@hjp.at>

On 5/18/19 5:39 PM, Peter J. Holzer wrote:
> On 2019-05-18 17:14:59 -0500, Ron wrote:
>> On 5/18/19 3:49 PM, Peter J. Holzer wrote:
>>
>>      On 2019-05-18 15:19:22 -0500, Ron wrote:
>>
>>          On 5/18/19 2:27 PM, Peter J. Holzer wrote:
>>
>>              On 2019-05-18 10:49:53 -0700, David G. Johnston wrote:
>>
>>                  You don’t perform math on a hash
>>
>>              That's not generally true. Hashes are used for further computation for
>>              example in hash tables or in cryptography.
>>
>>          How is it "using math" to use a hash key in a hash lookup table?
>>
>>      hash modulo table size.
>>
>>
>> I've seen that used when the tablespace is pre-allocated, and you hash modulo
>> the tablespace page number.  (Yes, performance tanks when you start filling up
>> pages.)  How do you hash on the (ever growing) table size?
> The hash function returns a number in a range much larger than the
> possible number of buckets. 64 bits is a good choice today.
>
> To determine the bucket you need to reduce this number to something in
> the range [0, nr_buckets). This is where modulo comes in:
>
> i = h % nr_buckets
>
> If the the table fills up, you increase nr_buckets, reallocate and
> rehash all entries.

Ouch.  Response time on a big table would take a serious hit if that rehash 
happened in the middle of the day on a big OLTP system.  Even worse if it 
were a 24x365 system, because you couldn't schedule an enlargement/rehash 
during a down period.


-- 
Angular momentum makes the world go 'round.





view thread (16+ messages)  latest in thread

Message-ID: <0bea576e-43df-9176-a5da-1aea2bb1b337@gmail.com>
Permalink:  ../0bea576e-43df-9176-a5da-1aea2bb1b337@gmail.com/
Also on:    postgresql.org/message-id/0bea576e-43df-9176-a5da-1aea2bb1b337@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ronljohnsonjr@gmail.com
  Subject: Re: bigint out of range
  In-Reply-To: <0bea576e-43df-9176-a5da-1aea2bb1b337@gmail.com>
  References: <BL0PR01MB518741644F902D8F4E447FF99B0A0@BL0PR01MB5187.prod.exchangelabs.com> <CAKFQuwbA+5nycp=GHyn3kfX++iv7TqAHLKxrywqosMjbKSUh1w@mail.gmail.com> <20190518093519.2kd6hyw37wcx6qwc@hjp.at> <CAKFQuwb5r0oWP2NFBRmhKJAW3xzK2f6z9_UxxTCnRiRxjMt1uQ@mail.gmail.com> <20190518192703.ml6duizgdyfyetva@hjp.at> <bc9cd95b-6ff8-891d-819e-6e947dec7fd1@gmail.com> <20190518204941.d2o5xy2b53r266ws@hjp.at> <55d8ce6e-2a94-1003-0fc1-66a39d6d2e8a@gmail.com> <20190518223952.g5jrsyj5us7kytpb@hjp.at> <0bea576e-43df-9176-a5da-1aea2bb1b337@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox