Skip to content

Commit 2e75be6

Browse files
committed
Fix calculation of latency of pgbench backslash commands.
When we loop back to the top of doCustom after processing a backslash command, we must reset the "now" timestamp, because that's used to calculate the time spent executing the previous command. Report and fix by Fabien Coelho. Backpatch to 9.5, where this was broken.
1 parent a664d47 commit 2e75be6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/bin/pgbench/pgbench.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,11 +1154,12 @@ doCustom(TState *thread, CState *st, instr_time *conn_time, FILE *logfile, AggVa
11541154
* first time it's needed, and reuse the same value throughout this
11551155
* function after that. This also ensures that e.g. the calculated latency
11561156
* reported in the log file and in the totals are the same. Zero means
1157-
* "not set yet".
1157+
* "not set yet". Reset "now" when we step to the next command with "goto
1158+
* top", though.
11581159
*/
1160+
top:
11591161
INSTR_TIME_SET_ZERO(now);
11601162

1161-
top:
11621163
commands = sql_files[st->use_file];
11631164

11641165
/*

0 commit comments

Comments
 (0)