Opened 9 years ago

Closed 4 years ago

Last modified 4 years ago

#5805 closed New feature (fixed)

Specify multicolumn indexes.

Reported by: Stavros Korokithakis <stavros@…> Owned by: Alex Gaynor
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords: index multicolumn indexes database dceu2011
Cc: fnl, martin.paquette@…, diegobz, Apostolis Bessas, jeffrey@…, gert.vangool@…, mike@…, Gillingham@…, charette.s@…, Ivan Virabyan, Danilo Bargen Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

It would be good if we could specify multicolumn indexes to be created in the model, sort of like unique_together but for index_together. I am not familiar with a way to do this currently, hence this feature request.

Attachments (1)

index_together.diff (7.1 KB) - added by Jeffrey Gelens 5 years ago.
Updated patch to match trunk

Download all attachments as: .zip

Change History (26)

comment:1 Changed 9 years ago by Simon G <dev@…>

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: duplicate
Status: newclosed

Dupe of #373, which is pending the queryset rewrite/refactor I believe..

comment:2 Changed 7 years ago by matclayton

Resolution: duplicate
Status: closedreopened

#373 is for multi column primary keys, not indexes.

comment:3 Changed 7 years ago by Russell Keith-Magee

Triage Stage: UnreviewedAccepted

comment:4 Changed 7 years ago by fnl

Cc: fnl added

comment:5 Changed 5 years ago by Gabriel Hurley

Severity: Normal
Type: New feature

comment:6 Changed 5 years ago by Martin Paquette

Cc: martin.paquette@… added
Easy pickings: unset

comment:7 Changed 5 years ago by diegobz

Cc: diegobz added

comment:8 Changed 5 years ago by Apostolis Bessas

Cc: Apostolis Bessas added

comment:9 Changed 5 years ago by Jeffrey Gelens

Cc: jeffrey@… added

comment:10 Changed 5 years ago by Jeffrey Gelens

Keywords: dceu2011 added
Owner: changed from nobody to Jeffrey Gelens
Status: reopenednew
UI/UX: unset

comment:11 Changed 5 years ago by Jeffrey Gelens

Has patch: set

Added a patch with docs and simple test. Which I tested on MySQL, PostgreSQL and SQLite

comment:12 Changed 5 years ago by Jeffrey Gelens

Needs tests: set
Status: newassigned

We still need to check if the indexes are being created. For this we need better database introspection for indexes. For this #16220 will need to be fixed first. Till that moment, this ticket is on hold.

comment:13 Changed 5 years ago by Gert Van Gool

Cc: gert.vangool@… added

comment:14 Changed 5 years ago by Mike Fogel

Cc: mike@… added

Changed 5 years ago by Jeffrey Gelens

Attachment: index_together.diff added

Updated patch to match trunk

comment:15 Changed 5 years ago by Gillingham@…

Cc: Gillingham@… added

comment:16 Changed 5 years ago by Simon Charette

Cc: charette.s@… added

comment:17 Changed 4 years ago by Aymeric Augustin

#18092 was closed as a duplicate and has a patch.

comment:18 Changed 4 years ago by Ivan Virabyan

Cc: Ivan Virabyan added

comment:19 Changed 4 years ago by Danilo Bargen

Cc: Danilo Bargen added

comment:20 Changed 4 years ago by mmfunkyd@…

I hope it's not too late to get this into 1.5. This functionality would be extremely nice as a complement to the db_index functionality currently in Django.

comment:21 Changed 4 years ago by Jeffrey Gelens

The patch was working fine for trunk 10 months ago. Only tests couldn't be written because of the broken django DB introspection (see related ticket).

comment:22 Changed 4 years ago by Alex Gaynor

Owner: changed from Jeffrey Gelens to Alex Gaynor
Status: assignednew

comment:23 Changed 4 years ago by Aymeric Augustin

comment:24 Changed 4 years ago by Aymeric Augustin

Resolution: fixed
Status: newclosed

comment:25 Changed 4 years ago by Alex Gaynor <alex.gaynor@…>

In 6f716e9e5f8f373f48b59791b80f0d68ce9e5bd2:

[1.5.x] Fixed #5805 -- it is now possible to specify multi-column indexes. Thanks to jgelens for the original patch. Backport of 4285571c5a9bf6ca3cb7c4d774942b9ae5b537e4.

Note: See TracTickets for help on using tickets.
Back to Top