diff options
| author | Mads Jensen <mje@inducks.org> | 2019-07-25 13:44:18 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-08-21 13:10:06 +0200 |
| commit | 85ac838d9e6975130b5c55299e9d7d1222a8e289 (patch) | |
| tree | 2466fdf4773081dfbaa33c24cda4b01ec9fc23e6 /docs | |
| parent | 9a88e43aeba6cc85ffb2a48a06c296ccf68e0d71 (diff) | |
Fixed #21039 -- Added AddIndexConcurrently/RemoveIndexConcurrently operations for PostgreSQL.
Thanks to Simon Charettes for review.
Co-Authored-By: Daniel Tao <daniel.tao@gmail.com>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/contrib/postgres/operations.txt | 30 | ||||
| -rw-r--r-- | docs/releases/3.0.txt | 4 |
2 files changed, 34 insertions, 0 deletions
diff --git a/docs/ref/contrib/postgres/operations.txt b/docs/ref/contrib/postgres/operations.txt index c56693478f..1329ff1f9e 100644 --- a/docs/ref/contrib/postgres/operations.txt +++ b/docs/ref/contrib/postgres/operations.txt @@ -98,3 +98,33 @@ run the query ``CREATE EXTENSION IF NOT EXISTS hstore;``. .. class:: UnaccentExtension() Installs the ``unaccent`` extension. + +Index concurrent operations +=========================== + +.. versionadded:: 3.0 + +PostgreSQL supports the ``CONCURRENTLY`` option to ``CREATE INDEX`` and +``DROP INDEX`` statements to add and remove indexes without locking out writes. +This option is useful for adding or removing an index in a live production +database. + +.. class:: AddIndexConcurrently(model_name, index) + + Like :class:`~django.db.migrations.operations.AddIndex`, but creates an + index with the ``CONCURRENTLY`` option. This has a few caveats to be aware + of when using this option, see `the PostgreSQL documentation of building + indexes concurrently <https://www.postgresql.org/docs/current/ + sql-createindex.html#SQL-CREATEINDEX-CONCURRENTLY>`_. + +.. class:: RemoveIndexConcurrently(model_name, name) + + Like :class:`~django.db.migrations.operations.RemoveIndex`, but removes the + index with the ``CONCURRENTLY`` option. This has a few caveats to be aware + of when using this option, see `the PostgreSQL documentation + <https://www.postgresql.org/docs/current/sql-dropindex.html>`_. + +.. note:: + + The ``CONCURRENTLY`` option is not supported inside a transaction (see + :ref:`non-atomic migration <non-atomic-migrations>`). diff --git a/docs/releases/3.0.txt b/docs/releases/3.0.txt index 5bb0691363..9489a38ca7 100644 --- a/docs/releases/3.0.txt +++ b/docs/releases/3.0.txt @@ -153,6 +153,10 @@ Minor features * The new :class:`~django.contrib.postgres.fields.RangeBoundary` expression represents the range boundaries. +* The new :class:`~django.contrib.postgres.operations.AddIndexConcurrently` + and :class:`~django.contrib.postgres.operations.RemoveIndexConcurrently` + classes allow creating and dropping indexes ``CONCURRENTLY`` on PostgreSQL. + :mod:`django.contrib.redirects` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
