Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#18046 closed Cleanup/optimization (fixed)

document index created for a ForeignKey

Reported by: jbauer@… Owned by: Raúl Cumplido
Component: Documentation Version: 1.4
Severity: Normal Keywords: ForeignKey db_index
Cc: raulcumplido@…, timograham@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

It would be helpful if the Model field docs mentioned that Django automatically creates an index for ForeignKey columns.

https://docs.djangoproject.com/en/dev/ref/models/fields/#foreignkey

The docs could also mention how to disable this behavior (db_index=False) and why the user may want to do this:

  • FK created for consistency, not joins
  • alternative special indexes (partial, multiple column, etc) will be created instead

Relevant links:

Attachments (1)

18046.diff (711 bytes ) - added by Tim Graham 11 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by Claude Paroz, 12 years ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

comment:2 by Raúl Cumplido, 12 years ago

Cc: raulcumplido@… added
Owner: changed from nobody to Raúl Cumplido

by Tim Graham, 11 years ago

Attachment: 18046.diff added

comment:3 by Tim Graham, 11 years ago

Cc: timograham@… added
Has patch: set

comment:4 by Tim Graham <timograham@…>, 11 years ago

Resolution: fixed
Status: newclosed

In db598dd8a053fe17c3308f89cd8f40676e2c479e:

Fixed #18046 - Documented than an index is created by default for ForeignKeys; thanks jbauer for the suggestion.

comment:5 by Tim Graham <timograham@…>, 11 years ago

In fd90a906333b569340e5507fec3f3a4d4c1d0f47:

[1.4.X] Fixed #18046 - Documented that an index is created by default for ForeignKeys; thanks jbauer for the suggestion.

Backport of db598dd8a0 from master

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