btr0cur.c:

  Fix bug: InnoDB row count and index cardinality estimates wrapped over at 512 million in 32-bit computers
parent 9a4fb019
...@@ -2638,7 +2638,7 @@ btr_estimate_number_of_different_key_vals( ...@@ -2638,7 +2638,7 @@ btr_estimate_number_of_different_key_vals(
ulint n_cols; ulint n_cols;
ulint matched_fields; ulint matched_fields;
ulint matched_bytes; ulint matched_bytes;
ulint* n_diff; ib_longlong* n_diff;
ulint not_empty_flag = 0; ulint not_empty_flag = 0;
ulint total_external_size = 0; ulint total_external_size = 0;
ulint i; ulint i;
...@@ -2710,7 +2710,8 @@ btr_estimate_number_of_different_key_vals( ...@@ -2710,7 +2710,8 @@ btr_estimate_number_of_different_key_vals(
for (j = 0; j <= n_cols; j++) { for (j = 0; j <= n_cols; j++) {
index->stat_n_diff_key_vals[j] = index->stat_n_diff_key_vals[j] =
(n_diff[j] * index->stat_n_leaf_pages (n_diff[j]
* (ib_longlong)index->stat_n_leaf_pages
+ BTR_KEY_VAL_ESTIMATE_N_PAGES - 1 + BTR_KEY_VAL_ESTIMATE_N_PAGES - 1
+ total_external_size + total_external_size
+ not_empty_flag) + not_empty_flag)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment