From f1ea26dd99415d376ab0e170bfce75fcfdeb7c01 Mon Sep 17 00:00:00 2001 From: Justin Bronn Date: Sat, 19 Dec 2009 08:19:38 +0000 Subject: Fixed #12234 -- Create additional indexes that use the appropriate operation class for PostgreSQL `varchar` and `text` columns when `db_index=True`. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11912 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/ref/databases.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'docs') diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt index fc58dbaf47..d7ae120f94 100644 --- a/docs/ref/databases.txt +++ b/docs/ref/databases.txt @@ -80,6 +80,21 @@ You should also audit your existing code for any instances of this behavior before enabling this feature. It's faster, but it provides less automatic protection for multi-call operations. +Indexes for ``varchar`` and ``text`` columns +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. versionadded:: 1.1.2 + +When specifying ``db_index=True`` on your model fields, Django typically +outputs a single ``CREATE INDEX`` statement. However, if the database type +for the field is either ``varchar`` or ``text`` (e.g., used by ``CharField``, +``FileField``, and ``TextField``), then Django will create +an additional index that uses an appropriate `PostgreSQL operator class`_ +for the column. The extra index is necessary to correctly perfrom +lookups that use the ``LIKE`` operator in their SQL, as is done with the +``contains`` and ``startswith`` lookup types. + +.. _PostgreSQL operator class: http://www.postgresql.org/docs/8.4/static/indexes-opclass.html + .. _mysql-notes: MySQL notes -- cgit v1.3