explain.depesz.com

PostgreSQL's explain analyze made readable

Result: gWMi

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 746.329 ↓ 0.0 0 1

Limit (cost=44,251.82..44,251.82 rows=1 width=1,014) (actual time=746.329..746.329 rows=0 loops=1)

2. 0.037 746.326 ↓ 0.0 0 1

Sort (cost=44,251.82..44,251.82 rows=1 width=1,014) (actual time=746.326..746.326 rows=0 loops=1)

  • Sort Key: orders.id
  • Sort Method: quicksort Memory: 25kB
3. 0.085 746.289 ↓ 0.0 0 1

Nested Loop Left Join (cost=1.15..44,251.81 rows=1 width=1,014) (actual time=746.289..746.289 rows=0 loops=1)

  • Filter: ((COALESCE(eatery_shipping_fees.city_id, 0) = 50) OR (COALESCE(orders.city_id, 0) = 50))
  • Rows Removed by Filter: 1
4. 47.332 745.972 ↑ 1.0 1 1

Nested Loop (cost=0.86..44,251.48 rows=1 width=1,014) (actual time=738.222..745.972 rows=1 loops=1)

5. 318.453 318.453 ↓ 9.0 42,243 1

Index Scan using shipping_transactions_created_at_idx on shipping_transactions (cost=0.43..2,775.24 rows=4,681 width=12) (actual time=5.683..318.453 rows=42,243 loops=1)

  • Index Cond: ((created_at > '2018-11-28 00:00:00+07'::timestamp with time zone) AND (created_at < '2018-11-28 23:59:59+07'::timestamp with time zone))
  • Filter: ((shipper_note IS NOT NULL) AND (shipper_note <> ''::text))
  • Rows Removed by Filter: 107298
6. 347.088 380.187 ↓ 0.0 0 42,243

Index Scan using orders_pkey on orders (cost=0.42..8.85 rows=1 width=1,014) (actual time=0.009..0.009 rows=0 loops=42,243)

  • Index Cond: (id = shipping_transactions.order_id)
  • Filter: ((status = 'done'::order_status_enum) AND (shipping_transactions.created_by = shipper_id) AND (NOT (SubPlan 1)))
  • Rows Removed by Filter: 1
7.          

SubPlan (forIndex Scan)

8. 1.298 33.099 ↑ 1.0 1 649

Limit (cost=0.43..1.06 rows=1 width=0) (actual time=0.051..0.051 rows=1 loops=649)

9. 31.801 31.801 ↑ 44.0 1 649

Index Scan using shipping_transactions_order_id_idx on shipping_transactions tmp_shipping_transactions (cost=0.43..28.13 rows=44 width=0) (actual time=0.049..0.049 rows=1 loops=649)

  • Index Cond: (order_id = orders.id)
  • Filter: ((id > shipping_transactions.id) AND ((COALESCE(manager_note, ''::text) <> ''::text) OR (COALESCE(shipper_note, ''::text) <> ''::text) OR (action = 'done'::order_status_enum)))
  • Rows Removed by Filter: 1
10. 0.232 0.232 ↑ 1.0 1 1

Index Only Scan using eatery_shipping_fees_eatery_id_city_id_idx on eatery_shipping_fees (cost=0.29..0.31 rows=1 width=8) (actual time=0.231..0.232 rows=1 loops=1)

  • Index Cond: (eatery_id = orders.eatery_id)
  • Heap Fetches: 1