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
pg_stat_tablespace-v11.patch
Description: Binary data
