explain.depesz.com

PostgreSQL's explain analyze made readable

Result: RO93

Settings
# exclusive inclusive rows x rows loops node
1. 2.103 475.535 ↓ 711.0 711 1

Sort (cost=5,851.13..5,851.13 rows=1 width=713) (actual time=475.507..475.535 rows=711 loops=1)

  • Sort Key: t4.open DESC, t4.term_score DESC, t4.merchant_short_id
  • Sort Method: quicksort Memory: 703kB
2. 0.141 473.432 ↓ 711.0 711 1

Subquery Scan on t4 (cost=5,850.90..5,851.12 rows=1 width=713) (actual time=472.804..473.432 rows=711 loops=1)

  • Filter: (t4.catalog_items_rn <= 100)
  • Rows Removed by Filter: 36
3. 0.453 473.291 ↓ 747.0 747 1

WindowAgg (cost=5,850.90..5,851.02 rows=1 width=757) (actual time=472.802..473.291 rows=747 loops=1)

4. 0.770 472.838 ↓ 747.0 747 1

Sort (cost=5,850.90..5,850.90 rows=1 width=615) (actual time=472.797..472.838 rows=747 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: 727kB
5. 1.178 472.068 ↓ 747.0 747 1

Nested Loop (cost=1,002.14..5,850.89 rows=1 width=615) (actual time=142.477..472.068 rows=747 loops=1)

6. 0.004 0.004 ↑ 1.0 1 1

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

7. 0.725 470.886 ↓ 106.7 747 1

Nested Loop (cost=1,002.14..5,850.08 rows=7 width=736) (actual time=142.468..470.886 rows=747 loops=1)

8. 0.069 134.758 ↓ 13.8 249 1

Subquery Scan on t2 (cost=720.13..732.96 rows=18 width=444) (actual time=133.841..134.758 rows=249 loops=1)

  • Filter: (t2.group_rn <= 1)
  • Rows Removed by Filter: 5
9. 0.764 134.689 ↓ 4.7 254 1

WindowAgg (cost=720.13..727.42 rows=54 width=501) (actual time=133.840..134.689 rows=254 loops=1)

10. 0.579 133.925 ↓ 4.7 254 1

Sort (cost=720.13..720.27 rows=54 width=428) (actual time=133.832..133.925 rows=254 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: 199kB
11. 0.398 133.346 ↓ 4.7 254 1

Nested Loop (cost=119.49..718.58 rows=54 width=428) (actual time=126.379..133.346 rows=254 loops=1)

12. 0.297 131.678 ↓ 4.7 254 1

Nested Loop Left Join (cost=119.23..707.11 rows=54 width=602) (actual time=126.157..131.678 rows=254 loops=1)

  • Filter: COALESCE((true), false)
  • Rows Removed by Filter: 353
13. 0.347 128.953 ↓ 5.6 607 1

Nested Loop (cost=118.79..606.79 rows=108 width=601) (actual time=126.107..128.953 rows=607 loops=1)

14. 0.099 126.458 ↓ 6.6 716 1

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

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

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

16. 0.396 126.200 ↓ 6.8 745 1

Sort (cost=118.38..118.65 rows=109 width=46) (actual time=126.093..126.200 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.232 125.804 ↓ 6.8 745 1

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

18. 122.940 122.940 ↓ 658.0 658 1

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

  • Index Cond: (geom && '0101000020E61000008EDF2582828647C06D945055FCDA36C0'::geometry)
  • Filter: _st_intersects(geom, '0101000020E61000008EDF2582828647C06D945055FCDA36C0'::geometry)
  • Rows Removed by Filter: 226
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=587) (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: 0
  • Heap Fetches: 319
22. 1.270 1.270 ↑ 1.0 1 254

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

23. 1.743 335.403 ↓ 3.0 3 249

Bitmap Heap Scan on catalog_items catalog_item (cost=282.00..284.18 rows=1 width=724) (actual time=1.343..1.347 rows=3 loops=249)

  • 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=565
24. 333.660 333.660 ↓ 3.0 3 249

Bitmap Index Scan on catalog_items_merchant_short_id_fts_idx (cost=0.00..282.00 rows=1 width=0) (actual time=1.340..1.340 rows=3 loops=249)

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