↑↓ 选择↵ 打开⌫ 切换范围完整搜索

PG.CENTER 连接 PostgreSQL 文档、百科与生态知识。由 Pigsty 维护。

Wiki / 索引访问方法

GIN

GIN indexes are “ inverted indexes ” which are appropriate for data values that contain multiple component values, such as arrays. An inverted index contains a separate entry for each component value, and can efficiently handle queries that test for the presence of specific component values.

当前阅读 PG 18·选择有来源记录的版本

此版本暂无所选语言的定义,以下显示原始英文内容。

能力 · PostgreSQL 18

以下结论来自同版本文档。条件性能力取决于运算符类、索引类型或查询,不代表普遍保证。

能力支持条件与证据
Sorted outputNo

Ordinary sorted output is distinct from ordering by an operator, such as nearest-neighbor distance.

同版本文档

In addition to simply finding the rows to be returned by a query, an index may be able to deliver them in a specific sorted order. This allows a query's ORDER BY specification to be honored without a separate sorting step. Of the index types currently supported by PostgreSQL , only B-tree can produce sorted output — the other index types return matching rows in an unspecified, implementation-dependent order.

PostgreSQL 18.6 · indexes-ordering

Unique keysNo

This means a unique index. Exclusion constraints use a different contract.

同版本文档

Currently, only B-tree indexes can be declared unique.

PostgreSQL 18.6 · indexes-unique

Multiple key columnsYes

Multiple search keys are distinct from non-key INCLUDE payload columns.

同版本文档

Currently, only the B-tree, GiST, GIN, and BRIN index types support multiple-key-column indexes. Whether there can be multiple key columns is independent of whether INCLUDE columns can be added to the index. Indexes can have up to 32 columns, including INCLUDE columns. (This limit can be altered when building PostgreSQL ; see the file pg_config_manual.h .)

PostgreSQL 18.6 · indexes-multicolumn

INCLUDE columnsNo

Payload columns do not become search keys. Wide payloads can exceed the index tuple-size limit.

同版本文档

Currently, the B-tree, GiST and SP-GiST index access methods support this feature. In these indexes, the values of columns listed in the INCLUDE clause are included in leaf tuples which correspond to heap tuples, but are not included in upper-level index entries used for tree navigation.

PostgreSQL 18.6 · sql-createindex

Index-only scansNo

The query must use covered values; visibility-map state determines whether heap visits can be avoided.

同版本文档

The index type must support index-only scans. B-tree indexes always do. GiST and SP-GiST indexes support index-only scans for some operator classes but not others. Other index types have no support. The underlying requirement is that the index must physically store, or else be able to reconstruct, the original data value for each index entry. As a counterexample, GIN indexes cannot support index-only scans because each index entry typically holds only part of the original data value.

PostgreSQL 18.6 · indexes-index-only-scans

Distance orderingNot established

Availability depends on the chosen operator class and ordering operator.

所采集来源不足以确认此能力。

Parallel index scanNo

A cooperating scan of one index is distinct from a parallel bitmap heap scan or separate serial scans under Parallel Append.

同版本文档

In a parallel index scan or parallel index-only scan , the cooperating processes take turns reading data from the index. Currently, parallel index scans are supported only for btree indexes. Each process will claim a single index block and will scan and return all tuples referenced by that block; other processes can at the same time be returning tuples from a different index block. The results of a parallel btree scan are returned in sorted order within each worker process.

PostgreSQL 18.6 · parallel-plans

Parallel index buildYes

Parallel construction is separate from parallel scans. Worker availability, settings and build phases also matter.

同版本文档

PostgreSQL can build indexes while leveraging multiple CPUs in order to process the table rows faster. This feature is known as parallel index build . For index methods that support building indexes in parallel (currently, B-tree, GIN, and BRIN), maintenance_work_mem specifies the maximum amount of memory that can be used by each index build operation as a whole, regardless of how many worker processes were started. Generally, a cost model automatically determines how many worker processes should be requested, if any.

PostgreSQL 18.6 · sql-createindex

存储选项

fastupdate

Controls usage of the fast update technique described in Section 65.4.4.1 . ON enables fast update, OFF disables it. The default is ON .

Turning fastupdate off via ALTER INDEX prevents future insertions from going into the list of pending index entries, but does not in itself flush existing entries. You might want to VACUUM the table or call the gin_clean_pending_list function afterward to ensure the pending list is emptied.

同版本选项定义

gin_pending_list_limit

Overrides the global setting of gin_pending_list_limit for this index. This value is specified in kilobytes.

同版本选项定义

Sorted output
No
Unique keys
No
Multiple key columns
Yes
INCLUDE columns
No
Index-only scans
No
Distance ordering
Not established
Parallel index scan
No
Parallel index build
Yes
evidence kind
documentation
runtime verified
false
signature
CREATE INDEX name ON table_name USING gin (column_name);

版本定义 PG 18

GIN indexes are “ inverted indexes ” which are appropriate for data values that contain multiple component values, such as arrays. An inverted index contains a separate entry for each component value, and can efficiently handle queries that test for the presence of specific component values.

比较版本

完整来源事实

capabilities

map[evidence:[map[anchor:INDEXES-ORDERING file:indexes-ordering.html label:PostgreSQL 18.6 · indexes-ordering quote:In addition to simply finding the rows to be returned by a query, an index may be able to deliver them in a specific sorted order. This allows a query's ORDER BY specification to be honored without a separate sorting step. Of the index types currently supported by PostgreSQL , only B-tree can produce sorted output — the other index types return matching rows in an unspecified, implementation-dependent order. sha256:85fac99c7c66ed19dd021f12b5cc53ce18aa5bfa4b56c8c168317f99b8f12d3b url:/docs/18/indexes-ordering.html#INDEXES-ORDERING]] key:ordered label:Sorted output note:Ordinary sorted output is distinct from ordering by an operator, such as nearest-neighbor distance. state:no value:No], map[evidence:[map[anchor:INDEXES-UNIQUE file:indexes-unique.html label:PostgreSQL 18.6 · indexes-unique quote:Currently, only B-tree indexes can be declared unique. sha256:7c3eac7fa180b22534ff01df0c68155f15b6b360ffe35507c5266059116840db url:/docs/18/indexes-unique.html#INDEXES-UNIQUE]] key:unique label:Unique keys note:This means a unique index. Exclusion constraints use a different contract. state:no value:No], map[evidence:[map[anchor:INDEXES-MULTICOLUMN file:indexes-multicolumn.html label:PostgreSQL 18.6 · indexes-multicolumn quote:Currently, only the B-tree, GiST, GIN, and BRIN index types support multiple-key-column indexes. Whether there can be multiple key columns is independent of whether INCLUDE columns can be added to the index. Indexes can have up to 32 columns, including INCLUDE columns. (This limit can be altered when building PostgreSQL ; see the file pg_config_manual.h .) sha256:c0a799ec49b8ef057a63d465fb1d72a3b81e16d652c28a71734d45592d081202 url:/docs/18/indexes-multicolumn.html#INDEXES-MULTICOLUMN]] key:multicolumn label:Multiple key columns note:Multiple search keys are distinct from non-key INCLUDE payload columns. state:yes value:Yes], map[evidence:[map[anchor:SQL-CREATEINDEX file:sql-createindex.html label:PostgreSQL 18.6 · sql-createindex quote:Currently, the B-tree, GiST and SP-GiST index access methods support this feature. In these indexes, the values of columns listed in the INCLUDE clause are included in leaf tuples which correspond to heap tuples, but are not included in upper-level index entries used for tree navigation. sha256:6aa00da55815d13d0355dd25cb1cdb603fa36964993f164d1b6f486011282580 url:/docs/18/sql-createindex.html#SQL-CREATEINDEX]] key:include label:INCLUDE columns note:Payload columns do not become search keys. Wide payloads can exceed the index tuple-size limit. state:no value:No], map[evidence:[map[anchor:INDEXES-INDEX-ONLY-SCANS file:indexes-index-only-scans.html label:PostgreSQL 18.6 · indexes-index-only-scans quote:The index type must support index-only scans. B-tree indexes always do. GiST and SP-GiST indexes support index-only scans for some operator classes but not others. Other index types have no support. The underlying requirement is that the index must physically store, or else be able to reconstruct, the original data value for each index entry. As a counterexample, GIN indexes cannot support index-only scans because each index entry typically holds only part of the original data value. sha256:2322ec12b82f3fd01ee4072049caaa5a0190148ac68d98c0fcd6eda958828a83 url:/docs/18/indexes-index-only-scans.html#INDEXES-INDEX-ONLY-SCANS]] key:index_only label:Index-only scans note:The query must use covered values; visibility-map state determines whether heap visits can be avoided. state:no value:No], map[evidence:[] key:distance label:Distance ordering note:Availability depends on the chosen operator class and ordering operator. state:unknown value:Not established], map[evidence:[map[anchor:PARALLEL-SCANS file:parallel-plans.html label:PostgreSQL 18.6 · parallel-plans quote:In a parallel index scan or parallel index-only scan , the cooperating processes take turns reading data from the index. Currently, parallel index scans are supported only for btree indexes. Each process will claim a single index block and will scan and return all tuples referenced by that block; other processes can at the same time be returning tuples from a different index block. The results of a parallel btree scan are returned in sorted order within each worker process. sha256:62207d207bead82b01b59dc119c4f95856f08655cc11d4699a05a40867ed2070 url:/docs/18/parallel-plans.html#PARALLEL-SCANS]] key:parallel_scan label:Parallel index scan note:A cooperating scan of one index is distinct from a parallel bitmap heap scan or separate serial scans under Parallel Append. state:no value:No], map[evidence:[map[anchor:SQL-CREATEINDEX file:sql-createindex.html label:PostgreSQL 18.6 · sql-createindex quote:PostgreSQL can build indexes while leveraging multiple CPUs in order to process the table rows faster. This feature is known as parallel index build . For index methods that support building indexes in parallel (currently, B-tree, GIN, and BRIN), maintenance_work_mem specifies the maximum amount of memory that can be used by each index build operation as a whole, regardless of how many worker processes were started. Generally, a cost model automatically determines how many worker processes should be requested, if any. sha256:6aa00da55815d13d0355dd25cb1cdb603fa36964993f164d1b6f486011282580 url:/docs/18/sql-createindex.html#SQL-CREATEINDEX]] key:parallel_build label:Parallel index build note:Parallel construction is separate from parallel scans. Worker availability, settings and build phases also matter. state:yes value:Yes]

storage options

map[description:[Controls usage of the fast update technique described in Section 65.4.4.1 . ON enables fast update, OFF disables it. The default is ON . Turning fastupdate off via ALTER INDEX prevents future insertions from going into the list of pending index entries, but does not in itself flush existing entries. You might want to VACUUM the table or call the gin_clean_pending_list function afterward to ensure the pending list is emptied.] name:fastupdate source:map[anchor:INDEX-RELOPTION-FASTUPDATE file:sql-createindex.html label:PostgreSQL 18.6 · sql-createindex sha256:6aa00da55815d13d0355dd25cb1cdb603fa36964993f164d1b6f486011282580 url:/docs/18/sql-createindex.html#INDEX-RELOPTION-FASTUPDATE] url:/wiki/relopts/gin-fastupdate/?v=18], map[description:[Overrides the global setting of gin_pending_list_limit for this index. This value is specified in kilobytes.] name:gin_pending_list_limit source:map[anchor:INDEX-RELOPTION-GIN-PENDING-LIST-LIMIT file:sql-createindex.html label:PostgreSQL 18.6 · sql-createindex sha256:6aa00da55815d13d0355dd25cb1cdb603fa36964993f164d1b6f486011282580 url:/docs/18/sql-createindex.html#INDEX-RELOPTION-GIN-PENDING-LIST-LIMIT] url:/wiki/relopts/gin-gin-pending-list-limit/?v=18]

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 18 · 0e39ebd4fddbd990280e62f4503f0bd18765bbd990dccf4cba976b5d47da45e7

正文语言: en · 0e39ebd4fddbd990280e62f4503f0bd18765bbd990dccf4cba976b5d47da45e7