Re: Domains vs data types

2025-08-21 Thread Merlin Moncure
On Thu, Aug 21, 2025 at 2:11 AM Dominique Devienne wrote: > On Wed, Aug 20, 2025 at 7:37 PM Florents Tselai > wrote: > > > On 20 Aug 2025, at 7:47 AM, Ertan Küçükoglu > > > wrote: > > > I would like to learn if there is any benefit of using domains over data > > > types for table column defini

Re: Domains vs data types

2025-08-21 Thread Dominique Devienne
On Wed, Aug 20, 2025 at 7:37 PM Florents Tselai wrote: > > On 20 Aug 2025, at 7:47 AM, Ertan Küçükoglu > > wrote: > > 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. > I know that this doesn’t a

Re: Domains vs data types

2025-08-20 Thread Florents Tselai
> On 20 Aug 2025, at 7:47 AM, Ertan Küçükoglu wrote: > > 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. > I know that this doesn’t answer your questio

Re: Domains vs data types

2025-08-20 Thread David G. Johnston
On Wed, Aug 20, 2025 at 9:57 AM Ron Clarke wrote: > ...and ensure the same defaults, nulls etc are applied accross tables. > Just as a warning - a deviation we have from the SQL Standard regarding domains and their NOT NULL constraints makes specifying one on a domain a bit of a potential trap.

Re: Domains vs data types

2025-08-20 Thread Ron Clarke
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 tabl

Re: Domains vs data types

2025-08-20 Thread Greg Sabino Mullane
On Wed, Aug 20, 2025 at 12:48 AM Ertan Küçükoglu 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 yo

Re: Domains vs data types

2025-08-20 Thread Ron Johnson
On Wed, Aug 20, 2025 at 11:05 AM Adrian Klaver wrote: [snip] > > Personally I don't see that integer --> aint really helps. > No one's going to create the domain "aint", but a DB designer in a rigorous environment _will_ create multiple, meaningfully-named domains, all of which happen to be INTE

Re: Domains vs data types

2025-08-20 Thread Adrian Klaver
On 8/19/25 21:47, Ertan Küçükoglu wrote: 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 i