Re: Turning column into *sorted* array?

From: PFC <lists(at)boutiquenumerique(dot)com>
To: "Felix E(dot) Klee" <felix(dot)klee(at)inka(dot)de>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Turning column into *sorted* array?
Date: 2005-05-18 17:54:08
Message-ID: op.sqzf0iuuth1vuj@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> SELECT array_accum(x) FROM (SELECT * FROM some_view ORDER BY x) AS tmp;

If you're using integers, you could use the int_array_accum or something
from the intarray module which is a lot faster.
I believe intarray also has a function for sorting integer arrays...

>
> BTW, the best alternative (in terms of execution performance) that comes
> into my mind is to create an aggregate that does the sorting right away
> while the values "come in" from the rows. But that'd probably take me
> some time to get right.
>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Felix E. Klee 2005-05-18 18:17:49 Re: Turning column into *sorted* array?
Previous Message Ragnar Hafstað 2005-05-18 17:53:52 Re: Changed to: how to solve the get next 100 records problem