10
10
alink ="#0000ff ">
11
11
< H1 > Frequently Asked Questions (FAQ) for PostgreSQL</ H1 >
12
12
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 >
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 > )< BR >
@@ -114,16 +114,14 @@ <H2 align="center">Operational Questions</H2>
114
114
< I > "invalid large obj descriptor"</ I > ?< BR >
115
115
< A href ="#4.17 "> 4.17</ A > ) How do I create a column that will
116
116
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
121
119
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
123
121
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
125
123
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 >
127
125
128
126
129
127
< 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
1155
1153
</ CODE >
1156
1154
</ PRE >
1157
1155
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 >
1183
1157
1184
1158
< P > PostgreSQL supports outer joins using the SQL standard syntax.
1185
1159
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>
1219
1193
ORDER BY col1
1220
1194
</ PRE >
1221
1195
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
1223
1197
multiple databases?</ H4 >
1224
1198
1225
1199
< 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
1231
1205
connections to different databases and merge the results on the
1232
1206
client side.</ P >
1233
1207
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
1235
1209
columns from a function?</ H4 >
1236
1210
1237
1211
< P > In 7.3, you can easily return multiple rows or columns from a
1238
1212
function,
1239
1213
< a href ="http://techdocs.postgresql.org/guides/SetReturningFunctions ">
1240
1214
http://techdocs.postgresql.org/guides/SetReturningFunctions</ a > .
1241
1215
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
1243
1217
temporary tables in PL/PgSQL functions?</ H4 >
1244
1218
< P > PL/PgSQL caches function contents, and an unfortunate side effect
1245
1219
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
1249
1223
< SMALL > EXECUTE</ SMALL > for temporary table access in PL/PgSQL. This
1250
1224
will cause the query to be reparsed every time.</ P >
1251
1225
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?
1253
1227
</ H4 >
1254
1228
< UL >
1255
1229
< LI > < I > contrib/pgcrypto</ I > contains many encryption functions for
0 commit comments