From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Dirk Krautschick <Dirk.Krautschick@trivadis.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: UUID with variable length
Date: Fri, 16 Oct 2020 13:09:32 -0300
Message-ID: <20201016160932.GA32253@alvherre.pgsql> (raw)
In-Reply-To: <AM0PR05MB6082166783DBD33747A49417E9020@AM0PR05MB6082.eurprd05.prod.outlook.com>
On 2020-Oct-15, Dirk Krautschick wrote:
> Hi,
>
> I have here a situation with the usage of UUID. Here the database user
> allows UUIDs with less then 16 byte lengths (please don't ask :-) ).
>
> Of course there are some technical ways to do the filling of the not
> used bytes but I hope there is a better solution. This UUID is used as
> primary Key and for indexing.
How much shorter than 16 bytes are you expecting your UUIDs to be? If
they're not short enough, you'll still have to store a lot of padding
space, and considering that you'll need a length indicator if you use
variable length, it does not really sound like you'll save much actual
space. And you'll definitely be getting a slower datatype, since doing
operations will become more complex.
If this were me, I would see about zeroing out the unused bytes and not
waste a lot of developer time on this.
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: alvherre@alvh.no-ip.org, Dirk.Krautschick@trivadis.com
Subject: Re: UUID with variable length
In-Reply-To: <20201016160932.GA32253@alvherre.pgsql>
References: <AM0PR05MB6082166783DBD33747A49417E9020@AM0PR05MB6082.eurprd05.prod.outlook.com> <20201016160932.GA32253@alvherre.pgsql>
* 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