summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2012-04-11 17:14:06 -0700
committerIgor Babaev <igor@askmonty.org>2012-04-11 17:14:06 -0700
commit1c0a89afcc1581187e8ee84abbd445da2bfa45d9 (patch)
treee5c28fa1690c0b42e678005bdf5c3896ee5e99f2 /sql/table.cc
parentff3d16fba898efa68677f3b0049668a341f27a06 (diff)
downloadmariadb-git-1c0a89afcc1581187e8ee84abbd445da2bfa45d9.tar.gz
The pilot implementation of mwl#250: Use the statistics from persistent
statistical tables instead of the statistics provided by engine.
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/table.cc b/sql/table.cc
index eb8d43deefa..6c20f95c28b 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -762,8 +762,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
ulong pos, record_offset;
ulong *rec_per_key= NULL;
ulong rec_buff_length;
- double *read_avg_frequency= 0;
- double *write_avg_frequency= 0;
+ double *read_avg_frequency= NULL;
+ double *write_avg_frequency= NULL;
handler *handler_file= 0;
KEY *keyinfo;
KEY_PART_INFO *key_part= NULL;
@@ -1019,6 +1019,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
{
*key_part++= first_key_part[j];
*rec_per_key++= 0;
+ *read_avg_frequency++= 0;
+ *write_avg_frequency++= 0;
keyinfo->ext_key_parts++;
keyinfo->ext_key_part_map|= 1 << j;
}
@@ -2406,6 +2408,8 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
}
#endif
+ outparam->read_stat.cardinality_is_null= TRUE;
+
if (!(field_ptr = (Field **) alloc_root(&outparam->mem_root,
(uint) ((share->fields+1)*
sizeof(Field*)))))
@@ -5924,6 +5928,7 @@ bool TABLE::add_tmp_key(uint key, uint key_parts,
keyinfo->algorithm= HA_KEY_ALG_UNDEF;
keyinfo->flags= HA_GENERATED_KEY;
keyinfo->ext_key_flags= keyinfo->flags;
+ keyinfo->is_statistics_from_stat_tables= FALSE;
if (unique)
keyinfo->flags|= HA_NOSAME;
sprintf(buf, "key%i", key);
@@ -6619,6 +6624,7 @@ int TABLE_LIST::fetch_number_of_rows()
{
table->file->stats.records= ((select_union*)derived->result)->records;
set_if_bigger(table->file->stats.records, 2);
+ table->used_stat_records= table->file->stats.records;
}
else
error= table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);