postgresql psql explain选项使用示例介绍
explain
postgres=# explain select count(*) from pgbench_accounts ;
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------
Aggregate (cost=2854.29..2854.30 rows=1 width=8)
-> Index Only Scan using pgbench_accounts_pkey on pgbench_accounts (cost=0.29..2604.29 rows=100000 width=0)
(2 rows)
postgres=#
explain analyze
postgres=# explain analyze select count(*) from pgbench_accounts ;
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------

本文详细介绍了PostgreSQL中使用explain选项进行SQL查询计划分析的方法,包括analyze、buffers、verbose、costs和timing等子选项的联合应用,通过具体示例展示了如何评估查询效率和资源消耗。
最低0.47元/天 解锁文章
3617

被折叠的 条评论
为什么被折叠?



