diff options
Diffstat (limited to 'doc/src/sgml/html/indexes-intro.html')
-rw-r--r-- | doc/src/sgml/html/indexes-intro.html | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/doc/src/sgml/html/indexes-intro.html b/doc/src/sgml/html/indexes-intro.html index acdb0c6..2dadf9a 100644 --- a/doc/src/sgml/html/indexes-intro.html +++ b/doc/src/sgml/html/indexes-intro.html @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>11.1. Introduction</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="indexes.html" title="Chapter 11. Indexes" /><link rel="next" href="indexes-types.html" title="11.2. Index Types" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">11.1. Introduction</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="indexes.html" title="Chapter 11. Indexes">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="indexes.html" title="Chapter 11. Indexes">Up</a></td><th width="60%" align="center">Chapter 11. Indexes</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 15.5 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="indexes-types.html" title="11.2. Index Types">Next</a></td></tr></table><hr /></div><div class="sect1" id="INDEXES-INTRO"><div class="titlepage"><div><div><h2 class="title" style="clear: both">11.1. Introduction</h2></div></div></div><p> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>11.1. Introduction</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="indexes.html" title="Chapter 11. Indexes" /><link rel="next" href="indexes-types.html" title="11.2. Index Types" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">11.1. Introduction</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="indexes.html" title="Chapter 11. Indexes">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="indexes.html" title="Chapter 11. Indexes">Up</a></td><th width="60%" align="center">Chapter 11. Indexes</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 15.6 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="indexes-types.html" title="11.2. Index Types">Next</a></td></tr></table><hr /></div><div class="sect1" id="INDEXES-INTRO"><div class="titlepage"><div><div><h2 class="title" style="clear: both">11.1. Introduction</h2></div></div></div><p> Suppose we have a table similar to this: </p><pre class="programlisting"> CREATE TABLE test1 ( @@ -59,6 +59,35 @@ CREATE INDEX test1_id_index ON test1 (id); an index defined on a column that is part of a join condition can also significantly speed up queries with joins. </p><p> + In general, <span class="productname">PostgreSQL</span> indexes can be used + to optimize queries that contain one or more <code class="literal">WHERE</code> + or <code class="literal">JOIN</code> clauses of the form + +</p><pre class="synopsis"> +<em class="replaceable"><code>indexed-column</code></em> <em class="replaceable"><code>indexable-operator</code></em> <em class="replaceable"><code>comparison-value</code></em> +</pre><p> + + Here, the <em class="replaceable"><code>indexed-column</code></em> is whatever + column or expression the index has been defined on. + The <em class="replaceable"><code>indexable-operator</code></em> is an operator that + is a member of the index's <em class="firstterm">operator class</em> for + the indexed column. (More details about that appear below.) + And the <em class="replaceable"><code>comparison-value</code></em> can be any + expression that is not volatile and does not reference the index's + table. + </p><p> + In some cases the query planner can extract an indexable clause of + this form from another SQL construct. A simple example is that if + the original clause was + +</p><pre class="synopsis"> +<em class="replaceable"><code>comparison-value</code></em> <em class="replaceable"><code>operator</code></em> <em class="replaceable"><code>indexed-column</code></em> +</pre><p> + + then it can be flipped around into indexable form if the + original <em class="replaceable"><code>operator</code></em> has a commutator + operator that is a member of the index's operator class. + </p><p> Creating an index on a large table can take a long time. By default, <span class="productname">PostgreSQL</span> allows reads (<code class="command">SELECT</code> statements) to occur on the table in parallel with index creation, but writes (<code class="command">INSERT</code>, @@ -74,4 +103,4 @@ CREATE INDEX test1_id_index ON test1 (id); tuples</a>. Therefore indexes that are seldom or never used in queries should be removed. - </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="indexes.html" title="Chapter 11. Indexes">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="indexes.html" title="Chapter 11. Indexes">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="indexes-types.html" title="11.2. Index Types">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 11. Indexes </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 15.5 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 11.2. Index Types</td></tr></table></div></body></html>
\ No newline at end of file + </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="indexes.html" title="Chapter 11. Indexes">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="indexes.html" title="Chapter 11. Indexes">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="indexes-types.html" title="11.2. Index Types">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 11. Indexes </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 15.6 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 11.2. Index Types</td></tr></table></div></body></html>
\ No newline at end of file |