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

Поиск
Список
Период
Сортировка
От Quan Zongliang
Тема Re: Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block
Дата
Msg-id 7201b127-fffb-4142-9e90-fd91dee02731@yeah.net
обсуждение исходный текст
Ответ на Re: Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block  (jian he <jian.universality@gmail.com>)
Список pgsql-hackers
A little tweak to the code.
GetTopTransactionIdIfAny() != InvalidTransactionId
changed to
TransactionIdIsValid(GetTopTransactionIdIfAny()


On 2024/1/12 08:51, jian he wrote:
> Hi
...
> with patch:
> src3=# explain(analyze, costs off) select 1 from pg_sleep(10);
> 2024-01-12 08:43:14.750 CST [5739] jian@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@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)
This problem does exist in a statement that takes a long time to run.
XID is applied only for the first change tuple. If the user want to see 
it in a single statement log, they have to wait until the statement has 
finished executing. And we don't know how long it will take until the 
statement ends. It is not appropriate to output the log twice because of 
xid. Besides, without parsing log_line_prefix we don't know if the user 
wants to see xid.
Вложения

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

Предыдущее
От: Sutou Kouhei
Дата:
Сообщение: Re: Make COPY format extendable: Extract COPY TO format implementations
Следующее
От: Richard Guo
Дата:
Сообщение: Re: set_cheapest without checking pathlist