pg-cron-scheduling

Schedule Postgres maintenance jobs with pg_cron in-database.

Updated Apr 22, 2026
One-click install
npx skills add https://github.com/Mercurium-Analytics/pg-search-vector --skill pg-cron-scheduling
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pg-cron-scheduling
Source: https://github.com/Mercurium-Analytics/pg-search-vector/tree/main/skills/pg-cron-scheduling
Command: npx skills add https://github.com/Mercurium-Analytics/pg-search-vector --skill pg-cron-scheduling

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

pg_cron scheduling inside Postgres lets you run maintenance tasks without external schedulers, unifying management and timing in-database.

Core Features & Use Cases

  • Scheduling jobs: VACUUM, REINDEX, pg_partman maintenance, or materialized view refresh, all run inside the database.
  • In-database scope: schedule across the cron.metadata database or any target database via schedule_in_database.
  • Observability and maintenance: inspect and unschedule jobs, view run details, and ensure safe operation.

Quick Start

Enable pg_cron in shared_preload_libraries and schedule your first job with cron.schedule.

Frequently Asked Questions about pg-cron-scheduling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I schedule SQL jobs inside Postgres without an external scheduler?

Schedule VACUUM, REINDEX, pg_partman maintenance, or materialized view refresh by calling cron.schedule with a cron expression and SQL command to automate Postgres maintenance tasks directly.

Can I schedule a pg_cron job across multiple databases?

Yes, you can schedule jobs across multiple databases using cron.schedule_in_database to execute SQL tasks on target databases outside the default cron metadata database.

What Postgres maintenance tasks can I automate with pg_cron?

Use pg_cron to automate VACUUM, REINDEX, pg_partman maintenance, and materialized view refresh by scheduling recurring SQL jobs directly inside the database.

How do I enable pg_cron to start scheduling database jobs?

Add pg_cron to shared_preload_libraries in your Postgres configuration, then call cron.schedule to configure and run your first automated SQL maintenance job.

How do I view and manage scheduled pg_cron jobs?

Inspect scheduled jobs, view run details, and unschedule jobs by querying pg_cron metadata tables to maintain safe operation and observability of automated Postgres maintenance tasks.

Why use in-database scheduling instead of an external cron tool for Postgres?

In-database scheduling with pg_cron unifies management and timing inside Postgres, eliminating external schedulers while safely running maintenance tasks like VACUUM and REINDEX.