Preparing support for counting queries.