explain.depesz.com

PostgreSQL's explain analyze made readable

Result: lChr : DEV -> indice no campo "supports_takeout" -> order by com o campo "distance" -> sem os campo "supports_delivery" no SELECT e WHERE

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

Limit (cost=2,348.31..2,348.39 rows=30 width=550) (actual time=210.303..210.304 rows=0 loops=1)

2. 0.007 210.301 ↓ 0.0 0 1

Sort (cost=2,348.31..2,348.50 rows=74 width=550) (actual time=210.301..210.301 rows=0 loops=1)

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

Subquery Scan on t2 (cost=2,291.74..2,346.13 rows=74 width=550) (actual time=210.293..210.294 rows=0 loops=1)

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

WindowAgg (cost=2,291.74..2,323.37 rows=222 width=499) (actual time=210.292..210.292 rows=0 loops=1)

5. 0.011 210.289 ↓ 0.0 0 1

Sort (cost=2,291.74..2,292.29 rows=222 width=615) (actual time=210.289..210.289 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 210.278 ↓ 0.0 0 1

Nested Loop Left Join (cost=1.26..2,283.09 rows=222 width=615) (actual time=210.278..210.278 rows=0 loops=1)

7. 0.381 210.277 ↓ 0.0 0 1

Nested Loop (cost=0.98..2,012.43 rows=222 width=537) (actual time=210.276..210.277 rows=0 loops=1)

8. 206.311 208.042 ↑ 1.1 206 1

Nested Loop Left Join (cost=0.72..1,967.22 rows=222 width=505) (actual time=0.148..208.042 rows=206 loops=1)

  • Filter: COALESCE((true), false)
  • Rows Removed by Filter: 14
  • -> 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.837
9. 1.731 1.731 ↑ 2.0 220 1

Index Scan using idx_merchant_test1 on merchants merc (cost=0.29..796.37 rows=443 width=518) (actual time=0.019..1.731 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. 1.854 1.854 ↓ 0.0 0 206

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

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

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

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