Query Performance

Median latency of every state-adapter query on PostgreSQL, SQLite, MySQL, MariaDB, Redis and the synchronous in-process adapter.

Every state-adapter method runs against the same seeded dataset on PostgreSQL, SQLite, MySQL, MariaDB, Redis and the synchronous in-process adapter.

Your stack

Showing every backend. Pick the ones you use to hide the rest on every benchmark page; the pick is saved in this browser.

Test setup

  • Machine
    Apple M1 Pro
  • Runtime
    Node.js v24
  • Infrastructure
    Docker Desktop on macOS
    Databases and pub/sub servers run in containers, so every round trip crosses the VM bridge.
  • Servers
    PostgreSQL 18, SQLite 3.53, MySQL 26, MariaDB 13, Redis 8, NATS 2
  • Runs
    10 per method
    The charts show the median (p50).
  • Dataset
    Scale 100
    A simulated week of traffic, generated once and loaded into every backend: all statuses, blocker topologies, multi-job chains, retries and deduplication keys.
  • PostgreSQL
    pg driver, after ANALYZE
  • SQLite
    In memory through better-sqlite3, after ANALYZE
  • MySQL
    mysql2 driver, after ANALYZE TABLE
    1 GB InnoDB buffer pool: InnoDB reads with O_DIRECT, so it has no OS page cache to fall back on.
  • MariaDB
    mysql2 driver, after ANALYZE TABLE
    1 GB InnoDB buffer pool.
  • Redis
    ioredis driver
  • In-process
    Sync in-process state adapter
    Loaded with the same dataset as the other backends.

Operational queries

The per-job path every worker and client call takes. The limit10 variants acquire or reclaim ten jobs in one statement, as the worker does when it fills or frees several idle slots at once.

Operational queries

p50 ms
  • getChains/default
  • PostgreSQL
    0.48
  • SQLite
    0.06
  • MySQL
    2.56
  • MariaDB
    0.62
  • Redis
    0.81
  • In-process
    0.01
  • getChains/lock
  • PostgreSQL
    0.96
  • SQLite
    0.05
  • MySQL
    3.47
  • MariaDB
    1.28
  • Redis
    0.74
  • In-process
    0.01
  • getJobs/default
  • PostgreSQL
    0.44
  • SQLite
    0.03
  • MySQL
    0.55
  • MariaDB
    0.39
  • Redis
    0.22
  • In-process
    0.00
  • getJobs/lock
  • PostgreSQL
    1.04
  • SQLite
    0.03
  • MySQL
    1.71
  • MariaDB
    0.89
  • Redis
    0.39
  • In-process
    0.00
  • getWorkers/default
  • PostgreSQL
    0.47
  • SQLite
    0.02
  • MySQL
    0.66
  • MariaDB
    0.26
  • Redis
    0.22
  • In-process
    0.00
  • getWorkers/lock
  • PostgreSQL
    0.83
  • SQLite
    0.03
  • MySQL
    1.37
  • MariaDB
    1.30
  • Redis
    0.23
  • In-process
    0.00
  • createJobs/default
  • PostgreSQL
    1.46
  • SQLite
    0.07
  • MySQL
    17.14
  • MariaDB
    3.43
  • Redis
    0.32
  • In-process
    0.01
  • createJobs/deduplication
  • PostgreSQL
    0.75
  • SQLite
    0.12
  • MySQL
    1.18
  • MariaDB
    1.51
  • Redis
    0.65
  • In-process
    0.01
  • continueJobs/default
  • PostgreSQL
    1.32
  • SQLite
    0.10
  • MySQL
    3.09
  • MariaDB
    2.86
  • Redis
    0.53
  • In-process
    0.01
  • addJobsBlockers/default
  • PostgreSQL
    1.43
  • SQLite
    0.09
  • MySQL
    3.41
  • MariaDB
    2.25
  • Redis
    0.56
  • In-process
    0.01
  • getJobBlockers/default
  • PostgreSQL
    0.35
  • SQLite
    0.08
  • MySQL
    0.56
  • MariaDB
    0.31
  • Redis
    0.57
  • In-process
    0.00
  • unblockJobs/default
  • PostgreSQL
    2.47
  • SQLite
    0.14
  • MySQL
    1.97
  • MariaDB
    1.74
  • Redis
    0.56
  • In-process
    0.01
  • startWorker/default
  • PostgreSQL
    0.67
  • SQLite
    0.06
  • MySQL
    2.00
  • MariaDB
    1.88
  • Redis
    0.49
  • In-process
    0.00
  • extendWorkerLease/default
  • PostgreSQL
    0.96
  • SQLite
    0.02
  • MySQL
    2.57
  • MariaDB
    2.26
  • Redis
    0.32
  • In-process
    0.00
  • stopWorker/default
  • PostgreSQL
    0.83
  • SQLite
    0.02
  • MySQL
    1.93
  • MariaDB
    2.55
  • Redis
    0.32
  • In-process
    0.00
  • startJobAttempts/default
  • PostgreSQL
    2.58
  • SQLite
    0.07
  • MySQL
    3.05
  • MariaDB
    4.07
  • Redis
    0.21
  • In-process
    0.00
  • startJobAttempts/limit10
  • PostgreSQL
    4.30
  • SQLite
    0.18
  • MySQL
    5.91
  • MariaDB
    3.58
  • Redis
    0.49
  • In-process
    0.01
  • completeJobs/default
  • PostgreSQL
    2.35
  • SQLite
    0.07
  • MySQL
    2.58
  • MariaDB
    2.92
  • Redis
    0.43
  • In-process
    0.01
  • getStartAttemptDelayMs/default
  • PostgreSQL
    1.47
  • SQLite
    0.03
  • MySQL
    1.07
  • MariaDB
    1.18
  • Redis
    0.38
  • In-process
    0.00
  • rescheduleJobs/default
  • PostgreSQL
    0.94
  • SQLite
    0.04
  • MySQL
    2.75
  • MariaDB
    2.51
  • Redis
    0.37
  • In-process
    0.00
  • deleteChains/default
  • PostgreSQL
    2.53
  • SQLite
    0.08
  • MySQL
    4.26
  • MariaDB
    5.31
  • Redis
    0.84
  • In-process
    0.01
  • deleteChains/multiJob
  • PostgreSQL
    3.22
  • SQLite
    0.09
  • MySQL
    15.28
  • MariaDB
    3.24
  • Redis
    1.26
  • In-process
    0.01

Listing queries

The list, filter and paginate path behind the dashboard, cleanup jobs and the query API. The blocked listing has its own partial index (job_blocked_idx) for its filter and scheduled-at ordering, so it lands in the same range as pending.

Type discovery & counts

p50 ms
  • getChainTypeNames/default
  • PostgreSQL
    0.74
  • SQLite
    0.05
  • MySQL
    0.53
  • MariaDB
    0.43
  • Redis
    0.28
  • In-process
    0.01
  • getJobTypeNames/default
  • PostgreSQL
    0.69
  • SQLite
    0.06
  • MySQL
    0.41
  • MariaDB
    0.61
  • Redis
    0.26
  • In-process
    0.02
  • countChainsByTypeName/default
  • PostgreSQL
    2.61
  • SQLite
    1.41
  • MySQL
    7.93
  • MariaDB
    11.40
  • Redis
    0.19
  • In-process
    0.00
  • countJobsByTypeName/default
  • PostgreSQL
    2.80
  • SQLite
    1.33
  • MySQL
    8.45
  • MariaDB
    12.51
  • Redis
    0.20
  • In-process
    0.00
  • countWorkers/default
  • PostgreSQL
    0.27
  • SQLite
    0.01
  • MySQL
    0.26
  • MariaDB
    0.39
  • Redis
    0.25
  • In-process
    0.00
  • countWorkersByTypeName/default
  • PostgreSQL
    0.45
  • SQLite
    0.04
  • MySQL
    0.42
  • MariaDB
    0.50
  • Redis
    0.24
  • In-process
    0.01
  • countRunningJobsByWorkerId/default
  • PostgreSQL
    0.33
  • SQLite
    0.02
  • MySQL
    0.31
  • MariaDB
    0.38
  • Redis
    0.19
  • In-process
    0.00

List chains

p50 ms
  • listChains/noStatus/default
  • PostgreSQL
    0.77
  • SQLite
    0.27
  • MySQL
    1.05
  • MariaDB
    0.91
  • Redis
    0.82
  • In-process
    0.02
  • listChains/noStatus/independent
  • PostgreSQL
    1.02
  • SQLite
    0.33
  • MySQL
    1.39
  • MariaDB
    0.88
  • Redis
    1.44
  • In-process
    0.01
  • listChains/noStatus/nonIndependent
  • PostgreSQL
    145.73
  • SQLite
    121.13
  • MySQL
    219.43
  • MariaDB
    223.56
  • Redis
    74.26
  • In-process
    0.00
  • listChains/noStatus/fromTo
  • PostgreSQL
    1.01
  • SQLite
    0.27
  • MySQL
    1.27
  • MariaDB
    2.22
  • Redis
    0.98
  • In-process
    0.01
  • listChains/noStatus/cursor
  • PostgreSQL
    1.95
  • SQLite
    0.57
  • MySQL
    1.87
  • MariaDB
    2.60
  • Redis
    2.01
  • In-process
    0.03
  • listChains/running/default
  • PostgreSQL
    1.02
  • SQLite
    0.27
  • MySQL
    1.32
  • MariaDB
    1.44
  • Redis
    0.83
  • In-process
    0.01
  • listChains/running/independent
  • PostgreSQL
    1.09
  • SQLite
    0.29
  • MySQL
    1.44
  • MariaDB
    1.60
  • Redis
    1.56
  • In-process
    0.01
  • listChains/running/nonIndependent
  • PostgreSQL
    24.26
  • SQLite
    20.83
  • MySQL
    100.78
  • MariaDB
    128.02
  • Redis
    68.60
  • In-process
    0.00
  • listChains/running/cursor
  • PostgreSQL
    1.81
  • SQLite
    0.52
  • MySQL
    2.27
  • MariaDB
    3.65
  • Redis
    2.21
  • In-process
    0.03
  • listChains/completed/default
  • PostgreSQL
    0.64
  • SQLite
    0.29
  • MySQL
    0.86
  • MariaDB
    1.96
  • Redis
    1.19
  • In-process
    0.01
  • listChains/completed/independent
  • PostgreSQL
    1.20
  • SQLite
    0.33
  • MySQL
    1.38
  • MariaDB
    1.83
  • Redis
    1.98
  • In-process
    0.01
  • listChains/completed/nonIndependent
  • PostgreSQL
    61.87
  • SQLite
    50.10
  • MySQL
    229.74
  • MariaDB
    251.91
  • Redis
    73.19
  • In-process
    0.00
  • listChains/completed/orderByCreatedAt
  • PostgreSQL
    0.99
  • SQLite
    0.61
  • MySQL
    1.30
  • MariaDB
    1.71
  • Redis
    0.95
  • In-process
    0.01
  • listChains/completed/orderByCompletedAt
  • PostgreSQL
    0.76
  • SQLite
    0.30
  • MySQL
    1.20
  • MariaDB
    1.71
  • Redis
    1.05
  • In-process
    0.01
  • listChains/completed/cursor
  • PostgreSQL
    1.35
  • SQLite
    0.74
  • MySQL
    2.43
  • MariaDB
    2.92
  • Redis
    2.09
  • In-process
    0.03
  • listChains/completed/orderByCreatedAtCursor
  • PostgreSQL
    1.25
  • SQLite
    0.60
  • MySQL
    2.33
  • MariaDB
    2.99
  • Redis
    2.03
  • In-process
    0.02
  • listChains/completed/orderByCompletedAtCursor
  • PostgreSQL
    1.21
  • SQLite
    0.52
  • MySQL
    2.00
  • MariaDB
    3.06
  • Redis
    1.77
  • In-process
    0.03

List jobs

p50 ms
  • listJobs/noStatus/default
  • PostgreSQL
    0.79
  • SQLite
    0.27
  • MySQL
    1.31
  • MariaDB
    1.03
  • Redis
    0.79
  • In-process
    0.02
  • listJobs/noStatus/fromTo
  • PostgreSQL
    0.85
  • SQLite
    0.25
  • MySQL
    0.89
  • MariaDB
    0.64
  • Redis
    0.79
  • In-process
    0.02
  • listJobs/noStatus/cursor
  • PostgreSQL
    1.92
  • SQLite
    0.41
  • MySQL
    1.60
  • MariaDB
    1.14
  • Redis
    1.85
  • In-process
    0.04
  • listJobs/pending/default
  • PostgreSQL
    1.27
  • SQLite
    0.20
  • MySQL
    0.62
  • MariaDB
    0.87
  • Redis
    0.83
  • In-process
    0.01
  • listJobs/pending/fromTo
  • PostgreSQL
    0.78
  • SQLite
    0.22
  • MySQL
    0.49
  • MariaDB
    0.95
  • Redis
    0.65
  • In-process
    0.01
  • listJobs/pending/orderByCreatedAt
  • PostgreSQL
    0.78
  • SQLite
    0.20
  • MySQL
    0.52
  • MariaDB
    1.11
  • Redis
    0.56
  • In-process
    0.02
  • listJobs/pending/cursor
  • PostgreSQL
    1.30
  • SQLite
    0.41
  • MySQL
    0.89
  • MariaDB
    1.68
  • Redis
    1.17
  • In-process
    0.03
  • listJobs/blocked/default
  • PostgreSQL
    1.10
  • SQLite
    0.23
  • MySQL
    0.47
  • MariaDB
    0.70
  • Redis
    0.60
  • In-process
    0.01
  • listJobs/blocked/fromTo
  • PostgreSQL
    1.11
  • SQLite
    0.22
  • MySQL
    0.48
  • MariaDB
    0.72
  • Redis
    0.56
  • In-process
    0.01
  • listJobs/blocked/orderByCreatedAt
  • PostgreSQL
    1.08
  • SQLite
    0.22
  • MySQL
    0.54
  • MariaDB
    0.82
  • Redis
    0.56
  • In-process
    0.01
  • listJobs/blocked/cursor
  • PostgreSQL
    1.93
  • SQLite
    0.40
  • MySQL
    0.94
  • MariaDB
    1.00
  • Redis
    1.16
  • In-process
    0.03
  • listJobs/running/default
  • PostgreSQL
    1.36
  • SQLite
    0.32
  • MySQL
    0.48
  • MariaDB
    0.52
  • Redis
    0.61
  • In-process
    0.02
  • listJobs/running/orderByCreatedAt
  • PostgreSQL
    0.77
  • SQLite
    0.21
  • MySQL
    0.53
  • MariaDB
    0.96
  • Redis
    0.56
  • In-process
    0.01
  • listJobs/running/cursor
  • PostgreSQL
    11.11
  • SQLite
    0.60
  • MySQL
    0.93
  • MariaDB
    1.43
  • Redis
    1.18
  • In-process
    0.03
  • listJobs/completed/default
  • PostgreSQL
    0.95
  • SQLite
    0.26
  • MySQL
    0.69
  • MariaDB
    0.53
  • Redis
    0.56
  • In-process
    0.01
  • listJobs/completed/orderByCreatedAt
  • PostgreSQL
    1.02
  • SQLite
    0.23
  • MySQL
    1.07
  • MariaDB
    0.59
  • Redis
    0.54
  • In-process
    0.01
  • listJobs/completed/cursor
  • PostgreSQL
    1.56
  • SQLite
    0.46
  • MySQL
    1.61
  • MariaDB
    0.90
  • Redis
    1.32
  • In-process
    0.02

List chain jobs & blocked jobs

p50 ms
  • listChainJobs/default
  • PostgreSQL
    3.33
  • SQLite
    0.91
  • MySQL
    0.80
  • MariaDB
    3.63
  • Redis
    0.51
  • In-process
    0.01
  • listChainJobs/cursor
  • PostgreSQL
    6.14
  • SQLite
    1.93
  • MySQL
    1.33
  • MariaDB
    5.18
  • Redis
    1.15
  • In-process
    0.01
  • listBlockedJobs/default
  • PostgreSQL
    177.82
  • SQLite
    225.34
  • MySQL
    207.28
  • MariaDB
    175.24
  • Redis
    0.55
  • In-process
    0.01
  • listBlockedJobs/cursor
  • PostgreSQL
    324.83
  • SQLite
    438.39
  • MySQL
    420.59
  • MariaDB
    324.15
  • Redis
    1.01
  • In-process
    0.02

List workers & worker jobs

p50 ms
  • listWorkers/default
  • PostgreSQL
    0.74
  • SQLite
    0.10
  • MySQL
    0.58
  • MariaDB
    0.40
  • Redis
    0.45
  • In-process
    0.03
  • listWorkers/typeName
  • PostgreSQL
    0.45
  • SQLite
    0.07
  • MySQL
    0.73
  • MariaDB
    0.32
  • Redis
    0.30
  • In-process
    0.01
  • listWorkers/status
  • PostgreSQL
    0.28
  • SQLite
    0.06
  • MySQL
    0.37
  • MariaDB
    0.28
  • Redis
    1.74
  • In-process
    0.00
  • listWorkers/cursor
  • PostgreSQL
    0.74
  • SQLite
    0.17
  • MySQL
    0.99
  • MariaDB
    0.69
  • Redis
    1.07
  • In-process
    0.06
  • listWorkerJobs/default
  • PostgreSQL
    0.49
  • SQLite
    0.15
  • MySQL
    0.41
  • MariaDB
    6.75
  • Redis
    0.46
  • In-process
    0.00
  • listWorkerJobs/cursor
  • PostgreSQL
    1.58
  • SQLite
    0.27
  • MySQL
    1.70
  • MariaDB
    14.47
  • Redis
    0.77
  • In-process
    0.02

Reproduce

From benchmarks/query-performance, with Docker running for PostgreSQL, MySQL, MariaDB and Redis. Each run also writes the query plans to explanations/.

Terminal

pnpm --filter benchmark-query-performance start:postgres
pnpm --filter benchmark-query-performance start:sqlite
pnpm --filter benchmark-query-performance start:mysql
pnpm --filter benchmark-query-performance start:mariadb
pnpm --filter benchmark-query-performance start:redis
pnpm --filter benchmark-query-performance start:in-process
esc

Search guides, integrations and every exported symbol.

↑ ↓ to navigate↵ to open