explain.depesz.com

PostgreSQL's explain analyze made readable

Result: wpre

Settings
# exclusive inclusive rows x rows loops node
1. 4.519 220.841 ↑ 75.1 800 1

Sort (cost=1,618,995.84..1,619,145.96 rows=60,049 width=212) (actual time=220.426..220.841 rows=800 loops=1)

  • Sort Key: analyses.created_at DESC
  • Sort Method: external merge Disk: 3288kB
2.          

CTE cte

3. 0.075 0.490 ↑ 1.0 800 1

Limit (cost=0.29..37.51 rows=800 width=24) (actual time=0.011..0.490 rows=800 loops=1)

4. 0.415 0.415 ↑ 75.1 800 1

Index Scan Backward using ix_doc_analysis_analyses_created_at on analyses analyses_1 (cost=0.29..2,794.02 rows=60,049 width=24) (actual time=0.010..0.415 rows=800 loops=1)

  • Filter: (is_current IS TRUE)
5. 128.696 216.322 ↑ 75.1 800 1

GroupAggregate (cost=64.96..1,608,032.29 rows=60,049 width=212) (actual time=1.967..216.322 rows=800 loops=1)

  • Group Key: analyses.id
6. 15.639 86.026 ↑ 2.2 80,329 1

Nested Loop Left Join (cost=64.96..479,270.58 rows=178,273 width=227) (actual time=1.429..86.026 rows=80,329 loops=1)

7. 5.605 49.587 ↑ 1.0 800 1

Merge Join (cost=54.99..7,233.84 rows=800 width=188) (actual time=1.396..49.587 rows=800 loops=1)

  • Merge Cond: (analyses.id = cte.id)
8. 42.553 42.553 ↑ 1.0 59,824 1

Index Scan using analyses_pkey on analyses (cost=0.41..7,017.14 rows=60,049 width=172) (actual time=0.013..42.553 rows=59,824 loops=1)

9. 0.582 1.429 ↑ 1.0 800 1

Sort (cost=54.58..56.58 rows=800 width=16) (actual time=1.180..1.429 rows=800 loops=1)

  • Sort Key: cte.id
  • Sort Method: quicksort Memory: 62kB
10. 0.847 0.847 ↑ 1.0 800 1

CTE Scan on cte (cost=0.00..16.00 rows=800 width=16) (actual time=0.013..0.847 rows=800 loops=1)

11. 14.400 20.800 ↑ 2.2 100 800

Bitmap Heap Scan on classifications (cost=9.97..587.82 rows=223 width=71) (actual time=0.011..0.026 rows=100 loops=800)

  • Recheck Cond: (cte.id = analysis_id)
  • Heap Blocks: exact=3175
12. 6.400 6.400 ↑ 2.2 100 800

Bitmap Index Scan on ix_doc_analysis_classifications_analysis_id (cost=0.00..9.91 rows=223 width=0) (actual time=0.008..0.008 rows=100 loops=800)

  • Index Cond: (cte.id = analysis_id)
13.          

SubPlan (for GroupAggregate)

14. 1.600 1.600 ↑ 1.0 1 800

Aggregate (cost=18.76..18.77 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=800)

15. 0.000 0.000 ↓ 0.0 0 800

Seq Scan on comments (cost=0.00..18.75 rows=4 width=16) (actual time=0.000..0.000 rows=0 loops=800)

  • Filter: (analyses.id = analysis_id)
Planning time : 0.433 ms
Execution time : 221.430 ms