Re: [PATCH] Tracking statements entry timestamp in pg_stat_statements

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Andrei Zubkov <zubkov(at)moonset(dot)ru>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Tracking statements entry timestamp in pg_stat_statements
Date: 2023-03-16 07:13:14
Message-ID: ZBLBijHGpy+Vse/D@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Mar 11, 2023 at 02:49:50PM +0300, Andrei Zubkov wrote:
> Hi,
>
> I've done a rebase of a patch to the current master.

+/* First we have to remove them from the extension */
+ALTER EXTENSION pg_stat_statements DROP VIEW pg_stat_statements;
+ALTER EXTENSION pg_stat_statements DROP FUNCTION pg_stat_statements(boolean);
+ALTER EXTENSION pg_stat_statements DROP FUNCTION
+ pg_stat_statements_reset(Oid, Oid, bigint);

The upgrade script of an extension is launched by the backend in the
context of an extension, so these three queries should not be needed,
as far as I recall.

-SELECT pg_stat_statements_reset();
- pg_stat_statements_reset
---------------------------
-
+SELECT pg_stat_statements_reset() IS NOT NULL AS t;
+ t
+---
+ t
(1 row)

Wouldn't it be better to do this kind of refactoring in its own patch
to make the follow-up changes more readable? This function is changed
to return a timestamp rather than void, but IS NOT NULL applied on the
existing queries would also return true. This would clean up quite a
few diffs in the main patch..
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-03-16 07:18:12 Re: Combine pg_walinspect till_end_of_wal functions with others
Previous Message Michael Paquier 2023-03-16 06:54:30 Re: Split index and table statistics into different types of stats