pg_stat_user_functions

一个统计视图,显示每个跟踪函数的执行统计信息

pg_stat_user_functions 是一个 统计视图,显示每个跟踪函数的执行统计信息。

pg_stat_user_functionsPostgreSQL 8.4 中添加。

用法

只有在启用 track_functions 时,PostgreSQL 才会收集信息以在 pg_stat_user_functions 中显示。

请注意,如果尚未为某个函数收集统计信息(包括统计信息已重置的情况),则 pg_stat_user_functions 将不包含该函数的条目。

可以使用 pg_stat_reset_single_function_counters() 重置单个函数的统计信息。

按PostgreSQL版本定义

pg_stat_user_functions (PostgreSQL 17)

            View "pg_catalog.pg_stat_user_functions"
   Column   |       Type       | Collation | Nullable | Default 
------------+------------------+-----------+----------+---------
 funcid     | oid              |           |          | 
 schemaname | name             |           |          | 
 funcname   | name             |           |          | 
 calls      | bigint           |           |          | 
 total_time | double precision |           |          | 
 self_time  | double precision |           |          |
    

文档: pg_stat_user_functions

pg_stat_user_functions (PostgreSQL 16)

            View "pg_catalog.pg_stat_user_functions"
   Column   |       Type       | Collation | Nullable | Default 
------------+------------------+-----------+----------+---------
 funcid     | oid              |           |          | 
 schemaname | name             |           |          | 
 funcname   | name             |           |          | 
 calls      | bigint           |           |          | 
 total_time | double precision |           |          | 
 self_time  | double precision |           |          |
    

文档: pg_stat_user_functions

pg_stat_user_functions (PostgreSQL 15)

            View "pg_catalog.pg_stat_user_functions"
   Column   |       Type       | Collation | Nullable | Default 
------------+------------------+-----------+----------+---------
 funcid     | oid              |           |          | 
 schemaname | name             |           |          | 
 funcname   | name             |           |          | 
 calls      | bigint           |           |          | 
 total_time | double precision |           |          | 
 self_time  | double precision |           |          |
    

文档: pg_stat_user_functions

pg_stat_user_functions (PostgreSQL 14)

            View "pg_catalog.pg_stat_user_functions"
   Column   |       Type       | Collation | Nullable | Default 
------------+------------------+-----------+----------+---------
 funcid     | oid              |           |          | 
 schemaname | name             |           |          | 
 funcname   | name             |           |          | 
 calls      | bigint           |           |          | 
 total_time | double precision |           |          | 
 self_time  | double precision |           |          |
    

文档: pg_stat_user_functions

pg_stat_user_functions (PostgreSQL 13)

            View "pg_catalog.pg_stat_user_functions"
   Column   |       Type       | Collation | Nullable | Default 
------------+------------------+-----------+----------+---------
 funcid     | oid              |           |          | 
 schemaname | name             |           |          | 
 funcname   | name             |           |          | 
 calls      | bigint           |           |          | 
 total_time | double precision |           |          | 
 self_time  | double precision |           |          |
    

文档: pg_stat_user_functions

pg_stat_user_functions (PostgreSQL 12)

            View "pg_catalog.pg_stat_user_functions"
   Column   |       Type       | Collation | Nullable | Default 
------------+------------------+-----------+----------+---------
 funcid     | oid              |           |          | 
 schemaname | name             |           |          | 
 funcname   | name             |           |          | 
 calls      | bigint           |           |          | 
 total_time | double precision |           |          | 
 self_time  | double precision |           |          |
    

文档: pg_stat_user_functions

pg_stat_user_functions (PostgreSQL 11)

            View "pg_catalog.pg_stat_user_functions"
   Column   |       Type       | Collation | Nullable | Default 
------------+------------------+-----------+----------+---------
 funcid     | oid              |           |          | 
 schemaname | name             |           |          | 
 funcname   | name             |           |          | 
 calls      | bigint           |           |          | 
 total_time | double precision |           |          | 
 self_time  | double precision |           |          |
    

文档: pg_stat_user_functions

pg_stat_user_functions (PostgreSQL 10)

            View "pg_catalog.pg_stat_user_functions"
   Column   |       Type       | Collation | Nullable | Default 
------------+------------------+-----------+----------+---------
 funcid     | oid              |           |          | 
 schemaname | name             |           |          | 
 funcname   | name             |           |          | 
 calls      | bigint           |           |          | 
 total_time | double precision |           |          | 
 self_time  | double precision |           |          |
    

文档: pg_stat_user_functions

pg_stat_user_functions (PostgreSQL 9.6)

 View "pg_catalog.pg_stat_user_functions"
   Column   |       Type       | Modifiers 
------------+------------------+-----------
 funcid     | oid              | 
 schemaname | name             | 
 funcname   | name             | 
 calls      | bigint           | 
 total_time | double precision | 
 self_time  | double precision |
    

文档: pg_stat_user_functions

pg_stat_user_functions (PostgreSQL 9.5)

 View "pg_catalog.pg_stat_user_functions"
   Column   |       Type       | Modifiers 
------------+------------------+-----------
 funcid     | oid              | 
 schemaname | name             | 
 funcname   | name             | 
 calls      | bigint           | 
 total_time | double precision | 
 self_time  | double precision |
    

文档: pg_stat_user_functions

pg_stat_user_functions (PostgreSQL 9.4)

 View "pg_catalog.pg_stat_user_functions"
   Column   |       Type       | Modifiers 
------------+------------------+-----------
 funcid     | oid              | 
 schemaname | name             | 
 funcname   | name             | 
 calls      | bigint           | 
 total_time | double precision | 
 self_time  | double precision |
    

文档: pg_stat_user_functions

pg_stat_user_functions (PostgreSQL 9.3)

 View "pg_catalog.pg_stat_user_functions"
   Column   |       Type       | Modifiers 
------------+------------------+-----------
 funcid     | oid              | 
 schemaname | name             | 
 funcname   | name             | 
 calls      | bigint           | 
 total_time | double precision | 
 self_time  | double precision |
    

文档: pg_stat_user_functions

pg_stat_user_functions (PostgreSQL 9.2)

 View "pg_catalog.pg_stat_user_functions"
   Column   |       Type       | Modifiers 
------------+------------------+-----------
 funcid     | oid              | 
 schemaname | name             | 
 funcname   | name             | 
 calls      | bigint           | 
 total_time | double precision | 
 self_time  | double precision |
    

文档: pg_stat_user_functions

pg_stat_user_functions (PostgreSQL 9.1)

View "pg_catalog.pg_stat_user_functions"
   Column   |  Type  | Modifiers 
------------+--------+-----------
 funcid     | oid    | 
 schemaname | name   | 
 funcname   | name   | 
 calls      | bigint | 
 total_time | bigint | 
 self_time  | bigint |
    

文档: pg_stat_user_functions

pg_stat_user_functions (PostgreSQL 9.0)

View "pg_catalog.pg_stat_user_functions"
   Column   |  Type  | Modifiers 
------------+--------+-----------
 funcid     | oid    | 
 schemaname | name   | 
 funcname   | name   | 
 calls      | bigint | 
 total_time | bigint | 
 self_time  | bigint |
    

文档: pg_stat_user_functions

pg_stat_user_functions (PostgreSQL 8.4)

View "pg_catalog.pg_stat_user_functions"
   Column   |  Type  | Modifiers 
------------+--------+-----------
 funcid     | oid    | 
 schemaname | name   | 
 funcname   | name   | 
 calls      | bigint | 
 total_time | bigint | 
 self_time  | bigint | 
View definition:
 SELECT p.oid AS funcid, n.nspname AS schemaname, p.proname AS funcname, pg_stat_get_function_calls(p.oid) AS calls, pg_stat_get_function_time(p.oid) / 1000 AS total_time, pg_stat_get_function_self_time(p.oid) / 1000 AS self_time
   FROM pg_proc p
   LEFT JOIN pg_namespace n ON n.oid = p.pronamespace
  WHERE p.prolang <> 12::oid AND pg_stat_get_function_calls(p.oid) IS NOT NULL;
    

文档: pg_stat_user_functions

更改历史记录

示例

pg_stat_user_functions 的示例输出

postgres=# SELECT * FROM pg_stat_user_functions;
 funcid | schemaname |             funcname              | calls | total_time | self_time 
--------+------------+-----------------------------------+-------+------------+-----------
  16406 | hstore     | fetchval                          |    10 |      0.008 |     0.008
  16732 | public     | calendar_month                    |     1 |       4.05 |      4.05
  16743 | public     | get_dir_id_from_path_site         |   156 |     44.653 |    22.136
  16744 | public     | get_dir_path_from_id              |  5973 |    465.216 |   465.216
  16745 | public     | get_object_property_value         |  4636 |    111.405 |   111.405
  16746 | public     | get_object_title                  | 30904 |    914.304 |   914.304
  16747 | public     | get_syndicate_child_directory_ids |     4 |      1.527 |     1.527
  16749 | public     | object_property_value             |  2856 |    131.923 |   131.923
  16750 | public     | olv_best_lang                     | 55657 |   1150.719 |  1150.719
  16764 | public     | ts_body_property_value            |  1242 |    129.289 |   129.289
  16768 | public     | user_modules                      |     6 |      3.053 |     3.053
  16769 | public     | user_site_access                  |    36 |      1.555 |     1.555
  69853 | public     | tr_update_object_access_tracking  |     1 |    134.301 |   134.301
(13 rows)

分类

统计/监控视图

另请参阅

track_functionspg_stat_xact_user_functionspg_stat_reset_single_function_counters()

反馈

提交任何关于“pg_stat_user_functions”的评论、建议或更正 此处