Re: Need help to organize database

From: "Frank D(dot) Engel, Jr(dot)" <fde101(at)fjrhome(dot)net>
To: General PostgreSQL list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Need help to organize database
Date: 2004-12-21 19:04:02
Message-ID: 13BCD41B-5383-11D9-872A-0050E410655F@fjrhome.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Instead of having separate fields for day, hour, ... - why not use
timestamp values?

On Dec 21, 2004, at 3:47 PM, Vladimir S. Petukhov 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
> );
>
>
>
> On Tuesday 21 December 2004 14:38, Bruno Wolff III wrote:
>> On Mon, Dec 20, 2004 at 12:13:31 +0000,
>>
>> "Vladimir S. Petukhov" <vladimir(at)sycore(dot)org> wrote:
>>> Hi
>>> Sorry for my English..
>>>
>>> I need to organize database structure for saving statistic data for
>>> objects. I have about 24 * 31 * 4 fields (4 month, 31 days, 24
>>> hours) of
>>> data for one object. Each field contain 8 numbers (N in general). So:
>>> object1 -> data -> field1, field2,...
>>> object2 -> data -> field1, field2,...
>>> ...
>>> How can I store this data in postgres database?
>>>
>>> For example it may be 24 * 31 * 4 * 8 fields and 1 row per object in
>>> table - but it is not good idea, of course.
>>>
>>> Or may be 8 fields and 24 * 31 * 4 rows per object in table, but
>>> table
>>> looked very big...
>>
>> You want to store rows with an object id, a field or fields storing
>> the
>> hour and the 8 object fields (assuming these fields shouldn't also
>> be one per row - but without any more knowledge about them I can't
>> say).
>> You should put a primary key constraint on the object id and the hour
>> field(s).
>>
>>> Or may be it's not good idea to use postgres for this purpose?
>>
>> Without seeing what you are going to do with the data it is hard to
>> say
>> if using a dbms is overkill or not.
>
> --
> Riches cover a multitude of woes.
> -- Menander
>
> Now playing: track08.mp3
> AutoGenerated by fortune & xmms...
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
>
-----------------------------------------------------------
Frank D. Engel, Jr. <fde101(at)fjrhome(dot)net>

$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten
Son, that whosoever believeth in him should not perish, but have
everlasting life.
$

___________________________________________________________
$0 Web Hosting with up to 120MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steve Wampler 2004-12-21 19:31:46 New Fedora 3 install gives: relation "pg_catalog.pg_user" does not exist
Previous Message Ernest Kim 2004-12-21 17:51:05 Re: BTree max row size?