| From: | shihao zhong <zhong950419(at)gmail(dot)com> |
|---|---|
| To: | Andres Freund <andres(at)anarazel(dot)de> |
| Cc: | Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Bernd Reiß <bd_reiss(at)gmx(dot)at>, Ahmed Gouda <ahmed(dot)gouda(at)cybertec(dot)at>, songjinzhou <tsinghualucky912(at)foxmail(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com> |
| Subject: | Re: [Patch] New pg_stat_tablespace view |
| Date: | 2026-10-12 04:11:27 |
| Message-ID: | CAGRkXqQ+06oP4kKvhtVh3-QRZ4nDqcVqWb=Tme6FnF5DoNyL_A@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Andres,
Thanks for looking at v10 and provide valuable feedback, I
appreciate it.
You are right about the function. In the x86-64 code for v10, every
caller in bufmgr.c stores the tablespace OID on the stack, and the
old name cannot tail call the new one, so the WAL callers pay too.
v11 leaves pgstat_count_io_op_time() alone, its code is the same as
on master. Relation block IO calls a second function,
pgstat_count_smgr_io_op_time(), which takes the SMgrRelation in place
of the IOObject, so still six arguments. It reads the tablespace slot
cached in the SMgrRelation and adds the time to that slot. No lookup,
no new call. The slot is assigned on the first timed IO on a
relation, once per SMgrRelation per process, and that is also where
the shared entry gets created. Both functions share one inlined body,
and the generic one compiles to the same code as on master. No caller
touches the stack.
On the per relation counters. The reason is the one pg_stat_database
has for the same columns. Relation stats live in one database and
vanish with the relation, while a tablespace spans databases, and the
block counts are the denominator of the block times. So v11 keeps
them. If you still want fewer columns, say which ones.
v11 is attached.
Thanks,
Shihao
| Attachment | Content-Type | Size |
|---|---|---|
| pg_stat_tablespace-v11.patch | application/octet-stream | 86.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shveta malik | 2026-10-12 04:17:55 | Re: Proposal: Conflict log history table for Logical Replication |
| Previous Message | surya poondla | 2026-10-12 04:11:24 | Re: pg_walinspect: add functions to locate and list WAL by time and LSN |