lazily generate count after union et al