[PATCH] pgbench log file headers

Поиск
Список
Период
Сортировка
От Adam Hendel
Тема [PATCH] pgbench log file headers
Дата
Msg-id CABfuTggpE-A5pvif9Zv++c4Jn3iu_7ccJ23Pm+8r+CKRBUMg_Q@mail.gmail.com
обсуждение исходный текст
Ответы Re: [PATCH] pgbench log file headers  (Andrew Atkinson <andyatkinson@gmail.com>)
Re: [PATCH] pgbench log file headers  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers

Hello Hackers!

Currently, pgbench will log individual transactions to a logfile when the `--log` parameter flag is provided. The logfile, however, does not include column header. It has become a fairly standard expectation of users to have column headers present in flat files. Without the header in the pgbench log files, new users must navigate to the docs and piece together the column headers themselves. Most industry leading frameworks have tooling built in to read column headers though, for example python/pandas read_csv().

We can improve the experience for users by adding column headers to pgbench logfiles with an optional command line flag, `--log-header`. This will keep the API backwards compatible by making users opt-in to the column headers. It follows the existing pattern of having conditional flags in pgbench’s API; the `--log` option would have both –log-prefix and –log-header if this work is accepted.

The implementation considers the column headers only when the `--log-header` flag is present. The values for the columns are taken directly from the “Per-Transaction Logging” section in https://www.postgresql.org/docs/current/pgbench.html and takes into account the conditional columns `schedule_lag` and `retries`.


Below is an example of what that logfile will look like:


pgbench  postgres://postgres:postgres@localhost:5432/postgres --log --log-header

client_id transaction_no time script_no time_epoch time_us

0 1 1863 0 1699555588 791102

0 2 706 0 1699555588 791812


If the interface and overall approach makes sense, I will work on adding documentation and tests for this too.

Respectfully,

Adam Hendel


Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: COPY TO (FREEZE)?
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Bug: RLS policy FOR SELECT is used to check new rows