drop table if exists data_table;
create table data_table (f1 text);
insert into data_table select x::text from generate_series(1,10000) x;
vacuum analyze data_table;

\timing on

do $$
begin
  for i in 1..10000 loop
    perform json_agg(f1) from data_table;
  end loop;
end$$;

do $$
begin
  for i in 1..10000 loop
    perform jsonb_agg(f1) from data_table;
  end loop;
end$$;
