tpcc: add PL/pgSQL stored-procedure mode (--stored-procs)#205
Open
akorotkov wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.