Re: dynamic crosstab - Mailing list pgsql-general

From Balázs Klein
Subject Re: dynamic crosstab
Date
Msg-id 20080215155622.AE10FACB94@mail00a.mail.t-online.hu
Whole thread Raw
In response to Re: dynamic crosstab  (Erik Jones <erik@myemma.com>)
Responses Re: dynamic crosstab
Re: dynamic crosstab
List pgsql-general
> given that answers for a questionnaire are stored as a
> batch

Not in our setup - for all sorts of reasons (preserving responses on a connection failure or restart, monitoring
responselatency in real time, creating adaptive/branching questionnaires) we send each response separately. 

> people running reports on will be the ones to notice, i.e. at
> retrieval time.

I am not sure - different responses are aggregated into different attributes in different ways - those properties need
tobe retrieved during scoring/report generation, so being able to create a join directly on a response is a good thing
forme. But report generation - in our case it must be a DTP quality PDF - is such a beast anyway that db times dwarf
comparedto pdf generation. 

The problem comes when I need to present the responses themselves in a human-friendly way - as an export or display or
report.Do you think there is a way to ensure that the order of the values in the array below is the same for each
person?

tbl(eID, aID, value)

Select eID, array_accum(value) from
(
 (Select Distinct eID from tbl) e
  CROSS JOIN
 (Select Distinct aID from tbl) a
) ea
 LEFT OUTER JOIN
tbl USING (eID, aID)
GROUP BY eID


Thx for the help.
B.


pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Are indexes blown?
Next
From: Erik Jones
Date:
Subject: Re: dynamic crosstab