Scheduling Jobs Using pg_cron

In this section, you’ll use the pg_cron[245] extension to schedule jobs in your database. This extension has wide support on PostgreSQL hosting providers.

Since the owner user you normally work with is not a superuser, you’ll connect to the rideshare_database as the superuser postgres to enable the extension. You’ll also grant the USAGE privilege to the cron schema for the owner role so that the owner user can call functions from the extension. Owners can work with functions and objects within the rideshare_development database. Refer to the pg_cron section of db/README.md in Rideshare for the latest information.

Before diving into all of that, you’ll need to set up pg_cron for macOS. While there is a Homebrew ...

Get High Performance PostgreSQL for Rails now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.