Re: [PATCH] Tracking statements entry timestamp in pg_stat_statements

Alena Rybakina <lena.ribackina@yandex.ru>

From: Alena Rybakina <lena.ribackina@yandex.ru>
To: Andrei Zubkov <zubkov@moonset.ru>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-10-25T13:25:08Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Improve quoting in some error messages

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