Re: Composite type storage overhead

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Composite type storage overhead
Date: 2019-10-24 06:19:14
Message-ID: 2d715b05-dce4-9aec-e01b-cb3213386f5c@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> 3. The value is logically defined as a 128-bit integer, that is in
> itself a compound value split into a few "bit groups". Extracting
> these parts can be done by simple (and supposedly efficient) bitwise
> operators when stored as integer, but becomes much more cumbersome
> with UUID, I guess.

This is usually a bad idea.

Putting logic into the primary key value and merging different types of information in a single column is typically not such a good idea.
(And it violates first normal form to begin with)

I would strongly recommend to revisit this idea, and e.g. think about a multi-column primary key instead. Where each of these "groups" are stored in a separate column where the actual (business) value can be retrieved without any bitshifting or similar operations.

Thomas

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laiszner Tamás 2019-10-24 08:12:28 Re: Composite type storage overhead
Previous Message Maurice Aubrey 2019-10-24 02:18:45 Re: jsonb_set() strictness considered harmful to data