public inbox for [email protected]  
help / color / mirror / Atom feed
From: Ertan Küçükoglu <[email protected]>
To: [email protected]
Subject: Domains vs data types
Date: Wed, 20 Aug 2025 07:47:43 +0300
Message-ID: <CAH2i4yf_M5NfX_kDu6_2Z+sgqLOZK9vCsF3EfmwZQyYFuAMxpg@mail.gmail.com> (raw)

Hello,

I am using PostgreSQL 17.6.
I would like to learn if there is any benefit of using domains over data
types for table column definitions in terms of performance gain/loss.

For example I might have table defined as below
create table test (
  a integer,
  b integer,
  c integer,
  d varchar(5)
);

I might also have ame table defined as below

create domain aint integer;
create domain s5 varchar(5);

create table test_domain (
  a aint,
  b aint,
  c aint,
  d s5
);

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?

Thanks & Regards,
Ertan


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]
  Subject: Re: Domains vs data types
  In-Reply-To: <CAH2i4yf_M5NfX_kDu6_2Z+sgqLOZK9vCsF3EfmwZQyYFuAMxpg@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