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
f757e3f3
Commit
f757e3f3
authored
Jan 27, 2019
by
Vicențiu Ciorbaru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More work
parent
211e3022
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
17 deletions
+22
-17
sql/sql_statistics.cc
sql/sql_statistics.cc
+3
-1
storage/myisam/mi_range.c
storage/myisam/mi_range.c
+19
-16
No files found.
sql/sql_statistics.cc
View file @
f757e3f3
...
...
@@ -2745,10 +2745,12 @@ int collect_statistics_for_table(THD *thd, TABLE *table)
rc
=
file
->
ha_random_sample_init
(
thd
,
100
);
rc
=
file
->
ha_random_sample
(
table
->
record
[
0
]);
table_field
->
collected_stats
->
add
(
0
);
rc
=
file
->
ha_random_sample_end
();
/* Perform a full table scan to collect statistics on 'table's columns */
/*
if (!(rc= file->ha_rnd_init(TRUE)))
{
DEBUG_SYNC(table->in_use, "statistics_collection_start");
...
...
@@ -2776,7 +2778,7 @@ int collect_statistics_for_table(THD *thd, TABLE *table)
file->ha_rnd_end();
}
rc= (rc == HA_ERR_END_OF_FILE && !thd->killed) ? 0 : 1;
*/
/*
Calculate values for all statistical characteristics on columns and
and for each field f of 'table' save them in the write_stat structure
...
...
storage/myisam/mi_range.c
View file @
f757e3f3
...
...
@@ -291,6 +291,11 @@ static int _mi_read_sample_static_record(MI_INFO *info, uchar *buf)
DBUG_ENTER
(
"_mi_read_sample_static_record"
);
DBUG_ASSERT
(
info
->
s
->
read_rnd
==
_mi_read_rnd_static_record
);
if
(
fast_mi_readinfo
(
info
))
DBUG_RETURN
(
-
1
);
fast_mi_writeinfo
(
info
);
DBUG_RETURN
(
0
);
}
...
...
@@ -303,6 +308,7 @@ static int _mi_read_sample_bernoulli(MI_INFO *info, uchar *buf)
if
(
fast_mi_readinfo
(
info
))
DBUG_RETURN
(
-
1
);
/* No rows to sample from. */
if
(
!
info
->
state
->
records
)
DBUG_RETURN
(
HA_ERR_END_OF_FILE
);
...
...
@@ -310,20 +316,12 @@ static int _mi_read_sample_bernoulli(MI_INFO *info, uchar *buf)
info
->
state
->
records
;
do
{
res
=
mi_scan
(
info
,
buf
);
/* Restart scan if we reached the end. */
if
(
res
==
HA_ERR_END_OF_FILE
)
{
if
((
res
=
mi_scan_init
(
info
)))
DBUG_RETURN
(
res
);
/* Second failure, abort. */
if
((
res
=
mi_scan
(
info
,
buf
)))
DBUG_RETURN
(
res
);
}
if
((
res
=
mi_scan
(
info
,
buf
)))
break
;
}
while
(
my_rnd_ssl
(
&
info
->
sampling_state
.
rand
)
<
select_probability
);
fast_mi_writeinfo
(
info
);
DBUG_RETURN
(
0
);
DBUG_RETURN
(
res
);
}
int
mi_random_sample_init
(
MYSQL_THD
thd
,
MI_INFO
*
info
,
...
...
@@ -332,21 +330,26 @@ int mi_random_sample_init(MYSQL_THD thd, MI_INFO *info,
int
res
=
0
;
DBUG_ENTER
(
"mi_random_sample_init"
);
struct
st_sampling_state
*
ss
=
&
info
->
sampling_state
;
ss
->
initialised
=
TRUE
;
ss
->
estimate_rows_read
=
estimate_rows_read
;
/* TODO(cvicentiu) use thd_rnd service instead. */
ss
->
thd
=
thd
;
ss
->
rand
.
max_value
=
1
;
my_rnd_init
(
&
ss
->
rand
,
42
,
32
);
/* Fastest possible case, equal sized records. */
if
(
!
(
info
->
s
->
options
&
(
HA_OPTION_COMPRESS_RECORD
|
HA_OPTION_PACK_RECORD
)))
if
(
!
(
info
->
s
->
options
&
(
HA_OPTION_COMPRESS_RECORD
|
HA_OPTION_PACK_RECORD
))
&&
FALSE
/* TODO(remove this once bernoulli is tested) */
)
{
info
->
sampling_state
.
read_sample
=
_mi_read_sample_static_record
;
}
/* Fallback revert to simple scan. */
info
->
sampling_state
.
read_sample
=
_mi_read_sample_bernoulli
;
mi_scan_init
(
info
);
else
{
/* Fallback revert to simple scan. */
mi_scan_init
(
info
);
info
->
sampling_state
.
read_sample
=
_mi_read_sample_bernoulli
;
}
DBUG_RETURN
(
res
);
}
...
...
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