Convert table t1 of this form:
id | p50 | p75 | p95
---------------------
1 | 10 | 11 | 12
2 | 13 | 14 | 15
into this form:
id | key | value
-------------------
1 | p50 | 10
1 | p75 | 11
1 | p95 | 12
2 | p50 | 13
2 | p75 | 14
2 | p95 | 15
select t1.id, t2.key, t2.value
from t1
cross join unnest (
array['P50', 'P75', 'P95'],
array[P50, P75, P95]
) t2 (key, value)