Re: bigint out of range

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Daulat Ram <Daulat(dot)Ram(at)exponential(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: bigint out of range
Date: 2019-05-19 13:54:22
Message-ID: 20190519135422.GF6197@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greetings,

* David G. Johnston (david(dot)g(dot)johnston(at)gmail(dot)com) wrote:
> On Thu, May 16, 2019 at 8:31 AM Daulat Ram <Daulat(dot)Ram(at)exponential(dot)com>
> wrote:
>
> > url_hash | bigint | | not null |
>
> Change the type of url_hash; make it text instead of bigint.

Making it text wastes a bunch of space actually, since it's really a
binary value. I tend to recommend using a bytea for storing hashes.
Given that hashes are really fixed width, it'd be nice if we had a set
of proper datatypes for them, perhaps not so much to avoid the 1-byte
overhead from storing as a variable-length bytea, but because we could
then avoid having a 7-byte hole due to padding if the hash is followed
by a bigint or such.

Thanks,

Stephen

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephen Frost 2019-05-19 14:04:34 Re: bigint out of range
Previous Message Ron 2019-05-19 13:38:14 Re: bigint out of range