explain.depesz.com

PostgreSQL's explain analyze made readable

Result: qb3U : Optimization for: Optimization for: plan #AKy; plan #5iTK

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.043 0.489 ↓ 7.5 15 1

Sort (cost=498.49..498.50 rows=2 width=714) (actual time=0.488..0.489 rows=15 loops=1)

  • Sort Key: a.order_num
  • Sort Method: quicksort Memory: 33kB
2. 0.032 0.446 ↓ 7.5 15 1

Nested Loop Left Join (cost=1.75..498.48 rows=2 width=714) (actual time=0.179..0.446 rows=15 loops=1)

3. 0.050 0.399 ↓ 7.5 15 1

Nested Loop Left Join (cost=1.47..496.78 rows=2 width=691) (actual time=0.160..0.399 rows=15 loops=1)

  • Join Filter: (co.courier_id = a.courier_id)
  • Rows Removed by Join Filter: 434
4. 0.027 0.304 ↓ 7.5 15 1

Nested Loop Left Join (cost=1.47..494.59 rows=2 width=672) (actual time=0.137..0.304 rows=15 loops=1)

  • Join Filter: (cu.customer_id = (a.customer_id)::numeric)
  • Rows Removed by Join Filter: 160
5. 0.035 0.247 ↓ 7.5 15 1

Hash Join (cost=1.47..493.49 rows=2 width=636) (actual time=0.122..0.247 rows=15 loops=1)

  • Hash Cond: ((a.dep_id)::numeric = d.dep_id)
6. 0.034 0.194 ↑ 3.1 15 1

Nested Loop (cost=0.29..492.18 rows=46 width=619) (actual time=0.085..0.194 rows=15 loops=1)

7. 0.016 0.016 ↓ 9.0 9 1

Seq Scan on status s (cost=0.00..11.38 rows=1 width=318) (actual time=0.011..0.016 rows=9 loops=1)

  • Filter: ((grp_code)::text = 'active'::text)
  • Rows Removed by Filter: 6
8. 0.144 0.144 ↑ 510.0 2 9

Index Scan using cc_order_idx_status on cc_order a (cost=0.29..470.61 rows=1,020 width=309) (actual time=0.013..0.016 rows=2 loops=9)

  • Index Cond: ((status_id = s.status_id) AND (status_id = ANY ('{1,2,3,4,201,202,203,41074871023437782,204,205,41074790371427610,41074815851824421,40626382319388217,41076109836551615,41076264940078335}'::bigint[])))
  • Filter: (dep_id = '37907397910465070'::bigint)
  • Rows Removed by Filter: 1
9. 0.009 0.018 ↓ 1.1 9 1

Hash (cost=1.08..1.08 rows=8 width=28) (actual time=0.018..0.018 rows=9 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
10. 0.009 0.009 ↓ 1.1 9 1

Seq Scan on org_dep d (cost=0.00..1.08 rows=8 width=28) (actual time=0.007..0.009 rows=9 loops=1)

11. 0.022 0.030 ↓ 5.5 11 15

Materialize (cost=0.00..1.03 rows=2 width=49) (actual time=0.001..0.002 rows=11 loops=15)

12. 0.008 0.008 ↓ 5.5 11 1

Seq Scan on crm_customer cu (cost=0.00..1.02 rows=2 width=49) (actual time=0.006..0.008 rows=11 loops=1)

13. 0.033 0.045 ↓ 1.0 29 15

Materialize (cost=0.00..1.42 rows=28 width=27) (actual time=0.001..0.003 rows=29 loops=15)

14. 0.012 0.012 ↓ 1.2 34 1

Seq Scan on cc_courier co (cost=0.00..1.28 rows=28 width=27) (actual time=0.007..0.012 rows=34 loops=1)

15. 0.015 0.015 ↓ 0.0 0 15

Index Scan using cc_order_pk on cc_order prev (cost=0.29..0.64 rows=1 width=14) (actual time=0.001..0.001 rows=0 loops=15)

  • Index Cond: (order_id = a.prev_order_id)