💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
> `pg_statio_all_tables`视图将为当前数据库中的每个表(包括 TOAST 表)包含一行,该行显示指定表上有关 I/O 的统计信息。`pg_statio_user_tables`和`pg_statio_sys_tables`视图包含相同的信息,但是被过滤得分别只显示用户表和系统表。 | 列名 | 示例值 | 说明 | | --- | --- | --- | | relid | 16390 | 表的OID | | schemaname | public | 模式名 | | relname | pgbench\_accounts | 表名 | | heap\_blks\_read | 414012 | 从磁盘中读入表的块数 | | idx\_heap\_blks\_hit | 44710713 | 指在shared\_buffer中命中表的块数 | | idx\_blks\_read | 67997 | 从磁盘中读入索引的块数 | | idx\_blks\_hit | 89424015 | 在shared\_buffer中命中的索引的块数 | | toast\_blks\_read | 无 | 从磁盘中读入toast表的块数 | | toast\_blks\_hit | 无 | 指在shared\_buffer中命中toast表的块数 | | tidx\_blks\_read | 无 | 从磁盘中读入toast表索引的块数 | | tidx\_blks\_hit | 无 | 指在shared\_buffer中命中toast表索引的块数 | * 如果heap\_blks\_read、idx\_blks\_read很高,说明shared buffer较小,存在频繁从磁盘或者page cache读取到shared buffer中命中toast表的块数 ``` postgres=# select * from pg_statio_user_tables; relid | schemaname | relname | heap_blks_read | heap_blks_hit | idx_blks_read | idx_blks_hit | toast_blks_read | toast_blks_hit | tidx_blks_read | tidx_blks_hit -------+------------+---------+----------------+---------------+---------------+--------------+-----------------+----------------+----------------+--------------- 16532 | public | goods | 21 | 3164 | 10 | 3644 | 0 | 0 | 1 | 1 16384 | public | test | 1303 | 118098 | 1069 | 434292 | | | | 16391 | public | alerts | 230130 | 1365837 | 35401 | 20835500 | 0 | 0 | 1 | 1 (3 rows) ```