explain.depesz.com

PostgreSQL's explain analyze made readable

Result: SrhQ

Settings
# exclusive inclusive rows x rows loops node
1. 0.001 197.244 ↓ 3.0 3 1

Limit (cost=89,701.78..89,701.79 rows=1 width=2,440) (actual time=197.243..197.244 rows=3 loops=1)

2. 0.012 197.243 ↓ 3.0 3 1

Sort (cost=89,701.78..89,701.79 rows=1 width=2,440) (actual time=197.243..197.243 rows=3 loops=1)

  • Sort Key: purchase_orders.created_at
  • Sort Method: quicksort Memory: 28kB
3. 0.042 197.231 ↓ 3.0 3 1

Nested Loop Left Join (cost=70,093.16..89,701.77 rows=1 width=2,440) (actual time=193.924..197.231 rows=3 loops=1)

  • Join Filter: (locations.id = purchase_orders.location_id)
  • Rows Removed by Join Filter: 399
4. 0.126 197.165 ↓ 3.0 3 1

Nested Loop Left Join (cost=70,093.16..89,696.76 rows=1 width=2,383) (actual time=193.910..197.165 rows=3 loops=1)

  • Join Filter: (vendors.id = purchase_orders.vendor_id)
  • Rows Removed by Join Filter: 1,971
5. 0.000 196.802 ↓ 3.0 3 1

Nested Loop Left Join (cost=70,093.16..89,674.00 rows=1 width=2,334) (actual time=193.876..196.802 rows=3 loops=1)

  • Filter: (((items.vendor_name)::text = '446688'::text) OR ((purchase_orders.transaction_id)::text = '446688'::text))
  • Rows Removed by Filter: 1,570
6. 7.931 192.299 ↑ 10.4 1,573 1

Merge Right Join (cost=70,092.75..80,276.60 rows=16,403 width=1,207) (actual time=177.286..192.299 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. 24.216 24.216 ↓ 1.0 103,957 1

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

8. 0.244 160.152 ↑ 96.0 1,857 1

Materialize (cost=70,089.32..70,980.89 rows=178,313 width=97) (actual time=159.740..160.152 rows=1,857 loops=1)

9. 0.584 159.908 ↑ 96.0 1,857 1

Sort (cost=70,089.32..70,535.10 rows=178,313 width=97) (actual time=159.736..159.908 rows=1,857 loops=1)

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

Seq Scan on purchase_order_lines (cost=0.00..44,782.32 rows=178,313 width=97) (actual time=32.699..159.324 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.002..0.003 rows=1 loops=1,573)

  • Index Cond: (id = purchase_order_lines.item_id)
12. 0.237 0.237 ↓ 1.0 658 3

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

13. 0.024 0.024 ↑ 1.0 134 3

Seq Scan on locations (cost=0.00..3.34 rows=134 width=57) (actual time=0.002..0.008 rows=134 loops=3)