pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: pacquet@newsguy.com
To: pgsql-sql@postgresql.org
Subject: "Inverting" a table, OLAP-style
Date: Fri, 13 Sep 2002 16:18:54 -0700 (PDT)
Message-ID: <200209132318.QAA09972@newsguy.com> (raw)

I have a data-collection app, which creates a table like this, more or less:

t    timestamp
name    varchar
value   numeric

the number of distinct values of <name> is 800 and growing, besides being
data-dependent, so it might be pretty inconvenient to have a single table with
800 columns.  (and we might exceed the 1600-column limit someday)

But clients WOULD like to view the data sometimes as though it were:

t         x                        y                          z  
----------------------------------------------------------------
t1     value when name='x'    value when name='y'       value when name='z'


if they do a SELECT on time=t1 and (name='x' or name='y' or name='z')

This seems like a fairly common desire.  I know we could use Pivot Tables in
Excel, or otherwise do it on the client, but the highest-leverage solution
would be to present this abstraction in the server.  Any ideas on how to do
this?




view thread (2+ messages)  latest in thread

Message-ID: <200209132318.QAA09972@newsguy.com>
Permalink:  ../200209132318.QAA09972@newsguy.com/
Also on:    postgresql.org/message-id/200209132318.QAA09972@newsguy.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-sql@postgresql.org
  Cc: pacquet@newsguy.com
  Subject: Re: "Inverting" a table, OLAP-style
  In-Reply-To: <200209132318.QAA09972@newsguy.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