explain.depesz.com

PostgreSQL's explain analyze made readable

Result: yj20M

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 8.740 ↑ 15.0 2 1

Limit (cost=2,348.31..2,348.39 rows=30 width=551) (actual time=8.737..8.740 rows=2 loops=1)

2. 0.015 8.737 ↑ 37.0 2 1

Sort (cost=2,348.31..2,348.50 rows=74 width=551) (actual time=8.736..8.737 rows=2 loops=1)

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

Subquery Scan on t2 (cost=2,291.74..2,346.13 rows=74 width=551) (actual time=8.701..8.722 rows=2 loops=1)

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

WindowAgg (cost=2,291.74..2,323.37 rows=222 width=500) (actual time=8.699..8.715 rows=7 loops=1)

5. 0.033 8.693 ↑ 31.7 7 1

Sort (cost=2,291.74..2,292.29 rows=222 width=616) (actual time=8.689..8.693 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.021 8.660 ↑ 31.7 7 1

Nested Loop Left Join (cost=1.26..2,283.09 rows=222 width=616) (actual time=2.446..8.660 rows=7 loops=1)

7. 0.323 8.590 ↑ 31.7 7 1

Nested Loop (cost=0.98..2,012.43 rows=222 width=538) (actual time=2.432..8.590 rows=7 loops=1)

8. 5.256 6.977 ↑ 1.0 215 1

Nested Loop Left Join (cost=0.72..1,967.22 rows=222 width=506) (actual time=0.133..6.977 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.018
9. 1.721 1.721 ↑ 2.0 220 1

Index Scan using idx_merchant_test1 on merchants merc (cost=0.29..796.37 rows=443 width=519) (actual time=0.058..1.721 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: 16
10. 1.290 1.290 ↓ 0.0 0 215

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

  • Filter: (distance <= 15.0)
  • Rows Removed by Filter: 1
11. 0.049 0.049 ↑ 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.007..0.007 rows=1 loops=7)

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