explain.depesz.com

PostgreSQL's explain analyze made readable

Result: gbVH

Settings
# exclusive inclusive rows x rows loops node
1. 0.001 244.151 ↑ 1.0 1 1

Limit (cost=89,767.33..89,767.34 rows=1 width=2,440) (actual time=244.151..244.151 rows=1 loops=1)

2. 0.007 244.150 ↑ 1.0 1 1

Sort (cost=89,767.33..89,767.34 rows=1 width=2,440) (actual time=244.150..244.150 rows=1 loops=1)

  • Sort Key: purchase_orders.created_at
  • Sort Method: quicksort Memory: 26kB
3. 0.014 244.143 ↑ 1.0 1 1

Nested Loop Left Join (cost=70,138.93..89,767.32 rows=1 width=2,440) (actual time=237.644..244.143 rows=1 loops=1)

  • Join Filter: (locations.id = purchase_orders.location_id)
  • Rows Removed by Join Filter: 133
4. 0.045 244.118 ↑ 1.0 1 1

Nested Loop Left Join (cost=70,138.93..89,762.31 rows=1 width=2,383) (actual time=237.637..244.118 rows=1 loops=1)

  • Join Filter: (vendors.id = purchase_orders.vendor_id)
  • Rows Removed by Join Filter: 657
5. 0.743 243.954 ↑ 1.0 1 1

Nested Loop Left Join (cost=70,138.93..89,739.55 rows=1 width=2,334) (actual time=237.502..243.954 rows=1 loops=1)

  • Filter: (((items.vendor_name)::text = 'PO-231988'::text) OR ((purchase_orders.transaction_id)::text = 'PO-231988'::text))
  • Rows Removed by Filter: 1,572
6. 9.507 238.492 ↑ 10.4 1,573 1

Merge Right Join (cost=70,138.51..80,335.46 rows=16,418 width=1,207) (actual time=219.768..238.492 rows=1,573 loops=1)

  • Merge Cond: (purchase_orders.id = purchase_order_lines.purchase_order_id)
  • Filter: ((purchase_orders.status IS NULL) OR ((purchase_orders.status)::text <> ALL ('{"Fully Billed","Helt fakturerad","Approved by Supervisor/Pending Bill","Godkänd av chef/Väntande faktura","Pending Bill","Väntande faktura",Closed,Stängd,Rejected,Avvisad}'::text[])))
  • Rows Removed by Filter: 284
7. 30.398 30.398 ↑ 1.0 103,957 1

Index Scan using idx_131924_primary on purchase_orders (cost=0.29..4,586.06 rows=103,957 width=1,110) (actual time=0.005..30.398 rows=103,957 loops=1)

8. 0.305 198.587 ↑ 96.1 1,857 1

Materialize (cost=70,135.05..71,027.46 rows=178,482 width=97) (actual time=198.096..198.587 rows=1,857 loops=1)

9. 0.540 198.282 ↑ 96.1 1,857 1

Sort (cost=70,135.05..70,581.26 rows=178,482 width=97) (actual time=198.095..198.282 rows=1,857 loops=1)

  • Sort Key: purchase_order_lines.purchase_order_id
  • Sort Method: quicksort Memory: 317kB
10. 197.742 197.742 ↑ 96.1 1,857 1

Seq Scan on purchase_order_lines (cost=0.00..44,805.08 rows=178,482 width=97) (actual time=42.042..197.742 rows=1,857 loops=1)

  • Filter: ((quantity_received < quantity) AND (COALESCE(modified_earliest_delivery_date, '2020-09-13'::date) <= '2020-09-14'::date))
  • Rows Removed by Filter: 1,604,482
11. 4.719 4.719 ↑ 1.0 1 1,573

Index Scan using idx_131692_primary on items (cost=0.42..0.56 rows=1 width=1,127) (actual time=0.003..0.003 rows=1 loops=1,573)

  • Index Cond: (id = purchase_order_lines.item_id)
12. 0.119 0.119 ↓ 1.0 658 1

Seq Scan on vendors (cost=0.00..14.56 rows=656 width=49) (actual time=0.002..0.119 rows=658 loops=1)

13. 0.011 0.011 ↑ 1.0 134 1

Seq Scan on locations (cost=0.00..3.34 rows=134 width=57) (actual time=0.003..0.011 rows=134 loops=1)