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
52f6918c
Commit
52f6918c
authored
Oct 10, 2002
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update IN/EXISTS item.
parent
5aa7849e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
10 deletions
+16
-10
doc/FAQ
doc/FAQ
+9
-6
doc/src/FAQ/FAQ.html
doc/src/FAQ/FAQ.html
+7
-4
No files found.
doc/FAQ
View file @
52f6918c
Frequently Asked Questions (FAQ) for PostgreSQL
Last updated:
Mon Sep 30 23:28:35
EDT 2002
Last updated:
Wed Oct 9 23:14:53
EDT 2002
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
...
...
@@ -998,18 +998,21 @@ CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
4.22) Why are my subqueries using IN so slow?
Currently, we join subqueries to outer queries by sequentially
scanning the result of the subquery for each row of the outer query. A
workaround is to replace IN with EXISTS:
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
1 IN (SELECT col2 FROM TAB2
)
WHERE col
IN (SELECT subcol FROM subtab
)
to:
SELECT *
FROM tab
WHERE EXISTS (SELECT
col2 FROM TAB2 WHERE col1 = col2
)
WHERE EXISTS (SELECT
subcol FROM subtab WHERE subcol = col
)
We hope to fix this limitation in a future release.
For this to be fast, subcol should be an indexed column. We hope to
fix this limitation in a future release.
4.23) How do I perform an outer join?
...
...
doc/src/FAQ/FAQ.html
View file @
52f6918c
...
...
@@ -14,7 +14,7 @@
alink=
"#0000ff"
>
<H1>
Frequently Asked Questions (FAQ) for PostgreSQL
</H1>
<P>
Last updated:
Mon Sep 30 23:28:35
EDT 2002
</P>
<P>
Last updated:
Wed Oct 9 23:14:53
EDT 2002
</P>
<P>
Current maintainer: Bruce Momjian (
<A
href=
"mailto:pgman@candle.pha.pa.us"
>
pgman@candle.pha.pa.us
</A>
)
<BR>
...
...
@@ -1282,22 +1282,25 @@ BYTEA bytea variable-length byte array (null-byte safe)
<P>
Currently, we join subqueries to outer queries by sequentially
scanning the result of the subquery for each row of the outer
query. A workaround is to replace
<CODE>
IN
</CODE>
with
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>
<CODE>
SELECT *
FROM tab
WHERE col
1 IN (SELECT col2 FROM TAB2
)
WHERE col
IN (SELECT subcol FROM subtab
)
</CODE>
</PRE>
to:
<PRE>
<CODE>
SELECT *
FROM tab
WHERE EXISTS (SELECT
col2 FROM TAB2 WHERE col1 = col2
)
WHERE EXISTS (SELECT
subcol FROM subtab WHERE subcol = col
)
</CODE>
</PRE>
For this to be fast,
<CODE>
subcol
</CODE>
should be an indexed column.
We hope to fix this limitation in a future release.
<H4><A
name=
"4.23"
>
4.23
</A>
) How do I perform an outer join?
</H4>
...
...
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