I write a stored procedure for most viewed photos in my procedure, this is my procedure can u check this please is ok or is there any improvement required?
create procedure sp_photos_selectmostviewedphotos
as
select * from photos order by views desc
is it enough or required any modification
First just specify the columns you really need -> replace the star in your query.
Then create an index over the views column (SortOrder DESC).
The rest should be OK 🙂