File tree 2 files changed +6
-20
lines changed
2 files changed +6
-20
lines changed Original file line number Diff line number Diff line change 1
1
2
2
Frequently Asked Questions (FAQ) for PostgreSQL
3
3
4
- Last updated: Sun Feb 12 12:15:49 EST 2006
4
+ Last updated: Fri Feb 24 09:59:35 EST 2006
5
5
6
6
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
7
7
569
569
sequential scan followed by an explicit sort is usually faster than an
570
570
index scan of a large table.
571
571
However, LIMIT combined with ORDER BY often will use an index because
572
- only a small portion of the table is returned. In fact, though MAX()
573
- and MIN() don't use indexes, it is possible to retrieve such values
574
- using an index with ORDER BY and LIMIT:
575
- SELECT col
576
- FROM tab
577
- ORDER BY col [ DESC ]
578
- LIMIT 1;
579
-
572
+ only a small portion of the table is returned.
573
+
580
574
If you believe the optimizer is incorrect in choosing a sequential
581
575
scan, use SET enable_seqscan TO 'off' and run query again to see if an
582
576
index scan is indeed faster.
Original file line number Diff line number Diff line change 10
10
alink ="#0000ff ">
11
11
< H1 > Frequently Asked Questions (FAQ) for PostgreSQL</ H1 >
12
12
13
- < P > Last updated: Sun Feb 12 12:15:49 EST 2006</ P >
13
+ < P > Last updated: Fri Feb 24 09:59:35 EST 2006</ P >
14
14
15
15
< P > Current maintainer: Bruce Momjian (< A href =
16
16
"mailto:pgman@candle.pha.pa.us "> pgman@candle.pha.pa.us</ A > )
@@ -742,16 +742,8 @@ <H3 id="item4.6">4.6) Why are my queries slow? Why don't they
742
742
usually faster than an index scan of a large table.</ P >
743
743
However, < SMALL > LIMIT</ SMALL > combined with < SMALL > ORDER BY</ SMALL >
744
744
often will use an index because only a small portion of the table
745
- is returned. In fact, though MAX() and MIN() don't use indexes,
746
- it is possible to retrieve such values using an index with ORDER BY
747
- and LIMIT:
748
- < PRE >
749
- SELECT col
750
- FROM tab
751
- ORDER BY col [ DESC ]
752
- LIMIT 1;
753
- </ PRE >
754
-
745
+ is returned.</ P >
746
+
755
747
< P > If you believe the optimizer is incorrect in choosing a
756
748
sequential scan, use < CODE > SET enable_seqscan TO 'off'</ CODE > and
757
749
run query again to see if an index scan is indeed faster.</ P >
You can’t perform that action at this time.
0 commit comments