Avoid building stderr message if possible

Started by cca55071 day ago1 messageshackers
Jump to latest
#1cca5507
cca5507@qq.com

Hi hackers,

Now we always build a message formatted for stderr in send_message_to_server_log()
even if it's useless in some case, e.g., log_destination = 'csvlog'. Attach a patch to
avoid building it if possible.

Test
====
I test it with a large sql (32MB) with guc:
```
log_destination = 'csvlog'
logging_collector = on
log_min_duration_statement = 0
```

master:
```
pgbench (20devel)
transaction type: large.sql
scaling factor: 1
query mode: simple
number of clients: 1
number of threads: 1
maximum number of tries: 1
duration: 60 s
number of transactions actually processed: 205
number of failed transactions: 0 (0.000%)
latency average = 293.219 ms
initial connection time = 0.767 ms
tps = 3.410415 (without initial connection time)
```

patched:
```
pgbench (20devel)
transaction type: large.sql
scaling factor: 1
query mode: simple
number of clients: 1
number of threads: 1
maximum number of tries: 1
duration: 60 s
number of transactions actually processed: 229
number of failed transactions: 0 (0.000%)
latency average = 263.087 ms
initial connection time = 1.068 ms
tps = 3.801022 (without initial connection time)
```

Thoughts?

--
Regards,
ChangAo Chen

Attachments:

v1-0001-Avoid-building-stderr-message-if-possible.patchapplication/octet-stream; charset=utf-8; name=v1-0001-Avoid-building-stderr-message-if-possible.patchDownload+82-49