Query performance optimizations