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
899dfb07
Commit
899dfb07
authored
Aug 31, 2021
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanups part #3
parent
859c14ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
13 deletions
+12
-13
sql/sql_statistics.cc
sql/sql_statistics.cc
+7
-5
sql/table.h
sql/table.h
+5
-8
No files found.
sql/sql_statistics.cc
View file @
899dfb07
...
...
@@ -1967,7 +1967,7 @@ class Stat_table_write_iter
class
Histogram_builder
{
p
ublic
:
p
rotected
:
Field
*
column
;
/* table field for which the histogram is built */
uint
col_length
;
/* size of this field */
ha_rows
records
;
/* number of records the histogram is built for */
...
...
@@ -1982,6 +1982,7 @@ class Histogram_builder
/* number of distinct values that occured only once */
ulonglong
count_distinct_single_occurence
;
public:
Histogram_builder
(
Field
*
col
,
uint
col_len
,
ha_rows
rows
)
:
column
(
col
),
col_length
(
col_len
),
records
(
rows
)
{
...
...
@@ -2934,7 +2935,8 @@ bool Column_statistics_collected::add()
*/
inline
void
Column_statistics_collected
::
finish
(
MEM_ROOT
*
mem_root
,
ha_rows
rows
,
double
sample_fraction
)
void
Column_statistics_collected
::
finish
(
MEM_ROOT
*
mem_root
,
ha_rows
rows
,
double
sample_fraction
)
{
double
val
;
...
...
@@ -3486,7 +3488,7 @@ int read_statistics_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables)
if
(
table_field
->
read_stats
->
histogram_type_on_disk
!=
INVALID_HISTOGRAM
)
have_histograms
=
true
;
}
table_share
->
stats_cb
.
total_hist_size
=
have_histograms
?
1
:
0
;
// total_hist_size
table_share
->
stats_cb
.
have_histograms
=
have_histograms
;
/* Read statistics from the statistical table index_stats */
stat_table
=
stat_tables
[
INDEX_STAT
].
table
;
...
...
@@ -3626,7 +3628,7 @@ int read_histograms_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables)
{
TABLE_STATISTICS_CB
*
stats_cb
=
&
table
->
s
->
stats_cb
;
DBUG_ENTER
(
"read_histograms_for_table"
);
if
(
stats_cb
->
start_histograms_load
())
{
Column_stat
column_stat
(
stat_tables
[
COLUMN_STAT
].
table
,
table
);
...
...
@@ -4547,7 +4549,7 @@ double Histogram_binary::range_selectivity(Field *field,
}
/*
Check whether the table is one of the persistent statistical tables.
Check whether the table is one of the persistent statistical tables.
*/
bool
is_stat_table
(
const
LEX_CSTRING
*
db
,
LEX_CSTRING
*
table
)
{
...
...
sql/table.h
View file @
899dfb07
...
...
@@ -681,22 +681,19 @@ class TABLE_STATISTICS_CB
Table_statistics
*
table_stats
;
/* Structure to access the statistical data */
/*
Total size of all histograms. A value of 0 means historams are not present,
and histograms_are_ready() can finish sooner.
Currently we just set it to 1 when we expect to load histograms.
histogram-todo: rename this or even remove?
Whether the table has histograms.
(If the table has none, histograms_are_ready() can finish sooner)
*/
ulong
total_hist_size
;
bool
have_histograms
;
bool
histograms_are_ready
()
const
{
return
!
total_hist_size
||
hist_state
.
is_ready
();
return
!
have_histograms
||
hist_state
.
is_ready
();
}
bool
start_histograms_load
()
{
return
total_hist_size
&&
hist_state
.
start_load
();
return
have_histograms
&&
hist_state
.
start_load
();
}
void
end_histograms_load
()
{
hist_state
.
end_load
();
}
...
...
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