Cron
Tested with: Databasezy API v1 · PostgreSQL 17 · pg_cron 1.6
Cron runs SQL, or calls an HTTPS endpoint, on a schedule inside your Postgres instance, using pg_cron. Open the
instance in the portal and choose Cron; the first job turns the pg_cron extension on for you (a one-time
restart).
Schedules
Section titled “Schedules”Standard cron syntax in UTC (*/5 * * * *, 0 3 * * *), shortcuts such as @daily, or an interval of 1 to 59
seconds (30 seconds).
Create a job
Section titled “Create a job”select cron.schedule( 'expire-sessions', -- name, unique per instance '0 3 * * *', -- every day at 03:00 UTC $$delete from sessions where expires_at < now()$$);Or with the API, for SQL or HTTPS jobs:
zb api POST /v1/orgs/{org}/instances/inst_01jb.../cron/jobs -d '{ "name": "expire-sessions", "schedule": "0 3 * * *", "kind": "sql", "sql": "delete from sessions where expires_at < now()"}'SQL jobs run as the application role. HTTPS jobs call a URL on port 443.
Runs and failures
Section titled “Runs and failures”The portal lists each job’s runs with status, duration and the error of a failed run
(GET .../cron/runs in the API). Pause a job by turning it off, or delete it.