Add support for getting the statistics of a query