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

Commit25deba3

Browse files
committed
Update LIMIT/FETCH FAQ item.
1 parent0a92c58 commit25deba3

File tree

2 files changed

+19
-33
lines changed

2 files changed

+19
-33
lines changed

‎doc/FAQ

Lines changed: 8 additions & 15 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: Mon Jan 3119:18:44 EST 2005
4+
Last updated: Mon Jan 3120:35:58 EST 2005
55

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

@@ -445,17 +445,13 @@
445445
PostgreSQL releases?
446446

447447
The PostgreSQL team makes only small changes between minor releases,
448-
so upgrading from 7.2 to 7.2.1 does not require a dump and restore.
449-
However, major releases (e.g. from 7.2 to 7.3) often change the
448+
so upgrading from 7.4 to 7.4.1 does not require a dump and restore.
449+
However, major releases (e.g. from 7.3 to 7.4) often change the
450450
internal format of system tables and data files. These changes are
451-
often complex, so we don't maintain backwardcompatability for data
451+
often complex, so we don't maintain backwardcompatibility for data
452452
files. A dump outputs data in a generic format that can then be loaded
453453
in using the new internal format.
454454

455-
In releases where the on-disk format does not change, the pg_upgrade
456-
script can be used to upgrade without a dump/restore. The release
457-
notes mention whether pg_upgrade is available for the release.
458-
459455
3.8) What computer hardware should I use?
460456

461457
Because PC hardware is mostly compatible, people tend to believe that
@@ -471,13 +467,10 @@
471467

472468
4.1) How do I SELECT only the first few rows of a query? A random row?
473469

474-
See the FETCH manual page, or use SELECT ... LIMIT....
475-
476-
The entire query may have to be evaluated, even if you only want the
477-
first few rows. Consider using a query that has an ORDER BY. If there
478-
is an index that matches the ORDER BY, PostgreSQL may be able to
479-
evaluate only the first few records requested, or the entire query may
480-
have to be evaluated until the desired rows have been generated.
470+
To retrieve only a few rows, if you know at the number of rows needed
471+
at the time of the SELECT use LIMIT . If an index matches the ORDER BY
472+
it is possible the entire query does not have to be executed. If you
473+
don't know the number of rows at SELECT time, use a cursor and FETCH.
481474

482475
To SELECT a random row, use:
483476
SELECT col

‎doc/src/FAQ/FAQ.html

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
alink="#0000ff">
1111
<H1>Frequently Asked Questions (FAQ) for PostgreSQL</H1>
1212

13-
<P>Last updated: Mon Jan 3119:18:44 EST 2005</P>
13+
<P>Last updated: Mon Jan 3120:35:58 EST 2005</P>
1414

1515
<P>Current maintainer: Bruce Momjian (<Ahref=
1616
"mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)
@@ -590,18 +590,13 @@ <H4><A name="3.7">3.7</A>) Why do I need to do a dump and restore
590590
to upgrade between major PostgreSQL releases?</H4>
591591

592592
<P>The PostgreSQL team makes only small changes between minor releases,
593-
so upgrading from 7.2 to 7.2.1 does not require a dump and restore.
594-
However, major releases (e.g. from 7.2 to 7.3) often change the internal
593+
so upgrading from 7.4 to 7.4.1 does not require a dump and restore.
594+
However, major releases (e.g. from 7.3 to 7.4) often change the internal
595595
format of system tables and data files. These changes are often complex,
596-
so we don't maintain backwardcompatability for data files. A dump outputs
596+
so we don't maintain backwardcompatibility for data files. A dump outputs
597597
data in a generic format that can then be loaded in using the new internal
598598
format.</P>
599599

600-
<P>In releases where the on-disk format does not change, the
601-
<I>pg_upgrade</I> script can be used to upgrade without a dump/restore.
602-
The release notes mention whether<I>pg_upgrade</I> is available for the
603-
release.</P>
604-
605600
<H4><Aname="3.8">3.8</A>) What computer hardware should I use?</H4>
606601

607602
<P>Because PC hardware is mostly compatible, people tend to believe that
@@ -619,15 +614,13 @@ <H2 align="center">Operational Questions</H2>
619614
<H4><Aname="4.1">4.1</A>) How do I<SMALL>SELECT</SMALL> only the
620615
first few rows of a query? A random row?</H4>
621616

622-
<P>See the<SMALL>FETCH</SMALL> manual page, or use
623-
<SMALL>SELECT</SMALL> ...<SMALL>LIMIT</SMALL>....</P>
624-
625-
<P>The entire query may have to be evaluated, even if you only want
626-
the first few rows. Consider using a query that has an<SMALL>ORDER
627-
BY</SMALL>. If there is an index that matches the<SMALL>ORDER
628-
BY</SMALL>, PostgreSQL may be able to evaluate only the first few
629-
records requested, or the entire query may have to be evaluated
630-
until the desired rows have been generated.</P>
617+
<P>To retrieve only a few rows, if you know at the number of rows
618+
needed at the time of the<SMALL>SELECT</SMALL> use
619+
<SMALL>LIMIT</SMALL> . If an index matches the<SMALL>ORDER
620+
BY</SMALL> it is possible the entire query does not have to be
621+
executed. If you don't know the number of rows at
622+
<SMALL>SELECT</SMALL> time, use a cursor and
623+
<SMALL>FETCH</SMALL>.</P>
631624

632625
<P>To<SMALL>SELECT</SMALL> a random row, use:
633626
<PRE>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp