Action Scheduler indexes

This document describes indexes defined in the Action Scheduler schema and how they support common queries.
Indexes are defined in the CREATE TABLE statements in classes/schema/.

actionscheduler_actions

Index name Columns Purpose
PRIMARY action_id Fast lookup by action ID.
hook_status_scheduled_date_gmt hook (prefix 163), status, scheduled_date_gmt Efficient selection of actions by hook and status ordered by scheduled date (uses hook prefix for index length constraints).
status_scheduled_date_gmt status, scheduled_date_gmt Fast retrieval of actions by status and scheduled time window.
scheduled_date_gmt scheduled_date_gmt Range queries on scheduled time regardless of status.
args args (prefix 191) Lookup/filter by args payloads that fit the indexed prefix.
group_id group_id Filter actions by group.
last_attempt_gmt last_attempt_gmt Range queries over last attempt time.
claim_id_status_priority_scheduled_date_gmt claim_id, status, priority, scheduled_date_gmt Fetch claimed actions with a given status, ordered by priority and scheduled time.
status_last_attempt_gmt status, last_attempt_gmt Find failed/in-progress actions with last attempt time constraints.
status_claim_id status, claim_id Quickly find unclaimed or claimed actions per status.

actionscheduler_claims

Index name Columns Purpose
PRIMARY claim_id Fast lookup by claim ID.
date_created_gmt date_created_gmt Range queries on claim creation time (cleanup/expiry).

actionscheduler_groups

Index name Columns Purpose
PRIMARY group_id Fast lookup by group ID.
slug slug (prefix 191) Fast lookup by group slug.

actionscheduler_logs

Index name Columns Purpose
PRIMARY log_id Fast lookup by log ID.
action_id action_id Retrieve logs for a specific action.
log_date_gmt log_date_gmt Range queries over log timestamps.