在Postgresql中将数组解包成行的最快方法是什么?即
我们有:
@H_403_3@a - {1,2} {2,3,4}我们需要:
@H_403_3@b - 1 2 2 3 4我使用:
@H_403_3@select explode_array(a) as a from a_table;其中explode_array是:
@H_403_3@create or replace function explode_array(in_array anyarray) returns setof anyelement as $$ select ($1)[s] from generate_series(1,array_upper($1,1)) as s; $$有什么更好的办法吗?