Re: Need help to organize database

From: "Vladimir S(dot) Petukhov" <vladimir(at)sycore(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Need help to organize database
Date: 2004-12-22 01:24:57
Message-ID: 200412220124.57862.vladimir@sycore.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tuesday 21 December 2004 22:00, Bruno Wolff III wrote:
> On Wed, Dec 22, 2004 at 00:16:06 +0000,
>
> "Vladimir S. Petukhov" <vladimir(at)sycore(dot)org> wrote:
> > On Tuesday 21 December 2004 21:21, Bruno Wolff III wrote:
> > > On Tue, Dec 21, 2004 at 20:47:31 +0000,
> > >
> > > "Vladimir S. Petukhov" <vladimir(at)sycore(dot)org> wrote:
> > > > Ok, this is a real example:
> > > >
> > > > CREATE TABLE account (
> > > > val1 BIGINT NULL,
> > > > val2 BIGINT NULL,
> > > > ...
> > > >
> > > > daypos SMALLINT NULL, -- Day position
> > > > hourpos SMALLINT NULL, -- Hour position
> > > > id INT NULL -- Link to the object
> > > > );
> > >
> > > That approach is reasonable but depending on what the val* columns mean
> > > you might each of those as a separate role. You didn't add a lot of
> > > information, but that they appear to be the same type suggests that you
> > > might want one row per value. But without knowing what they mean it is
> > > hard to say.
> >
> > OK, i want to store ststistic information, ingoing/outgoing traffic,
> > ingoing/outgoing errors(val1-val4) for example...
>
> Those sound like different domains then for each column. So you probably do
> want to keep the 8 values in one row.
> I also noticed that you marked a lot of these values as NULL. I think that
> daypos, hourpos and id form the primary key and you probably don't want to
> allow NULLs for these.
Yes, of course, this is example only.
But relation between tables is not important now...
I whant to ask - is it a good idea to store 1 time's data (value1-4) per row
in 24*31 rows? May be it is better and quicker to store, for example, 2
time's data per row (value1-4, day 1, value1-4, day 2) or other structure?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message A. Mous 2004-12-22 02:50:39 8.0 Beta3 worked, RC1 didn't!
Previous Message Greg Sabino Mullane 2004-12-22 01:05:43 ANNOUNCE: DBD::Pg 1.40 release candidate 1 request for testing