v.25.11Performance Improvement

Use aggregate projection for queries with DISTINCT

Use aggregate projection for queries with DISTINCT. Closes #86925. #88894 (Nihal Z. Miaji).