Opened 10 years ago

Closed 10 years ago

#21986 closed Cleanup/optimization (fixed)

The documentation provides no indication as to why you might want to use indexes

Reported by: django-issues@… Owned by: bbaja42
Component: Documentation Version: dev
Severity: Normal Keywords:
Cc: django-issues@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: yes UI/UX: no

Description

Indexing is not an inherently straightforward and intuitive concept. There's plenty of material out there that suggests where you might want to apply database indexes, but the Django documentation doesn't suggest *anything*. Database access optimization suggests that it is a number one priority, and that you should use the information you have gleaned from profiling to decide what to index, but provides no methodology for applying that information. It's left to the reader's imagination to decide if they should add indexes to fields they read a lot or fields they change a lot or fields they do lookups by a lot or fields that have fish puns in their names.

I'd make some suggestions, but I am not qualified enough to write anything I'd be at all confident in.

Change History (7)

comment:1 by Aymeric Augustin, 10 years ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

comment:2 by django-issues@…, 10 years ago

Cc: django-issues@… added

comment:4 by bbaja42, 10 years ago

Owner: changed from nobody to bbaja42
Status: newassigned

comment:5 by Tim Graham, 10 years ago

Has patch: set
Patch needs improvement: set

As noted on the PR, I think we can probably do a bit better than just a link to Wikipedia's entry on database indexes. I wouldn't want to go into too much detail since indexing is a complex topic and is often database dependent, but some idea of where to start looking would be helpful.

comment:6 by alextreme, 10 years ago

I've expanded upon the previous pull request to also document a rule-of-thumb (use indexes to speed up lookups). I have added your caveats on the topic of indexes, but this should be enough to point readers in the right direction.

https://github.com/django/django/pull/2360

comment:7 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In 8e704b176f30c9c208a45125d8f36319cf1aafa8:

[1.6.x] Fixed #21986 -- Added some guidelines for database indexes.

Thanks django-issues at colons.co for the suggestion.

Backport of c8d61fa109 from master

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