docs: public void aggQueryStats() {
      // These are overall aggregations
      final Map<QueryStat, Pair<Long, Long>> overall_cumulations = 
          new HashMap<QueryStat, Pair<Long, Long>>();
      
      // scanner aggs
      for (final Entry<Integer, Map<Integer, Map<QueryStat, Long>>> entry : 
        scanner_stats.entrySet()) {
        final int query_index = entry.getKey();
        
        final Map<QueryStat, Pair<Long, Long>> cumulations = 
            new HashMap<QueryStat, Pair<Long, Long>>();
        
        for (final Entry<Integer, Map<QueryStat, Long>> scanner : 
          entry.getValue().entrySet()) {
          
          for (final Entry<QueryStat, Long> stat : scanner.getValue().entrySet()) {
            if (stat.getKey().is_time) {
              if (!AGG_MAP.containsKey(stat.getKey())) {
                // we're not aggregating this value
                continue;
              }
              
              // per query aggs
              Pair<Long, Long> pair = cumulations.get(stat.getKey());
              if (pair == null) {
                pair = new Pair<Long, Long>(0L, Long.MIN_VALUE);
                cumulations.put(stat.getKey(), pair);
              }
              pair.setKey(pair.getKey() + stat.getValue());
              if (stat.getValue() > pair.getValue()) {
                pair.setValue(stat.getValue());
              }
              
              // overall aggs required here for proper time averaging
              pair = overall_cumulations.get(stat.getKey());
              if (pair == null) {
                pair = new Pair<Long, Long>(0L, Long.MIN_VALUE);
                overall_cumulations.put(stat.getKey(), pair);
              }
              pair.setKey(pair.getKey() + stat.getValue());
              if (stat.getValue() > pair.getValue()) {
                pair.setValue(stat.getValue());
              }
            } else {
              // only add counters for the per query maps as they'll be rolled
              // up below into the overall
              updateStat(query_index, stat.getKey(), stat.getValue());
            }
          }
        }
        
        // per query aggs
        for (final Entry<QueryStat, Pair<Long, Long>> cumulation : 
          cumulations.entrySet()) {
          // names can't be null as we validate above that it exists
          final Pair<QueryStat, QueryStat> names = AGG_MAP.get(cumulation.getKey());
          addStat(query_index, names.getKey(),  
              (cumulation.getValue().getKey() / entry.getValue().size()));
          addStat(query_index, names.getValue(), cumulation.getValue().getValue());
        }
      }
      
      // handle the per scanner aggs
      for (final Entry<QueryStat, Pair<Long, Long>> cumulation : 
        overall_cumulations.entrySet()) {
        // names can't be null as we validate above that it exists
        final Pair<QueryStat, QueryStat> names = AGG_MAP.get(cumulation.getKey());
        addStat(names.getKey(),  
            (cumulation.getValue().getKey() / 
                (scanner_stats.size() * 
                    Const.SALT_WIDTH() > 0 ? Const.SALT_BUCKETS() : 1)));
        addStat(names.getValue(), cumulation.getValue().getValue());
      }
      overall_cumulations.clear();
      
      // aggregate counters from the sub queries
      for (final Map<QueryStat, Long> sub_query : query_stats.values()) {
        for (final Entry<QueryStat, Long> stat : sub_query.entrySet()) {
          if (stat.getKey().is_time) {
            if (!AGG_MAP.containsKey(stat.getKey())) {
              // we're not aggregating this value
              continue;
            }
            Pair<Long, Long> pair = overall_cumulations.get(stat.getKey());
            if (pair == null) {
              pair = new Pair<Long, Long>(0L, Long.MIN_VALUE);
              overall_cumulations.put(stat.getKey(), pair);
            }
            pair.setKey(pair.getKey() + stat.getValue());
            if (stat.getValue() > pair.getValue()) {
              pair.setValue(stat.getValue());
            }
          } else if (overall_stats.containsKey(stat.getKey())) {
            overall_stats.put(stat.getKey(), 
                overall_stats.get(stat.getKey()) + stat.getValue());
          } else {
            overall_stats.put(stat.getKey(), stat.getValue());
          }
        }
      }
      
      for (final Entry<QueryStat, Pair<Long, Long>> cumulation : 
        overall_cumulations.entrySet()) {
        // names can't be null as we validate above that it exists
        final Pair<QueryStat, QueryStat> names = AGG_MAP.get(cumulation.getKey());
        overall_stats.put(names.getKey(),  
            (cumulation.getValue().getKey() / query_stats.size()));
        overall_stats.put(names.getValue(), cumulation.getValue().getValue());
      }
    }