explain.depesz.com

A tool for finding a real cause for slow queries.

Result: SRL

options
Did it help? Consider supporting us - Bitcoin address: 12v2hUztAk2LgzQ9H9LMwuU32urHMjZQnq
# exclusive inclusive rows x rows loops node
1. 0.015 5824.500 ↑ 1.0 20 1

Limit (cost=126634.66..126634.71 rows=20 width=184) (actual time=5824.483..5824.500 rows=20 loops=1)

  • Total runtime: 5824.794 ms
2. 222.001 5824.485 ↑ 330.1 20 1

Sort (cost=126634.66..126651.16 rows=6601 width=184) (actual time=5824.480..5824.485 rows=20 loops=1)

  • Sort Key: ((restaurants_item.main_image_id IS NOT NULL)), ((acos(((0.652288298761769::double precision * sin(((restaurants_restaurant.latitude * 3.14159265359::double precision) / 180::double precision))) + ((0.757970959403114::double precision * cos(((restaurants_restaurant.latitude * 3.14159265359::double precision) / 180::double precision))) * cos(((-1.29164789674)::double precision - ((restaurants_restaurant.longitude * 3.14159265359::double precision) / 180::double precision)))))) * 6372.795::double precision))
  • Sort Method: top-N heapsort Memory: 20kB
3. 3305.108 5602.484 ↓ 43.2 285420 1

Hash Join (cost=11098.88..126459.01 rows=6601 width=184) (actual time=451.784..5602.484 rows=285420 loops=1)

  • Hash Cond: (restaurants_item.restaurant_id = restaurants_restaurant.id)
4. 1871.246 1871.246 ↓ 1.0 2598641 1

Seq Scan on restaurants_item (cost=0.00..102040.72 rows=2597872 width=168) (actual time=0.031..1871.246 rows=2598641 loops=1)

5. 49.893 426.130 ↓ 25.7 54124 1

Hash (cost=11072.57..11072.57 rows=2105 width=20) (actual time=426.130..426.130 rows=54124 loops=1)

6. 211.328 376.237 ↓ 25.7 54124 1

Bitmap Heap Scan on restaurants_restaurant (cost=4191.81..11072.57 rows=2105 width=20) (actual time=166.875..376.237 rows=54124 loops=1)

  • Recheck Cond: ((longitude > (-74.4555072488)::double precision) AND (longitude < (-73.5564389512)::double precision) AND (latitude > 40.1212771113::double precision) AND (latitude < 41.3074284887::double precision))
7. 4.000 164.909 ↓ 0.0 0 1

BitmapAnd (cost=4191.81..4191.81 rows=2105 width=0) (actual time=164.909..164.909 rows=0 loops=1)

8. 42.839 42.839 ↓ 4.2 62492 1

Bitmap Index Scan on restaurants_restaurant_longitude (cost=0.00..482.87 rows=15044 width=0) (actual time=42.839..42.839 rows=62492 loops=1)

  • Index Cond: ((longitude > (-74.4555072488)::double precision) AND (longitude < (-73.5564389512)::double precision))
9. 118.070 118.070 ↓ 1.0 117794 1

Bitmap Index Scan on restaurants_restaurant_latitude (cost=0.00..3707.63 rows=115920 width=0) (actual time=118.070..118.070 rows=117794 loops=1)

  • Index Cond: ((latitude > 40.1212771113::double precision) AND (latitude < 41.3074284887::double precision))