On Fri, 29 Nov 2024 at 20:04, jian he <jian.universal...@gmail.com> wrote: > I found that unique expression index can also be used for groupby > column removal. > so I implemented it, aslo added two tests on it.
> what do you think? I think it's likely just not common enough to be worthwhile, plus, unfortunately, I don't think this optimisation is possible with what we have today. Also, if it were possible you'd need to check the GROUP BY expressions match the indexed expressions. You've not done that. The reason I don't think is possible is that we have no infrastructure that allows us to tag functions or operators so that non-null input(s) mean non-null outputs. We only have strict, which means null input means null output. That's the opposite of what we'd need. It might only be possible with a NULLS NOT DISTINCT index. David