In order to show paging of our resources, we use LIMIT in our MySQL query. I met some scalability issues, while using the simplest way of getting total number of rows. The simplest way to get total number of rows…