Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit87bff68

Browse files
committed
pgbench: When using pipelining only do PQconsumeInput() when necessary.
Up to now we did a PQconsumeInput() for each pipelined query, asking the OSfor more input - which it often won't have, as all results might already havebeen sent. That turns out to have a noticeable performance impact.Alvaro Herrera reviewed the idea to add the PQisBusy() check, but not thisconcrete patch.Author: Andres Freund <andres@anarazel.de>Discussion:https://postgr.es/m/20210720180039.23rivhdft3l4mayn@alap3.anarazel.deBackpatch: 14, where libpq/pgbench pipelining was introduced.
1 parent1bc8e7b commit87bff68

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

‎src/bin/pgbench/pgbench.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3461,7 +3461,14 @@ advanceConnectionState(TState *thread, CState *st, StatsData *agg)
34613461
*/
34623462
caseCSTATE_WAIT_RESULT:
34633463
pg_log_debug("client %d receiving",st->id);
3464-
if (!PQconsumeInput(st->con))
3464+
3465+
/*
3466+
* Only check for new network data if we processed all data
3467+
* fetched prior. Otherwise we end up doing a syscall for each
3468+
* individual pipelined query, which has a measurable
3469+
* performance impact.
3470+
*/
3471+
if (PQisBusy(st->con)&& !PQconsumeInput(st->con))
34653472
{
34663473
/* there's something wrong */
34673474
commandFailed(st,"SQL","perhaps the backend died while processing");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp