Re: [noob] How to optimize this double pivot query? - Mailing list pgsql-sql

From Samuel Gendler
Subject Re: [noob] How to optimize this double pivot query?
Date
Msg-id CAEV0TzBd8vUSY1adZhkB6QwwKeG0OQaT-rDs-mp4aDbHEJO2BQ@mail.gmail.com
Whole thread Raw
In response to Re: [noob] How to optimize this double pivot query?  (Thomas Kellerer <spam_eater@gmx.net>)
Responses Re: [noob] How to optimize this double pivot query?  (Robert Buck <buck.robert.j@gmail.com>)
List pgsql-sql


On Mon, Oct 1, 2012 at 11:46 PM, Thomas Kellerer <spam_eater@gmx.net> wrote:

That combined with the tablefunc module (which let's you do pivot queries) might
make your queries substantially more readable (and maybe faster as well).


I woud think that using the crosstab functions in tablefunc would solve the problem without needing a complete change of structure. I've built crosstabs over a whole lot more than 54K rows in far, far less time (and resulting in more than 35 columns, too) than the 11 seconds that was quoted here, without feeling the need to deal with hstore or similar.  In fact, wouldn't hstore actually make it more difficult to build a crosstab query than the schema that he has in place now?

--sam

pgsql-sql by date:

Previous
From: mephysto
Date:
Subject: Help in accessing array
Next
From: Robert Buck
Date:
Subject: Re: [noob] How to optimize this double pivot query?