select rank() over (order by film_count desc) as film_rank, a.title as film_title
from (select count(r.rental_id) as film_count, f.title
from rental as r
inner join inventory as i
on r.inventory_id = i.inventory_id
inner join film as f
on f.film_id = i.film_id
where year(r.rental_date) = 2005
group by f.title) as a
order by film_rank, film_title
limit 3
;
show status like 'Last_query_cost';