explain.depesz.com

PostgreSQL's explain analyze made readable

Result: hjqp

Settings
# exclusive inclusive rows x rows loops node
1. 35.470 853.622 ↓ 1.5 2,773 1

Limit (cost=70.39..137,428.27 rows=1,888 width=212) (actual time=35.165..853.622 rows=2,773 loops=1)

  • Functions: 25
  • Options: Inlining false, Optimization false, Expressions true, Deforming true
  • Timing: Generation 4.028 ms, Inlining 0.000 ms, Optimization 1.901 ms, Emission 32.070 ms, Total 37.999 ms
2. 7.520 818.152 ↓ 1.5 2,773 1

Nested Loop Left Join (cost=70.39..137,428.27 rows=1,888 width=212) (actual time=0.481..818.152 rows=2,773 loops=1)

  • Filter: (((sa.step_id = 6) AND ((max(shipment.real_pick_up_date)) >= (now() - '6 mons'::interval))) OR (sa.step_id <> 6))
  • Rows Removed by Filter: 208
3. 4.422 113.078 ↓ 1.6 2,981 1

Nested Loop Left Join (cost=20.46..42,635.18 rows=1,897 width=212) (actual time=0.184..113.078 rows=2,981 loops=1)

4. 5.474 52.017 ↓ 1.6 2,981 1

Nested Loop (cost=0.15..4,049.93 rows=1,897 width=202) (actual time=0.104..52.017 rows=2,981 loops=1)

5. 37.600 37.600 ↓ 1.6 2,981 1

Seq Scan on stocks s (cost=0.00..3,684.32 rows=1,897 width=134) (actual time=0.068..37.600 rows=2,981 loops=1)

  • Filter: ((NOT is_deleted) AND (orientation = 'Supplier'::text) AND (((type_of_return = 'A return'::text) AND (cr2_date IS NOT NULL)) OR ((type_of_return = 'B return'::text) AND (tfp_date IS NOT NULL))))
  • Rows Removed by Filter: 2,882
6. 8.943 8.943 ↑ 1.0 1 2,981

Index Scan using steps_actions_pkey on steps_actions sa (cost=0.15..0.19 rows=1 width=76) (actual time=0.003..0.003 rows=1 loops=2,981)

  • Index Cond: (id = s.step_action_id)
7. 41.734 56.639 ↑ 1.0 1 2,981

Aggregate (cost=20.31..20.32 rows=1 width=32) (actual time=0.019..0.019 rows=1 loops=2,981)

8. 8.943 14.905 ↑ 5.0 2 2,981

Bitmap Heap Scan on ref_stock_statuses status (cost=9.60..20.26 rows=10 width=40) (actual time=0.005..0.005 rows=2 loops=2,981)

  • Recheck Cond: (id = ANY (s.statuses))
  • Heap Blocks: exact=2,981
9. 5.962 5.962 ↑ 5.0 2 2,981

Bitmap Index Scan on ref_stock_statuses_pkey (cost=0.00..9.60 rows=10 width=0) (actual time=0.002..0.002 rows=2 loops=2,981)

  • Index Cond: (id = ANY (s.statuses))
10. 5.962 697.554 ↑ 1.0 1 2,981

Aggregate (cost=49.93..49.94 rows=1 width=8) (actual time=0.234..0.234 rows=1 loops=2,981)

11. 691.592 691.592 ↓ 0.0 0 2,981

Seq Scan on shipments shipment (cost=0.00..49.92 rows=1 width=8) (actual time=0.188..0.232 rows=0 loops=2,981)

  • Filter: (stock_id = s.id)
  • Rows Removed by Filter: 1,836
Execution time : 858.519 ms