Re: Normalized Tables & SELECT [was: Find "smallest common year"] - Mailing list pgsql-general

From Stefan Schwarzer
Subject Re: Normalized Tables & SELECT [was: Find "smallest common year"]
Date
Msg-id 618997C9-A5A5-4491-9A8A-A4B018AD8A1B@grid.unep.ch
Whole thread Raw
In response to Normalized Tables & SELECT [was: Find "smallest common year"]  (Stefan Schwarzer <stefan.schwarzer@grid.unep.ch>)
List pgsql-general
>> I find it far easier to maintain normalized tables that produced
>> non-normalized ones (for things like data warehousing) than it is to
>> maintain non-normalized tables and trying to produce normalized data
>> from that.
>
> Ok, I do understand that.
>
> So, instead of the earlier mentioned database design, I would have
> something like this:
>
>    - one table for the country names/ids/etc. (Afghanistan, 1;
> Albania, 2....)
>    - one table for the variable names/ids/etc. (GDP, 1; Population,
> 2; Fish Catch, 3;....)
>    - one table for the years names/ids/etc. (1970, 1; 1971, 2;
> 1973, 3; ....)
> and
>    - one table for all "statistical data" with four fields -
> id_variable, id_country, id_year, and the actual value
>
> You say
>
>> I find it far easier to maintain normalized tables that produced
>> non-normalized ones (for things like data warehousing) than it is to
>> maintain non-normalized tables and trying to produce normalized data
>> from that.

What is your view about (having 500 different variables/data sets)
using a single table for all data versus one table for each variable.
In terms of "readability" I guess the second solution would be
better. But, then,.... I don't know...

Thanks for any views....

Stef

pgsql-general by date:

Previous
From: Stefan Schwarzer
Date:
Subject: Re: Normalized Tables & SELECT [was: Find "smallest common year"]
Next
From: Richard Huxton
Date:
Subject: Re: sha1 function