pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: Composite type storage overhead
Date: Thu, 24 Oct 2019 08:19:14 +0200
Message-ID: <2d715b05-dce4-9aec-e01b-cb3213386f5c@gmx.net> (raw)
In-Reply-To: <VI1PR0602MB353483C1C1D2BA99797A0F76F36B0@VI1PR0602MB3534.eurprd06.prod.outlook.com>
References: <VI1PR0602MB3534C22D06A205A990F235DFF36B0@VI1PR0602MB3534.eurprd06.prod.outlook.com>
	<90AA42A6-38FC-4117-90B5-4539302CA154@gmail.com>
	<VI1PR0602MB353483C1C1D2BA99797A0F76F36B0@VI1PR0602MB3534.eurprd06.prod.outlook.com>

> 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







view thread (8+ messages)  latest in thread

Message-ID: <2d715b05-dce4-9aec-e01b-cb3213386f5c@gmx.net>
Permalink:  ../2d715b05-dce4-9aec-e01b-cb3213386f5c@gmx.net/
Also on:    postgresql.org/message-id/2d715b05-dce4-9aec-e01b-cb3213386f5c@gmx.net

 · 

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: spam_eater@gmx.net
  Subject: Re: Composite type storage overhead
  In-Reply-To: <2d715b05-dce4-9aec-e01b-cb3213386f5c@gmx.net>
  References: <VI1PR0602MB3534C22D06A205A990F235DFF36B0@VI1PR0602MB3534.eurprd06.prod.outlook.com> <90AA42A6-38FC-4117-90B5-4539302CA154@gmail.com> <VI1PR0602MB353483C1C1D2BA99797A0F76F36B0@VI1PR0602MB3534.eurprd06.prod.outlook.com> <2d715b05-dce4-9aec-e01b-cb3213386f5c@gmx.net>

* 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