Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
d79f2d40
Commit
d79f2d40
authored
Jan 30, 2005
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove IN/slow FAQ item because it only applies to <=7.3.X.
parent
bfc53621
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
70 deletions
+22
-70
doc/FAQ
doc/FAQ
+11
-33
doc/src/FAQ/FAQ.html
doc/src/FAQ/FAQ.html
+11
-37
No files found.
doc/FAQ
View file @
d79f2d40
Frequently Asked Questions (FAQ) for PostgreSQL
Frequently Asked Questions (FAQ) for PostgreSQL
Last updated: Sat Jan 29 23:
15:42
EST 2005
Last updated: Sat Jan 29 23:
20:03
EST 2005
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
...
@@ -76,13 +76,12 @@
...
@@ -76,13 +76,12 @@
4.16) Why does my large-object operations get "invalid large obj
4.16) Why does my large-object operations get "invalid large obj
descriptor"?
descriptor"?
4.17) How do I create a column that will default to the current time?
4.17) How do I create a column that will default to the current time?
4.18) Why are my subqueries using IN so slow?
4.18) How do I perform an outer join?
4.19) How do I perform an outer join?
4.19) How do I perform queries using multiple databases?
4.20) How do I perform queries using multiple databases?
4.20) How do I return multiple rows or columns from a function?
4.21) How do I return multiple rows or columns from a function?
4.21) Why can't I reliably create/drop temporary tables in PL/PgSQL
4.22) Why can't I reliably create/drop temporary tables in PL/PgSQL
functions?
functions?
4.2
3
) What encryption options are available?
4.2
2
) What encryption options are available?
Extending PostgreSQL
Extending PostgreSQL
...
@@ -922,28 +921,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
...
@@ -922,28 +921,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
Use CURRENT_TIMESTAMP:
Use CURRENT_TIMESTAMP:
CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
4.18) Why are my subqueries using IN so slow?
4.18) How do I perform an outer join?
In versions prior to 7.4, subqueries were joined to outer queries by
sequentially scanning the result of the subquery for each row of the
outer query. If the subquery returns only a few rows and the outer
query returns many rows, IN is fastest. To speed up other queries,
replace IN with EXISTS:
SELECT *
FROM tab
WHERE col IN (SELECT subcol FROM subtab);
to:
SELECT *
FROM tab
WHERE EXISTS (SELECT subcol FROM subtab WHERE subcol = col);
For this to be fast, subcol should be an indexed column.
In version 7.4 and later, IN actually uses the same sophisticated join
techniques as normal queries, and is prefered to using EXISTS.
4.19) How do I perform an outer join?
PostgreSQL supports outer joins using the SQL standard syntax. Here
PostgreSQL supports outer joins using the SQL standard syntax. Here
are two examples:
are two examples:
...
@@ -973,7 +951,7 @@ CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
...
@@ -973,7 +951,7 @@ CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
WHERE tab1.col1 NOT IN (SELECT tab2.col1 FROM tab2)
WHERE tab1.col1 NOT IN (SELECT tab2.col1 FROM tab2)
ORDER BY col1
ORDER BY col1
4.
20
) How do I perform queries using multiple databases?
4.
19
) How do I perform queries using multiple databases?
There is no way to query a database other than the current one.
There is no way to query a database other than the current one.
Because PostgreSQL loads database-specific system catalogs, it is
Because PostgreSQL loads database-specific system catalogs, it is
...
@@ -983,12 +961,12 @@ CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
...
@@ -983,12 +961,12 @@ CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
course, a client can make simultaneous connections to different
course, a client can make simultaneous connections to different
databases and merge the results on the client side.
databases and merge the results on the client side.
4.2
1
) How do I return multiple rows or columns from a function?
4.2
0
) How do I return multiple rows or columns from a function?
In 7.3, you can easily return multiple rows or columns from a
In 7.3, you can easily return multiple rows or columns from a
function, http://techdocs.postgresql.org/guides/SetReturningFunctions.
function, http://techdocs.postgresql.org/guides/SetReturningFunctions.
4.2
2
) Why can't I reliably create/drop temporary tables in PL/PgSQL
4.2
1
) Why can't I reliably create/drop temporary tables in PL/PgSQL
functions?
functions?
PL/PgSQL caches function contents, and an unfortunate side effect is
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 );
...
@@ -999,7 +977,7 @@ CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
table access in PL/PgSQL. This will cause the query to be reparsed
table access in PL/PgSQL. This will cause the query to be reparsed
every time.
every time.
4.2
3
) What encryption options are available?
4.2
2
) What encryption options are available?
* contrib/pgcrypto contains many encryption functions for use in SQL
* contrib/pgcrypto contains many encryption functions for use in SQL
queries.
queries.
...
...
doc/src/FAQ/FAQ.html
View file @
d79f2d40
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
alink=
"#0000ff"
>
alink=
"#0000ff"
>
<H1>
Frequently Asked Questions (FAQ) for PostgreSQL
</H1>
<H1>
Frequently Asked Questions (FAQ) for PostgreSQL
</H1>
<P>
Last updated: Sat Jan 29 23:
15:42
EST 2005
</P>
<P>
Last updated: Sat Jan 29 23:
20:03
EST 2005
</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>
...
@@ -114,16 +114,14 @@
...
@@ -114,16 +114,14 @@
<I>
"invalid large obj descriptor"
</I>
?
<BR>
<I>
"invalid large obj descriptor"
</I>
?
<BR>
<A
href=
"#4.17"
>
4.17
</A>
) How do I create a column that will
<A
href=
"#4.17"
>
4.17
</A>
) How do I create a column that will
default to the current time?
<BR>
default to the current time?
<BR>
<A
href=
"#4.18"
>
4.18
</A>
) Why are my subqueries using
<A
href=
"#4.18"
>
4.18
</A>
) How do I perform an outer join?
<BR>
<CODE><SMALL>
IN
</SMALL></CODE>
so slow?
<BR>
<A
href=
"#4.19"
>
4.19
</A>
) How do I perform queries using multiple
<A
href=
"#4.19"
>
4.19
</A>
) How do I perform an outer join?
<BR>
<A
href=
"#4.20"
>
4.20
</A>
) How do I perform queries using multiple
databases?
<BR>
databases?
<BR>
<A
href=
"#4.2
1"
>
4.21
</A>
) How do I return multiple rows or columns
<A
href=
"#4.2
0"
>
4.20
</A>
) How do I return multiple rows or columns
from a function?
<BR>
from a function?
<BR>
<A
href=
"#4.2
2"
>
4.22
</A>
) Why can't I reliably create/drop
<A
href=
"#4.2
1"
>
4.21
</A>
) Why can't I reliably create/drop
temporary tables in PL/PgSQL functions?
<BR>
temporary tables in PL/PgSQL functions?
<BR>
<A
href=
"#4.2
3"
>
4.23
</A>
) What encryption options are available?
<BR>
<A
href=
"#4.2
2"
>
4.22
</A>
) What encryption options are available?
<BR>
<H2
align=
"center"
>
Extending PostgreSQL
</H2>
<H2
align=
"center"
>
Extending PostgreSQL
</H2>
...
@@ -1155,31 +1153,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
...
@@ -1155,31 +1153,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
</CODE>
</CODE>
</PRE>
</PRE>
<H4><A
name=
"4.18"
>
4.18
</A>
) Why are my subqueries using
<H4><A
name=
"4.18"
>
4.18
</A>
) How do I perform an outer join?
</H4>
<CODE><SMALL>
IN
</SMALL></CODE>
so slow?
</H4>
<P>
In versions prior to 7.4, subqueries were joined to outer queries
by sequentially scanning the result of the subquery for each row of
the outer query. If the subquery returns only a few rows and the outer
query returns many rows,
<CODE><SMALL>
IN
</SMALL></CODE>
is fastest. To
speed up other queries, replace
<CODE>
IN
</CODE>
with
<CODE>
EXISTS
</CODE>
:
</P>
<PRE>
SELECT *
FROM tab
WHERE col IN (SELECT subcol FROM subtab);
</PRE>
to:
<PRE>
SELECT *
FROM tab
WHERE EXISTS (SELECT subcol FROM subtab WHERE subcol = col);
</PRE>
For this to be fast,
<CODE>
subcol
</CODE>
should be an indexed column.
<P>
In version 7.4 and later,
<CODE>
IN
</CODE>
actually uses the same
sophisticated join techniques as normal queries, and is prefered
to using
<CODE>
EXISTS
</CODE>
.
<H4><A
name=
"4.19"
>
4.19
</A>
) How do I perform an outer join?
</H4>
<P>
PostgreSQL supports outer joins using the SQL standard syntax.
<P>
PostgreSQL supports outer joins using the SQL standard syntax.
Here are two examples:
</P>
Here are two examples:
</P>
...
@@ -1219,7 +1193,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
...
@@ -1219,7 +1193,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
ORDER BY col1
ORDER BY col1
</PRE>
</PRE>
<H4><A
name=
"4.
20"
>
4.20
</A>
) How do I perform queries using
<H4><A
name=
"4.
19"
>
4.19
</A>
) How do I perform queries using
multiple databases?
</H4>
multiple databases?
</H4>
<P>
There is no way to query a database other than the current one.
<P>
There is no way to query a database other than the current one.
...
@@ -1231,7 +1205,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
...
@@ -1231,7 +1205,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
connections to different databases and merge the results on the
connections to different databases and merge the results on the
client side.
</P>
client side.
</P>
<H4><A
name=
"4.2
1"
>
4.21
</A>
) How do I return multiple rows or
<H4><A
name=
"4.2
0"
>
4.20
</A>
) How do I return multiple rows or
columns from a function?
</H4>
columns from a function?
</H4>
<P>
In 7.3, you can easily return multiple rows or columns from a
<P>
In 7.3, you can easily return multiple rows or columns from a
...
@@ -1239,7 +1213,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
...
@@ -1239,7 +1213,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
<a
href=
"http://techdocs.postgresql.org/guides/SetReturningFunctions"
>
<a
href=
"http://techdocs.postgresql.org/guides/SetReturningFunctions"
>
http://techdocs.postgresql.org/guides/SetReturningFunctions
</a>
.
http://techdocs.postgresql.org/guides/SetReturningFunctions
</a>
.
<H4><A
name=
"4.2
2"
>
4.22
</A>
) Why can't I reliably create/drop
<H4><A
name=
"4.2
1"
>
4.21
</A>
) Why can't I reliably create/drop
temporary tables in PL/PgSQL functions?
</H4>
temporary tables in PL/PgSQL functions?
</H4>
<P>
PL/PgSQL caches function contents, and an unfortunate side effect
<P>
PL/PgSQL caches function contents, and an unfortunate side effect
is that if a PL/PgSQL function accesses a temporary table, and that
is that if a PL/PgSQL function accesses a temporary table, and that
...
@@ -1249,7 +1223,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
...
@@ -1249,7 +1223,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
<SMALL>
EXECUTE
</SMALL>
for temporary table access in PL/PgSQL. This
<SMALL>
EXECUTE
</SMALL>
for temporary table access in PL/PgSQL. This
will cause the query to be reparsed every time.
</P>
will cause the query to be reparsed every time.
</P>
<H4><A
name=
"4.2
3"
>
4.23
</A>
) What encryption options are available?
<H4><A
name=
"4.2
2"
>
4.22
</A>
) What encryption options are available?
</H4>
</H4>
<UL>
<UL>
<LI><I>
contrib/pgcrypto
</I>
contains many encryption functions for
<LI><I>
contrib/pgcrypto
</I>
contains many encryption functions for
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment