pg_stat_statements
Functions
pg_stat_statements_reset() returns void
pg_stat_statements_reset discards all statistics gathered so far by pg_stat_statements. By default, this function can only be executed by superusers.
pg_stat_statements(showtext boolean) returns setof record
The pg_stat_statements view is defined in terms of a function also named pg_stat_statements. It is possible for clients to call the pg_stat_statements function directly, and by specifying showtext := false have query text be omitted (that is, the OUT argument that corresponds to the view's query column will return nulls). This feature is intended to support external tools that might wish to avoid the overhead of repeatedly retrieving query texts of indeterminate length. Such tools can instead cache the first query text observed for each entry themselves, since that is all pg_stat_statements itself does, and then retrieve query texts only as needed. Since the server stores query texts in a file, this approach may reduce physical I/O for repeated examination of the pg_stat_statements data.
Configuration Parameters
- pg_stat_statements.max (integer)
-
pg_stat_statements.max is the maximum number of statements tracked by the module (i.e., the maximum number of rows in the pg_stat_statements view). If more distinct statements than that are observed, information about the least-executed statements is discarded. The default value is 5000. This parameter can only be set at server start.
- pg_stat_statements.track (enum)
-
pg_stat_statements.track controls which statements are counted by the module. Specify top to track top-level statements (those issued directly by clients), all to also track nested statements (such as statements invoked within functions), or none to disable statement statistics collection. The default value is top. Only superusers can change this setting.
- pg_stat_statements.track_utility (boolean)
-
pg_stat_statements.track_utility controls whether utility commands are tracked by the module. Utility commands are all those other than SELECT, INSERT, UPDATE and DELETE. The default value is on. Only superusers can change this setting.
- pg_stat_statements.save (boolean)
-
pg_stat_statements.save specifies whether to save statement statistics across server shutdowns. If it is off then statistics are not saved at shutdown nor reloaded at server start. The default value is on. This parameter can only be set in the postgresql.conf file or on the server command line.
The module requires additional shared memory proportional to pg_stat_statements.max. Note that this memory is consumed whenever the module is loaded, even ifpg_stat_statements.track is set to none.
# postgresql.conf
shared_preload_libraries = 'pg_stat_statements' pg_stat_statements.max = 10000
pg_stat_statements.track = all
| Name | Type | References | Description |
|---|---|---|---|
| userid | oid | pg_authid.oid | OID of user who executed the statement |
| dbid | oid | pg_database.oid | OID of database in which the statement was executed |
| queryid | bigint | Internal hash code, computed from the statement's parse tree | |
| query | text | Text of a representative statement | |
| calls | bigint | Number of times executed | |
| total_time | double precision | Total time spent in the statement, in milliseconds | |
| rows | bigint | Total number of rows retrieved or affected by the statement | |
| shared_blks_hit | bigint | Total number of shared block cache hits by the statement | |
| shared_blks_read | bigint | Total number of shared blocks read by the statement | |
| shared_blks_dirtied | bigint | Total number of shared blocks dirtied by the statement | |
| shared_blks_written | bigint | Total number of shared blocks written by the statement | |
| local_blks_hit | bigint | Total number of local block cache hits by the statement | |
| local_blks_read | bigint | Total number of local blocks read by the statement | |
| local_blks_dirtied | bigint | Total number of local blocks dirtied by the statement | |
| local_blks_written | bigint | Total number of local blocks written by the statement | |
| temp_blks_read | bigint | Total number of temp blocks read by the statement | |
| temp_blks_written | bigint | Total number of temp blocks written by the statement | |
| blk_read_time | double precision | Total time the statement spent reading blocks, in milliseconds (if track_io_timing is enabled, otherwise zero) | |
| blk_write_time | double precision | Total time the statement spent writing blocks, in milliseconds (if track_io_timing is enabled, otherwise zero) |
ref:http://www.postgresql.org/docs/9.4/static/pgstatstatements.html
pg_stat_statements的更多相关文章
- PostgreSQL下安装pg_stat_statements
一.安装过程如下:进入postgreSQL安装包的contrib/pg_stat_statements目录,执行编译和安装动作:用root用户 make && make install ...
- pg_stat_statements跳过的坑
pg_stat_statements跳过的坑 原本以为只是一个简单的插件扩展安装,三下五除二就能搞定,结果搞了很久也没找到问题所在.首先pg_stat_statements已经安装成功,且已经能够使用 ...
- pg_stat_statements源代码分析
磨砺技术珠矶,践行数据之道,追求卓越价值 回到上一级页面:PostgreSQL内部结构与源代码研究索引页 回到顶级页面:PostgreSQL索引页 pg_stat_statement的源代码,非 ...
- PPAS下安装 pg_stat_statements过程记录
磨砺技术珠矶,践行数据之道,追求卓越价值 回到上一级页面: PostgreSQL统计信息索引页 回到顶级页面:PostgreSQL索引页 PostgreSQL中,如何安装pg_stat_sta ...
- Postgresql 监控sql之 pg_stat_statements模块
postgresql.confpg_stat_statements.max = 1000000pg_stat_statements.track = allpg_stat_statements.trac ...
- PostgreSQL 磁盘使用大小监控
表大小信息 postgres=# SELECT *, pg_size_pretty(total_bytes) AS totalpostgres-# , pg_size_pretty(index_byt ...
- postgreSQL 统计语句
pg_stat_statements 是 postgresql 的一个扩展,用来统计查询语句,类似于 mysql 的 慢查询. 安装二进制文件 有些发行版可能没有附带这个扩展,则需要用户自己安装, 本 ...
- 使用pgstatspack分析PostgreSQL数据库性能
pgstatspack [root@test01 soft]# wget http://pgfoundry.org/frs/download.php/3151/pgstatspack_version_ ...
- PG sys function
The System Catalogs of PostgreSQLscott=# \dS List of relations Schema | Name | Type | Owner -------- ...
随机推荐
- 20145317彭垚 《Java程序设计》第4周学习总结
20145317彭垚 <Java程序设计>第04周学习总结 20145317彭垚 <Java程序设计>第4周学习总结 教材学习内容总结 继承 继承就是避免多个类间重复定义共同行 ...
- vue model双向绑定
view <div id='demo' class="container"> <input type="text" v-model='name ...
- 微信公众账号开发教程(一) 基本原理及微信公众账号注册 ——转自http://www.cnblogs.com/yank/p/3364827.html
微信公众账号开发教程 基本原理 在开始做之前,大家可能对这个很感兴趣,但是又比较茫然.是不是很复杂?很难学啊? 其实恰恰相反,很简单.为了打消大家的顾虑,先简单介绍了微信公众平台的基本原理. 微信服务 ...
- Transform.InverseTransformPoint 反向变换点
JavaScript ⇒ public function InverseTransformPoint(position: Vector3): Vector3; C# ⇒public Vector3 I ...
- 使用Reveal
添加Reveal.framework,设置Other link flags 添加Debug为 -ObjC,添加 libz 库 这里介绍 Reveal UI 分析工具的简单使用,至于使用他分析手机 Ap ...
- 低功耗蓝牙4.0BLE编程-nrf51822开发(3)
蓝牙协议栈 nrf51822开发中,蓝牙协议栈和应用开发是分开的. (1)兼容蓝牙4.0低功耗协议栈基带层,L2CAP\AAT\SM\GAP\GATT协议,设备和广播,GATT客户端和服务器,SMP支 ...
- 【Android开发学习笔记】【高级】【随笔】插件化——资源加载
前言 上一节我们针对插件最基本的原理进行了一个简单的demo实现,但是由于插件的Context对象被宿主所接管,因此无法加载插件程序的资源.那么如何解决这个问题捏? 有人提出这样的方案:将apk中的资 ...
- WPF自定义RoutedEvent事件示例代码
************************* 引用网友,便于查找所用..... 创建自定义路由事件和应用分为6个步骤: (1)自定义路由事件参数对象 (2)声明并注册路由事件 (3)为路由事件添 ...
- 从输入url到页面加载完成都发生了什么?
原文地址: http://segmentfault.com/a/1190000003925803 根据 URL 请求页面过程 过程概述 浏览器查找域名对应的 IP 地址: 浏览器根据 IP 地址与服务 ...
- 动态创建地图文档MXD并发布地图服务
原文:动态创建地图文档MXD并发布地图服务 1.动态创建MXD private bool CreateMxd(string MxdPath, string MxdName) { IMapDocumen ...