X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id BA4E8D1E728 for ; Fri, 30 Apr 2004 12:04:29 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 32683-01 for ; Fri, 30 Apr 2004 12:04:07 -0300 (ADT) Received: from outmx001.isp.belgacom.be (outmx001.isp.belgacom.be [195.238.3.51]) by svr1.postgresql.org (Postfix) with ESMTP id D419CD1DC64 for ; Fri, 30 Apr 2004 12:04:06 -0300 (ADT) Received: from ALAIN (156-251.242.81.adsl.skynet.be [81.242.251.156]) by outmx001.isp.belgacom.be (8.12.9/8.12.9/Skynet-OUT-2.21) with ESMTP id i3UF41e2025280 for ; Fri, 30 Apr 2004 17:04:01 +0200 (envelope-from ) From: "Alain Reymond" To: pgsql-sql@postgresql.org Date: Fri, 30 Apr 2004 17:06:03 +0200 MIME-Version: 1.0 Subject: Database structure Message-ID: <4092877B.2470.1E894F5@localhost> X-mailer: Pegasus Mail for Windows (v4.12a) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-RAVMilter-Version: 8.4.3(snapshot 20030212) (outmx001.isp.belgacom.be) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/26 X-Sequence-Number: 17740 Hello, I would like an advise on the following problem : I have a table of patients. Each patient can make different biological assessments. Each assessment is always decomposed into different laboratory tests. A laboratory test is made of a test number and two values coming from analysers. The schema is : Patients(#patient_nr,name,etc...) Assessment(#assessment_nr, #patient_nr, assessment_type, other usefull values). Assessment_types(assessment_type, labtest_nr) An assessment is composed of different tests, let's say assessment type 1 is composed of lab test 1,2,3,5 and assessment type 2 of lab test number 10 to 70. I have an assessment with 60 different lab tests (always the same). I have two ways for storing the values : 1 - a table with 120 columns for the two values. results(#assessment_nr, p10,d10, p11,d11, .....,p70,d70). where 10 to 70 represents the lab test number. 2 - a table with 60 rows for one assessment : results(#assessment_nr, labtest_nr, p, d) where p and d are my two results. Here comes my question. Which of the two would you choose? The firsrt solution has the advantage of returning one single row for one complete assessment. If I have to make statistics, it is easy. But, if I have to modify the composition of an assessment (which occurs very rarely), I shall have to use an alter table instruction. As I have 4 different assessment types, I have to create five different tables, one per assessment type. The second solution is normalized and more elegant. But I am preoccupied by the size of the table. For one assessment, I'll store 60 rows with only two useful integers in it. And you must add the size of the index. With 25.000 assessments a year, it makes 1.500.000 rows with only 4 columns amoung them 2 only for the results and 2 for identification. I would like to store 10 years online, so 15.000.000 rows. What about the size of index ? Any advise ? I thank you in advance. Alain Reymond (I hope that it is clear enough with my bad English).