explain.depesz.com

PostgreSQL's explain analyze made readable

Result: qbBm

Settings
# exclusive inclusive rows x rows loops node
1. 10,174.156 10,615.206 ↓ 419.7 1,746,339 1

Nested Loop Left Join (cost=4,974.22..67,847.48 rows=4,161 width=552) (actual time=22.372..10,615.206 rows=1,746,339 loops=1)

  • Join Filter: (cases_case.id = last_event.case_id)
  • Rows Removed by Join Filter: 2383776
2. 5.177 41.594 ↑ 1.0 4,161 1

Hash Left Join (cost=4,853.57..5,218.93 rows=4,161 width=386) (actual time=21.602..41.594 rows=4,161 loops=1)

  • Hash Cond: (cases_case.id = last_event.case_id)
3. 9.928 14.852 ↑ 1.0 4,161 1

Hash Left Join (cost=2.36..315.20 rows=4,161 width=356) (actual time=0.028..14.852 rows=4,161 loops=1)

  • Hash Cond: (cases_case.partner_id = cases_businesspartner.id)
4. 4.911 4.911 ↑ 1.0 4,161 1

Seq Scan on cases_case (cost=0.00..262.61 rows=4,161 width=352) (actual time=0.009..4.911 rows=4,161 loops=1)

5. 0.004 0.013 ↑ 1.0 16 1

Hash (cost=2.16..2.16 rows=16 width=8) (actual time=0.013..0.013 rows=16 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
6. 0.009 0.009 ↑ 1.0 16 1

Seq Scan on cases_businesspartner (cost=0.00..2.16 rows=16 width=8) (actual time=0.005..0.009 rows=16 loops=1)

7. 0.363 21.565 ↑ 1.3 1,758 1

Hash (cost=4,821.82..4,821.82 rows=2,351 width=30) (actual time=21.565..21.565 rows=1,758 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 146kB
8. 0.315 21.202 ↑ 1.3 1,758 1

Subquery Scan on last_event (cost=4,772.24..4,821.82 rows=2,351 width=30) (actual time=19.825..21.202 rows=1,758 loops=1)

9. 0.639 20.887 ↑ 1.3 1,758 1

Unique (cost=4,772.24..4,798.31 rows=2,351 width=34) (actual time=19.824..20.887 rows=1,758 loops=1)

10. 2.932 20.248 ↑ 1.0 5,068 1

Sort (cost=4,772.24..4,785.27 rows=5,215 width=34) (actual time=19.815..20.248 rows=5,068 loops=1)

  • Sort Key: cases_caseevent.case_id DESC, cases_caseevent.id DESC
  • Sort Method: quicksort Memory: 637kB
11. 17.316 17.316 ↑ 1.0 5,068 1

Seq Scan on cases_caseevent (cost=0.00..4,450.25 rows=5,215 width=34) (actual time=0.006..17.316 rows=5,068 loops=1)

  • Filter: ((creation_type)::text = ''MANUAL''::text)
  • Rows Removed by Filter: 91495
12. 397.956 399.456 ↑ 1.0 992 4,161

Materialize (cost=120.65..143.21 rows=992 width=19) (actual time=0.000..0.096 rows=992 loops=4,161)

13. 0.231 1.500 ↑ 1.0 992 1

Subquery Scan on last_promise (cost=120.65..138.25 rows=992 width=19) (actual time=0.748..1.500 rows=992 loops=1)

14. 0.338 1.269 ↑ 1.0 992 1

Unique (cost=120.65..128.33 rows=992 width=27) (actual time=0.747..1.269 rows=992 loops=1)

15. 0.632 0.931 ↑ 1.0 1,536 1

Sort (cost=120.65..124.49 rows=1,536 width=27) (actual time=0.746..0.931 rows=1,536 loops=1)

  • Sort Key: cases_paymentpromise.case_id DESC, cases_paymentpromise.id DESC
  • Sort Method: quicksort Memory: 169kB
16. 0.299 0.299 ↑ 1.0 1,536 1

Seq Scan on cases_paymentpromise (cost=0.00..39.36 rows=1,536 width=27) (actual time=0.011..0.299 rows=1,536 loops=1)