Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit407bd1c

Browse files
committed
Add MIN/MAX LIMIT/OFFSET mention.
1 parentaad4cc7 commit407bd1c

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

‎doc/FAQ

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Frequently Asked Questions (FAQ) for PostgreSQL
33

4-
Last updated:Thu Jun20 22:00:57 EDT 2002
4+
Last updated:Sun Jun23 17:16:13 EDT 2002
55

66
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
77

@@ -723,7 +723,7 @@
723723
Indexes are not automatically used by every query. Indexes are only
724724
used if the table is larger than a minimum size, and the query selects
725725
only a small percentage of the rows in the table. This is because the
726-
random disk access caused by an index scanis sometimes slower than a
726+
random disk access caused by an index scancan be slower than a
727727
straight read through the table, or sequential scan.
728728

729729
To determine if an index should be used, PostgreSQL must have
@@ -738,8 +738,14 @@
738738
sequential scan followed by an explicit sort is usually faster than an
739739
index scan of a large table.
740740
However, LIMIT combined with ORDER BY often will use an index because
741-
only a small portion of the table is returned.
742-
741+
only a small portion of the table is returned. In fact, though MAX()
742+
and MIN() don't use indexes, it is possible to retrieve such values
743+
using an index with ORDER BY and LIMIT:
744+
SELECT col
745+
FROM tab
746+
ORDER BY col
747+
LIMIT 1
748+
743749
When using wild-card operators such as LIKE or ~, indexes can only be
744750
used if the beginning of the search is anchored to the start of the
745751
string. Therefore, to use indexes, LIKE patterns must not start with

‎doc/src/FAQ/FAQ.html

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
alink="#0000ff">
1515
<H1>Frequently Asked Questions (FAQ) for PostgreSQL</H1>
1616

17-
<P>Last updated:Thu Jun20 22:00:57 EDT 2002</P>
17+
<P>Last updated:Sun Jun23 17:16:13 EDT 2002</P>
1818

1919
<P>Current maintainer: Bruce Momjian (<Ahref=
2020
"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
923923
Indexes are not automatically used by every query. Indexes are only
924924
used if the table is larger than a minimum size, and the query
925925
selects only a small percentage of the rows in the table. This is
926-
because the random disk access caused by an index scanis sometimes
926+
because the random disk access caused by an index scancan be
927927
slower than a straight read through the table, or sequential scan.
928928

929929
<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
940940
usually faster than an index scan of a large table.</P>
941941
However,<SMALL>LIMIT</SMALL> combined with<SMALL>ORDER BY</SMALL>
942942
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>
944952

945953
<P>When using wild-card operators such as<SMALL>LIKE</SMALL> or
946954
<I>~</I>, indexes can only be used if the beginning of the search

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp