From 407bd1c29b66f7e007288455982f428e7f26b7f9 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sun, 23 Jun 2002 21:16:29 +0000 Subject: Add MIN/MAX LIMIT/OFFSET mention. --- doc/src/FAQ/FAQ.html | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'doc/src/FAQ/FAQ.html') diff --git a/doc/src/FAQ/FAQ.html b/doc/src/FAQ/FAQ.html index 08e9c9d98eb..b6de1a6d499 100644 --- a/doc/src/FAQ/FAQ.html +++ b/doc/src/FAQ/FAQ.html @@ -14,7 +14,7 @@ alink="#0000ff">

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)
@@ -923,7 +923,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 + because the 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 @@ -940,7 +940,15 @@ 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. + 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 -- cgit v1.2.3