How to split an array into columns

From: a <372660931(at)qq(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: How to split an array into columns
Date: 2018-08-24 09:01:53
Message-ID: tencent_457E571D2754843359EF7ABA@qq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2018-08-24 09:09:58 Re: How to split an array into columns
Previous Message Durumdara 2018-08-24 08:21:04 Re: Hungarian collation in English Windows server