graphile-worker

Create PostgreSQL job queues with triggers and LISTEN/NOTIFY.

Updated Mar 5, 2026
One-click install
npx skills add https://github.com/pohlai88/AFENDA --skill graphile-worker
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: graphile-worker
Source: https://github.com/pohlai88/AFENDA/tree/main/.agents/skills/graphile-worker
Command: npx skills add https://github.com/pohlai88/AFENDA --skill graphile-worker

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the need for efficient, high-performance job queuing directly within PostgreSQL, leveraging triggers and LISTEN/NOTIFY for near real-time job processing.

Core Features & Use Cases

  • Trigger-based Job Creation: Automatically queue jobs when database events occur.
  • Low-latency Job Pickup: Achieve millisecond job pickup using PostgreSQL's LISTEN/NOTIFY mechanism.
  • Transactional Consistency: Ensure jobs are queued atomically with data changes.
  • Cron Scheduling: Implement recurring tasks directly within the worker.
  • Use Case: When a new user signs up, a database trigger can automatically queue a send_welcome_email job, which is picked up and processed within milliseconds.

Quick Start

Use the graphile-worker skill to set up a basic job queue with TypeScript tasks.

Frequently Asked Questions about graphile-worker

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

FAQPage Schema
How do I create a high-performance PostgreSQL job queue using triggers?

You can create a PostgreSQL job queue by using database triggers to automatically queue tasks when events occur, ensuring jobs are created atomically with your data changes for transactional consistency.

How does LISTEN/NOTIFY achieve low-latency job pickup in PostgreSQL background jobs?

LISTEN/NOTIFY enables low-latency job pickup by allowing PostgreSQL to push notifications to workers instantly, achieving millisecond job pickup without the overhead of continuous database polling.

Can I schedule cron jobs and batch processing directly within a PostgreSQL worker?

Yes, you can implement recurring cron scheduling and batch processing directly within the worker to manage periodic tasks and process multiple jobs efficiently in PostgreSQL.

What are the limitations and anti-patterns when using PostgreSQL for background job queues?

Key anti-patterns include using polling instead of LISTEN/NOTIFY for job pickup and storing large payloads in the queue, which degrades performance and should be avoided.

How do I ensure transactional consistency when adding background jobs from SQL?

Transactional consistency is achieved by adding jobs from SQL within the same transaction as your data changes, ensuring jobs are only queued if the database transaction commits successfully.

How do I handle job deduplication in a PostgreSQL job queue?

Job deduplication prevents duplicate tasks by checking existing queue entries before adding new jobs, ensuring identical background jobs are not processed multiple times concurrently.