pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: kuopo <spkuo@cs.nctu.edu.tw>
Cc: pgsql-performance@postgresql.org
Subject: Re: how to handle a big table for data log
Date: Tue, 27 Jul 2010 14:13:42 -0700
Message-ID: <4C4F4C06.1050404@agliodbs.com> (raw)
In-Reply-To: <AANLkTilcCUP2ohhotmvoOoDlp2j1OiqwcZusEvYjjfzS@mail.gmail.com>
References: <AANLkTilCP3sGTbHIvrM-ixG-P1Dz6ToqrhbgijY8m8V8@mail.gmail.com>
	<4C442B03.2E1C.0042.0@homedecorators.com>
	<AANLkTilcCUP2ohhotmvoOoDlp2j1OiqwcZusEvYjjfzS@mail.gmail.com>

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



view thread (5+ messages)

Message-ID: <4C4F4C06.1050404@agliodbs.com>
Permalink:  ../4C4F4C06.1050404@agliodbs.com/
Also on:    postgresql.org/message-id/4C4F4C06.1050404@agliodbs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: josh@agliodbs.com, spkuo@cs.nctu.edu.tw
  Subject: Re: how to handle a big table for data log
  In-Reply-To: <4C4F4C06.1050404@agliodbs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox