一、图形化在线分析工具
https://www.php.cn/link/ef0e1d56faee5d1938febf0bfdcb8d3f
![[PostgreSQL] - explain SQL分析介绍](https://img.php.cn/upload/article/001/503/042/175315597450701.jpg)
二、执行分析语句
代码语言:javascript
代码运行次数:0
运行 复制EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS, FORMAT JSON) select * from ...
生成分析JSON之后,填入图形化分析页面,进行分析。
三、分析样例
![[PostgreSQL] - explain SQL分析介绍](https://img.php.cn/upload/article/001/503/042/175315597475754.jpg)
1、使用索引 - Index Scan Node表示先使用二级索引,再使用一级索引找到数据
![[PostgreSQL] - explain SQL分析介绍](https://img.php.cn/upload/article/001/503/042/175315597475689.jpg)
2、顺序扫描 - Seq Scan Node
![[PostgreSQL] - explain SQL分析介绍](https://img.php.cn/upload/article/001/503/042/175315597422929.jpg)
3、缓存 - sharedHit - 命中,Read - 读磁盘,Dirtied - 脏页(脏页包含在Hit中)
![[PostgreSQL] - explain SQL分析介绍](https://img.php.cn/upload/article/001/503/042/175315597468116.jpg)
4、循环匹配 - Nested Loop join数据,将两个结果集进行拼接
遍历模式
![[PostgreSQL] - explain SQL分析介绍](https://img.php.cn/upload/article/001/503/042/175315597567904.jpg)
索引模式
![[PostgreSQL] - explain SQL分析介绍](https://img.php.cn/upload/article/001/503/042/175315597510666.jpg)
5、聚合 - Aggregate group by 操作
![[PostgreSQL] - explain SQL分析介绍](https://img.php.cn/upload/article/001/503/042/175315597586213.jpg)
6、排序 - Sort order by 操作
![[PostgreSQL] - explain SQL分析介绍](https://img.php.cn/upload/article/001/503/042/175315597520763.jpg)
7、数量限制 - limit
![[PostgreSQL] - explain SQL分析介绍](https://img.php.cn/upload/article/001/503/042/175315597523775.jpg)
8、with as 临时表 - Common table expressions - CTE
![[PostgreSQL] - explain SQL分析介绍](https://img.php.cn/upload/article/001/503/042/175315597518899.jpg)
9、其他操作
WindowAgg
Subquery Scan
10、其他join模式图解
Hash Join
![[PostgreSQL] - explain SQL分析介绍](https://img.php.cn/upload/article/001/503/042/175315597637773.jpg)
Merge Join
![[PostgreSQL] - explain SQL分析介绍](https://img.php.cn/upload/article/001/503/042/175315597624844.jpg)
以上就是[PostgreSQL] - explain SQL分析介绍的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号