Re: Any thoughts on a better approach to this query?
От | David G. Johnston |
---|---|
Тема | Re: Any thoughts on a better approach to this query? |
Дата | |
Msg-id | CAKFQuwadJNir8L6ft7Px65_BxqRxjE5=eaV5uAwP_Emq56hkYA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Any thoughts on a better approach to this query? (Marc Mamin <M.Mamin@intershop.de>) |
Список | pgsql-general |
array_not_nulls(array_agg(case when type='A' then link end ))as ar_a,
array_not_nulls(array_agg(case when type='B' then link end ))as ar_b,
array_not_nulls(array_agg(case when type NOT IN ('A', 'B') then link end)) as ar_others
Yeah. I'm not sure why I didn't tend toward the array_agg approach since I have made use of it previously. It cleans up a bit but not as much as I was hoping - but also not seeing. The preponderance of case statements
and array slicing is still present. I image trying to write some kind of "shift" function but that doesn't mesh well with set theory; it seems to be a procedural concept which I suspect would be considerably worse performing.
Thanks for the suggestion and once I get back on that project I'm intended to do a barebones performance comparison of the two which I'll follow up with.
David J.
В списке pgsql-general по дате отправления: