Skip to content

Commit 4c0d2d0

Browse files
authored
Create README.md (#1)
1 parent 798c7fe commit 4c0d2d0

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
```

0 commit comments

Comments
 (0)