Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
52f6918c
Commit
52f6918c
authored
22 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
Update IN/EXISTS item.
parent
5aa7849e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/FAQ
+9
-6
9 additions, 6 deletions
doc/FAQ
doc/src/FAQ/FAQ.html
+7
-4
7 additions, 4 deletions
doc/src/FAQ/FAQ.html
with
16 additions
and
10 deletions
doc/FAQ
+
9
−
6
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 col
2
FROM
TAB2
)
WHERE col IN (SELECT
sub
col FROM
subtab
)
to:
SELECT *
FROM tab
WHERE EXISTS (SELECT col
2
FROM
TAB2
WHERE col
1
= col
2
)
WHERE EXISTS (SELECT
sub
col FROM
subtab
WHERE
sub
col = 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?
...
...
This diff is collapsed.
Click to expand it.
doc/src/FAQ/FAQ.html
+
7
−
4
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 col
2
FROM
TAB2
)
WHERE col IN (SELECT
sub
col FROM
subtab
)
</CODE>
</PRE>
to:
<PRE>
<CODE>
SELECT *
FROM tab
WHERE EXISTS (SELECT col
2
FROM
TAB2
WHERE col
1
= col
2
)
WHERE EXISTS (SELECT
sub
col FROM
subtab
WHERE
sub
col = 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>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment