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
d158fce8
Commit
d158fce8
authored
27 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
Add optimizer README file.
parent
542d4e52
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/optimizer/README
+66
-0
66 additions, 0 deletions
src/backend/optimizer/README
with
66 additions
and
0 deletions
src/backend/optimizer/README
0 → 100644
+
66
−
0
View file @
d158fce8
Thse directories take the Query structure returned by the parser, and
generate a plan used by the executor. The /plan directory generates the
plan, the /path generates all possible ways to join the tables, and
/prep handles special cases like inheritance. /utils is utility stuff.
planner()
handle inheritance by processing separately
-init_query_planner()
preprocess target list
preprocess qualifications(WHERE)
--query_planner()
pull out constants from target list
get a target list that only contains column names, no expressions
if none, then return
---subplanner()
make list of relations in target
make list of relations in where clause
find which relations can do merge sort and hash joins
----find_paths()
find scan and all index paths for each relation not yet joined
one relation, return
find selectivity of columns used in joins
-----find_join_paths()
Summary: With OPTIMIZER_DEBUG defined, you see:
Tables 1, 2, 3, and 4 are joined as:
{1 2},{1 3},{1 4},{2 3},{2 4}
{1 2 3},{1 2 4},{2 3 4}
{1 2 3 4}
Actual output tests show combinations:
{4 2},{3 2},{1 4},{1 3},{1 2}
{4 2 3},{1 4 2},{1 3 2}
{4 2 3 1}
Cheapest join order shows:
{4 2},{3 2},{1 4},{1 3},{1 2}
{3 2 4},{1 4 2},{1 3 2}
{1 4 2 3}
It first finds the best way to join each table to every other
table. It then takes those joined table combinations, and joins
them to the other joined table combinations, until all tables are
joined.
jump to geqo if needed
again:
find_join_rels():
for each joinrel:
find_clause_joins()
for each join on joinrel:
if a join from the join clause adds only one relation, do the join
or find_clauseless_joins()
find_all_join_paths()
generate paths(nested,mergesort) for joins found in find_join_rels()
prune_joinrels()
remove from the join list the relation we just added to each join
prune_rel_paths()
set cheapest and perhaps remove unordered path, recompute table sizes
if we have not done all the tables, go to "again"
do group(GROUP)
do aggregate
put back constants
re-flatten target list
make unique(DISTINCT)
make sort(ORDER BY)
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