explain.depesz.com

PostgreSQL's explain analyze made readable

Result: b6LH

Settings
# exclusive inclusive rows x rows loops node
1. 4.534 3,029.273 ↑ 70.6 850 1

Sort (cost=1,625,032.90..1,625,183.02 rows=60,049 width=212) (actual time=3,028.848..3,029.273 rows=850 loops=1)

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

CTE cte

3. 0.061 0.273 ↑ 1.0 850 1

Limit (cost=0.29..39.84 rows=850 width=24) (actual time=0.012..0.273 rows=850 loops=1)

4. 0.212 0.212 ↑ 70.6 850 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.011..0.212 rows=850 loops=1)

  • Filter: (is_current IS TRUE)
5. 126.192 3,024.739 ↑ 70.6 850 1

GroupAggregate (cost=474,767.99..1,614,067.02 rows=60,049 width=212) (actual time=2,815.660..3,024.739 rows=850 loops=1)

  • Group Key: analyses.id
6. 23.162 2,897.697 ↑ 2.2 85,329 1

Merge Join (cost=474,767.99..485,249.60 rows=189,415 width=227) (actual time=2,815.361..2,897.697 rows=85,329 loops=1)

  • Merge Cond: (analyses.id = cte.id)
7. 37.432 37.432 ↑ 1.0 59,917 1

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

8. 8.498 2,837.103 ↑ 2.2 85,329 1

Materialize (cost=474,767.58..475,714.65 rows=189,415 width=71) (actual time=2,815.185..2,837.103 rows=85,329 loops=1)

9. 50.818 2,828.605 ↑ 2.2 85,329 1

Sort (cost=474,767.58..475,241.12 rows=189,415 width=71) (actual time=2,815.182..2,828.605 rows=85,329 loops=1)

  • Sort Key: cte.id
  • Sort Method: external merge Disk: 6784kB
10. 529.289 2,777.787 ↑ 2.2 85,329 1

Hash Left Join (cost=376,178.33..450,394.22 rows=189,415 width=71) (actual time=2,250.050..2,777.787 rows=85,329 loops=1)

  • Hash Cond: (cte.id = classifications.analysis_id)
11. 0.450 0.450 ↑ 1.0 850 1

CTE Scan on cte (cost=0.00..17.00 rows=850 width=16) (actual time=0.014..0.450 rows=850 loops=1)

12. 1,204.839 2,248.048 ↑ 1.0 6,002,428 1

Hash (cost=230,730.70..230,730.70 rows=6,005,570 width=71) (actual time=2,248.048..2,248.048 rows=6,002,428 loops=1)

  • Buckets: 65536 Batches: 256 Memory Usage: 3157kB
13. 1,043.209 1,043.209 ↑ 1.0 6,002,428 1

Seq Scan on classifications (cost=0.00..230,730.70 rows=6,005,570 width=71) (actual time=0.030..1,043.209 rows=6,002,428 loops=1)

14.          

SubPlan (for GroupAggregate)

15. 0.850 0.850 ↑ 1.0 1 850

Aggregate (cost=18.76..18.77 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=850)

16. 0.000 0.000 ↓ 0.0 0 850

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

  • Filter: (analyses.id = analysis_id)
Planning time : 0.388 ms
Execution time : 3,030.954 ms