Last active
December 7, 2016 16:07
-
-
Save x4m/d64884d5f69b17238e06096396acde23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\timing | |
create extension if not exists pg_background; | |
create table input as select round(random()*20) x from generate_series(1,5,1); | |
create table output(place int,value int); | |
create sequence s start 1; | |
create table handles as select pg_background_launch('select pg_sleep('||x||'); insert into output values (nextval(''s''),'||x||');') h from input; | |
select (select * from pg_background_result(h) as (x text) limit 1) from handles; | |
select * from output; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment