File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed
Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ # pg_later
2+ Execute SQL now and get the results later.
3+
4+ A postgres extension to execute queries asynchronously.
5+
6+ ``` sql
7+ CREATE EXTENSION pg_later CASCADE
8+ ```
9+
10+ Execute a SQL query now:
11+
12+ ``` sql
13+ select pg_later_exec(
14+ ' select * from pg_available_extensions order by name limit 2'
15+ ) as job_id
16+
17+ job_id
18+ -- ------
19+ 1
20+ (1 row)
21+ ```
22+
23+ Come back at some later time, and retrieve the results by providing the job id:
24+
25+ ``` sql
26+ select pg_later_results(1 )
27+
28+ pg_later_results
29+ -- ------------------
30+ {
31+ " query" : " select * from pg_available_extensions order by name limit 2" ,
32+ " job_id" : 48 ,
33+ " result" : [
34+ {
35+ " name" : " adminpack" ,
36+ " comment" : " administrative functions for PostgreSQL" ,
37+ " default_version" : " 2.1" ,
38+ " installed_version" : null
39+ },
40+ {
41+ " name" : " amcheck" ,
42+ " comment" : " functions for verifying relation integrity" ,
43+ " default_version" : " 1.3" ,
44+ " installed_version" : null
45+ }
46+ ],
47+ " status" : " success"
48+ }
49+ ```
You can’t perform that action at this time.
0 commit comments