explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Rd3P

Settings
# exclusive inclusive rows x rows loops node
1. 80.759 3,411.115 ↑ 5.9 9,772 1

Unique (cost=102,293.11..102,580.82 rows=57,542 width=32) (actual time=3,194.415..3,411.115 rows=9,772 loops=1)

2. 1,216.655 3,330.356 ↓ 2.1 118,401 1

Sort (cost=102,293.11..102,436.96 rows=57,542 width=32) (actual time=3,194.412..3,330.356 rows=118,401 loops=1)

  • Sort Key: (ROW(r.a, r.b, r.c, s.d))
  • Sort Method: external merge Disk: 5456kB
3. 296.161 2,113.701 ↓ 2.1 118,401 1

Gather (cost=88,887.90..97,743.74 rows=57,542 width=32) (actual time=1,711.364..2,113.701 rows=118,401 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
4. 110.256 1,817.540 ↓ 1.7 59,200 2 / 2

Merge Join (cost=87,887.90..90,989.54 rows=33,848 width=32) (actual time=1,554.024..1,817.540 rows=59,200 loops=2)

  • Merge Cond: ((r.c = s.c) AND (r.b = s.b) AND (r.a = t.a))
5. 504.025 574.059 ↑ 1.2 248,460 2 / 2

Sort (cost=37,388.47..38,123.76 rows=294,118 width=12) (actual time=431.051..574.059 rows=248,460 loops=2)

  • Sort Key: r.c, r.b, r.a
  • Sort Method: external merge Disk: 4864kB
  • Worker 0: Sort Method: external merge Disk: 5944kB
6. 70.034 70.034 ↑ 1.2 250,000 2 / 2

Parallel Seq Scan on r (cost=0.00..5,644.18 rows=294,118 width=12) (actual time=0.034..70.034 rows=250,000 loops=2)

7. 38.443 1,133.225 ↓ 4.3 63,707 2 / 2

Sort (cost=50,499.43..50,536.65 rows=14,890 width=28) (actual time=1,122.874..1,133.225 rows=63,707 loops=2)

  • Sort Key: s.c, s.b, t.a
  • Sort Method: quicksort Memory: 3142kB
  • Worker 0: Sort Method: quicksort Memory: 3142kB
8. 63.832 1,094.782 ↓ 2.0 30,377 2 / 2

Merge Join (cost=47,086.89..49,467.40 rows=14,890 width=28) (actual time=951.722..1,094.782 rows=30,377 loops=2)

  • Merge Cond: ((u.b = s.b) AND (t.c = s.c) AND (t.d = s.d))
9. 358.322 570.377 ↓ 1.0 158,676 2 / 2

Sort (cost=22,975.55..23,366.52 rows=156,390 width=24) (actual time=515.508..570.377 rows=158,676 loops=2)

  • Sort Key: u.b, t.c, t.d
  • Sort Method: external merge Disk: 5288kB
  • Worker 0: Sort Method: external merge Disk: 5288kB
10. 107.383 212.055 ↓ 1.0 158,676 2 / 2

Merge Join (cost=3,475.54..6,273.66 rows=156,390 width=24) (actual time=79.394..212.055 rows=158,676 loops=2)

  • Merge Cond: ((t.a = u.a) AND (t.d = u.d))
11. 34.011 39.452 ↑ 2.5 7,940 2 / 2

Sort (cost=1,737.77..1,787.77 rows=20,000 width=12) (actual time=37.882..39.452 rows=7,940 loops=2)

  • Sort Key: t.a, t.d
  • Sort Method: quicksort Memory: 1706kB
  • Worker 0: Sort Method: quicksort Memory: 1706kB
12. 5.441 5.441 ↑ 1.0 20,000 2 / 2

Seq Scan on t (cost=0.00..309.00 rows=20,000 width=12) (actual time=0.066..5.441 rows=20,000 loops=2)

13. 47.641 65.220 ↓ 7.9 158,667 2 / 2

Sort (cost=1,737.77..1,787.77 rows=20,000 width=12) (actual time=41.499..65.220 rows=158,667 loops=2)

  • Sort Key: u.a, u.d
  • Sort Method: quicksort Memory: 1706kB
  • Worker 0: Sort Method: quicksort Memory: 1706kB
14. 17.579 17.579 ↑ 1.0 20,000 2 / 2

Seq Scan on u (cost=0.00..309.00 rows=20,000 width=12) (actual time=6.072..17.579 rows=20,000 loops=2)

15. 10.521 460.573 ↑ 3.0 66,388 2 / 2

Materialize (cost=24,111.14..25,111.14 rows=200,000 width=12) (actual time=436.164..460.573 rows=66,388 loops=2)

16. 394.297 450.052 ↑ 5.0 39,885 2 / 2

Sort (cost=24,111.14..24,611.14 rows=200,000 width=12) (actual time=436.157..450.052 rows=39,885 loops=2)

  • Sort Key: s.b, s.c, s.d
  • Sort Method: external merge Disk: 4320kB
  • Worker 0: Sort Method: external merge Disk: 4320kB
17. 55.755 55.755 ↑ 1.0 200,000 2 / 2

Seq Scan on s (cost=0.00..3,082.00 rows=200,000 width=12) (actual time=0.065..55.755 rows=200,000 loops=2)

Planning time : 2.095 ms
Execution time : 3,419.262 ms