Re: Composite types or composite keys? - Mailing list pgsql-general

From Tony Theodore
Subject Re: Composite types or composite keys?
Date
Msg-id 56EBD949-93BD-4152-95FA-8C5BB22319E1@gmail.com
Whole thread Raw
In response to Re: Composite types or composite keys?  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-general
On 16 Nov 2013, at 3:01 am, Merlin Moncure <mmoncure@gmail.com> wrote:
>
> Well, here are the downsides.  Composite types:
> *) are more than the sum of their parts performance-wise.  So there is
> a storage penalty in both the heap and the index
> *) can't leverage indexes that are querying only part of the key
> *) will defeat the implicit 'per column NOT NULL constraint' of the primary keys

Thanks, I didn’t see any of those - I was thinking that they were like pseudo tables or column templates.

> *) are not very well supported in certain clients -- for example JAVA.
> you can always deal with them as text, but that can be a headache.
>
> ...plus some other things I didn't think about.  If you can deal with
> those constraints, it might be interesting to try a limited
> experiment.   The big upside of composite types is that you can add
> attributes on the fly without rebuilding the index.  Test carefully.

I’ll give it a try - I might stick to using plain or inherited tables for the main storage and then experiment with
compositetypes for functions and other aggregate tables that are used internally. 

Cheers,

Tony



pgsql-general by date:

Previous
From: Hengky Liwandouw
Date:
Subject: Sum 2 tables based on key from other table
Next
From: Tom Lane
Date:
Subject: Re: What does this error message mean?