Received: from hermes.gatewaynet.com (hermes.gatewaynet.com [217.19.69.34]) by postgresql.org (Postfix) with ESMTP id 4C97B47586C for ; Wed, 27 Mar 2002 02:22:48 -0500 (EST) Received: œby rnd@gatewaynet.com (8.12.1/8.12.1) with ESMTP id g2R7MjO2011435; Wed, 27 Mar 2002 09:22:45 +0200 (EET) Received: from pc216 ([10.9.200.216]) by hermes.internal.net (Lotus Domino Release 5.0.9a) with SMTP id 2002032709224432:4003 ; Wed, 27 Mar 2002 09:22:44 +0200 From: Achilleus Mantzios To: josh@agliodbs.com Subject: Re: Arrays Design Question Date: Wed, 27 Mar 2002 09:23:32 +0200 X-Mailer: KMail [version 1.2] References: <02032709093006.09965@pc216> In-Reply-To: <02032709093006.09965@pc216> Cc: pgsql-sql@postgresql.org MIME-Version: 1.0 Message-Id: <02032709233207.09965@pc216> X-MIMETrack: Itemize by SMTP Server on hermes/hermes(Release 5.0.9a |January 7, 2002) at 03/27/2002 09:22:44 AM, Serialize by Router on hermes/hermes(Release 5.0.9a |January 7, 2002) at 03/27/2002 09:22:45 AM, Serialize complete at 03/27/2002 09:22:45 AM Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="iso-8859-7" X-Archive-Number: 200203/354 X-Sequence-Number: 7228 On Wednesday 27 March 2002 09:09, you wrote: > 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). ^^^ Dear josh "for" does not mean "in". > > 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. Average performer. > > b) Add 10 columns of type float8 and store 0 values where the > > position of the > > column exceeds the degree of the formula. > Worst performer. The best performer is do the calculations in java using the "arrays" way. (BTW pgsql Arrays are hated and used by everone it seems) > 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 ^^^^ ^^^^^^^ ^ ^^^^^^ That was the question actually. > 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 How did you conclude i was about to store the formulae in the stats table? Is my English that bad? :)) -- Achilleus Mantzios S/W Engineer IT dept Dynacom Tankers Mngmt tel: +30-10-8981112 fax: +30-10-8981877 email: it@dynacomtm.com rnd@gatewaynet.com