Database/Table Design for Global Country Statistics - Mailing list pgsql-general

From Stefan Schwarzer
Subject Database/Table Design for Global Country Statistics
Date
Msg-id 350438D3-3085-4037-871E-4A77724C1154@grid.unep.ch
Whole thread Raw
Responses Re: Database/Table Design for Global Country Statistics  (Richard Huxton <dev@archonet.com>)
Re: Database/Table Design for Global Country Statistics  (Tino Wildenhain <tino@wildenhain.de>)
Re: Database/Table Design for Global Country Statistics  (Ron Johnson <ron.l.johnson@cox.net>)
List pgsql-general
Hi there,

I learned in another posting that my table design - in a polite way -
"could be improved".

So, before doing any additional design errors, I would like to get
feedback, if possible.

I am dealing with some 500 tables for worldwide national statistics
(GDP, population, environment etc.), covering approx. 30 years each.
For each of these variables, I usually have as well (pre-prepared)
subregional and regional aggregations too. These could - and should -
at the end be calculated on-the-fly, and not pre-calculated and
imported from Excel as it is for the moment.

My (national) table for a given variable is in the moment as follows
(id being the identifier for a specific country):

id   |    1970    |    1971    |    ...    |    2004    |    2005
-------------------------------------------------------------------
  1   |   NULL    |      36       |   ...     |      42      |      45
  2 ......

The new design would be like this:

id   |    year    |    value
-------------------------------
  1   |   1970    |     NULL
  1   |   1971    |      36
  1   ....
  1   |   2005    |      45
  2   |   1970    |      ....
  2   .....


Would that be considered as "good table design" then?

Thanks for any advice!

Stef



pgsql-general by date:

Previous
From: Ow Mun Heng
Date:
Subject: Table partitioning based on multiple criterias possible?
Next
From: Richard Huxton
Date:
Subject: Re: Table partitioning based on multiple criterias possible?