Optimizing the SELECT statement for counting rows

Hi,

This p-request will optimize the SELECT statement in get_total_results(). Instead of getting all the records from the database, this will only count them.