Skip to content

pg_settimeout

Delayed and repeating SQL tasks in background workers

pg_settimeout · Delayed and repeating SQL tasks in background workers

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
102191pg_settimeoutpg_settimeout1.1ADMINMITC

PostgreSQL · 9.6, 10, 11

Usage

Sources:

pg_settimeout starts dynamic background workers to execute SQL after a delay. Upstream reports testing on PostgreSQL 9.6, 10 and 11; compatibility with later majors is unverified.

Core Workflow

CREATE EXTENSION pg_settimeout;
SELECT pg_settimeout('SELECT 1', 1000);

Operational Boundaries

pg_settimeout(query, timeout) runs once; pg_setinterval(query, timeout) repeats indefinitely. The timeout is in milliseconds and the result is the worker PID. Workers connect to the current database as the calling user and execute in separate transactions; rolling back the scheduling transaction does not undo an independently completed task. Available worker slots limit scheduling. The module has no startup routines and needs no preload. Installation uses the control-file superuser default.

Table reader