workload: change the way we issue SQL for TPCC [DNM] #31079
Closed
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.
This PR changes the SQL issue method for the TPCC workload (for the queries that don't use variable-length tuples).
Before, we were putting the entire query in a single string (no parameters) and it was issued as a "simple query". After, we issue with parameters and support two methods. With
--method=prepare
, we prepare once per session and re-execute the same query. With--method=noprepare
, we don't prepare explicitly, which internally results in each statement being prepared and executed every time.I made some test runs and I'm baffled at the results (link below). I expected
prepare
to be the fastest but it is the slowest. I can't understand how it can be slower thannoprepare
.. These were interleaved runs on a single-node gceworker (which ran both the workload and the server). Maybe I'm missing some subtlety oflib/pq
andTx.Stmt
? (CC @mjibson)https://docs.google.com/spreadsheets/d/14TrUwte2QMN6L3y_H6RRtrYt1q9xJkm5yF5CNX9U3X0/edit?usp=sharing
workload: add SQLRunner
A common facility for issuing SQL queries. It supports multiple
issuing methods, speciifed the
--method
flag:reused.
is equivalent to preparing and executing each statement
separately).
workload: refactor tpccTx
Refactoring tpccTx to allow per-worker state. This will be necessary
for preparing statements in advance.
workload: use SQLRunner for queries without tuples
Switch TPCC to use SQLRunner for queries that have a fixed number of
arguments.