aboutsummaryrefslogtreecommitdiff
path: root/doc/FAQ
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2002-06-23 21:16:29 +0000
committerBruce Momjian <bruce@momjian.us>2002-06-23 21:16:29 +0000
commit407bd1c29b66f7e007288455982f428e7f26b7f9 (patch)
tree866df7c34223e10a00e6c2c9162e312682d554f5 /doc/FAQ
parentaad4cc7d0dc4523bfc91613597f3c3c21aef8e00 (diff)
downloadpostgresql-407bd1c29b66f7e007288455982f428e7f26b7f9.tar.gz
postgresql-407bd1c29b66f7e007288455982f428e7f26b7f9.zip
Add MIN/MAX LIMIT/OFFSET mention.
Diffstat (limited to 'doc/FAQ')
-rw-r--r--doc/FAQ14
1 files changed, 10 insertions, 4 deletions
diff --git a/doc/FAQ b/doc/FAQ
index a60063eac18..a1f9d150ba7 100644
--- a/doc/FAQ
+++ b/doc/FAQ
@@ -1,7 +1,7 @@
Frequently Asked Questions (FAQ) for PostgreSQL
- Last updated: Thu Jun 20 22:00:57 EDT 2002
+ Last updated: Sun Jun 23 17:16:13 EDT 2002
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
@@ -723,7 +723,7 @@
Indexes are not automatically used by every query. Indexes are only
used if the table is larger than a minimum size, and the query selects
only a small percentage of the rows in the table. This is because the
- random disk access caused by an index scan is sometimes slower than a
+ random disk access caused by an index scan can be slower than a
straight read through the table, or sequential scan.
To determine if an index should be used, PostgreSQL must have
@@ -738,8 +738,14 @@
sequential scan followed by an explicit sort is usually faster than an
index scan of a large table.
However, LIMIT combined with ORDER BY often will use an index because
- only a small portion of the table is returned.
-
+ only a small portion of the table is returned. In fact, though MAX()
+ and MIN() don't use indexes, it is possible to retrieve such values
+ using an index with ORDER BY and LIMIT:
+ SELECT col
+ FROM tab
+ ORDER BY col
+ LIMIT 1
+
When using wild-card operators such as LIKE or ~, indexes can only be
used if the beginning of the search is anchored to the start of the
string. Therefore, to use indexes, LIKE patterns must not start with