Re: Normalized Tables & SELECT [was: Find "smallest common year"]

From: Stefan Schwarzer <stefan(dot)schwarzer(at)grid(dot)unep(dot)ch>
To: pgsql-general(at)postgresql(dot)org, Alban Hertroys <a(dot)hertroys(at)magproductions(dot)nl>
Subject: Re: Normalized Tables & SELECT [was: Find "smallest common year"]
Date: 2007-10-01 14:13:23
Message-ID: FE0D6DEC-DF04-4035-8803-F67411D52E39@grid.unep.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


>
>
>> - one table for the years names/ids/etc. (1970, 1; 1971, 2;
>> 1973, 3;
>> ....)
>
> If you _do_ need this table (because you want to constrain your
> statistical data to only contain a specific set of years, or
> because you
> need a quick list of available years to select from): Make the year
> primary key and drop the artificial index.
>
> Years are perfectly fine data to constrain on, and it saves you the
> joins with that table (the foreign key constraint constrains your data
> sufficiently).

If my years are not only single years such as 1970, 1971... but time
spans, such as 1970-75.... should your proposal be still valid? It
won't be anymore an integer field, but a text field instead...

Stef

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stefan Schwarzer 2007-10-01 14:17:15 Re: Normalized Tables & SELECT [was: Find "smallest common year"]
Previous Message Martin Marques 2007-10-01 14:00:45 sha1 function