explain.depesz.com

PostgreSQL's explain analyze made readable

Result: mr8h

Settings
# exclusive inclusive rows x rows loops node
1. 600.742 1,374.470 ↓ 177.0 177 1

Nested Loop (cost=3,556.42..5,683.18 rows=1 width=40) (actual time=52.825..1,374.470 rows=177 loops=1)

  • Join Filter: (min_areas.rid = da.restaurant_id)
  • Rows Removed by Join Filter: 15462
2. 248.511 297.826 ↓ 16,996.5 33,993 1

Hash Join (cost=3,556.00..5,666.00 rows=2 width=56) (actual time=39.822..297.826 rows=33,993 loops=1)

  • Hash Cond: (dag.area = min_areas.min_area)
3. 9.590 9.798 ↓ 2.4 407 1

Bitmap Heap Scan on delivery_areas_geometry dag (cost=20.16..2,129.50 rows=170 width=56) (actual time=0.275..9.798 rows=407 loops=1)

  • Recheck Cond: (shape ~ '0101000020E610000000000020A4B9184000000054A51C4740'::geometry)
  • Filter: _st_contains(shape, '0101000020E610000000000020A4B9184000000054A51C4740'::geometry)
  • Rows Removed by Filter: 46
  • Heap Blocks: exact=419
4. 0.208 0.208 ↑ 1.1 453 1

Bitmap Index Scan on idx_delivery_areas_geometry_shape (cost=0.00..20.12 rows=511 width=0) (actual time=0.202..0.208 rows=453 loops=1)

  • Index Cond: (shape ~ '0101000020E610000000000020A4B9184000000054A51C4740'::geometry)
5. 1.549 39.517 ↓ 1.2 174 1

Hash (cost=3,534.00..3,534.00 rows=147 width=16) (actual time=39.511..39.517 rows=174 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 17kB
6. 2.903 37.968 ↓ 1.2 174 1

Subquery Scan on min_areas (cost=3,529.59..3,534.00 rows=147 width=16) (actual time=29.204..37.968 rows=174 loops=1)

7. 3.910 35.065 ↓ 1.2 174 1

GroupAggregate (cost=3,529.59..3,532.53 rows=147 width=20) (actual time=29.186..35.065 rows=174 loops=1)

  • Group Key: delivery_areas.type, delivery_areas.restaurant_id
8. 4.461 31.155 ↓ 1.7 253 1

Sort (cost=3,529.59..3,529.96 rows=147 width=20) (actual time=29.044..31.155 rows=253 loops=1)

  • Sort Key: delivery_areas.type, delivery_areas.restaurant_id
  • Sort Method: quicksort Memory: 44kB
9. 9.594 26.694 ↓ 1.7 253 1

Nested Loop (cost=20.58..3,524.30 rows=147 width=20) (actual time=0.496..26.694 rows=253 loops=1)

10. 11.204 11.402 ↓ 2.4 407 1

Bitmap Heap Scan on delivery_areas_geometry (cost=20.16..2,129.50 rows=170 width=16) (actual time=0.276..11.402 rows=407 loops=1)

  • Recheck Cond: (shape ~ '0101000020E610000000000020A4B9184000000054A51C4740'::geometry)
  • Filter: _st_contains(shape, '0101000020E610000000000020A4B9184000000054A51C4740'::geometry)
  • Rows Removed by Filter: 46
  • Heap Blocks: exact=419
11. 0.198 0.198 ↑ 1.1 453 1

Bitmap Index Scan on idx_delivery_areas_geometry_shape (cost=0.00..20.12 rows=511 width=0) (actual time=0.192..0.198 rows=453 loops=1)

  • Index Cond: (shape ~ '0101000020E610000000000020A4B9184000000054A51C4740'::geometry)
12. 5.698 5.698 ↑ 1.0 1 407

Index Scan using idx_502849_primary on delivery_areas (cost=0.42..8.20 rows=1 width=20) (actual time=0.014..0.014 rows=1 loops=407)

  • Index Cond: (id = delivery_areas_geometry.delivery_area_id)
  • Filter: is_active
  • Rows Removed by Filter: 0
13. 475.902 475.902 ↓ 0.0 0 33,993

Index Scan using idx_502849_primary on delivery_areas da (cost=0.42..8.20 rows=1 width=32) (actual time=0.010..0.014 rows=0 loops=33,993)

  • Index Cond: (id = dag.delivery_area_id)
  • Filter: is_active" Rows Removed by Filter: 1