explain.depesz.com

PostgreSQL's explain analyze made readable

Result: NyLu

Settings
# exclusive inclusive rows x rows loops node
1. 0.154 149.770 ↓ 51.0 51 1

Sort (cost=4,306.15..4,306.15 rows=1 width=716) (actual time=149.768..149.770 rows=51 loops=1)

  • Sort Key: t4.open DESC, t4.term_score DESC, t4.merchant_short_id
  • Sort Method: quicksort Memory: 69kB
2. 0.025 149.616 ↓ 51.0 51 1

Subquery Scan on t4 (cost=4,305.92..4,306.14 rows=1 width=716) (actual time=149.432..149.616 rows=51 loops=1)

  • Filter: (t4.catalog_items_rn <= 2)
  • Rows Removed by Filter: 222
3. 0.155 149.591 ↓ 273.0 273 1

WindowAgg (cost=4,305.92..4,306.04 rows=1 width=792) (actual time=149.430..149.591 rows=273 loops=1)

4. 0.322 149.436 ↓ 273.0 273 1

Sort (cost=4,305.92..4,305.92 rows=1 width=618) (actual time=149.425..149.436 rows=273 loops=1)

  • Sort Key: t2.merchant_id, (NULLIF((ts_rank_cd(catalog_item.fts, q.tsquery))::double precision, '0'::double precision))
  • Sort Method: quicksort Memory: 314kB
5. 3.000 149.114 ↓ 273.0 273 1

Nested Loop (cost=715.74..4,305.91 rows=1 width=618) (actual time=124.439..149.114 rows=273 loops=1)

  • Join Filter: (catalog_item.fts @@@ q.tsquery)
  • Rows Removed by Join Filter: 12288
6. 0.003 0.003 ↑ 1.0 1 1

Function Scan on q (cost=0.00..0.10 rows=1 width=32) (actual time=0.002..0.003 rows=1 loops=1)

7. 2.200 146.111 ↓ 1,570.1 12,561 1

Nested Loop (cost=715.74..4,304.98 rows=8 width=739) (actual time=124.080..146.111 rows=12,561 loops=1)

8. 0.033 124.463 ↓ 15.9 286 1

Subquery Scan on t2 (cost=715.31..728.14 rows=18 width=447) (actual time=124.053..124.463 rows=286 loops=1)

  • Filter: (t2.group_rn <= 1)
  • Rows Removed by Filter: 10
9. 0.347 124.430 ↓ 5.5 296 1

WindowAgg (cost=715.31..722.60 rows=54 width=536) (actual time=124.052..124.430 rows=296 loops=1)

10. 0.604 124.083 ↓ 5.5 296 1

Sort (cost=715.31..715.45 rows=54 width=431) (actual time=124.043..124.083 rows=296 loops=1)

  • Sort Key: merc.group_id, (COALESCE((true), false)) DESC, d.distance, t.delivery_fee, (((merc.evaluations #>> '{IFOOD,avg}'::text[]))::real) DESC, merc.merchant_short_id
  • Sort Method: quicksort Memory: 225kB
11. 0.446 123.479 ↓ 5.5 296 1

Nested Loop (cost=119.49..713.76 rows=54 width=431) (actual time=113.917..123.479 rows=296 loops=1)

12. 2.527 121.553 ↓ 5.5 296 1

Nested Loop Left Join (cost=119.23..702.29 rows=54 width=604) (actual time=113.706..121.553 rows=296 loops=1)

  • Filter: COALESCE((true), false)
  • Rows Removed by Filter: 311
13. 0.420 116.598 ↓ 5.6 607 1

Nested Loop (cost=118.79..606.79 rows=108 width=603) (actual time=113.678..116.598 rows=607 loops=1)

14. 0.101 114.030 ↓ 6.6 716 1

Subquery Scan on t (cost=118.38..130.09 rows=108 width=30) (actual time=113.667..114.030 rows=716 loops=1)

  • Filter: (t.mode <> 'EXCLUSION'::delivery_mode)
  • Rows Removed by Filter: 19
15. 0.161 113.929 ↓ 6.7 735 1

Unique (cost=118.38..118.92 rows=109 width=46) (actual time=113.666..113.929 rows=735 loops=1)

16. 0.393 113.768 ↓ 6.8 745 1

Sort (cost=118.38..118.65 rows=109 width=46) (actual time=113.665..113.768 rows=745 loops=1)

  • Sort Key: dels.owner_id, ((dels.mode <> 'EXCLUSION'::delivery_mode)), dels.zipcode COLLATE "C", dels.priority
  • Sort Method: quicksort Memory: 83kB
17. 0.326 113.375 ↓ 6.8 745 1

Nested Loop (cost=0.98..114.69 rows=109 width=46) (actual time=2.810..113.375 rows=745 loops=1)

18. 110.417 110.417 ↓ 658.0 658 1

Index Scan using polygons_geom_idx on polygons pol (cost=0.55..4.90 rows=1 width=16) (actual time=2.798..110.417 rows=658 loops=1)

  • Index Cond: (geom && '0101000020E61000008EDF2582828647C06D945055FCDA36C0'::geometry)
  • Filter: _st_intersects(geom, '0101000020E61000008EDF2582828647C06D945055FCDA36C0'::geometry)
  • Rows Removed by Filter: 225
19. 2.632 2.632 ↑ 110.0 1 658

Index Scan using deliveries_pol_id_idx on deliveries dels (cost=0.43..98.51 rows=110 width=61) (actual time=0.004..0.004 rows=1 loops=658)

  • Index Cond: (pol_id = pol.pol_id)
20. 2.148 2.148 ↑ 1.0 1 716

Index Scan using merchants_pkey on merchants merc (cost=0.42..4.41 rows=1 width=589) (actual time=0.003..0.003 rows=1 loops=716)

  • Index Cond: (merchant_id = t.owner_id)
21. 2.428 2.428 ↓ 0.0 0 607

Index Only Scan using merchant_shifts_pkey on merchant_shifts shift (cost=0.43..0.78 rows=1 width=31) (actual time=0.004..0.004 rows=0 loops=607)

  • Index Cond: ((merchant_short_id = merc.merchant_short_id) AND (dow = (date_part('dow'::text, timezone((merc.timezone)::text, now())))::integer))
  • Filter: (shift_range @> timerange((timezone((merc.timezone)::text, now()))::time without time zone, (timezone((merc.timezone)::text, now()))::time without time zone, '[]'::text))
  • Rows Removed by Filter: 0
  • Heap Fetches: 172
22. 1.480 1.480 ↑ 1.0 1 296

Function Scan on round d (cost=0.26..0.36 rows=1 width=32) (actual time=0.005..0.005 rows=1 loops=296)

23. 19.448 19.448 ↓ 44.0 44 286

Index Scan using catalog_items_merchant_short_id_idx on catalog_items catalog_item (cost=0.43..198.61 rows=1 width=726) (actual time=0.006..0.068 rows=44 loops=286)

  • Index Cond: (merchant_short_id = t2.merchant_short_id)
  • Filter: (((range_of_times IS NULL) OR ((timezone((t2.timezone)::text, to_timestamp((trunc((date_part('epoch'::text, now()) / '900'::double precision)) * '900'::double precision))))::time without time zone = ANY (range_of_times))) AND (date_part('dow'::text, now()) = ANY ((COALESCE(days, '{0,1,2,3,4,5,6}'::integer[]))::double precision[])))
  • Rows Removed by Filter: 3