performance optimizations TagQuery