summaryrefslogtreecommitdiff
path: root/docs/ref/databases.txt
diff options
context:
space:
mode:
authorJustin Bronn <jbronn@gmail.com>2009-12-19 08:19:38 +0000
committerJustin Bronn <jbronn@gmail.com>2009-12-19 08:19:38 +0000
commitf1ea26dd99415d376ab0e170bfce75fcfdeb7c01 (patch)
tree40d7cd808c7ffd20b3d037a548c96a2749559c63 /docs/ref/databases.txt
parentca2d64788d74ea86d4e462d3e58311dc651ee5e0 (diff)
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
Diffstat (limited to 'docs/ref/databases.txt')
-rw-r--r--docs/ref/databases.txt15
1 files changed, 15 insertions, 0 deletions
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