Search Postgresql Archives

Re: Any thoughts on a better approach to this query?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Sep 5, 2015 at 8:36 AM, Marc Mamin <M.Mamin@xxxxxxxxxxxx> wrote:

   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.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux