Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Schedules

Schedules register actions for future execution by Amphi’s integrated scheduler. The scheduler is a generic subsystem: SQL, backup, materialized-view refresh, and queue delivery can use the same trigger, policy, and execution-history mechanism.

Each schedule is persisted in the catalog. The server uses one orchestrator thread and a bounded worker pool; creating schedules does not create individual threads.

Execution session

Each DO SQL action runs in a dedicated internal session created by the worker. It is independent of the client session that created the schedule and is closed when the action finishes.

poller/orchestrator
  -> atomic occurrence claim
  -> bounded queue
  -> worker
  -> dedicated internal session
  -> SQL execution and commit/rollback
  -> schedule history

The worker pool is shared by all schedules. Execution is at-least-once: after a crash or timeout, an action may run again, so actions should be idempotent or deduplicate using the recorded run_id. The runtime also provides a no-poller mode for servers or tests that dispatch occurrences explicitly.

Logical dump and restore

ampdump exports tables, views, and materialized views. It does not export schedule definitions or sys.schedule_run history.

When a full database dump is implemented, only schedule definitions should be exported as recreatable DDL. Execution history is operational and should not be restored. Schedules must be restored after the tables, queues, views, and materialized views referenced by their actions, and must not start running before data loading completes.

Secret values are never part of a dump. A schedule may refer to an EXTERNAL CONNECTION, but its credentials remain outside the backup.

See CREATE SCHEDULE, ALTER SCHEDULE, and DROP SCHEDULE.