mariadb/storage
Jan Lindström 8bc5eabea8 MDEV-7084: innodb index stats inadequate using constant
innodb_stats_sample_pages

Analysis: If you set the number of analyzed pages 
to very low number compared to actual pages on 
that table/index it randomly pics those pages 
(default 8 pages), this leads to fact that query 
after analyze table returns different results. If 
the index tree is small, smaller than 10 * 
n_sample_pages + total_external_size, then the 
estimate is ok. For bigger index 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 n_sample_pages different key values, 
or even more. And it just tries to 
approximate to n_sample_pages (8).

Fix: (1) Introduced new dynamic configuration variable
innodb_stats_sample_traditional  that retains
the current design. Default false.

(2) If traditional sample is not used we use
n_sample_pages = max(min(srv_stats_sample_pages,
                         index->stat_index_size),
                     log2(index->stat_index_size)*
                          srv_stats_sample_pages);

(3) Introduced new dynamic configuration variable
stat_modified_counter (default = 0) if set
sets lower bound for row updates when statistics is re-estimated.

If user has provided upper bound for how many rows needs to be updated
before we calculate new statistics we use minimum of provided value
and 1/16 of table every 16th round. If no upper bound is provided
(srv_stats_modified_counter = 0, default) then calculate new statistics
if 1 / 16 of table has been modified
since the last time a statistics batch was run.
We calculate statistics at most every 16th round, since we may have
a counter table which is very small and updated very often.
@param t table
@return true if the table has changed too much and stats need to be
recalculated
*/
#define DICT_TABLE_CHANGED_TOO_MUCH(t) \
	((ib_int64_t) (t)->stat_modified_counter > (srv_stats_modified_counter ? \
	ut_min(srv_stats_modified_counter, (16 + (t)->stat_n_rows / 16)) : \
		16 + (t)->stat_n_rows / 16))
2014-11-19 20:27:34 +02:00
..
archive mysql-5.5.38 merge 2014-06-03 09:55:08 +02:00
blackhole
csv
example MDEV-5120 Test suite test maria-no-logging fails 2014-10-02 11:57:40 +02:00
federated 5.1 merge 2014-03-16 13:59:44 +01:00
federatedx MDEV-5120 Test suite test maria-no-logging fails 2014-10-02 11:57:40 +02:00
heap MDEV-4813 Replication fails on updating a MEMORY table with an index using btree 2014-10-07 10:54:14 +02:00
innobase MDEV-7084: innodb index stats inadequate using constant 2014-11-19 20:27:34 +02:00
maria MDEV-5120 Test suite test maria-no-logging fails 2014-10-02 11:57:40 +02:00
myisam MDEV-6528 review debian patches for mysql 2014-10-02 11:58:24 +02:00
myisammrg Re-enabling tests disabled due to MDEV-5266 and MySQL:65225 (fixed now) 2014-11-17 20:28:18 +04:00
ndb mysql-5.5.37 selective merge 2014-03-27 22:26:58 +01:00
oqgraph improve oqgraph boost check to filter out newer boost versions 2014-01-26 21:49:39 +01:00
perfschema mysql-5.5.37 selective merge 2014-03-27 22:26:58 +01:00
sphinx MDEV-5120 Test suite test maria-no-logging fails 2014-10-02 11:57:40 +02:00
tokudb TokuDB 7.5.3 2014-11-18 17:54:00 +01:00
xtradb MDEV-7084: innodb index stats inadequate using constant 2014-11-19 20:27:34 +02:00