14
14
alink ="#0000ff ">
15
15
< H1 > Frequently Asked Questions (FAQ) for PostgreSQL</ H1 >
16
16
17
- < P > Last updated: Thu Jun 20 22:00:57 EDT 2002</ P >
17
+ < P > Last updated: Sun Jun 23 17:16:13 EDT 2002</ P >
18
18
19
19
< P > Current maintainer: Bruce Momjian (< A href =
20
20
"mailto:pgman@candle.pha.pa.us "> pgman@candle.pha.pa.us</ A > )< BR >
@@ -923,7 +923,7 @@ <H4><A name="4.8">4.8</A>) My queries are slow or don't make use of
923
923
Indexes are not automatically used by every query. Indexes are only
924
924
used if the table is larger than a minimum size, and the query
925
925
selects only a small percentage of the rows in the table. This is
926
- because the random disk access caused by an index scan is sometimes
926
+ because the random disk access caused by an index scan can be
927
927
slower than a straight read through the table, or sequential scan.
928
928
929
929
< P > To determine if an index should be used, PostgreSQL must have
@@ -940,7 +940,15 @@ <H4><A name="4.8">4.8</A>) My queries are slow or don't make use of
940
940
usually faster than an index scan of a large table.</ P >
941
941
However, < SMALL > LIMIT</ SMALL > combined with < SMALL > ORDER BY</ SMALL >
942
942
often will use an index because only a small portion of the table
943
- is returned.
943
+ is returned. In fact, though MAX() and MIN() don't use indexes,
944
+ it is possible to retrieve such values using an index with ORDER BY
945
+ and LIMIT:
946
+ < PRE >
947
+ SELECT col
948
+ FROM tab
949
+ ORDER BY col
950
+ LIMIT 1
951
+ </ PRE >
944
952
945
953
< P > When using wild-card operators such as < SMALL > LIKE</ SMALL > or
946
954
< I > ~</ I > , indexes can only be used if the beginning of the search
0 commit comments