Re: Standardize relation name formatting in ANALYZE messages

From: Tatsuya Kawata <kawatatatsuya0913(at)gmail(dot)com>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Standardize relation name formatting in ANALYZE messages
Date: 2026-01-12 15:57:00
Message-ID: CAHza6qeecqqzZY8urYz2B_8zQsdbO3SgdpGRCZXmiSq1u6RFww@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2026-01-12 16:00:53 Re: [PATCH} Move instrumentation structs
Previous Message Jim Jones 2026-01-12 15:54:52 Re: WIP - xmlvalidate implementation from TODO list