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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
4f3e7f68
Commit
4f3e7f68
authored
22 years ago
by
heikki@donna.mysql.fi
Browse files
Options
Browse Files
Download
Plain Diff
Merge heikki@work.mysql.com:/home/my/mysql
into donna.mysql.fi:/home/heikki/mysqln
parents
3457b6fd
43439d0c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
17 deletions
+19
-17
innobase/btr/btr0cur.c
innobase/btr/btr0cur.c
+19
-1
sql/ha_innobase.cc
sql/ha_innobase.cc
+0
-16
No files found.
innobase/btr/btr0cur.c
View file @
4f3e7f68
...
...
@@ -2552,6 +2552,7 @@ btr_estimate_number_of_different_key_vals(
ulint
total_external_size
=
0
;
ulint
i
;
ulint
j
;
ulint
add_on
;
mtr_t
mtr
;
n_cols
=
dict_index_get_n_unique
(
index
);
...
...
@@ -2624,6 +2625,23 @@ btr_estimate_number_of_different_key_vals(
+
not_empty_flag
)
/
(
BTR_KEY_VAL_ESTIMATE_N_PAGES
+
total_external_size
);
/* If the tree is small, smaller than <
10 * BTR_KEY_VAL_ESTIMATE_N_PAGES + total_external_size, then
the above estimate is ok. For bigger trees it is common that we
do not see any borders between key values in the few pages
we pick. But still there may be BTR_KEY_VAL_ESTIMATE_N_PAGES
different key values, or even more. Let us try to approximate
that: */
add_on
=
index
->
stat_n_leaf_pages
/
(
10
*
(
BTR_KEY_VAL_ESTIMATE_N_PAGES
+
total_external_size
));
if
(
add_on
>
BTR_KEY_VAL_ESTIMATE_N_PAGES
)
{
add_on
=
BTR_KEY_VAL_ESTIMATE_N_PAGES
;
}
index
->
stat_n_diff_key_vals
[
j
]
+=
add_on
;
}
mem_free
(
n_diff
);
...
...
This diff is collapsed.
Click to expand it.
sql/ha_innobase.cc
View file @
4f3e7f68
...
...
@@ -3130,22 +3130,6 @@ ha_innobase::info(
rec_per_key
=
1
;
}
/* Since the MySQL optimizer is often too
pessimistic in the assumption that a table
does not fit in the buffer pool, we
increase the attractiveness of indexes
by assuming the selectivity of any prefix
of an index is 1 / 100 or better.
(Actually, we should look at the table
size, and if the table is smaller than
the buffer pool, we should uniformly
increase the attractiveness of indexes,
regardless of the estimated selectivity.) */
if
(
rec_per_key
>
records
/
100
)
{
rec_per_key
=
records
/
100
;
}
table
->
key_info
[
i
].
rec_per_key
[
j
]
=
rec_per_key
;
}
...
...
This diff is collapsed.
Click to expand it.
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