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
Hide 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,11 +8117,13 @@ best_access_path(JOIN *join,
...
@@ -8117,11 +8117,13 @@ best_access_path(JOIN *join,
DBUG_ENTER("best_access_path");
DBUG_ENTER("best_access_path");
/*
/*
Assume that there is at least one accepted row from previous table combinations.
Assume that there is at least one accepted row from previous table
This fixes a problem when the selectivity for the preceding table combinations
combinations.
becomes so high that record_count becomes << 1.0, which makes the cost for the
This fixes a problem when the selectivity for the preceding table
current table so low that it does not matter when calculating the best plans.
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);
set_if_bigger(record_count, 1.0);
best.cost= DBL_MAX;
best.cost= DBL_MAX;
...
@@ -9123,17 +9125,15 @@ best_access_path(JOIN *join,
...
@@ -9123,17 +9125,15 @@ best_access_path(JOIN *join,
{
{
/*
/*
Simple scan
Simple scan
We estimate we have to read org_records rows.
For each record we have to:
records_after_filter rows will survive the where check of constants.
- Read the table record
'best.records_out' rows will survive after the check against columns
- Compare with the current WHERE clause
from previous tables.
We estmate that 'rnd_records' will survive this check.
*/
*/
scan_type= "scan";
scan_type= "scan";
/*
/*
If this is not the first table we have to compare the rows against
We have to compare each row set against all previous row combinations
all previous row combinations
*/
*/
cur_cost= COST_MULT(cur_cost, record_count);
cur_cost= COST_MULT(cur_cost, record_count);
}
}
...
@@ -9143,9 +9143,8 @@ best_access_path(JOIN *join,
...
@@ -9143,9 +9143,8 @@ best_access_path(JOIN *join,
double cmp_time, row_copy_cost, refills;
double cmp_time, row_copy_cost, refills;
/*
/*
Calculate cost of checking the the WHERE for this table.
Note that the cost of checking all rows against the table specific
This is done before we check the TABLE rows aginst the rows
WHERE is already included in cur_cost.
in the join cache.
*/
*/
scan_type= "scan_with_join_cache";
scan_type= "scan_with_join_cache";
...
@@ -9158,7 +9157,10 @@ best_access_path(JOIN *join,
...
@@ -9158,7 +9157,10 @@ best_access_path(JOIN *join,
/* We come here only if there are already rows in the join cache */
/* We come here only if there are already rows in the join cache */
DBUG_ASSERT(idx != join->const_tables);
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 all previous record combinations to the join cache
- Copying the tables from the join cache to table records
- Copying the tables from the join cache to table records
- Checking the WHERE against the final row combination
- Checking the WHERE against the final row combination
...
@@ -9206,7 +9208,8 @@ best_access_path(JOIN *join,
...
@@ -9206,7 +9208,8 @@ best_access_path(JOIN *join,
*/
*/
best.cost= cur_cost;
best.cost= cur_cost;
best.records_read= org_records; // Records accessed
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
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