pg_stat_get_xact_blocks_hit()

返回当前事务中关系(relation)的缓存命中数

pg_stat_get_xact_blocks_hit() 是一个系统函数,用于返回当前事务中表、物化视图或索引的缓存命中数。

pg_stat_get_xact_blocks_hit() 添加于 PostgreSQL 7.2

用法

pg_stat_get_xact_blocks_hit ( oid ) → bigint

如果指定的关系不是表、物化视图或索引,则返回 0

如果指定的关系不存在,则会引发一个 ERROR 错误。

变更历史

示例

pg_stat_get_xact_blocks_fetched() 的基本用法示例

postgres=# CREATE TABLE foo (id INT NOT NULL PRIMARY KEY);
CREATE TABLE

postgres=# INSERT INTO foo VALUES(generate_series(1,100));
INSERT 0 100

postgres=# SELECT * FROM foo LIMIT 1;
 id 
----
  1
(1 row)

postgres=# SELECT pg_stat_get_xact_blocks_hit ('foo'::regclass);
 pg_stat_get_xact_blocks_hit 
-----------------------------
                           0
(1 row)

postgres=# BEGIN;
BEGIN
postgres=*# SELECT * FROM foo LIMIT 1;
 id 
----
  1
(1 row)

postgres=*# SELECT pg_stat_get_xact_blocks_hit ('foo'::regclass);
 pg_stat_get_xact_blocks_hit 
-----------------------------
                           1
(1 row)

分类

服务器统计信息, 系统函数

另请参阅

pg_stat_get_xact_blocks_fetched()

反馈

提交任何关于 "pg_stat_get_xact_blocks_hit()" 的评论、建议或更正,请点击 此处