mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-25 11:49:53 -05:00
### Does this PR have any customer impact? Yes - in 1.16 ### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) Perf ### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes) Yes ### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md)) ### Description In Postgres default behavior for Group by/Distinct is to ORDER BY the Grouping term/Distinct which means building a tuple sort + Ordering it before doing the group. However, if the type defines a hash operator class then the GROUP will use a HashAgg instead of OrderedAgg which is better since it only needs to handle equality (and not Sorted). Implement a bson hash operator class and add it to 1.15. When the schema deploys it will automatically pick this in the planner.