Re: Arrays Design Question

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Arrays Design Question
Дата
Msg-id web-839200@davinci.ethosmedia.com
обсуждение исходный текст
Ответ на Arrays Design Question  (Achilleus Mantzios <rnd@gatewaynet.com>)
Список pgsql-sql
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 foryou later on.  Instead:

c. Store each formula in a column in another table with a parent-childrelationship 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 upa copy of "Relational Database Design for Mere
Mortals" before youget yourself into a real mess ...
 

-Josh Berkus


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Arguile"
Дата:
Сообщение: Re: Cleaning up template 1
Следующее
От: "Josh Berkus"
Дата:
Сообщение: Re: Cleaning up template 1