Skip to main content
Version: Next

TPC-B

TPC-B models a short banking transaction over branches, tellers, accounts, and history. It is useful for measuring transactional throughput, contention, connection-pool behavior, and retry rates with a compact schema.

Variants

WorkloadExecutionDrivers
tpcb/txFive ordered statements inside a driver transactionPostgreSQL, MySQL, Picodata (none), YDB
tpcb/procsOne tpcb_transaction procedure callPostgreSQL, MySQL
stroppy run tpcb/tx -d pg \
--executor constant-vus --vus 32 --duration 5m

stroppy run tpcb/procs -d mysql \
--executor shared-iterations --iterations 100

Transaction

Each iteration:

  1. updates one account balance;
  2. reads resulting account balance;
  3. updates teller balance;
  4. updates branch balance;
  5. inserts one history row.

The tx variant groups these statements in one transaction. The procs variant performs equivalent work in one server-side call.

Scale and data

--scale-factor is integer branch count B.

TableInitial rows
pgbench_branchesB
pgbench_tellers10 × B
pgbench_accounts100,000 × B
pgbench_history0; grows during transactions

Rows are generated deterministically with typed gen.IndexedSource batches. Filler columns use fixed-width ASCII allowed by the specification.

Parameters

FlagDefaultMeaning
--scale-factor1Branch count.
--load-workers1Workers per table load.
--retry-attempts3Maximum transaction attempts.
--tx-isolationdriver-derivedIsolation override.
--sql-fileselected dialectSQL override.

Shared flags also apply: --executor, --vus, --iterations, --duration, and --query-timeout.

Default isolation:

DriverIsolation
PostgreSQLread_committed
MySQLread_committed
Picodatanone
YDBserializable

Steps

StepVariantsMeaning
drop_schemabothRemove existing tables and procedures.
create_schemabothCreate TPC-B tables.
create_proceduresprocsCreate PostgreSQL/MySQL procedure.
load_databothLoad branches, tellers, and accounts.
create_indexesbothCreate post-load indexes.
create_foreign_keysbothAdd PostgreSQL/MySQL references; no-op where unsupported.
analyzebothRefresh PostgreSQL/MySQL planner statistics.
workloadbothExecute measured transaction loop.

Load then measure:

stroppy run tpcb/tx -d pg --scale-factor 10 --load-workers 8 \
--no-steps workload

stroppy run tpcb/tx -d pg --scale-factor 10 \
--executor constant-vus --vus 32 --duration 10m \
--steps workload

SQL assets

DriverAsset
PostgreSQLworkloads/tpcb/pg.sql
MySQLworkloads/tpcb/mysql.sql
Picodataworkloads/tpcb/pico.sql
YDBworkloads/tpcb/ydb.sql

Use a local override while editing:

stroppy run tpcb/tx ./workloads/tpcb/pg.sql -d pg

Retry and errors

Drivers classify serialization, deadlock, lock-timeout, and transient errors. TPC-B retries selected errors up to --retry-attempts. Successful retries do not taint a run; terminal nonfatal errors fail one iteration, let the VU continue, and appear in final error counters/summary.

tpcb_retry_attempts is the workload-specific retry counter. Core transaction metrics include transactions_total, tx_total_duration, tx_commits_total, tx_errors_total, and tx_queries_per_tx.

Integration coverage

The v6 repository includes unit, asset-contract, and tagged PostgreSQL/MySQL integration coverage. From source:

make tmpfs-up
make build
make integration
make tmpfs-down

Reference implementation: