Re: Building dynamic contents from database

From: Scott Ribe <scott_ribe(at)killerbytes(dot)com>
To: Frederic Jolliton <fred-pg(at)jolliton(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Building dynamic contents from database
Date: 2003-12-29 19:40:07
Message-ID: BC15D127.3DA18%scott_ribe@killerbytes.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> name | state | from_date | to_date
> ------------------------------------
> foo | state2 | <date> | <date>
> foo | state1 | <date> | <date>
> bar | state4 | <date> | <date>
> ...
> foo | state3 | <date> | <date>

I would consider using only 1 table, where a NULL to_date indicates the
current state, and you have a compound index on (name, to_date) to support
querying for current state. Perhaps you could use a partial index as well to
speed up those queries, but I haven't yet explored that feature of
PostgreSQL.

--
Scott Ribe
scott_ribe(at)killerbytes(dot)com
http://www.killerbytes.com/
(303) 665-7007 voice

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Keith C. Perry 2003-12-29 19:42:14 Re: [GENERAL] Is my MySQL Gaining ?
Previous Message Joshua D. Drake 2003-12-29 19:36:03 Re: [GENERAL] Is my MySQL Gaining ?