explain.depesz.com

PostgreSQL's explain analyze made readable

Result: l8mf

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 0.374 ↓ 0.0 0 1

Limit (cost=111.94..111.94 rows=2 width=551) (actual time=0.374..0.374 rows=0 loops=1)

2. 0.011 0.372 ↓ 0.0 0 1

Sort (cost=111.94..111.94 rows=2 width=551) (actual time=0.371..0.372 rows=0 loops=1)

  • Sort Key: t2.distance, t2.score DESC, t2.merchant_short_id
  • Sort Method: quicksort Memory: 25kB
3. 0.002 0.361 ↓ 0.0 0 1

Subquery Scan on t2 (cost=110.46..111.93 rows=2 width=551) (actual time=0.360..0.361 rows=0 loops=1)

  • Filter: (t2.group_rn <= 1)
4. 0.002 0.359 ↓ 0.0 0 1

WindowAgg (cost=110.46..111.31 rows=6 width=500) (actual time=0.359..0.359 rows=0 loops=1)

5. 0.011 0.357 ↓ 0.0 0 1

Sort (cost=110.46..110.47 rows=6 width=616) (actual time=0.356..0.357 rows=0 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: 25kB
6. 0.002 0.346 ↓ 0.0 0 1

Nested Loop Left Join (cost=5.13..110.38 rows=6 width=616) (actual time=0.345..0.346 rows=0 loops=1)

7. 0.021 0.344 ↓ 0.0 0 1

Nested Loop (cost=4.84..85.08 rows=6 width=538) (actual time=0.344..0.344 rows=0 loops=1)

8. 0.089 0.122 ↑ 6.0 1 1

Nested Loop Left Join (cost=4.58..83.61 rows=6 width=506) (actual time=0.102..0.122 rows=1 loops=1)

  • Filter: COALESCE((true), false)
  • -> Index Only Scan using merchant_shifts_merchant_short_id_dow_shift_range_excl on merchant_shifts shift (cost=0.43..2.73 rows=1 width=31) (actual time=0.059
9. 0.015 0.033 ↑ 11.0 1 1

Bitmap Heap Scan on merchants merc (cost=4.15..52.49 rows=11 width=519) (actual time=0.026..0.033 rows=1 loops=1)

  • Recheck Cond: ((channels && '{IFOOD}'::text[]) AND supports_takeout AND (NOT supports_delivery) AND (NOT supports_dark_kitchen))
  • Filter: (available AND (COALESCE(connected, false) OR always_online))
  • Rows Removed by Filter: 2
  • Heap Blocks: exact=3
  • 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: 1
10. 0.018 0.018 ↑ 8.0 3 1

Bitmap Index Scan on idx_merchant_test (cost=0.00..4.14 rows=24 width=0) (actual time=0.018..0.018 rows=3 loops=1)

11. 0.201 0.201 ↓ 0.0 0 1

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

  • Filter: (distance <= 15.0)
  • Rows Removed by Filter: 1
12. 0.000 0.000 ↓ 0.0 0

Index Scan using chain_external_id_key on merchant_chain chain (cost=0.28..4.21 rows=1 width=82) (never executed)

  • Index Cond: ((merc.group_id)::text = (external_id)::text)