Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
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
nexedi
MariaDB
Commits
33af691f
Commit
33af691f
authored
Jan 24, 2023
by
Monty
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated comments in best_access_path()
parent
0eca91ab
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
17 deletions
+20
-17
sql/sql_select.cc
sql/sql_select.cc
+20
-17
No files found.
sql/sql_select.cc
View file @
33af691f
...
...
@@ -8117,10 +8117,12 @@ best_access_path(JOIN *join,
DBUG_ENTER("best_access_path");
/*
Assume that there is at least one accepted row from previous table combinations.
This fixes a problem when the selectivity for the preceding table combinations
becomes so high that record_count becomes << 1.0, which makes the cost for the
current table so low that it does not matter when calculating the best plans.
Assume that there is at least one accepted row from previous table
combinations.
This fixes a problem when the selectivity for the preceding table
combinations becomes so high that record_count becomes << 1.0,
which makes the cost for the current table so low that it does not
matter when calculating the best plans.
*/
set_if_bigger(record_count, 1.0);
...
...
@@ -9123,17 +9125,15 @@ best_access_path(JOIN *join,
{
/*
Simple scan
For each record we have to:
- Read the table record
- Compare with the current WHERE clause
We estmate that 'rnd_records' will survive this check.
We estimate we have to read org_records rows.
records_after_filter rows will survive the where check of constants.
'best.records_out' rows will survive after the check against columns
from previous tables.
*/
scan_type= "scan";
/*
If this is not the first table we have to compare the rows against
all previous row combinations
We have to compare each row set against all previous row combinations
*/
cur_cost= COST_MULT(cur_cost, record_count);
}
...
...
@@ -9143,9 +9143,8 @@ best_access_path(JOIN *join,
double cmp_time, row_copy_cost, refills;
/*
Calculate cost of checking the the WHERE for this table.
This is done before we check the TABLE rows aginst the rows
in the join cache.
Note that the cost of checking all rows against the table specific
WHERE is already included in cur_cost.
*/
scan_type= "scan_with_join_cache";
...
...
@@ -9158,7 +9157,10 @@ best_access_path(JOIN *join,
/* We come here only if there are already rows in the join cache */
DBUG_ASSERT(idx != join->const_tables);
/*
Cost of:
records_after_filter is the number of rows that have survived
the table specific WHERE check that only involves constants.
Calculate cost of:
- Copying all previous record combinations to the join cache
- Copying the tables from the join cache to table records
- Checking the WHERE against the final row combination
...
...
@@ -9206,7 +9208,8 @@ best_access_path(JOIN *join,
*/
best.cost= cur_cost;
best.records_read= org_records; // Records accessed
best.records= records_after_filter; // Records to be checked with WHERE
best.records= records_after_filter; // Records to be checked against
// previous row combinations
/*
If we are using 'use_cond_selectivity > 1' then
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