pg_later

pg_later

pg_later : Run queries now and get results later

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
1090
pg_later
pg_later
0.4.0
TIME
PostgreSQL
Rust
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--sLd--
No
Yes
Yes
Yes
no
no
Relationships
Schemaspglater
Requires
pgmq
See Also
pg_cron
pg_task
pg_background
timescaledb
timescaledb_toolkit
timeseries
periods
temporal_tables

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
PIGSTY
0.4.0
18
17
16
15
14
pg_laterpgmq
RPM
PIGSTY
0.4.0
18
17
16
15
14
pg_later_$vpgmq_$v
DEB
PIGSTY
0.4.0
18
17
16
15
14
postgresql-$v-pg-laterpostgresql-$v-pgmq
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
el8.aarch64
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
el9.x86_64
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
el9.aarch64
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
el10.x86_64
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
el10.aarch64
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
d12.x86_64
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
d12.aarch64
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
d13.x86_64
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
d13.aarch64
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
u22.x86_64
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
u22.aarch64
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
u24.x86_64
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
u24.aarch64
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0
PIGSTY 0.4.0

Source

pig build pkg pg_later;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pg_later;		# install via package name, for the active PG version

pig install pg_later -v 18;   # install for PG 18
pig install pg_later -v 17;   # install for PG 17
pig install pg_later -v 16;   # install for PG 16
pig install pg_later -v 15;   # install for PG 15
pig install pg_later -v 14;   # install for PG 14

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'pg_later';

Create this extension with:

CREATE EXTENSION pg_later CASCADE; -- requires pgmq

Usage

pg_later: Execute SQL now and get the results later

A PostgreSQL extension to execute queries asynchronously. Built on pgmq.

Getting Started

Initialize the extension’s backend:

CREATE EXTENSION pg_later CASCADE;
SELECT pglater.init();

Execute a SQL query now:

SELECT pglater.exec(
  'SELECT * FROM pg_available_extensions ORDER BY name LIMIT 2'
) AS job_id;
 job_id
--------
     1

Come back at some later time, and retrieve the results by providing the job id:

SELECT pglater.fetch_results(1);
{
  "query": "select * from pg_available_extensions order by name limit 2",
  "job_id": 1,
  "result": [
    {
      "name": "adminpack",
      "comment": "administrative functions for PostgreSQL",
      "default_version": "2.1",
      "installed_version": null
    },
    {
      "name": "amcheck",
      "comment": "functions for verifying relation integrity",
      "default_version": "1.3",
      "installed_version": null
    }
  ],
  "status": "success"
}
Last updated on