apps/www/_blog/2024-12-04-supabase-cron.mdx
Today we're releasing Supabase Cron, a new Postgres Module that makes recurring Jobs simple and intuitive inside your database.
It's designed to work seamlessly with the entire Supabase platform. Create recurring Jobs to run SQL snippets and call database functions, Supabase Edge Functions, and even remote webhooks.
<div className="video-container mb-8"> <iframe className="w-full" src="https://www.youtube-nocookie.com/embed/miRQPbIJOuQ" title="Introducing Supabase Cron" allow="accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture; web-share" allowfullscreen /> </div> <Admonition>Supabase Cron is built on the powerful pg_cron extension by the team at Citus Data.
It's a Supabase policy to support existing tools wherever possible, and the Citus Data team have generously licensed their extension with the OSI-compatible PostgreSQL license.
We're very thankful to all the contributors and we look forward to our continued work with the community.
</Admonition>Cron is a tool for scheduling recurring tasks that run at specified intervals. These periodic tasks are called “Cron Jobs”. Common use-cases include:
Supabase Cron stores the scheduling logic within Postgres and runs your Jobs accordingly while integrating with the rest of the Supabase primitives - Dashboard, Edge Functions, and AI Assistant.
You can create Jobs either via the Dashboard or SQL.
<Admonition>For this post we'll focus on the Dashboard. You can refer to the documentation for SQL.
</Admonition>Within the Dashboard you can define schedules using standard cron syntax and the special pg_cron seconds syntax for sub-minute schedules or use natural language.
You can choose between four types of Jobs based on what you need to execute:
Create an inline SQL query or command to run on your database periodically. Use this for tasks like:
Call a Postgres function. This is useful for workflows, such as:
Trigger an external HTTP endpoint. Use this for:
Run a serverless function to execute custom logic. Examples include:
These options cover a wide range of use cases, helping with everything from database management to external integrations.
Wondering why a Job failed? You can view the history of all Jobs and their logs in the Dashboard. You can see when a Job started, how long it took, and what the result was.
For a deeper dive, you can view Jobs in the Logs Explorer.
Getting started is easy:
We're looking forward to seeing how you use Supabase Cron to help automate your workflows!