explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Jyv5 : DEV -> indice PARCIAL no campo "supports_takeout" e "supports_delivery" -> order by com o campo "distance"

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

Limit (cost=123.72..123.72 rows=2 width=551) (actual time=0.414..0.415 rows=0 loops=1)

2. 0.009 0.412 ↓ 0.0 0 1

Sort (cost=123.72..123.72 rows=2 width=551) (actual time=0.412..0.412 rows=0 loops=1)

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

Subquery Scan on t2 (cost=122.24..123.71 rows=2 width=551) (actual time=0.402..0.403 rows=0 loops=1)

  • Filter: (t2.group_rn <= 1)
4. 0.003 0.401 ↓ 0.0 0 1

WindowAgg (cost=122.24..123.09 rows=6 width=500) (actual time=0.400..0.401 rows=0 loops=1)

5. 0.010 0.398 ↓ 0.0 0 1

Sort (cost=122.24..122.25 rows=6 width=616) (actual time=0.398..0.398 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.001 0.388 ↓ 0.0 0 1

Nested Loop Left Join (cost=5.14..122.16 rows=6 width=616) (actual time=0.388..0.388 rows=0 loops=1)

7. 0.004 0.387 ↓ 0.0 0 1

Nested Loop (cost=4.86..96.87 rows=6 width=538) (actual time=0.386..0.387 rows=0 loops=1)

8. 0.089 0.126 ↑ 6.0 1 1

Nested Loop Left Join (cost=4.60..95.39 rows=6 width=506) (actual time=0.098..0.126 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.060
9. 0.027 0.037 ↑ 11.0 1 1

Bitmap Heap Scan on merchants merc (cost=4.16..64.27 rows=11 width=519) (actual time=0.021..0.037 rows=1 loops=1)

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

Bitmap Index Scan on idx_merchant_parcial1 (cost=0.00..4.16 rows=30 width=0) (actual time=0.009..0.010 rows=5 loops=1)

11. 0.257 0.257 ↓ 0.0 0 1

Function Scan on round d (cost=0.26..0.36 rows=1 width=32) (actual time=0.256..0.257 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)
Planning time : 1.655 ms
Execution time : 0.756 ms