mirror of
https://github.com/postgres/postgres.git
synced 2025-05-03 22:24:49 +03:00
Doc: clarify partial-index example.
Jonathan Katz Discussion: https://postgr.es/m/155432280882.722.12392985690846288230@wrigleys.postgresql.org
This commit is contained in:
parent
ea569d64ac
commit
af052daec5
@ -814,18 +814,20 @@ SELECT *
|
|||||||
FROM access_log
|
FROM access_log
|
||||||
WHERE url = '/index.html' AND client_ip = inet '212.78.10.32';
|
WHERE url = '/index.html' AND client_ip = inet '212.78.10.32';
|
||||||
</programlisting>
|
</programlisting>
|
||||||
A query that cannot use this index is:
|
Here the query's IP address is covered by the partial index. The
|
||||||
|
following query cannot use the partial index, as it uses an IP address
|
||||||
|
that is excluded from the index:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM access_log
|
FROM access_log
|
||||||
WHERE client_ip = inet '192.168.100.23';
|
WHERE url = '/index.html' AND client_ip = inet '192.168.100.23';
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Observe that this kind of partial index requires that the common
|
Observe that this kind of partial index requires that the common
|
||||||
values be predetermined, so such partial indexes are best used for
|
values be predetermined, so such partial indexes are best used for
|
||||||
data distributions that do not change. The indexes can be recreated
|
data distributions that do not change. Such indexes can be recreated
|
||||||
occasionally to adjust for new data distributions, but this adds
|
occasionally to adjust for new data distributions, but this adds
|
||||||
maintenance effort.
|
maintenance effort.
|
||||||
</para>
|
</para>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user