pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Achilleus Mantzios <rnd@gatewaynet.com>
To: pgsql-sql@postgresql.org
Subject: Re: Arrays Design Question
Date: Tue, 26 Mar 2002 08:44:24 -0800
Message-ID: <web-839200@davinci.ethosmedia.com> (raw)
In-Reply-To: <02032610121202.09965@pc216>

 Achilleus ,

> performance for the following problem:
> I want to store the factors of a linear formula of unknown degree
>  (but less 
> than 10) in a table for online stats/graphs on historical data (about
>  200 Mb).
> I am thinking of
> a) Store each formula as a float8[] array and then write a pgsql
>  function in C
> to compute the result given the value of variable x.
> b) Add 10 columns of type float8 and store 0 values where the
>  position of the 
> column exceeds the degree of the formula.

BOTH of the above are poor approaches that will lead to headaches for
 you later on.  Instead:

c. Store each formula in a column in another table with a parent-child
 relationship to your main table, i.e.

online_stats                           stat_formulas
---------------                           ------------------
online_stat_id ------------->online_stat_id
                                                 formula_number
                                                 formula

This is basic relational database design.  You should probably pick up
 a copy of "Relational Database Design for Mere Mortals"  before you
 get yourself into a real mess ...

-Josh Berkus



view thread (3+ messages)  latest in thread

Message-ID: <web-839200@davinci.ethosmedia.com>
Permalink:  ../web-839200@davinci.ethosmedia.com/
Also on:    postgresql.org/message-id/web-839200@davinci.ethosmedia.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com, rnd@gatewaynet.com
  Subject: Re: Arrays Design Question
  In-Reply-To: <web-839200@davinci.ethosmedia.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox