Opened 2 years ago

Closed 18 months ago

#18016 closed Cleanup/optimization (duplicate)

Add support for grouping by primary key for PostgreSQL 9.1+

Reported by: akaariai Owned by: nobody
Component: Database layer (models, ORM) Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


PostgreSQL supports grouping by primary keys in 9.1+ While MySQL has a similar feature, the PostgreSQL behavior is a little different. In MySQL it is enough to add one primary key into the group by, in PostgreSQL every table having column in SELECT or ORDER BY will need to have its PK added to the GROUP BY.

Supporting this needs some changes in the ORM, as the information which columns are primary keys isn't currently easily available. The benefit is faster query plans, as grouping by a large text field for example is very inefficient.

Attachments (0)

Change History (2)

comment:1 Changed 2 years ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 18 months ago by akaariai

  • Resolution set to duplicate
  • Status changed from new to closed

Closing as duplicate of #19259 - that one has more discussion going on than this one.

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.