#26610: Case insensitive indexes
-------------------------------------+-------------------------------------
Reporter: shadow7412 | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: 1.9
(models, ORM) | Keywords: index charfield
Severity: Normal | textfield case insensitive
| optimisation
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
I was analysing some of our queries - and one of the things I noticed was
that if you use iexact, then the database needs to do a full table scan
because it is unable to use the index I had on the field.
{{{
class Example(models.Model):
text = models.CharField(index=True)
Example.objects.get(text="meow") # This will hit the index
Example.objects.get(text__iexact="meow") # This does not.
}}}
I am aware that this kind of index can be added manually by RunSQL
migrations, but I think this is probably a common enough scenario that the
ORM should attempt to handle it natively.
{{{
# PROPOSED CHANGES - THIS DOES NOT ACTUALLY WORK
class Example(models.Model):
text = models.CharField(insensitive_index=True)
Example.objects.get(text="meow") # This probably won't hit the index
(might depend on the db)
Example.objects.get(text__iexact="meow") # This would.
}}}
What are your thoughts?
--
Ticket URL: <https://code.djangoproject.com/ticket/26610>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/053.05566e2f54d648ebe31ec5e49deb5695%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.