On Thu, 31 Aug 2023 at 05:37, Денис Смирнов <darthu...@gmail.com> wrote: > I have inspected the performance of the GROUP BY and DISTINCT queries for the > sorted data streams and found out, that Group node (produced by GROUP BY) > works faster then the Unique node (produced by DISTINCT). The flame graph > should out the reason - Unique palloc`s tuples for the result slot while the > Group node doesn’t. > > I wonder, why do we use minimal tuples for the Unique node instead of the > virtual ones? It looks like there is no actual reason for that as Unique > doesn’t make any materialization.
It would be good to see example queries and a demonstration of the performance increase. I'm not disputing your claims, but showing some performance numbers might catch the eye of a reviewer more quickly. You should also add this to the September commitfest at https://commitfest.postgresql.org/44/ David