db_select get all results count when also using a pager
Yes you can use setCountQuery if you need to define a count query to return the total number of rows in your resultset.

See the docs for PagerDefault::setCountQuery()