explain.depesz.com

PostgreSQL's explain analyze made readable

Result: li3t

Settings
# exclusive inclusive rows x rows loops node
1. 0.300 351.238 ↓ 80.0 80 1

Sort (cost=7,723.16..7,723.16 rows=1 width=713) (actual time=351.233..351.238 rows=80 loops=1)

  • Sort Key: t4.open DESC, t4.term_score DESC, t4.merchant_short_id
  • Sort Method: quicksort Memory: 117kB
2. 0.029 350.938 ↓ 80.0 80 1

Subquery Scan on t4 (cost=7,722.93..7,723.15 rows=1 width=713) (actual time=350.812..350.938 rows=80 loops=1)

  • Filter: (t4.catalog_items_rn <= 100)
3. 0.100 350.909 ↓ 80.0 80 1

WindowAgg (cost=7,722.93..7,723.05 rows=1 width=789) (actual time=350.809..350.909 rows=80 loops=1)

4. 0.139 350.809 ↓ 80.0 80 1

Sort (cost=7,722.93..7,722.93 rows=1 width=615) (actual time=350.803..350.809 rows=80 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: 116kB
5. 0.164 350.670 ↓ 80.0 80 1

Nested Loop (cost=1,106.17..7,722.92 rows=1 width=615) (actual time=123.063..350.670 rows=80 loops=1)

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. 0.253 350.503 ↓ 11.4 80 1

Nested Loop (cost=1,106.17..7,722.11 rows=7 width=736) (actual time=123.051..350.503 rows=80 loops=1)

8. 0.039 117.930 ↓ 7.3 132 1

Subquery Scan on t2 (cost=720.16..732.99 rows=18 width=444) (actual time=117.449..117.930 rows=132 loops=1)

  • Filter: (t2.group_rn <= 1)
  • Rows Removed by Filter: 6
9. 0.409 117.891 ↓ 2.6 138 1

WindowAgg (cost=720.16..727.45 rows=54 width=533) (actual time=117.448..117.891 rows=138 loops=1)

10. 0.297 117.482 ↓ 2.6 138 1

Sort (cost=720.16..720.30 rows=54 width=428) (actual time=117.440..117.482 rows=138 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: 117kB
11. 0.205 117.185 ↓ 2.6 138 1

Nested Loop (cost=119.49..718.61 rows=54 width=428) (actual time=110.865..117.185 rows=138 loops=1)

12. 0.258 116.152 ↓ 2.6 138 1

Nested Loop Left Join (cost=119.23..707.14 rows=54 width=600) (actual time=110.642..116.152 rows=138 loops=1)

  • Filter: COALESCE((true), false)
  • Rows Removed by Filter: 469
13. 0.465 113.466 ↓ 5.6 607 1

Nested Loop (cost=118.79..606.79 rows=108 width=599) (actual time=110.528..113.466 rows=607 loops=1)

14. 0.095 110.853 ↓ 6.6 716 1

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

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

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

16. 0.389 110.613 ↓ 6.8 745 1

Sort (cost=118.38..118.65 rows=109 width=46) (actual time=110.514..110.613 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.198 110.224 ↓ 6.8 745 1

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

18. 107.394 107.394 ↓ 658.0 658 1

Index Scan using polygons_geom_idx on polygons pol (cost=0.55..4.90 rows=1 width=16) (actual time=1.038..107.394 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=585) (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.83 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: 1
  • Heap Fetches: 273
22. 0.828 0.828 ↑ 1.0 1 138

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

23. 0.396 232.320 ↑ 1.0 1 132

Bitmap Heap Scan on catalog_items catalog_item (cost=386.00..388.18 rows=1 width=724) (actual time=1.759..1.760 rows=1 loops=132)

  • Recheck Cond: ((merchant_short_id = t2.merchant_short_id) AND (fts @@@ q.tsquery))
  • 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: 0
  • Heap Blocks: exact=70
24. 231.924 231.924 ↑ 1.0 1 132

Bitmap Index Scan on catalog_items_merchant_short_id_fts_idx (cost=0.00..386.00 rows=1 width=0) (actual time=1.757..1.757 rows=1 loops=132)

  • Index Cond: ((merchant_short_id = t2.merchant_short_id) AND (fts @@@ q.tsquery))