Re: [PATCH] Tracking statements entry timestamp in pg_stat_statements

From: Alena Rybakina <lena(dot)ribackina(at)yandex(dot)ru>
To: Andrei Zubkov <zubkov(at)moonset(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Tracking statements entry timestamp in pg_stat_statements
Date: 2023-10-25 13:25:08
Message-ID: 00c073b3-721d-4656-9528-b64a155aa2b9@yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 19.10.2023 15:40, Andrei Zubkov wrote:
> Hi hackers,
>
> New version 23 attached. It contains rebase to the current master.
> Noted that v1.11 adds new fields to the pg_stat_sstatements view, but
> leaves the PGSS_FILE_HEADER constant unchanged. It this correct?
Hi! Thank you for your work on the subject.

1. I didn't understand why we first try to find pgssEntry with a false
top_level value, and later find it with a true top_level value.

/*
 * Remove the entry if it exists, starting with the non-top-level entry.
 */
*key.toplevel = false;*
entry = (pgssEntry *) hash_search(pgss_hash, &key, HASH_FIND, NULL);

SINGLE_ENTRY_RESET(entry);

*/* Also reset the top-level entry if it exists. */
key.toplevel = true;*
entry = (pgssEntry *) hash_search(pgss_hash, &key, HASH_FIND, NULL);

SINGLE_ENTRY_RESET(entry);

I looked through this topic and found some explanation in this email
[0], but I didn't understand it. Can you explain it to me?

2. And honestly, I think you should change
"Remove the entry if it exists, starting with the non-top-level entry." on
"Remove the entry or reset min/max time statistic information and the
timestamp if it exists, starting with the non-top-level entry."

And the same with the comment bellow:

"Also reset the top-level entry if it exists."
"Also remove the entry or reset min/max time statistic information and
the timestamp if it exists."

In my opinion, this is necessary because the minmax_only parameter is
set by the user, so both ways are possible.

0 -
https://www.postgresql.org/message-id/62d16845-e74e-a6f9-9661-022e44f48922%40inbox.ru

--
Regards,
Alena Rybakina

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrei Zubkov 2023-10-25 13:36:32 Re: Add connection active, idle time to pg_stat_activity
Previous Message Aleksander Alekseev 2023-10-25 13:17:51 Re: Add connection active, idle time to pg_stat_activity