explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.046 0.413 ↓ 8.5 17 1

Sort (cost=498.49..498.50 rows=2 width=714) (actual time=0.412..0.413 rows=17 loops=1)

  • Sort Key: a.order_num
  • Sort Method: quicksort Memory: 34kB
2. 0.035 0.367 ↓ 8.5 17 1

Nested Loop Left Join (cost=1.75..498.48 rows=2 width=714) (actual time=0.116..0.367 rows=17 loops=1)

3. 0.053 0.332 ↓ 8.5 17 1

Nested Loop Left Join (cost=1.47..496.78 rows=2 width=691) (actual time=0.106..0.332 rows=17 loops=1)

  • Join Filter: (co.courier_id = a.courier_id)
  • Rows Removed by Join Filter: 502
4. 0.040 0.228 ↓ 8.5 17 1

Nested Loop Left Join (cost=1.47..494.59 rows=2 width=672) (actual time=0.085..0.228 rows=17 loops=1)

  • Join Filter: (cu.customer_id = (a.customer_id)::numeric)
  • Rows Removed by Join Filter: 182
5. 0.035 0.171 ↓ 8.5 17 1

Hash Join (cost=1.47..493.49 rows=2 width=636) (actual time=0.070..0.171 rows=17 loops=1)

  • Hash Cond: ((a.dep_id)::numeric = d.dep_id)
6. 0.037 0.116 ↑ 2.7 17 1

Nested Loop (cost=0.29..492.18 rows=46 width=619) (actual time=0.031..0.116 rows=17 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.012..0.016 rows=9 loops=1)

  • Filter: ((grp_code)::text = 'active'::text)
  • Rows Removed by Filter: 6
8. 0.063 0.063 ↑ 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.005..0.007 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.012 0.020 ↓ 1.1 9 1

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

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

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

11. 0.009 0.017 ↓ 5.5 11 17

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

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.040 0.051 ↓ 1.1 30 17

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

14. 0.011 0.011 ↓ 1.2 34 1

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

15. 0.000 0.000 ↓ 0.0 0 17

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

  • Index Cond: (order_id = a.prev_order_id)