explain.depesz.com

PostgreSQL's explain analyze made readable

Result: xdwu

Settings
# exclusive inclusive rows x rows loops node
1. 0.005 127.338 ↑ 15.0 2 1

Limit (cost=2,952.02..2,952.09 rows=30 width=551) (actual time=127.334..127.338 rows=2 loops=1)

2. 0.015 127.333 ↑ 37.0 2 1

Sort (cost=2,952.02..2,952.20 rows=74 width=551) (actual time=127.332..127.333 rows=2 loops=1)

  • Sort Key: t2.distance, t2.score DESC, t2.merchant_short_id
  • Sort Method: quicksort Memory: 26kB
3. 0.008 127.318 ↑ 37.0 2 1

Subquery Scan on t2 (cost=2,895.44..2,949.83 rows=74 width=551) (actual time=127.296..127.318 rows=2 loops=1)

  • Filter: (t2.group_rn <= 1)
  • Rows Removed by Filter: 5
4. 0.026 127.310 ↑ 31.7 7 1

WindowAgg (cost=2,895.44..2,927.08 rows=222 width=500) (actual time=127.293..127.310 rows=7 loops=1)

5. 0.040 127.284 ↑ 31.7 7 1

Sort (cost=2,895.44..2,896.00 rows=222 width=616) (actual time=127.280..127.284 rows=7 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, (
  • Sort Method: quicksort Memory: 28kB
6. 0.037 127.244 ↑ 31.7 7 1

Nested Loop Left Join (cost=1.26..2,886.79 rows=222 width=616) (actual time=59.580..127.244 rows=7 loops=1)

7. 0.528 127.109 ↑ 31.7 7 1

Nested Loop (cost=0.98..2,616.13 rows=222 width=538) (actual time=59.548..127.109 rows=7 loops=1)

8. 111.741 124.431 ↑ 1.0 215 1

Nested Loop Left Join (cost=0.72..2,570.92 rows=222 width=506) (actual time=0.072..124.431 rows=215 loops=1)

  • Filter: COALESCE((true), false)
  • Rows Removed by Filter: 5
  • -> Index Only Scan using merchant_shifts_merchant_short_id_dow_shift_range_excl on merchant_shifts shift (cost=0.43..2.54 rows=1 width=31) (actual time=0.374
9. 12.690 12.690 ↑ 2.0 220 1

Index Scan using idx_merchant_test1 on merchants merc (cost=0.29..1,400.08 rows=443 width=519) (actual time=0.017..12.690 rows=220 loops=1)

  • Index Cond: (supports_takeout = true)
  • Filter: (supports_takeout AND (NOT supports_dark_kitchen) AND available AND (COALESCE(connected, false) OR always_online) AND (channels && '{IFOOD}'::tex
  • Rows Removed by Filter: 998
  • Index Cond: ((merchant_short_id = merc.merchant_short_id) AND (dow = (date_part('dow'::text, timezone((merc.timezone)::text, now())))::integer) AND (shif
  • Heap Fetches: 17
10. 2.150 2.150 ↓ 0.0 0 215

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

  • Filter: (distance <= 15.0)
  • Rows Removed by Filter: 1
11. 0.098 0.098 ↑ 1.0 1 7

Index Scan using chain_external_id_key on merchant_chain chain (cost=0.28..1.21 rows=1 width=82) (actual time=0.014..0.014 rows=1 loops=7)

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