v.21.8New Feature
Support DISTINCT ON expression
Support DISTINCT ON (columns) expression, close #25404. #25589 (Zijie Lu).Why it matters
This feature addresses the need to retrieve unique rows based on one or more columns without requiring complex workarounds. It simplifies queries by allowing users to explicitly specify columns for distinctness, improving query expressiveness and performance in scenarios where distinct subsets are needed.How to use it
Users can apply theDISTINCT ON (columns) syntax directly in their SELECT statements to return distinct rows based on the specified columns. For example:SELECT DISTINCT ON (column1, column2) *
FROM table_name