pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: a <372660931@qq.com>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: How to split an array into columns
Date: Fri, 24 Aug 2018 17:01:53 +0800
Message-ID: <tencent_457E571D2754843359EF7ABA@qq.com> (raw)

Say if I have an float8 array:

id| data
--|---------------
a | {1,2}
b | {2,4}


If I could using query to make it looks like this:


id| data[1] | data[2]
--|----------|-----------
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().


Thank you so much!

view thread (4+ messages)  latest in thread

Message-ID: <tencent_457E571D2754843359EF7ABA@qq.com>
Permalink:  ../tencent_457E571D2754843359EF7ABA@qq.com/
Also on:    postgresql.org/message-id/tencent_457E571D2754843359EF7ABA@qq.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: 372660931@qq.com
  Subject: Re: How to split an array into columns
  In-Reply-To: <tencent_457E571D2754843359EF7ABA@qq.com>
  References: <tencent_457E571D2754843359EF7ABA@qq.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox