explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Pqe7

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

Aggregate (cost=888,573.64..888,573.65 rows=1 width=8) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=888,568.15..888,573.51 rows=275 width=0) (actual rows= loops=)

  • Hash Cond: (units.id = disable_days.unit_id)
  • Filter: ((disable_days.id IS NULL) OR (((disable_days.disable_from < '2020-08-03 00:00:00'::timestamp without time zone) OR (disable_days.disable_from > '2020-08-08 00:00:00'::timestamp without time zone)) AND ((disable_days.disable_to < '2020-08-03 00:00:00'::timestamp without time zone) OR (disable_days.disable_to > '2020-08-08 00:00:00'::timestamp without time zone)) AND ((disable_days.disable_from > '2020-08-03 00:00:00'::timestamp without time zone) OR (disable_days.disable_to < '2020-08-08 00:00:00'::timestamp without time zone))))
3. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=888,555.50..888,556.65 rows=113 width=8) (actual rows= loops=)

  • Merge Cond: (units.id = bookings.unit_id)
  • Filter: ((bookings.id IS NULL) OR (((bookings.from_date < '2020-08-03'::date) OR (bookings.from_date > '2020-08-08'::date)) AND ((bookings.to_date < '2020-08-03'::date) OR (bookings.to_date > '2020-08-08'::date)) AND ((bookings.from_date > '2020-08-03'::date) OR (bookings.to_date < '2020-08-08'::date))))
4. 0.000 0.000 ↓ 0.0

Sort (cost=888,545.59..888,545.61 rows=54 width=8) (actual rows= loops=)

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

Nested Loop (cost=887,590.83..888,545.28 rows=54 width=8) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Nested Loop (cost=887,586.74..888,323.74 rows=54 width=4) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Merge Join (cost=887,586.63..887,669.14 rows=164 width=8) (actual rows= loops=)

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

Subquery Scan on listings (cost=881,340.59..886,893.16 rows=14,219 width=12) (actual rows= loops=)

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

WindowAgg (cost=881,340.59..884,606.81 rows=653,243 width=768) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Sort (cost=881,340.59..881,667.22 rows=653,243 width=30) (actual rows= loops=)

  • Sort Key: listings_1.host_id, listings_1.updated_at DESC
11. 0.000 0.000 ↓ 0.0

Seq Scan on listings listings_1 (cost=0.00..857,556.73 rows=653,243 width=30) (actual rows= loops=)

12. 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
13. 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))
14. 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.778178754300132'::double precision * cos(radians((lat)::double precision))) * cos((radians((long)::double precision) - '-1.34400531163761'::double precision))) + ('0.628042853916749'::double precision * sin(radians((lat)::double precision)))))) <= '10'::double precision)
15. 0.000 0.000 ↓ 0.0

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

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

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

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

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

  • Index Cond: (listing_id = listings.id)
  • Filter: ((number_of_beds >= 1) AND (price_per_month_cents >= 54,546) AND (price_per_month_cents <= 318,182))
18. 0.000 0.000 ↓ 0.0

Sort (cost=9.91..10.12 rows=417 width=20) (actual rows= loops=)

  • Sort Key: bookings.unit_id
19. 0.000 0.000 ↓ 0.0

Seq Scan on bookings (cost=0.00..6.28 rows=417 width=20) (actual rows= loops=)

  • Filter: (deleted_at IS NULL)
20. 0.000 0.000 ↓ 0.0

Hash (cost=10.32..10.32 rows=666 width=28) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Seq Scan on disable_days (cost=0.00..10.32 rows=666 width=28) (actual rows= loops=)

  • Filter: (deleted_at IS NULL)