Re: POC: track vacuum/analyze cumulative time per relation - Mailing list pgsql-hackers

From Bertrand Drouvot
Subject Re: POC: track vacuum/analyze cumulative time per relation
Date
Msg-id Z4ez/l7kbFd6Ppmq@ip-10-97-1-34.eu-west-3.compute.internal
Whole thread Raw
In response to Re: POC: track vacuum/analyze cumulative time per relation  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
List pgsql-hackers
Hi,

On Tue, Jan 14, 2025 at 05:01:52PM -0600, Sami Imseih wrote:
> Please see the attached v3.

Thanks!

A few comments:

=== 1

+      <entry role="catalog_table_entry"><para role="column_definition">
+       <structfield>total_vacuum_time</structfield> <type>bigint</type>
+      </para>

Those new fields should be documented as "double precision".

=== 2

+#define PG_STAT_GET_RELENTRY_FLOAT8(stat)                                              \
+Datum
\
+CppConcat(pg_stat_get_,stat)(PG_FUNCTION_ARGS)                                 \
+{
       \
 
+       Oid                     relid = PG_GETARG_OID(0);                                               \
+       float8          result;                                                                                 \
+       PgStat_StatTabEntry *tabentry;                                                          \
+
       \
 
+       if ((tabentry = pgstat_fetch_stat_tabentry(relid)) == NULL)     \
+               result = 0;
\
+       else
\
+               result = (float8) (tabentry->stat);                                             \
+
       \
 
+       PG_RETURN_FLOAT8(result);                                                                       \
+}

I did propose "double" up-thread to be consistent with the code around. That
would mean to also cast to "double". That's just for consistency purpose. What do
you think?

Appart from the above that LGTM.

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: Aleksander Alekseev
Date:
Subject: Re: Purpose of wal_init_zero
Next
From: Aleksander Alekseev
Date:
Subject: Re: Purpose of wal_init_zero