Re: [noob] How to optimize this double pivot query?

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: [noob] How to optimize this double pivot query?
Дата
Msg-id k4e2j6$hc2$1@ger.gmane.org
обсуждение исходный текст
Ответ на Re: [noob] How to optimize this double pivot query?  (Robert Buck <buck.robert.j@gmail.com>)
Ответы Re: [noob] How to optimize this double pivot query?  (Samuel Gendler <sgendler@ideasculptor.com>)
Список pgsql-sql
Robert Buck, 02.10.2012 03:13:
> So as you can probably glean, the tables store performance metric
> data. The reason I chose to use k-v is simply to avoid having to
> create an additional column every time a new metric type come along.
> So those were the two options I thought of, straight k-v and column
> for every value type.
>
> Are there other better options worth considering that you could point
> me towards that supports storing metrics viz. with an unbounded
> number of metric types in my case?
>

Have a look at the hstore module. It's exactly meant for that scenario with the added
benefit that you can index on that column and looking up key names and their values
is blazingly fast then.

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).

Regards
Thomas







В списке pgsql-sql по дате отправления:

Предыдущее
От: David Johnston
Дата:
Сообщение: Re: [noob] How to optimize this double pivot query?
Следующее
От: mephysto
Дата:
Сообщение: Help in accessing array