public inbox for [email protected]  
help / color / mirror / Atom feed
From: Ron Clarke <[email protected]>
To: Greg Sabino Mullane <[email protected]>
Cc: Ertan Küçükoglu <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: Domains vs data types
Date: Wed, 20 Aug 2025 18:56:47 +0200
Message-ID: <CAGVf-sMLRbWsff5x3_s6vGisQCLy7LPTmJMOWoyaORy6yBC+Wg@mail.gmail.com> (raw)
In-Reply-To: <CAKAnmmJfh2hPk8v597tRNVhM9_4oCQmTtJ6CVqHAp4hO0qPj6Q@mail.gmail.com>
References: <CAH2i4yf_M5NfX_kDu6_2Z+sgqLOZK9vCsF3EfmwZQyYFuAMxpg@mail.gmail.com>
	<CAKAnmmJfh2hPk8v597tRNVhM9_4oCQmTtJ6CVqHAp4hO0qPj6Q@mail.gmail.com>

Opinion: domains are useful if you give them names that are full of
meaning. For example if you have the same type of data accross tables
"item_number" or "account" etc so that you can use them to describe what
you want stored in them and ensure the same defaults, nulls etc are applied
accross tables. Having randomly named or encoded lists just makes life more
complicated.

On Wed, 20 Aug 2025, 18:13 Greg Sabino Mullane, <[email protected]> wrote:

> On Wed, Aug 20, 2025 at 12:48 AM Ertan Küçükoglu <
> [email protected]> wrote:
>
>> Does the second table have any technical advantage/disadvantage over
>> plain data type definition?
>> Less metadata in memory? High metadata in memory? Less/increased disk
>> space?
>>
>
> Same disk space. No disadvantage other than confusing your users, and any
> performance differences will be so minor as to be unmeasurable. (my two
> cents: domains are best when the data type is complex AND shared across
> multiple tables. Even then I tend to avoid them.)
>
> Cheers,
> Greg
>
> --
> Crunchy Data - https://www.crunchydata.com
> Enterprise Postgres Software Products & Tech Support
>
>


view thread (4+ messages)  latest in thread

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Domains vs data types
  In-Reply-To: <CAGVf-sMLRbWsff5x3_s6vGisQCLy7LPTmJMOWoyaORy6yBC+Wg@mail.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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox