app/models/climber_proximity.rb:107
- Average Self
-
230ms
- Average calls
- 1x
- Total Self
- 230ms
- Total Children
- 0ms
- Total runtime
- 230ms
WITH t_ascent_crags AS (
SELECT ascents.user_id,
COUNT(DISTINCT ascents.released_at) AS count
FROM ascents INNER JOIN crag_routes ON ascents.crag_route_id = crag_routes.id AND ascents.user_id != ?,
ascents my_ascents INNER JOIN crag_routes my_crag_routes ON my_ascents.crag_route_id = my_crag_routes.id AND my_ascents.user_id = ?
WHERE ascents.released_at = my_ascents.released_at
AND ascents.user_id != ?
AND crag_routes.crag_id = my_crag_routes.crag_id
AND ascents.released_at > CURRENT_DATE - INTERVAL ? YEAR
AND NOT EXISTS (SELECT * FROM follows WHERE follows.followable_type = ? AND follows.followable_id = ascents.user_id AND follows.user_id = ?)
GROUP BY ascents.user_id
), t_ascent_gyms AS (
SELECT ascents.user_id,
COUNT(DISTINCT ascents.released_at) AS count
FROM ascents,
ascents my_a [TRUNCATED]
|