explain.depesz.com

PostgreSQL's explain analyze made readable

Result: aiVN

Settings
# exclusive inclusive rows x rows loops node
1. 0.004 0.289 ↓ 2.0 2 1

Nested Loop Left Join (cost=16.04..87.49 rows=1 width=784) (actual time=0.260..0.289 rows=2 loops=1)

2.          

Initplan (for Nested Loop Left Join)

3. 0.005 0.053 ↑ 1.0 1 1

Result (cost=1.98..4.80 rows=1 width=8) (actual time=0.051..0.053 rows=1 loops=1)

  • One-Time Filter: (($0)::text <> 'ABORTED'::text)
4.          

Initplan (for Result)

5. 0.001 0.034 ↑ 1.0 1 1

Unique (cost=1.97..1.98 rows=1 width=34) (actual time=0.034..0.034 rows=1 loops=1)

6. 0.015 0.033 ↑ 1.0 1 1

Sort (cost=1.97..1.98 rows=1 width=34) (actual time=0.033..0.033 rows=1 loops=1)

  • Sort Key: fulfillment_order_state_1.period_number DESC, fulfillment_order_state_1.session_number DESC
  • Sort Method: quicksort Memory: 25kB
7. 0.018 0.018 ↑ 1.0 1 1

Seq Scan on fulfillment_order_state fulfillment_order_state_1 (cost=0.00..1.96 rows=1 width=34) (actual time=0.015..0.018 rows=1 loops=1)

  • Filter: (fulfillment_order_id = 49)
  • Rows Removed by Filter: 78
8. 0.014 0.014 ↑ 1.0 1 1

Seq Scan on fulfillment_order (cost=1.98..4.80 rows=1 width=8) (actual time=0.012..0.014 rows=1 loops=1)

  • Filter: (original_fulfillment_order_id = 49)
  • Rows Removed by Filter: 67
9. 0.002 0.232 ↓ 2.0 2 1

Nested Loop Left Join (cost=11.08..82.48 rows=1 width=751) (actual time=0.205..0.232 rows=2 loops=1)

10. 0.001 0.230 ↓ 2.0 2 1

Nested Loop Left Join (cost=10.93..78.30 rows=1 width=707) (actual time=0.204..0.230 rows=2 loops=1)

  • Join Filter: (plor.fulfillment_order_id = o.fulfillment_order_id)
11. 0.003 0.225 ↓ 2.0 2 1

Nested Loop Left Join (cost=10.78..74.12 rows=1 width=428) (actual time=0.201..0.225 rows=2 loops=1)

12. 0.002 0.218 ↓ 2.0 2 1

Nested Loop Left Join (cost=10.63..69.95 rows=1 width=436) (actual time=0.197..0.218 rows=2 loops=1)

  • Join Filter: ((c.fulfillment_order_id = cb.fulfillment_order_id) AND (c.code = cb.code))
13. 0.006 0.206 ↓ 2.0 2 1

Nested Loop Left Join (cost=10.63..44.06 rows=1 width=436) (actual time=0.189..0.206 rows=2 loops=1)

  • Join Filter: ((o.fulfillment_order_id = cv.fulfillment_order_id) AND (cv.code = c.code))
14. 0.006 0.164 ↓ 2.0 2 1

Nested Loop Left Join (cost=6.45..39.82 rows=1 width=428) (actual time=0.152..0.164 rows=2 loops=1)

  • Join Filter: (o.fulfillment_order_id = c.fulfillment_order_id)
15. 0.002 0.132 ↓ 2.0 2 1

Nested Loop Left Join (cost=2.27..35.59 rows=1 width=396) (actual time=0.124..0.132 rows=2 loops=1)

  • Join Filter: (o.fulfillment_order_id = p.fulfillment_order_id)
16. 0.005 0.124 ↓ 2.0 2 1

Nested Loop Left Join (cost=2.12..31.41 rows=1 width=388) (actual time=0.119..0.124 rows=2 loops=1)

  • Join Filter: (o.fulfillment_order_id = g.fulfillment_order_id)
17. 0.001 0.103 ↑ 1.0 1 1

Nested Loop Left Join (cost=2.12..29.66 rows=1 width=368) (actual time=0.101..0.103 rows=1 loops=1)

  • Join Filter: (o.fulfillment_order_id = a.fulfillment_order_id)
18. 0.003 0.088 ↑ 1.0 1 1

Nested Loop (cost=2.12..9.02 rows=1 width=309) (actual time=0.086..0.088 rows=1 loops=1)

19. 0.007 0.035 ↑ 1.0 1 1

Nested Loop (cost=0.15..7.00 rows=1 width=299) (actual time=0.033..0.035 rows=1 loops=1)

20. 0.021 0.021 ↑ 1.0 1 1

Seq Scan on fulfillment_order o (cost=0.00..2.83 rows=1 width=239) (actual time=0.020..0.021 rows=1 loops=1)

  • Filter: (fulfillment_order_id = 49)
  • Rows Removed by Filter: 67
21. 0.007 0.007 ↑ 1.0 1 1

Index Scan using pk_session on session s (cost=0.15..4.17 rows=1 width=76) (actual time=0.007..0.007 rows=1 loops=1)

  • Index Cond: ((period_number = o.period_number) AND (session_number = o.session_number))
22. 0.006 0.050 ↑ 1.0 1 1

Subquery Scan on lastorderstate (cost=1.97..2.01 rows=1 width=18) (actual time=0.050..0.050 rows=1 loops=1)

  • Filter: (((lastorderstate.state)::text <> 'ABORTED'::text) AND (lastorderstate.rank = 1))
23. 0.006 0.044 ↑ 1.0 1 1

WindowAgg (cost=1.97..1.99 rows=1 width=74) (actual time=0.044..0.044 rows=1 loops=1)

24. 0.017 0.038 ↑ 1.0 1 1

Sort (cost=1.97..1.98 rows=1 width=50) (actual time=0.038..0.038 rows=1 loops=1)

  • Sort Key: (ROW(fulfillment_order_state.period_number, fulfillment_order_state.session_number)) DESC
  • Sort Method: quicksort Memory: 25kB
25. 0.021 0.021 ↑ 1.0 1 1

Seq Scan on fulfillment_order_state (cost=0.00..1.96 rows=1 width=50) (actual time=0.019..0.021 rows=1 loops=1)

  • Filter: (fulfillment_order_id = 49)
  • Rows Removed by Filter: 78
26. 0.014 0.014 ↓ 0.0 0 1

Seq Scan on fulfillment_order_award a (cost=0.00..20.62 rows=1 width=67) (actual time=0.014..0.014 rows=0 loops=1)

  • Filter: (fulfillment_order_id = 49)
  • Rows Removed by Filter: 34
27. 0.016 0.016 ↑ 1.0 2 1

Seq Scan on fulfillment_order_gift g (cost=0.00..1.73 rows=2 width=28) (actual time=0.014..0.016 rows=2 loops=1)

  • Filter: (fulfillment_order_id = 49)
  • Rows Removed by Filter: 56
28. 0.006 0.006 ↓ 0.0 0 2

Index Scan using uc_fulfillment_order_id on fulfillment_order_payoutdate p (cost=0.15..4.17 rows=1 width=16) (actual time=0.003..0.003 rows=0 loops=2)

  • Index Cond: (fulfillment_order_id = 49)
29. 0.004 0.026 ↑ 1.0 1 2

Subquery Scan on c (cost=4.18..4.22 rows=1 width=32) (actual time=0.013..0.013 rows=1 loops=2)

  • Filter: (c.rank = 1)
30. 0.004 0.022 ↑ 1.0 1 2

WindowAgg (cost=4.18..4.21 rows=1 width=40) (actual time=0.011..0.011 rows=1 loops=2)

31. 0.013 0.018 ↑ 1.0 1 2

Sort (cost=4.18..4.18 rows=1 width=32) (actual time=0.008..0.009 rows=1 loops=2)

  • Sort Key: fulfillment_order_claimcode.period_number, fulfillment_order_claimcode.session_number DESC
  • Sort Method: quicksort Memory: 25kB
32. 0.005 0.005 ↑ 1.0 1 1

Index Scan using pk_fulfillment_order_claimcode on fulfillment_order_claimcode (cost=0.15..4.17 rows=1 width=32) (actual time=0.004..0.005 rows=1 loops=1)

  • Index Cond: (fulfillment_order_id = 49)
33. 0.006 0.036 ↑ 1.0 1 2

Subquery Scan on cv (cost=4.18..4.22 rows=1 width=24) (actual time=0.016..0.018 rows=1 loops=2)

  • Filter: (cv.rank = 1)
34. 0.006 0.030 ↑ 1.0 1 2

WindowAgg (cost=4.18..4.21 rows=1 width=80) (actual time=0.014..0.015 rows=1 loops=2)

35. 0.016 0.024 ↑ 1.0 1 2

Sort (cost=4.18..4.18 rows=1 width=56) (actual time=0.012..0.012 rows=1 loops=2)

  • Sort Key: fulfillment_order_claimcode_validity.code, (ROW(fulfillment_order_claimcode_validity.period_number, fulfillment_order_claimcode_validity.session_number)) DESC
  • Sort Method: quicksort Memory: 25kB
36. 0.008 0.008 ↑ 1.0 1 1

Index Scan using pk_claimcode_validity on fulfillment_order_claimcode_validity (cost=0.15..4.17 rows=1 width=56) (actual time=0.008..0.008 rows=1 loops=1)

  • Index Cond: (fulfillment_order_id = 49)
37. 0.010 0.010 ↓ 0.0 0 2

Seq Scan on fulfillment_order_claimcode_blocked cb (cost=0.00..25.88 rows=1 width=16) (actual time=0.005..0.005 rows=0 loops=2)

  • Filter: (fulfillment_order_id = 49)
  • Rows Removed by Filter: 2
38. 0.004 0.004 ↑ 1.0 1 2

Index Scan using pk_session on session se (cost=0.15..4.17 rows=1 width=24) (actual time=0.002..0.002 rows=1 loops=2)

  • Index Cond: ((period_number = c.period_number) AND (session_number = c.session_number))
39. 0.004 0.004 ↓ 0.0 0 2

Index Scan using placed_order_idx on placed_order plor (cost=0.15..4.17 rows=1 width=279) (actual time=0.002..0.002 rows=0 loops=2)

  • Index Cond: (fulfillment_order_id = 49)
40. 0.000 0.000 ↓ 0.0 0 2

Index Scan using placed_order_item_idx on placed_order_item plit (cost=0.15..4.17 rows=1 width=52) (actual time=0.000..0.000 rows=0 loops=2)

  • Index Cond: (placed_order_id = plor.id)
41. 0.000 0.000 ↓ 0.0 0 2

Index Scan using placed_order_item_additional_info_idx on placed_order_item_additional_info plai (cost=0.15..0.20 rows=1 width=32) (actual time=0.000..0.000 rows=0 loops=2)

  • Index Cond: (placed_order_item_id = plit.id)
Planning time : 3.309 ms
Execution time : 0.945 ms