Re: Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Quan Zongliang <quanzongliang(at)yeah(dot)net>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block
Date: 2024-01-12 00:51:07
Message-ID: CACJufxHg1oir8sd=xScMP3n+tYcbug=zusG5KiA2KzH5PmOeuQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi
another big difference compare to HEAD:

select name,setting
from pg_settings
where name in
('auto_explain.log_timing','auto_explain.log_analyze',
'auto_explain.log_min_duration','log_statement','log_line_prefix')
;
name | setting
-------------------------------+----------------------------
auto_explain.log_analyze | on
auto_explain.log_min_duration | 0
auto_explain.log_timing | on
log_line_prefix | %m [%p] %q%u(at)%d/%a XID:%x
log_statement | all

simple query: explain(analyze, costs off) select 1 from pg_sleep(10);

with patch:
src3=# explain(analyze, costs off) select 1 from pg_sleep(10);
2024-01-12 08:43:14.750 CST [5739] jian(at)src3/psql XID:0 LOG:
duration: 10010.167 ms plan:
Query Text: explain(analyze, costs off) select 1 from pg_sleep(10);
Function Scan on pg_sleep (cost=0.00..0.01 rows=1 width=4)
(actual time=10010.155..10010.159 rows=1 loops=1)
2024-01-12 08:43:14.750 CST [5739] jian(at)src3/psql XID:0 LOG:
statement: explain(analyze, costs off) select 1 from pg_sleep(10);
QUERY PLAN
-----------------------------------------------------------------------------
Function Scan on pg_sleep (actual time=10010.155..10010.159 rows=1 loops=1)
Planning Time: 0.115 ms
Execution Time: 10010.227 ms
(3 rows)

without patch:

src4=#
src4=# explain(analyze, costs off) select 1 from pg_sleep(10);
2024-01-12 08:43:13.462 CST [5869] jian(at)src4/psql XID:0 LOG:
statement: explain(analyze, costs off) select 1 from pg_sleep(10);
2024-01-12 08:43:23.473 CST [5869] jian(at)src4/psql XID:0 LOG:
duration: 10010.133 ms plan:
Query Text: explain(analyze, costs off) select 1 from pg_sleep(10);
Function Scan on pg_sleep (cost=0.00..0.01 rows=1 width=4)
(actual time=10010.126..10010.128 rows=1 loops=1)
QUERY PLAN
-----------------------------------------------------------------------------
Function Scan on pg_sleep (actual time=10010.126..10010.128 rows=1 loops=1)
Planning Time: 0.031 ms
Execution Time: 10010.172 ms
(3 rows)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shinoda, Noriyoshi (HPE Services Japan - FSIP) 2024-01-12 00:58:49 RE: cleanup patches for incremental backup
Previous Message Melanie Plageman 2024-01-11 23:50:50 Re: Confine vacuum skip logic to lazy_scan_skip