X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 75B619DC89D for ; Wed, 8 Mar 2006 10:28:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16195-01 for ; Wed, 8 Mar 2006 10:28:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.rentalia.net (mail.rentalia.com [213.192.209.8]) by postgresql.org (Postfix) with ESMTP id B6FB99DC887 for ; Wed, 8 Mar 2006 10:28:50 -0400 (AST) Received: (qmail 31840 invoked by uid 514); 8 Mar 2006 15:25:24 +0100 Received: from 62.37.216.137 by rigodon (envelope-from , uid 512) with qmail-scanner-1.25-st-qms (clamdscan: 0.88/1284. spamassassin: 3.0.2. perlscan: 1.25-st-qms. Clear:RC:0(62.37.216.137):SA:0(-0.9/5.0):. Processed in 0.675658 secs); 08 Mar 2006 14:25:24 -0000 X-Antivirus-MYDOMAIN-Mail-From: ruben@rentalia.com via rigodon X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:0(62.37.216.137):SA:0(-0.9/5.0):. Processed in 0.675658 secs Process 31831) Received: from 62-37-216-137.mad1.adsl.uni2.es (HELO ?192.168.2.28?) (ruben@rentalia.com@62.37.216.137) by mail.rentalia.net with SMTP; 8 Mar 2006 15:25:23 +0100 Message-ID: <440EEA14.70606@rentalia.com> Date: Wed, 08 Mar 2006 15:28:36 +0100 From: Ruben Rubio Rey User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051011) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Is good idea an array of 365 elements in a cell of a table, in order to perform searchs? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200603/85 X-Sequence-Number: 17522 Hi, Im having a dude with a new inplementation in a web site. The ojective is create a search as fast as possible. I have thought two possibilities to do that: I have several items. Those items has 1 or more of capacity. Each capacity, has several dates (From 1 january to 10 of april, for example). The dates covers 366 days, the current year, and they are indeterminated ranges. Per each date, it has price per day, per week, per15days and per month. I have designed two possibilities: First: IdItem StartDate EndDate Capacity PricePerDay PricePerWeek* PricePer15days* PricePerMonth* 1 1-1-2005 10-1-2005 2 100 90 85 80 1 11-1-2005 20-1-2005 2 105 94 83 82 1 21-1-2005 5-2-2005 4 405 394 283 182 2 ... Right now arround 30.000 rows, in one year is spected to have 60.000 rows * In order to compare right, all prices will be translated to days. Example, PricePerWeek will have the Week Price / 7 and go on Second IdItem Capacity Days Week 15Days Month Year 1 2 [Array of 365 values, one per day of year] [ .Array. ] [ .Array. ] [ .Array. ] [ .Array. ] ^__ Each item of array its a price Right now arround 2.500 rows. in one year is spected to have 5.000 rows I have to compare prices or prices and dates or prices and dates and capacity or capacity and prices I have no experience working with arrays on a table. Is it fast? Witch one do u think will have better performance? Any good idea? I hope this is enouth information. Thanks in advance, Ruben Rubio Rey