Skip to content

tpcc: add PL/pgSQL stored-procedure mode (--stored-procs)#205

Open
akorotkov wants to merge 1 commit into
pingcap:masterfrom
akorotkov:master
Open

tpcc: add PL/pgSQL stored-procedure mode (--stored-procs)#205
akorotkov wants to merge 1 commit into
pingcap:masterfrom
akorotkov:master

Conversation

@akorotkov
Copy link
Copy Markdown

While benchmarking PostgreSQL with TPC-C, one may note that backends might spend most of the time in the ClientRead wait event. That is, PostgreSQL protocol communication spends most of the time preventing us from reaching the core bottlenecks. This PR implements --stored-procs mode (similar to HammerDB's pg_storedprocs), in which a single transaction is appended to a single stored procedure on the PostgreSQL side. This allow us to reach higher performance level and explore PostgreSQL core/storage bottlenecks with TPC-C benchmark.

When --stored-procs is set on `go-tpc tpcc run` (postgres driver only),
each of the five TPC-C transactions is dispatched as a single server-side
CALL: tpcc_new_order / tpcc_payment / tpcc_order_status / tpcc_delivery /
tpcc_stock_level. Procedures are installed via CREATE OR REPLACE on the
first Run() invocation (sync.Once), so the same dataset can be benched
in either mode — no separate prepare step.

NEW_ORDER's 1%-rollback path (sentinel item id of -1) is handled
server-side via an in-band ROLLBACK inside the procedure: the engine
pays for the district/orders/new_order writes and then undoes them,
matching the original Go transaction's behaviour exactly. Other
procedures run their work and return; the autocommit transaction
commits implicitly.
@pingcap-cla-assistant
Copy link
Copy Markdown

pingcap-cla-assistant Bot commented May 12, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant