explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 4Y6Y : Optimization for: plan #Lu6B

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Limit (cost=18,590.60..18,590.60 rows=15 width=1,335) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Sort (cost=18,590.60..18,590.62 rows=54 width=1,335) (actual rows= loops=)

  • Sort Key: (min(units.price_per_month_cents))
3. 0.000 0.000 ↓ 0.0

Nested Loop (cost=6,250.33..18,590.33 rows=54 width=1,335) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Merge Join (cost=6,246.23..18,368.69 rows=54 width=1,331) (actual rows= loops=)

  • Merge Cond: (listings.host_id = users.id)
5. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.20..1,011,592.09 rows=4,679 width=1,331) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Subquery Scan on listings (cost=0.08..954,837.61 rows=14,219 width=1,331) (actual rows= loops=)

  • Filter: ((listings.deleted_at IS NULL) AND listings.published AND (NOT listings.is_in_progress) AND (listings.rank <= 1))
7. 0.000 0.000 ↓ 0.0

WindowAgg (cost=0.08..952,551.26 rows=653,243 width=1,331) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Index Scan using index_listings_on_host_id_and_updated_at on listings listings_1 (cost=0.08..949,611.66 rows=653,243 width=1,323) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Index Scan using locations_pkey on locations (cost=0.11..3.99 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = listings.location_id)
  • Filter: (('3959'::double precision * acos(((('0.778297945677305'::double precision * cos(radians((lat)::double precision))) * cos((radians((long)::double precision) - '-1.34454231454186'::double precision))) + ('0.627895140731704'::double precision * sin(radians((lat)::double precision)))))) <= '10'::double precision)
10. 0.000 0.000 ↓ 0.0

Sort (cost=6,246.04..6,253.62 rows=15,161 width=4) (actual rows= loops=)

  • Sort Key: users.id
11. 0.000 0.000 ↓ 0.0

Seq Scan on users (cost=0.00..6,035.48 rows=15,161 width=4) (actual rows= loops=)

  • Filter: ((deleted_at IS NULL) AND (NOT banned))
12. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=4.09..4.10 rows=1 width=108) (actual rows= loops=)

  • Group Key: units.id
13. 0.000 0.000 ↓ 0.0

Sort (cost=4.09..4.09 rows=1 width=12) (actual rows= loops=)

  • Sort Key: units.id
14. 0.000 0.000 ↓ 0.0

Index Scan using index_units_on_listing_id on units (cost=0.08..4.09 rows=1 width=12) (actual rows= loops=)

  • Index Cond: (listing_id = listings.id)
  • Filter: ((number_of_beds >= 1) AND (price_per_month_cents >= 68,182) AND (price_per_month_cents <= 113,637) AND (bath_type = 0) AND (gender_type = 0) AND (unit_type = 0))