code: func (ssa *SQLStorageAuthority) countCertificatesFaster(
  	db dbSelector,
  	domain string,
  	earliest,
  	latest time.Time,
  ) (int, error) {
  	base := baseDomain(domain)
  	var counts []int
  	_, err := db.Select(
  		&counts,
  		`SELECT count FROM certificatesPerName
  		 WHERE eTLDPlusOne = :baseDomain AND
  		 time > :earliest AND
  		 time <= :latest`,
  		map[string]interface{}{
  			"baseDomain": base,
  			"earliest":   earliest,
  			"latest":     latest,
  		})
  	if err == sql.ErrNoRows {
  		return 0, nil
  	} else if err != nil {
  		return 0, err
  	}
  	var total int
  	for _, count := range counts {
  		total += count
  	}
  	return total, nil
  }
docs: // countCertificatesFaster returns, for a single domain, the count of
  // certificates issued in the given time range for that domain's eTLD+1 (aka
  // base domain). It uses the certificatesPerName table to make this lookup fast.
  // This function can replace both countCertificatesByName and
  // countCertificatesByExactName because domains that are exactly equal to an
  // public suffix have their issuances counted under a separate bucket from their
  // subdomains.