Gathers statistics on query traces.