2017-02-25 27 views
0

我正在使用postgresql和pgAdmin 4。我正在嘗試做一些查詢性能優化。 當我使用EXPLAIN ANALYZE(或)EXPLAIN(VERBOSE TRUE)運行查詢時,我看到的'Data Output'顯示在以下屏幕截圖中。 enter image description here如何導出EXPLAIN數據從pgAdmin輸出4

如何獲得輸出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 

回答

0

使用內置的解釋pgAdmin4的選項得到你想要的輸出。

enter image description here

現在你可以從輸出複製「數據輸出繼電器」選項卡。

+0

你有沒有檢查你真的在輸出文件中有什麼? – klin

+0

哦,我的壞.. :(,更新了答案。 – n33rma