Re: Domain vs table

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Michal Szymanski <mich20061(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Domain vs table
Date: 2009-10-20 11:55:34
Message-ID: b42b73150910200455t6795dfccod70318c0a5300c22@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Sun, Oct 11, 2009 at 11:31 AM, Michal Szymanski <mich20061(at)gmail(dot)com> wrote:
> I think I've found answer to my question
> http://www.commandprompt.com/blogs/joshua_drake/2009/01/fk_check_enum_or_domain_that_is_the_question/
>

I mostly agree with the comments on the blog but let me throw a couple
more points out there:

*) It is possible (although not necessarily advised) to manipulate
enums via direct manipulation of pg_enum
*) enums are the best solution if you need natural ordering properties
for indexing purposes
*) domains can't be used in arrays
*) foreign key is obviously preferred if you need store more related
properties than the value itself
*) if the constraint is complicated (not just a list of values), maybe
domain/check constraint is preferred, possibly hooked to immutable
function

merlin

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Shaul Dar 2009-10-20 12:37:04 Finding rows in table T1 that DO NOT MATCH any row in table T2
Previous Message Joe Uhl 2009-10-20 10:31:18 Re: Performance with sorting and LIMIT on partitioned table