pg_cron: Cron Inside PostgreSQL
pg_cron lets you schedule SQL directly in PostgreSQL using standard cron syntax — no OS crontab needed. Supabase ships it built in; on self-hosted Postgres you enable the extension and use cron.schedule().
Enable and schedule
CREATE EXTENSION IF NOT EXISTS pg_cron; then SELECT cron.schedule('nightly-vacuum', '0 3 * * *', 'VACUUM ANALYZE'); runs the SQL at 3 AM daily. The schedule string is ordinary cron syntax.
On Supabase
Supabase has pg_cron pre-installed. Enable it under Database > Extensions, then use the same cron.schedule() call in the SQL editor, or call an Edge Function via cron.schedule + net.http_post.
Manage jobs
List with SELECT * FROM cron.job; and remove with SELECT cron.unschedule('nightly-vacuum');. Job run history is in cron.job_run_details.
FAQ
What is pg_cron?
A PostgreSQL extension that schedules SQL inside the database using standard cron syntax, via cron.schedule('name', '0 3 * * *', 'SQL'). No OS crontab required.
Does Supabase support scheduled jobs?
Yes — Supabase ships pg_cron. Enable it under Database > Extensions and use cron.schedule() in the SQL editor to run SQL or call Edge Functions on a schedule.
How do I list or delete pg_cron jobs?
SELECT * FROM cron.job; lists them and SELECT cron.unschedule('job-name'); removes one. Run history is in cron.job_run_details.