explain.depesz.com

PostgreSQL's explain analyze made readable

Result: m2Q

Settings
# exclusive inclusive rows x rows loops node
1. 17,063.355 17,063.355 ↑ 426.2 60,354 1

CTE Scan on z (cost=3,559,529.94..4,074,023.78 rows=25,724,692 width=464) (actual time=429.553..17,063.355 rows=60,354 loops=1)

2.          

CTE x

3. 55.666 55.666 ↑ 1.4 60,582 1

Index Scan using rtb_ssp_log_created_at_idx on rtb_ssp_log (cost=0.42..49,684.25 rows=85,167 width=1,238) (actual time=2.796..55.666 rows=60,582 loops=1)

  • Index Cond: ((created_at >= '2019-06-10 11:32:55+00'::timestamp with time zone) AND (created_at < '2019-06-10 11:33:00+00'::timestamp with time zone))
4.          

CTE y

5. 35.595 35.595 ↓ 1.0 60,558 1

Index Scan using rtb_dsp_log_dsp_id_created_at_idx on rtb_dsp_log (cost=0.42..16,722.82 rows=60,410 width=109) (actual time=2.825..35.595 rows=60,558 loops=1)

  • Index Cond: ((created_at >= '2019-06-10 11:32:55+00'::timestamp with time zone) AND (created_at < '2019-06-10 11:33:00+00'::timestamp with time zone))
6.          

CTE z

7. 16,336.553 16,885.072 ↑ 426.2 60,354 1

Merge Join (cost=19,774.48..3,493,122.87 rows=25,724,692 width=464) (actual time=429.546..16,885.072 rows=60,354 loops=1)

  • Merge Cond: (y.ssp_log_id = x.id)
8. 68.047 141.426 ↓ 1.0 60,558 1

Sort (cost=8,117.39..8,268.41 rows=60,410 width=97) (actual time=126.798..141.426 rows=60,558 loops=1)

  • Sort Key: y.ssp_log_id
  • Sort Method: external merge Disk: 3680kB
9. 17.821 73.379 ↓ 1.0 60,558 1

Hash Join (cost=15.18..1,384.88 rows=60,410 width=97) (actual time=2.863..73.379 rows=60,558 loops=1)

  • Hash Cond: (y.dsp_id = rtb_dsp.id)
10. 55.541 55.541 ↓ 1.0 60,558 1

CTE Scan on y (cost=0.00..1,208.20 rows=60,410 width=65) (actual time=2.829..55.541 rows=60,558 loops=1)

11. 0.003 0.017 ↑ 76.7 3 1

Hash (cost=12.30..12.30 rows=230 width=48) (actual time=0.017..0.017 rows=3 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
12. 0.014 0.014 ↑ 76.7 3 1

Seq Scan on rtb_dsp (cost=0.00..12.30 rows=230 width=48) (actual time=0.013..0.014 rows=3 loops=1)

13. 15.924 407.093 ↑ 1.4 60,582 1

Materialize (cost=11,657.09..12,082.93 rows=85,167 width=104) (actual time=302.402..407.093 rows=60,582 loops=1)

14. 220.438 391.169 ↑ 1.4 60,582 1

Sort (cost=11,657.09..11,870.01 rows=85,167 width=104) (actual time=302.398..391.169 rows=60,582 loops=1)

  • Sort Key: x.id
  • Sort Method: external merge Disk: 75304kB
15. 17.075 170.731 ↑ 1.4 60,582 1

Hash Join (cost=25.98..1,954.21 rows=85,167 width=104) (actual time=2.833..170.731 rows=60,582 loops=1)

  • Hash Cond: (x.ssp_id = rtb_ssp.id)
16. 153.641 153.641 ↑ 1.4 60,582 1

CTE Scan on x (cost=0.00..1,703.34 rows=85,167 width=72) (actual time=2.802..153.641 rows=60,582 loops=1)

17. 0.003 0.015 ↑ 236.7 3 1

Hash (cost=17.10..17.10 rows=710 width=48) (actual time=0.015..0.015 rows=3 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
18. 0.012 0.012 ↑ 236.7 3 1

Seq Scan on rtb_ssp (cost=0.00..17.10 rows=710 width=48) (actual time=0.011..0.012 rows=3 loops=1)