Re: How to split an array into columns

From: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>
To: a <372660931(at)qq(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to split an array into columns
Date: 2018-08-24 16:54:27
Message-ID: CA+renyV+kFyKvydAT3Fm871ubL8VB4dRdm6N2arD4i-NMWE96A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Aug 24, 2018 at 2:01 AM, a <372660931(at)qq(dot)com> wrote:
>
> Say if I have an float8 array:
>
> id| data
> --|---------------
> a | {1,2}
> b | {2,4}
>
> . . .
>
> Since I would have around 200,000 rows, I would prefer it having enough capacity to carry out the calculation such as sum().

Is this something that would help you?:

https://github.com/pjungwir/aggs_for_vecs

(also on pgxn: https://pgxn.org/dist/aggs_for_vecs)

It would let you say `SELECT vec_to_sum(data)` and get `{3,6}`.

Paul

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Gauthier 2018-08-24 18:18:47 unorthodox use of PG for a customer
Previous Message Tom Lane 2018-08-24 14:01:47 Re: Hungarian collation in English Windows server