Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
b6e42bdd
Commit
b6e42bdd
authored
Apr 09, 2009
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update GIN limitations documentation to match current reality.
parent
06e27572
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
21 deletions
+31
-21
doc/src/sgml/gin.sgml
doc/src/sgml/gin.sgml
+31
-21
No files found.
doc/src/sgml/gin.sgml
View file @
b6e42bdd
<!-- $PostgreSQL: pgsql/doc/src/sgml/gin.sgml,v 2.1
8 2009/03/25 22:19:01
tgl Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/gin.sgml,v 2.1
9 2009/04/09 19:07:44
tgl Exp $ -->
<chapter id="GIN">
<chapter id="GIN">
<title>GIN Indexes</title>
<title>GIN Indexes</title>
...
@@ -103,8 +103,10 @@
...
@@ -103,8 +103,10 @@
If the query contains no keys then <function>extractQuery</>
If the query contains no keys then <function>extractQuery</>
should store 0 or -1 into <literal>*nkeys</>, depending on the
should store 0 or -1 into <literal>*nkeys</>, depending on the
semantics of the operator. 0 means that every
semantics of the operator. 0 means that every
value matches the <literal>query</> and a sequential scan should be
value matches the <literal>query</> and a full-index scan should be
performed. -1 means nothing can match the <literal>query</>.
performed (but see <xref linkend="gin-limit">).
-1 means that nothing can match the <literal>query</>, and
so the index scan can be skipped entirely.
<literal>pmatch</> is an output argument for use when partial match
<literal>pmatch</> is an output argument for use when partial match
is supported. To use it, <function>extractQuery</> must allocate
is supported. To use it, <function>extractQuery</> must allocate
an array of <literal>*nkeys</> booleans and store its address at
an array of <literal>*nkeys</> booleans and store its address at
...
@@ -354,26 +356,20 @@
...
@@ -354,26 +356,20 @@
<title>Limitations</title>
<title>Limitations</title>
<para>
<para>
<acronym>GIN</acronym> doesn't support full index scans: because there are
<acronym>GIN</acronym> doesn't support full index scans. The reason for
often many keys per value, each heap pointer would be returned many times,
this is that <function>extractValue</> is allowed to return zero keys,
and there is no easy way to prevent this.
as for example might happen with an empty string or empty array. In such
a case the indexed value will be unrepresented in the index. It is
therefore impossible for <acronym>GIN</acronym> to guarantee that a
scan of the index can find every row in the table.
</para>
</para>
<para>
<para>
When <function>extractQuery</function> returns zero keys,
Because of this limitation, when <function>extractQuery</function> returns
<acronym>GIN</acronym> will emit an error. Depending on the operator,
<literal>nkeys = 0</> to indicate that all values match the query,
a void query might match all, some, or none of the indexed values (for
<acronym>GIN</acronym> will emit an error. (If there are multiple ANDed
example, every array contains the empty array, but does not overlap the
indexable operators in the query, this happens only if they all return zero
empty array), and <acronym>GIN</acronym> cannot determine the correct
for <literal>nkeys</>.)
answer, nor produce a full-index-scan result if it could determine that
that was correct.
</para>
<para>
It is not an error for <function>extractValue</> to return zero keys,
but in this case the indexed value will be unrepresented in the index.
This is another reason why full index scan is not useful — it would
miss such rows.
</para>
</para>
<para>
<para>
...
@@ -383,7 +379,21 @@
...
@@ -383,7 +379,21 @@
<function>extractQuery</function> must convert an unrestricted search into
<function>extractQuery</function> must convert an unrestricted search into
a partial-match query that will scan the whole index. This is inefficient
a partial-match query that will scan the whole index. This is inefficient
but might be necessary to avoid corner-case failures with operators such
but might be necessary to avoid corner-case failures with operators such
as <literal>LIKE</>.
as <literal>LIKE</> or subset inclusion.
</para>
<para>
<acronym>GIN</acronym> assumes that indexable operators are strict.
This means that <function>extractValue</> will not be called at all on
a NULL value (so the value will go unindexed), and
<function>extractQuery</function> will not be called on a NULL comparison
value either (instead, the query is presumed to be unmatchable).
</para>
<para>
A possibly more serious limitation is that <acronym>GIN</acronym> cannot
handle NULL keys — for example, an array containing a NULL cannot
be handled except by ignoring the NULL.
</para>
</para>
</sect1>
</sect1>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment