Re: SQL Challenge: Arbitrary Cross-tab - Mailing list pgsql-sql

From Josh Berkus
Subject Re: SQL Challenge: Arbitrary Cross-tab
Date
Msg-id 200408180956.14356.josh@agliodbs.com
Whole thread Raw
In response to Re: SQL Challenge: Arbitrary Cross-tab  (Joe Conway <mail@joeconway.com>)
Responses Re: SQL Challenge: Arbitrary Cross-tab
List pgsql-sql
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


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: multi column foreign key for implicitly unique columns
Next
From: Josh Berkus
Date:
Subject: Re: multi column foreign key for implicitly unique columns