Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 5F4B5635886 for ; Tue, 27 Jul 2010 18:17:34 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 45755-02-2 for ; Tue, 27 Jul 2010 21:17:26 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from glacier.frostconsultingllc.com (glacier.frostconsultingllc.com [69.36.227.170]) by mail.postgresql.org (Postfix) with ESMTP id 21598635FD7 for ; Tue, 27 Jul 2010 18:13:49 -0300 (ADT) Received: from dsl081-245-111.sfo1.dsl.speakeasy.net ([64.81.245.111] helo=Sidney-Stratton.local) by glacier.frostconsultingllc.com with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.69) (envelope-from ) id 1OdrT4-0005X0-DA; Tue, 27 Jul 2010 14:13:45 -0700 Message-ID: <4C4F4C06.1050404@agliodbs.com> Date: Tue, 27 Jul 2010 14:13:42 -0700 From: Josh Berkus User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b3pre) Gecko/20090223 Thunderbird/3.0b2 MIME-Version: 1.0 To: kuopo CC: pgsql-performance@postgresql.org Subject: Re: how to handle a big table for data log References: <4C442B03.2E1C.0042.0@homedecorators.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201007/415 X-Sequence-Number: 39804 On 7/20/10 8:51 PM, kuopo wrote: > Let me make my problem clearer. Here is a requirement to log data from a > set of objects consistently. For example, the object maybe a mobile > phone and it will report its location every 30s. To record its > historical trace, I create a table like > /CREATE TABLE log_table > ( > id integer NOT NULL, > data_type integer NOT NULL, > data_value double precision, > ts timestamp with time zone NOT NULL, > CONSTRAINT log_table_pkey PRIMARY KEY (id, data_type, ts) > )/; > In my location log example, the field data_type could be longitude or > latitude. If what you have is longitude and latitude, why this brain-dead EAV table structure? You're making the table twice as large and half as useful for no particular reason. Use the "point" datatype instead of anonymizing the data. -- -- Josh Berkus PostgreSQL Experts Inc. http://www.pgexperts.com