---
title: "Postgres as a CRON Server"
description: "Postgres can act as a cron server by combining the pg_cron extension for scheduling with the pgsql-http extension for outbound HTTP calls, letting a scheduled SQL statement POST to a webhook every minute."
url: "https://swe.quest/articles/postgres-as-a-cron-server-d7e215165e9a3fbe"
canonical: "https://supabase.com/blog/postgres-as-a-cron-server"
source: "Supabase"
published: "2021-03-05"
difficulty: "medium"
kind: "How-to"
reading_minutes: 6
tags: ["postgres","scheduling","sql"]
---

# Postgres as a CRON Server

A post on [Supabase](https://swe.quest/sources/supabase.md), published 2021-03-05, 6 min read, How-to. Original: [https://supabase.com/blog/postgres-as-a-cron-server](https://supabase.com/blog/postgres-as-a-cron-server)

## Summary

Postgres can act as a cron server by combining the pg\_cron extension for scheduling with the pgsql-http extension for outbound HTTP calls, letting a scheduled SQL statement POST to a webhook every minute. The walkthrough covers enabling both extensions, granting cron schema access to non-superuser roles, cron syntax, and inspecting or unscheduling jobs via cron.job and cron.job\_run\_details. pg\_cron runs jobs in background workers so slow endpoints don't block core Postgres, but setting http.timeout\_msec to fail fast is still recommended. Suggested uses include batching welcome emails, aggregating data and deleting old rows.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Scheduling](https://swe.quest/tags/scheduling.md) (Distributed systems)
- [SQL](https://swe.quest/tags/sql.md) (Languages)

## Prerequisites

- Basic SQL ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- Postgres extensions ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- cron syntax

## Keywords

pg\_cron, pgsql-http, Supabase, PostgreSQL, webhooks

## Related posts

- [Run Scheduled and Recurring Tasks with Cron](https://swe.quest/articles/run-scheduled-and-recurring-tasks-with-cron-ca49b6813f0599a8.md): Railway · 2025-11-26 · Medium · 10 min read · Scheduling, Deployment, PostgreSQL
  Cron runs commands on time-based schedules but keeps no job history, has no retries and does no concurrency control, so reliability depends on the job itself.
- [Your Neon Functions can now run on a schedule](https://swe.quest/articles/your-neon-functions-can-now-run-on-a-schedule-72b4a206b2b5554b.md): Neon · 2026-09-21 · Medium · 5 min read · Serverless, PostgreSQL, Scheduling
  Neon Function Triggers let Neon invoke a deployed Node.js function on a cron schedule.
- [How to fix missing table errors in pg\_cron](https://swe.quest/articles/how-to-fix-missing-table-errors-in-pg-cron-3e70d0e00b3759de.md): Neon · 2025-07-14 · Medium · 8 min read · PostgreSQL, Scheduling, SQL
  pg\_cron stores scheduled jobs as raw SQL text, separate from Postgres' system catalogs, so dropping a table leaves jobs that fail every run with "relation does not exist" and fill cron.job\_run\_details with errors.
- [Updates for Supabase Functions](https://swe.quest/articles/updates-for-supabase-functions-78e26e9858c89367.md): Supabase · 2021-07-30 · Medium · 6 min read · PostgreSQL, Event-driven architecture, Serverless
  Supabase is shipping Database Webhooks in alpha, a convenience wrapper around Postgres triggers that fires asynchronous HTTP requests on INSERT, UPDATE and DELETE with a Realtime-style JSON payload.
- [Processing large jobs with Edge Functions, Cron, and Queues](https://swe.quest/articles/processing-large-jobs-with-edge-functions-cron-and-queues-07d70dfaed40c250.md): Supabase · 2025-09-16 · Medium · 8 min read · Serverless, Data pipelines, PostgreSQL, Resilience, Scheduling
  Large data-processing jobs on Supabase can be split into a three-layer pipeline: cron-triggered Edge Functions collect work, distributor jobs route it into per-source Postgres queue tables, and specialized workers process one item at a time to stay within serverless timeouts.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
