0PricingLogin
Supabase Backend as a Service · Lesson

Scheduling Recurring Jobs with pg_cron

Automate recurring work inside Supabase using pg_cron to schedule periodic Edge Function calls, cleanup jobs, and data aggregation tasks on a reliable timeline.

Why Scheduled Jobs Matter

Complex workflows often need work to happen on a schedule, not just in response to a request. Think nightly cleanups, hourly aggregations, or weekly digest emails.

Supabase ships with the pg_cron extension, letting you run SQL on a recurring timetable directly inside Postgres.

  • No external scheduler to maintain
  • Runs close to your data
  • Can trigger Edge Functions via HTTP

Enabling pg_cron

Enable the extension once per project. In the Supabase dashboard go to Database > Extensions and toggle pg_cron, or run SQL.

It creates a cron.job table that tracks every scheduled task.

create extension if not exists pg_cron;

All lessons in this course

  1. Integrating with External Services
  2. Task Queues with Supabase & Workers
  3. Scheduling Recurring Jobs with pg_cron
← Back to Supabase Backend as a Service