我正在使用 pgAdmin 4 研究 postgresql 。我正在尝试做一些查询性能优化。当我使用 EXPLAIN ANALYZE (or) EXPLAIN (VERBOSE TRUE) 运行查询时,我看到的“数据输出”显示在以下屏幕截图中。
如何以这种格式获取 EXPLAIN ANALYZE 的输出(或导出我当前的“数据输出”),我可以将其输入http://explain.depesz.com :
QUERY PLAN
--------------------------------------------------------------------------------------------------------------
Sort (cost=29.71..29.73 rows=6 width=64) (actual time=0.189..16.233 rows=7 loops=1)
Sort Key: books.title
-> Nested Loop (cost=0.00..29.63 rows=6 width=64) (actual time=0.068..0.129 rows=7 loops=1)
-> Index Scan using authors_pkey on authors (cost=0.00..5.82 rows=1 width=36) (actual time=0.029..0.033 rows=1 loops=1)
Index Cond: (id = 16)
-> Seq Scan on books (cost=0.00..23.75 rows=6 width=36) (actual time=0.026..0.052 rows=7 loops=1)
Filter: (author_id = 16)
Total runtime: 16.386 ms