Re: Standardize relation name formatting in ANALYZE messages - Mailing list pgsql-hackers

From Tatsuya Kawata
Subject Re: Standardize relation name formatting in ANALYZE messages
Date
Msg-id CAHza6qeecqqzZY8urYz2B_8zQsdbO3SgdpGRCZXmiSq1u6RFww@mail.gmail.com
Whole thread Raw
In response to Standardize relation name formatting in ANALYZE messages  (Chao Li <li.evan.chao@gmail.com>)
List pgsql-hackers
Hi Chao-san,

Thanks for the patch and testing patch [1]!
This is my first review, so please forgive any oversights or mistakes on my part.

I ran some tests to verify the output and everything seems to work correctly.
I have two very minor points I'd like to comment on:

1.
A similar function, generate_qualified_relation_name(), is already defined as a static function at src/backend/utils/adt/ruleutils.c:13246 and is used in several places within that file.
One option to consider: to avoid duplicate implementations and ensure consistent behavior, this function could be exported via ruleutils.h and called from analyze.c by passing RelationGetRelid(rel). However, this would require changes to ruleutils.h, so please consider whether that is appropriate for the scope of this patch.


2.
As you mentioned, the existing log output includes the database name in the "finished" message.
Including the database name might provide slightly more information.

Current ANALYZE VERBOSE log
```
postgres=# ANALYZE VERBOSE parent_schema.sales;
INFO:  analyzing "parent_schema.sales" inheritance tree
INFO:  "sales_2024": scanned 1 of 1 pages, containing 2 live rows and 0 dead rows; 2 rows in sample, 2 estimated total rows
INFO:  "sales_2025": scanned 1 of 1 pages, containing 2 live rows and 0 dead rows; 2 rows in sample, 2 estimated total rows
INFO:  finished analyzing table "postgres.parent_schema.sales"
avg read rate: 3.906 MB/s, avg write rate: 0.000 MB/s
buffer usage: 155 hits, 2 reads, 0 dirtied
WAL usage: 9 records, 0 full page images, 1388 bytes, 0 full page image bytes, 0 buffers full
system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s
```

Current AUTOANALYZE log
```
2026-01-12 23:53:59.863 JST [28190] LOG:  automatic analyze of table "postgres.public.parent_table"
avg read rate: 0.000 MB/s, avg write rate: 0.000 MB/s
buffer usage: 113 hits, 0 reads, 0 dirtied
WAL usage: 4 records, 0 full page images, 2282 bytes, 0 full page image bytes, 0 buffers full
system usage: CPU: user: 0.01 s, system: 0.00 s, elapsed: 0.01 s
```  

Regards,
Tatsuya Kawata

pgsql-hackers by date:

Previous
From: Jim Jones
Date:
Subject: Re: WIP - xmlvalidate implementation from TODO list
Next
From: Álvaro Herrera
Date:
Subject: Re: [PATCH} Move instrumentation structs