PostgreSQL auto_explain
The auto_explain module provides a means for logging execution plans of slow statements automatically, without having to run EXPLAIN by hand. This is especially helpful for tracking down un-optimized queries in large applications.
https://www.postgresql.org/docs/current/static/auto-explain.html
postgresql.conf
shared_preload_libraries = 'auto_explain'
auto_explain.log_min_duration = 0
auto_explain.log_analyze = true
auto_explain.log_verbose = true
auto_explain.log_buffers = true
auto_explain.log_buffers = true
auto_explain.log_timing = true
auto_explain.log_triggers = true
auto_explain.log_nested_statements = true
[root@test01 pg_log]# vim postgresql-2016-05-28_004047.csv
2016-05-28 00:41:23.990 CST,"postgres","postgres",7263,"[local]",574878a4.1c5f,3,"SELECT",2016-05-28 00:41:08 CST,2/3,0,LOG,00000,"duration: 0.808 ms plan:
Query Text: SELECT count(*)
FROM pg_class, pg_index
WHERE oid = indrelid AND indisunique;
Aggregate (cost=22.07..22.08 rows=1 width=0) (actual time=0.785..0.785 rows=1 loops=1)
Output: count(*)
Buffers: shared hit=46 read=1
-> Hash Join (cost=5.71..21.80 rows=109 width=0) (actual time=0.352..0.736 rows=109 loops=1)
Hash Cond: (pg_class.oid = pg_index.indrelid)
Buffers: shared hit=46 read=1
-> Index Only Scan using pg_class_oid_index on pg_catalog.pg_class (cost=0.15..12.81 rows=311 width=4) (actual time=0.088..0.285 rows=313 loops=1)
Output: pg_class.oid
Heap Fetches: 124
Buffers: shared hit=40 read=1
-> Hash (cost=4.20..4.20 rows=109 width=4) (actual time=0.187..0.187 rows=109 loops=1)
Output: pg_index.indrelid
Buckets: 1024 Batches: 1 Memory Usage: 12kB
Buffers: shared hit=3
-> Seq Scan on pg_catalog.pg_index (cost=0.00..4.20 rows=109 width=4) (actual time=0.008..0.094 rows=109 loops=1)
Output: pg_index.indrelid
Filter: pg_index.indisunique
Rows Removed by Filter: 11
Buffers: shared hit=3",,,,,,,,"explain_ExecutorEnd, auto_explain.c:333","psql.bin"
2016-05-28 00:41:23.990 CST,"postgres","postgres",7263,"[local]",574878a4.1c5f,4,"SELECT",2016-05-28 00:41:08 CST,2/0,0,LOG,00000,"duration: 5.327 ms",,,,,,,,"exec_simple_query, postgres.c:1174","psql.bin"
PostgreSQL auto_explain的更多相关文章
- postgresql常用命令
1.createdb 数据库名称 产生数据库2.dropdb 数据库名称 删除数据库 3.CREATE USER 用户名称 创建用户4.drop User 用户名称 删除用户 5.SELECT use ...
- 使用pgstatspack分析PostgreSQL数据库性能
pgstatspack [root@test01 soft]# wget http://pgfoundry.org/frs/download.php/3151/pgstatspack_version_ ...
- 在CentOS上编译安装PostgreSQL
http://my.oschina.net/tashi/blog 第一步:准备阶段 获取必需软件包: CentOS中查看是否安装了某个软件的命令:rpm -qa | grep 软件名.which命令可 ...
- Postgresql 10 自带扩展模块功能说明
adminpackadminpack提供了许多支持功能,pgAdmin 和其他管理和管理工具可以使用它们来提供其他功能,例如远程管理服务器日志文件.所有这些功能的使用仅限于超级用户. citext 该 ...
- PostgreSQL源代码中插件的使用
如果编译数据库时使用了gmake world和gmake install-world, 所有的插件都会被安装, 那么就不需要再次安装了. 插件目录 contrib 进入要安装的插件目录, 例如 cd ...
- PostgreSQL+pgpooll+Keepalived双机HA方案
PostgreSQL+pgpooll+Keepalived双机HA方案 (注:本文档中的所有操作在没有说明的情况下都应该使用postgres用户进行操作,postgres用户没有权限的操作方可采用ro ...
- postgresql 基本语法
postgresql数据库创建/修改/删除等写入类代码语法总结: 1,创建库 2,创建/删除表 2.1 创建表 create table myTableName 2.2 如果表不存在则创建表 crea ...
- postgresql无法安装pldbgapi的问题
要对函数进行调试需要安装插件pldbgapi,当初在windows上面的postgresql实例中执行了一下语句就安装上了: create extension pldbgapi; 但是在linux中执 ...
- ASP.NET MVC 使用 Petapoco 微型ORM框架+NpgSql驱动连接 PostgreSQL数据库
前段时间在园子里看到了小蝶惊鸿 发布的有关绿色版的Linux.NET——“Jws.Mono”.由于我对.Net程序跑在Linux上非常感兴趣,自己也看了一些有关mono的资料,但是一直没有时间抽出时间 ...
随机推荐
- HTML标签之间不是可以随便嵌套的
深究:我们先来认识in-line内联元素和block-line块元素,因为HTML里几乎所有元素都属于内联元素或者块元素中的一种. in-line这个词有很多种解释:内嵌.内联.行内.线级等,但是,它 ...
- git 解决冲突
$ git push origin master To /home/fan/repo/code/../a.git/ ! [rejected] master -> master (fetch fi ...
- Delphi下使用MapWinGIS控件打开GIS图层
unit Unit3; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System ...
- web项目中 集合Spring&使用junit4测试Spring
web项目中 集合Spring 问题: 如果将 ApplicationContext applicationContext = new ClassPathXmlApplicationContext(& ...
- 鸡肋的Drools
在看过Drools例子之后,认为其太鸡肋. 完全可以用bshell脚本来代替,或者用java自带的脚本(java5以上才支持,不过不是太好用)代替. 规则文件还要学其新标签,与其配套的接口写那么多,还 ...
- nrf51822裸机教程-SPI(主)
关于SPI总线的介绍这里就不细说了,网上有很多介绍SPI总线时序的. SPI总线的本质就是一个环形总线结构,在时钟驱动下两个双向移位寄存器进行数据交换. 所以SPI总线的特色就是:传输一字节数据的同时 ...
- C# 判断字符串是否为日期格式
判断字符串内容是否为日期格式,并返回一个日期变量 string str; DateTime dtTime; if (DateTime.TryParse(str, out dtTime)) { //st ...
- 新的开始--Python
第一周——python基础 1.Python简介 1.1Python简史 1.2安装Python 1.3“hello world” 在运行第一个程序“hello world”之前,先来看看运行Pyth ...
- LightOj 1163 - Bank Robbery(x-x/10 = n求所有的 x )
题目链接:http://lightoj.com/volume_showproblem.php?problem=1163 题意:有一个数A,然后去掉A的最后一位得到B,先告诉你A-B的值,求所有满足条件 ...
- sell- 获取邮箱的后缀
1. public static void main(String[] args) { System.out.println(getEmailSuffix("jim_chen28270@16 ...