Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#13730 closed (fixed)

Allow db_index=False for ForeignKey

Reported by: Suor Owned by: Suor
Component: Database layer (models, ORM) Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Now db_index=True is hard-coded, so I have to drop unneeded indexes manually after syncdb or south migrate.

Rationalization:
Indexes slow down insert, update and delete operations, so it's ineffective to manage indexes that are not really used.
They may be not used if:

  • they are created for consistency not for joins;
  • there are partial, multiple column or other special indexes that would be used instead of them

Attachments (2)

needs_context.diff (2.1 KB) - added by Suor 5 years ago.
soft_db_index.diff (887 bytes) - added by Suor 5 years ago.

Download all attachments as: .zip

Change History (8)

Changed 5 years ago by Suor

Changed 5 years ago by Suor

comment:1 Changed 5 years ago by Suor

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Sorry, first patch is for other issue.

comment:2 Changed 5 years ago by Suor

  • Owner changed from nobody to Suor

comment:3 Changed 5 years ago by russellm

  • Triage Stage changed from Unreviewed to Accepted

comment:4 Changed 5 years ago by Suor

  • Status changed from new to assigned
  • Triage Stage changed from Accepted to Ready for checkin

Promoting to ready for chekin since it's obvious bug

comment:5 Changed 5 years ago by russellm

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [13452]) Fixed #13730 -- Removed the hard-coding of the requirement that ForeignKeys have an index. Thanks to Suor for the report.

comment:6 Changed 5 years ago by russellm

(In [13454]) [1.2.X] Fixed #13730 -- Removed the hard-coding of the requirement that ForeignKeys have an index. Thanks to Suor for the report.

Backport of r13452 from trunk.

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