[pgpool-committers: 3466] pgpool: Enhance performance of SELECT when lots of rows involved.
ishii at postgresql.org
Fri Sep 9 12:01:48 JST 2016
Enhance performance of SELECT when lots of rows involved.
(From pgpool-hackers: 1784)
While taking care of bug track item 238:
I found there's a room to enhance the performance of data transfer
from Pgpool-II to frontend. In an extreme case, such as sending many
rows to frontend, the enhancement was 47% to 62% according to my
Currently Pgpool-II flushes data to network (calling write(2)) every
time it sends a row data ("Data Row" message) to frontend. For
example, if 10,000 rows needed to be transfer, 10,000 times write()s
are issued. This is pretty expensive. Since after repeating to send
row data, "Command Complete" message is sent, it's enough to issue a
write() with the command complete message. Also there are unnecessary
flushing are in handling the command complete message.
Attached patch tries to fix them. I did a quick benchmark on my laptop
(Ubuntu 14.04 LTS, 2 cores, 16GB mem, SSD) using pgbench (scale factor
= 1) + custom query (SELECT * FROM pgbench_accounts), with master
branch head and with patched version. The graph attached.
Unfortunately, performance in workloads where transferring few rows,
will not be enhanced since such rows are needed to flush to network
src/protocol/CommandComplete.c | 8 ++------
src/protocol/pool_process_query.c | 17 ++++++++++++++++-
src/protocol/pool_proto_modules.c | 2 ++
3 files changed, 20 insertions(+), 7 deletions(-)
More information about the pgpool-committers