yugabyte / tpcc

Repo to run TPCC benchmarks against YugabyteDB
Other
24 stars 21 forks source link

Avoid redundant reads for FK checks in NewOrder #112

Closed d-uspenskiy closed 3 years ago

hbhanawat commented 3 years ago

@d-uspenskiy if the server side doesn't have your changes, will this change degrade the performance?

d-uspenskiy commented 3 years ago

@hbhanawat In case YB doesn't have changes with the optimization of FK check this changes in TPC-C client will decrease the performance a little bit. The reason is: Before this change TPC-C does 2 read operations SELECT + FK check. In this case YB's postgres process produces 2 read RPCs to DocDB. The first read RPC (for SELECT) has no ROW MARK, as a result it doesn't produces any intents on DocDB side. Only second read RPC (for FK check) will have ROW MARK and will produces intents on DocDB side.

After the current change TPC-C client still does 2 operations SELECT with ROW MARK + FK check. But YB's postgres (if it has all the optimizations) will generate single read RPC only for (SELECT with ROW MARK). FK check read operations will be omitted. As a result DocDB will receive single read RPC with ROW MARK which is better that 2 read RPCs.

But in case YB's postgres process has no optimization for FK check it will send 2 read RPCs to DocDB and both these RPCs will has ROW MARK and will create intents. From the DocDB side 2 RPCs both with ROW MARK requires more computations than 2 RPCs where only one has ROW MARK.

hbhanawat commented 3 years ago

@d-uspenskiy Thanks for the detailed description. Are you backporting your change to previous releases? If not, we should wait for sometime before merging this to master.