首页
随机页面
分类
查看“Django/docs/3.0.x/ref/contrib/postgres/indexes”的源代码
来自菜鸟教程
Django/docs/3.0.x/ref/contrib/postgres/indexes / ←
PostgreSQL 特定模型索引 — Django 文档
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
<div id="module-django.contrib.postgres.indexes" class="section"> <span id="postgresql-specific-model-indexes"></span> = PostgreSQL specific model indexes = The following are PostgreSQL specific [[../../../models/indexes|<span class="doc">indexes</span>]] available from the <code>django.contrib.postgres.indexes</code> module. <div id="brinindex" class="section"> == <code>BrinIndex</code> == <dl> <dt>''class'' <code>BrinIndex</code><span class="sig-paren">(</span>''<span class="n">autosummarize</span><span class="o">=</span><span class="default_value">None</span>'', ''<span class="n">pages_per_range</span><span class="o">=</span><span class="default_value">None</span>'', ''<span class="o">**</span><span class="n">options</span>''<span class="sig-paren">)</span></dt> <dd><p>Creates a [https://www.postgresql.org/docs/current/brin-intro.html BRIN index].</p> <p>Set the <code>autosummarize</code> parameter to <code>True</code> to enable [https://www.postgresql.org/docs/current/brin-intro.html#BRIN-OPERATION automatic summarization] to be performed by autovacuum.</p> <p>The <code>pages_per_range</code> argument takes a positive integer.</p> <div class="versionchanged"> <p>The <code>autosummarize</code> parameter was added.</p> </div></dd></dl> </div> <div id="btreeindex" class="section"> == <code>BTreeIndex</code> == <dl> <dt>''class'' <code>BTreeIndex</code><span class="sig-paren">(</span>''<span class="n">fillfactor</span><span class="o">=</span><span class="default_value">None</span>'', ''<span class="o">**</span><span class="n">options</span>''<span class="sig-paren">)</span></dt> <dd><div class="versionadded"> </div> <p>Creates a B-Tree index.</p> <p>Provide an integer value from 10 to 100 to the [https://www.postgresql.org/docs/current/sql-createindex.html#SQL-CREATEINDEX-STORAGE-PARAMETERS fillfactor] parameter to tune how packed the index pages will be. PostgreSQL's default is 90.</p></dd></dl> </div> <div id="ginindex" class="section"> == <code>GinIndex</code> == <dl> <dt>''class'' <code>GinIndex</code><span class="sig-paren">(</span>''<span class="n">fastupdate</span><span class="o">=</span><span class="default_value">None</span>'', ''<span class="n">gin_pending_list_limit</span><span class="o">=</span><span class="default_value">None</span>'', ''<span class="o">**</span><span class="n">options</span>''<span class="sig-paren">)</span></dt> <dd><p>Creates a [https://www.postgresql.org/docs/current/gin.html gin index].</p> <p>To use this index on data types not in the [https://www.postgresql.org/docs/current/gin-builtin-opclasses.html built-in operator classes], you need to activate the [https://www.postgresql.org/docs/current/btree-gin.html btree_gin extension] on PostgreSQL. You can install it using the [[../operations#django.contrib.postgres.operations|<code>BtreeGinExtension</code>]] migration operation.</p> <p>Set the <code>fastupdate</code> parameter to <code>False</code> to disable the [https://www.postgresql.org/docs/current/gin-implementation.html#GIN-FAST-UPDATE GIN Fast Update Technique] that's enabled by default in PostgreSQL.</p> <p>Provide an integer number of bytes to the [https://www.postgresql.org/docs/current/runtime-config-client.html#GUC-GIN-PENDING-LIST-LIMIT gin_pending_list_limit] parameter to tune the maximum size of the GIN pending list which is used when <code>fastupdate</code> is enabled.</p></dd></dl> </div> <div id="gistindex" class="section"> == <code>GistIndex</code> == <dl> <dt>''class'' <code>GistIndex</code><span class="sig-paren">(</span>''<span class="n">buffering</span><span class="o">=</span><span class="default_value">None</span>'', ''<span class="n">fillfactor</span><span class="o">=</span><span class="default_value">None</span>'', ''<span class="o">**</span><span class="n">options</span>''<span class="sig-paren">)</span></dt> <dd><p>Creates a [https://www.postgresql.org/docs/current/gist.html GiST index]. These indexes are automatically created on spatial fields with [[../../gis/model-api#django.contrib.gis.db.models.BaseSpatialField|<code>spatial_index=True</code>]]. They're also useful on other types, such as [[../fields#django.contrib.postgres.fields|<code>HStoreField</code>]] or the [[../fields#range-fields|<span class="std std-ref">range fields</span>]].</p> <p>To use this index on data types not in the built-in [https://www.postgresql.org/docs/current/gist-builtin-opclasses.html gist operator classes], you need to activate the [https://www.postgresql.org/docs/current/btree-gist.html btree_gist extension] on PostgreSQL. You can install it using the [[../operations#django.contrib.postgres.operations|<code>BtreeGistExtension</code>]] migration operation.</p> <p>Set the <code>buffering</code> parameter to <code>True</code> or <code>False</code> to manually enable or disable [https://www.postgresql.org/docs/current/gist-implementation.html#GIST-BUFFERING-BUILD buffering build] of the index.</p> <p>Provide an integer value from 10 to 100 to the [https://www.postgresql.org/docs/current/sql-createindex.html#SQL-CREATEINDEX-STORAGE-PARAMETERS fillfactor] parameter to tune how packed the index pages will be. PostgreSQL's default is 90.</p></dd></dl> </div> <div id="hashindex" class="section"> == <code>HashIndex</code> == <dl> <dt>''class'' <code>HashIndex</code><span class="sig-paren">(</span>''<span class="n">fillfactor</span><span class="o">=</span><span class="default_value">None</span>'', ''<span class="o">**</span><span class="n">options</span>''<span class="sig-paren">)</span></dt> <dd><div class="versionadded"> </div> <p>Creates a hash index.</p> <p>Provide an integer value from 10 to 100 to the [https://www.postgresql.org/docs/current/sql-createindex.html#SQL-CREATEINDEX-STORAGE-PARAMETERS fillfactor] parameter to tune how packed the index pages will be. PostgreSQL's default is 90.</p> <div class="admonition-use-this-index-only-on-postgresql-10-and-later admonition"> <p>Use this index only on PostgreSQL 10 and later</p> <p>Hash indexes have been available in PostgreSQL for a long time, but they suffer from a number of data integrity issues in older versions.</p> </div></dd></dl> </div> <div id="spgistindex" class="section"> == <code>SpGistIndex</code> == <dl> <dt>''class'' <code>SpGistIndex</code><span class="sig-paren">(</span>''<span class="n">fillfactor</span><span class="o">=</span><span class="default_value">None</span>'', ''<span class="o">**</span><span class="n">options</span>''<span class="sig-paren">)</span></dt> <dd><div class="versionadded"> </div> <p>Creates an [https://www.postgresql.org/docs/current/spgist.html SP-GiST index].</p> <p>Provide an integer value from 10 to 100 to the [https://www.postgresql.org/docs/current/sql-createindex.html#SQL-CREATEINDEX-STORAGE-PARAMETERS fillfactor] parameter to tune how packed the index pages will be. PostgreSQL's default is 90.</p></dd></dl> </div> </div> [[Category:Django 3.0.x 中文文档]]
返回至“
PostgreSQL 特定模型索引 — Django 文档
”。