当前位置:网站首页>[PostgreSQL] - explain SQL分析介绍
[PostgreSQL] - explain SQL分析介绍
2022-07-30 12:15:00 【夹胡碰】
一、图形化在线分析工具
二、执行分析语句
EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS, FORMAT JSON)
select * from ...生成分析JSON之后,填入图形化分析页面,进行分析。
三、分析样例
1、走索引 - Index Scan Node
表示先走二级索引,再走一级索引找到数据
finds relevant records based on an Index. Index Scans perform 2 read operations: one to read the index and another to read the actual value from the table.
2、顺序扫描 - Seq Scan Node
finds relevant records by sequentially scanning the input record set. When reading from a table, Seq Scans (unlike Index Scans) perform a single read operation (only the table is read).
3、缓存 - shared
- Hit - 命中
- Read - 读磁盘
- Dirtied - 脏页(脏页包含在Hit中)
4、循环匹配 - Nested Loop
join数据,将两个结果集进行拼接
merges two record sets by looping through every record in the first set and trying to find a match in the second set. All matching records are returned.
遍历模式
索引模式
5、聚合 - Aggregate
group by 操作
groups records together based on a GROUP BY or aggregate function (like sum()).
6、排序 - Sort
order by 操作
sorts a record set based on the specified sort key.
7、数量限制 - limit
returns a specified number of rows from a record set.
8、with as 临时表 - Common table expressions - CTE
performs a sequential scan of Common Table Expression (CTE) query results. Note that results of a CTE are materialized (calculated and temporarily stored). 对公共表表达式(CTE)查询结果执行顺序扫描。注意,CTE的结果是具体化的(计算并临时存储)。
9、其他操作
- WindowAgg
- Subquery Scan
10、其他join模式图解
- Hash Join
- Merge Join
边栏推荐
猜你喜欢
随机推荐
别被隐私计算表象骗了 | 量子位智库报告(附下载)
手慢无!阿里亿级流量高并发系统设计核心原理全彩笔记现实开源
基于反步积分滑模摩擦补偿的光电伺服转台控制
什么是驱动程序签名,驱动程序如何获取数字签名?
WinForm枚举容器中的控件,实现控件统一事件处理机制
DOM常用方法以及项目
unity对象池(学习)
[ASP.NET Core] Dependency Injection for Option Classes
Farmers on the assembly line: I grow vegetables in a factory
看了这些6G原型样机,我想一觉睡到2030年
Scheduling of combined electric-heating system based on multi-objective two-stage stochastic programming method
小心 transmittable-thread-local 的这个坑
Horizontal comparison of 5 commonly used registration centers, whether it is used for interviews or technical selection, is very helpful
关于File文件的相关知识
崩了,该来的终究躲不掉
初级永磁直线电机双动子电流镜像容错控制
Add the device library after Vivado installation
来n遍剑指--04. 二维数组中的查找
【语音识别】基于GMM-HMM的语音识别系统
ModelCoder状态机:对柴油机工况判断策略进行建模









