Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d79f2d4

Browse files
committed
Remove IN/slow FAQ item because it only applies to <=7.3.X.
1 parent bfc5362 commit d79f2d4

File tree

2 files changed

+22
-70
lines changed

2 files changed

+22
-70
lines changed

doc/FAQ

Lines changed: 11 additions & 33 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: Sat Jan 29 23:15:42 EST 2005
4+
Last updated: Sat Jan 29 23:20:03 EST 2005
55

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

@@ -76,13 +76,12 @@
7676
4.16) Why does my large-object operations get "invalid large obj
7777
descriptor"?
7878
4.17) How do I create a column that will default to the current time?
79-
4.18) Why are my subqueries using IN so slow?
80-
4.19) How do I perform an outer join?
81-
4.20) How do I perform queries using multiple databases?
82-
4.21) How do I return multiple rows or columns from a function?
83-
4.22) Why can't I reliably create/drop temporary tables in PL/PgSQL
79+
4.18) How do I perform an outer join?
80+
4.19) How do I perform queries using multiple databases?
81+
4.20) How do I return multiple rows or columns from a function?
82+
4.21) Why can't I reliably create/drop temporary tables in PL/PgSQL
8483
functions?
85-
4.23) What encryption options are available?
84+
4.22) What encryption options are available?
8685

8786
Extending PostgreSQL
8887

@@ -922,28 +921,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
922921
Use CURRENT_TIMESTAMP:
923922
CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
924923

925-
4.18) Why are my subqueries using IN so slow?
926-
927-
In versions prior to 7.4, subqueries were joined to outer queries by
928-
sequentially scanning the result of the subquery for each row of the
929-
outer query. If the subquery returns only a few rows and the outer
930-
query returns many rows, IN is fastest. To speed up other queries,
931-
replace IN with EXISTS:
932-
SELECT *
933-
FROM tab
934-
WHERE col IN (SELECT subcol FROM subtab);
935-
936-
to:
937-
SELECT *
938-
FROM tab
939-
WHERE EXISTS (SELECT subcol FROM subtab WHERE subcol = col);
940-
941-
For this to be fast, subcol should be an indexed column.
942-
943-
In version 7.4 and later, IN actually uses the same sophisticated join
944-
techniques as normal queries, and is prefered to using EXISTS.
945-
946-
4.19) How do I perform an outer join?
924+
4.18) How do I perform an outer join?
947925

948926
PostgreSQL supports outer joins using the SQL standard syntax. Here
949927
are two examples:
@@ -973,7 +951,7 @@ CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
973951
WHERE tab1.col1 NOT IN (SELECT tab2.col1 FROM tab2)
974952
ORDER BY col1
975953

976-
4.20) How do I perform queries using multiple databases?
954+
4.19) How do I perform queries using multiple databases?
977955

978956
There is no way to query a database other than the current one.
979957
Because PostgreSQL loads database-specific system catalogs, it is
@@ -983,12 +961,12 @@ CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
983961
course, a client can make simultaneous connections to different
984962
databases and merge the results on the client side.
985963

986-
4.21) How do I return multiple rows or columns from a function?
964+
4.20) How do I return multiple rows or columns from a function?
987965

988966
In 7.3, you can easily return multiple rows or columns from a
989967
function, http://techdocs.postgresql.org/guides/SetReturningFunctions.
990968

991-
4.22) Why can't I reliably create/drop temporary tables in PL/PgSQL
969+
4.21) Why can't I reliably create/drop temporary tables in PL/PgSQL
992970
functions?
993971

994972
PL/PgSQL caches function contents, and an unfortunate side effect is
@@ -999,7 +977,7 @@ CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
999977
table access in PL/PgSQL. This will cause the query to be reparsed
1000978
every time.
1001979

1002-
4.23) What encryption options are available?
980+
4.22) What encryption options are available?
1003981

1004982
* contrib/pgcrypto contains many encryption functions for use in SQL
1005983
queries.

doc/src/FAQ/FAQ.html

Lines changed: 11 additions & 37 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: Sat Jan 29 23:15:42 EST 2005</P>
13+
<P>Last updated: Sat Jan 29 23:20:03 EST 2005</P>
1414

1515
<P>Current maintainer: Bruce Momjian (<A href=
1616
"mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)<BR>
@@ -114,16 +114,14 @@ <H2 align="center">Operational Questions</H2>
114114
<I>"invalid large obj descriptor"</I>?<BR>
115115
<A href="#4.17">4.17</A>) How do I create a column that will
116116
default to the current time?<BR>
117-
<A href="#4.18">4.18</A>) Why are my subqueries using
118-
<CODE><SMALL>IN</SMALL></CODE> so slow?<BR>
119-
<A href="#4.19">4.19</A>) How do I perform an outer join?<BR>
120-
<A href="#4.20">4.20</A>) How do I perform queries using multiple
117+
<A href="#4.18">4.18</A>) How do I perform an outer join?<BR>
118+
<A href="#4.19">4.19</A>) How do I perform queries using multiple
121119
databases?<BR>
122-
<A href="#4.21">4.21</A>) How do I return multiple rows or columns
120+
<A href="#4.20">4.20</A>) How do I return multiple rows or columns
123121
from a function?<BR>
124-
<A href="#4.22">4.22</A>) Why can't I reliably create/drop
122+
<A href="#4.21">4.21</A>) Why can't I reliably create/drop
125123
temporary tables in PL/PgSQL functions?<BR>
126-
<A href="#4.23">4.23</A>) What encryption options are available?<BR>
124+
<A href="#4.22">4.22</A>) What encryption options are available?<BR>
127125

128126

129127
<H2 align="center">Extending PostgreSQL</H2>
@@ -1155,31 +1153,7 @@ <H4><A name="4.17">4.17</A>) How do I create a column that will
11551153
</CODE>
11561154
</PRE>
11571155

1158-
<H4><A name="4.18">4.18</A>) Why are my subqueries using
1159-
<CODE><SMALL>IN</SMALL></CODE> so slow?</H4>
1160-
1161-
<P>In versions prior to 7.4, subqueries were joined to outer queries
1162-
by sequentially scanning the result of the subquery for each row of
1163-
the outer query. If the subquery returns only a few rows and the outer
1164-
query returns many rows, <CODE><SMALL>IN</SMALL></CODE> is fastest. To
1165-
speed up other queries, replace <CODE>IN</CODE> with
1166-
<CODE>EXISTS</CODE>:</P>
1167-
<PRE> SELECT *
1168-
FROM tab
1169-
WHERE col IN (SELECT subcol FROM subtab);
1170-
</PRE>
1171-
to:
1172-
<PRE> SELECT *
1173-
FROM tab
1174-
WHERE EXISTS (SELECT subcol FROM subtab WHERE subcol = col);
1175-
</PRE>
1176-
1177-
For this to be fast, <CODE>subcol</CODE> should be an indexed column.
1178-
<P>In version 7.4 and later, <CODE>IN</CODE> actually uses the same
1179-
sophisticated join techniques as normal queries, and is prefered
1180-
to using <CODE>EXISTS</CODE>.
1181-
1182-
<H4><A name="4.19">4.19</A>) How do I perform an outer join?</H4>
1156+
<H4><A name="4.18">4.18</A>) How do I perform an outer join?</H4>
11831157

11841158
<P>PostgreSQL supports outer joins using the SQL standard syntax.
11851159
Here are two examples:</P>
@@ -1219,7 +1193,7 @@ <H4><A name="4.19">4.19</A>) How do I perform an outer join?</H4>
12191193
ORDER BY col1
12201194
</PRE>
12211195

1222-
<H4><A name="4.20">4.20</A>) How do I perform queries using
1196+
<H4><A name="4.19">4.19</A>) How do I perform queries using
12231197
multiple databases?</H4>
12241198

12251199
<P>There is no way to query a database other than the current one.
@@ -1231,15 +1205,15 @@ <H4><A name="4.20">4.20</A>) How do I perform queries using
12311205
connections to different databases and merge the results on the
12321206
client side.</P>
12331207

1234-
<H4><A name="4.21">4.21</A>) How do I return multiple rows or
1208+
<H4><A name="4.20">4.20</A>) How do I return multiple rows or
12351209
columns from a function?</H4>
12361210

12371211
<P>In 7.3, you can easily return multiple rows or columns from a
12381212
function,
12391213
<a href="http://techdocs.postgresql.org/guides/SetReturningFunctions">
12401214
http://techdocs.postgresql.org/guides/SetReturningFunctions</a>.
12411215

1242-
<H4><A name="4.22">4.22</A>) Why can't I reliably create/drop
1216+
<H4><A name="4.21">4.21</A>) Why can't I reliably create/drop
12431217
temporary tables in PL/PgSQL functions?</H4>
12441218
<P>PL/PgSQL caches function contents, and an unfortunate side effect
12451219
is that if a PL/PgSQL function accesses a temporary table, and that
@@ -1249,7 +1223,7 @@ <H4><A name="4.22">4.22</A>) Why can't I reliably create/drop
12491223
<SMALL>EXECUTE</SMALL> for temporary table access in PL/PgSQL. This
12501224
will cause the query to be reparsed every time.</P>
12511225

1252-
<H4><A name="4.23">4.23</A>) What encryption options are available?
1226+
<H4><A name="4.22">4.22</A>) What encryption options are available?
12531227
</H4>
12541228
<UL>
12551229
<LI><I>contrib/pgcrypto</I> contains many encryption functions for

0 commit comments

Comments
 (0)