pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: pgsql-sql@postgresql.org
Subject: Re: SQL Challenge:  Arbitrary Cross-tab
Date: Wed, 18 Aug 2004 09:56:14 -0700
Message-ID: <200408180956.14356.josh@agliodbs.com> (raw)
In-Reply-To: <4122E60F.2080403@joeconway.com>
References: <200408171955.11850.josh@agliodbs.com>
	<4122E60F.2080403@joeconway.com>

Joe, Elein:

> This is pretty much exactly how contrib/tablefunc's crosstab (non-hashed
> version; crosstab(sourcesql, ncols)) works. If you really need it to be
> portable, though, application layer procedural code is likely to be the
> easiest and fastest way to go. crosstab just wraps the procedural code
> in an SRF for you.

No, you're missing one factor in the spec.   Timekeeper_1 for case_id = 182738 
is not the same timekeeper as Timekeeper_1 for case_id = 217437.  That's why 
traditional crosstab plans don't work.

Anyway, here's the wrap-up:   I tried Stephan's idea, it works, but it's so 
slow that we're going to to the procedural loop.   Thanks, all!

-- 
Josh Berkus
Aglio Database Solutions
San Francisco



view thread (16+ messages)  latest in thread

Message-ID: <200408180956.14356.josh@agliodbs.com>
Permalink:  ../200408180956.14356.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200408180956.14356.josh@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-sql@postgresql.org
  Cc: josh@agliodbs.com
  Subject: Re: SQL Challenge:  Arbitrary Cross-tab
  In-Reply-To: <200408180956.14356.josh@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