Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
407bd1c2
Commit
407bd1c2
authored
22 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
Add MIN/MAX LIMIT/OFFSET mention.
parent
aad4cc7d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/FAQ
+10
-4
10 additions, 4 deletions
doc/FAQ
doc/src/FAQ/FAQ.html
+11
-3
11 additions, 3 deletions
doc/src/FAQ/FAQ.html
with
21 additions
and
7 deletions
doc/FAQ
+
10
−
4
View file @
407bd1c2
Frequently Asked Questions (FAQ) for PostgreSQL
Frequently Asked Questions (FAQ) for PostgreSQL
Last updated:
Thu
Jun 2
0 22:00:57
EDT 2002
Last updated:
Sun
Jun 2
3 17:16:13
EDT 2002
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
...
@@ -723,7 +723,7 @@
...
@@ -723,7 +723,7 @@
Indexes are not automatically used by every query. Indexes are only
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
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
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.
straight read through the table, or sequential scan.
To determine if an index should be used, PostgreSQL must have
To determine if an index should be used, PostgreSQL must have
...
@@ -738,7 +738,13 @@
...
@@ -738,7 +738,13 @@
sequential scan followed by an explicit sort is usually faster than an
sequential scan followed by an explicit sort is usually faster than an
index scan of a large table.
index scan of a large table.
However, LIMIT combined with ORDER BY often will use an index because
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
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
used if the beginning of the search is anchored to the start of the
...
...
This diff is collapsed.
Click to expand it.
doc/src/FAQ/FAQ.html
+
11
−
3
View file @
407bd1c2
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
alink=
"#0000ff"
>
alink=
"#0000ff"
>
<H1>
Frequently Asked Questions (FAQ) for PostgreSQL
</H1>
<H1>
Frequently Asked Questions (FAQ) for PostgreSQL
</H1>
<P>
Last updated:
Thu
Jun 2
0 22:00:57
EDT 2002
</P>
<P>
Last updated:
Sun
Jun 2
3 17:16:13
EDT 2002
</P>
<P>
Current maintainer: Bruce Momjian (
<A
href=
<P>
Current maintainer: Bruce Momjian (
<A
href=
"mailto:pgman@candle.pha.pa.us"
>
pgman@candle.pha.pa.us
</A>
)
<BR>
"mailto:pgman@candle.pha.pa.us"
>
pgman@candle.pha.pa.us
</A>
)
<BR>
...
@@ -923,7 +923,7 @@
...
@@ -923,7 +923,7 @@
Indexes are not automatically used by every query. Indexes are only
Indexes are not automatically used by every query. Indexes are only
used if the table is larger than a minimum size, and the query
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
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.
slower than a straight read through the table, or sequential scan.
<P>
To determine if an index should be used, PostgreSQL must have
<P>
To determine if an index should be used, PostgreSQL must have
...
@@ -940,7 +940,15 @@
...
@@ -940,7 +940,15 @@
usually faster than an index scan of a large table.
</P>
usually faster than an index scan of a large table.
</P>
However,
<SMALL>
LIMIT
</SMALL>
combined with
<SMALL>
ORDER BY
</SMALL>
However,
<SMALL>
LIMIT
</SMALL>
combined with
<SMALL>
ORDER BY
</SMALL>
often will use an index because only a small portion of the table
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:
<PRE>
SELECT col
FROM tab
ORDER BY col
LIMIT 1
</PRE>
<P>
When using wild-card operators such as
<SMALL>
LIKE
</SMALL>
or
<P>
When using wild-card operators such as
<SMALL>
LIKE
</SMALL>
or
<I>
~
</I>
, indexes can only be used if the beginning of the search
<I>
~
</I>
, indexes can only be used if the beginning of the search
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment