explain.depesz.com

PostgreSQL's explain analyze made readable

Result: sW81

Settings
# exclusive inclusive rows x rows loops node
1. 0.160 891.632 ↓ 1.1 130 1

Sort (cost=5,688.56..5,688.85 rows=117 width=879) (actual time=891.627..891.632 rows=130 loops=1)

  • Sort Key: t2.distance, t2.score DESC, t2.merchant_short_id
  • Sort Method: quicksort Memory: 198kB
2. 0.043 891.472 ↓ 1.1 130 1

Subquery Scan on t2 (cost=5,598.79..5,684.54 rows=117 width=879) (actual time=891.212..891.472 rows=130 loops=1)

  • Filter: (t2.group_rn <= 1)
  • Rows Removed by Filter: 93
3. 0.214 891.429 ↑ 1.6 223 1

WindowAgg (cost=5,598.79..5,648.66 rows=350 width=828) (actual time=891.211..891.429 rows=223 loops=1)

4. 0.707 891.215 ↑ 1.6 223 1

Sort (cost=5,598.79..5,599.66 rows=350 width=869) (actual time=891.202..891.215 rows=223 loops=1)

  • Sort Key: merc.group_id, ((merc.available AND (COALESCE(merc.connected, false) OR merc.always_online) AND COALESCE((true), false))) DESC, merc.chain_priority DESC, d.distance, (((merc
  • Sort Method: quicksort Memory: 366kB
5. 0.870 890.508 ↑ 1.6 223 1

Nested Loop Left Join (cost=1.41..5,584.00 rows=350 width=869) (actual time=55.019..890.508 rows=223 loops=1)

6. 0.241 869.791 ↑ 1.6 223 1

Nested Loop (cost=1.12..5,037.12 rows=350 width=758) (actual time=55.008..869.791 rows=223 loops=1)

7. 863.784 863.784 ↓ 2.7 961 1

Nested Loop Left Join (cost=0.86..4,965.99 rows=350 width=726) (actual time=15.934..863.784 rows=961 loops=1)

  • Filter: COALESCE((true), false)
  • Rows Removed by Filter: 180
  • -> Index Scan using search_platform_merchants_suptak_supdel_index on merchants merc (cost=0.42..2779.24 rows=700 width=735) (actual time=0.055..5.263 rows=1141 loo
  • Index Cond: (supports_takeout = true)
  • Filter: (supports_takeout AND available AND (COALESCE(connected, false) OR always_online) AND (channels && '{IFOOD}'::text[]))
  • Rows Removed by Filter: 555
  • -> Index Only Scan using merchant_shifts_merchant_short_id_dow_shift_range_excl on merchant_shifts shift (cost=0.44..3.02 rows=1 width=31) (actual time=0.580..0.74
  • Index Cond: ((merchant_short_id = merc.merchant_short_id) AND (dow = (date_part('dow'::text, timezone((merc.timezone)::text, now())))::integer) AND (shift_rang
  • Heap Fetches: 724
8. 5.766 5.766 ↓ 0.0 0 961

Function Scan on round d (cost=0.26..0.36 rows=1 width=32) (actual time=0.006..0.006 rows=0 loops=961)

  • Filter: (distance <= 15.0)
  • Rows Removed by Filter: 1
9. 19.847 19.847 ↑ 1.0 1 223

Index Scan using chain_external_id_key on merchant_chain chain (cost=0.29..1.56 rows=1 width=115) (actual time=0.089..0.089 rows=1 loops=223)

  • Index Cond: ((merc.group_id)::text = (external_id)::text)
Planning time : 0.785 ms
Execution time : 891.815 ms