Commit 97aa60ee authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

refs #5738 imp index_only_read_time for mysql 5.6

git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@50577 c7de825b-a66e-492c-adef-691d508d4ae1
parent 2323f2bb
...@@ -6994,8 +6994,11 @@ double ha_tokudb::scan_time() { ...@@ -6994,8 +6994,11 @@ double ha_tokudb::scan_time() {
double ha_tokudb::keyread_time(uint index, uint ranges, ha_rows rows) double ha_tokudb::keyread_time(uint index, uint ranges, ha_rows rows)
{ {
TOKUDB_DBUG_ENTER("ha_tokudb::keyread_time");
double ret_val;
if ((table->key_info[index].flags & HA_CLUSTERING) || (index == primary_key)) { if ((table->key_info[index].flags & HA_CLUSTERING) || (index == primary_key)) {
return read_time(index, ranges, rows); ret_val = read_time(index, ranges, rows);
DBUG_RETURN(ret_val);
} }
/* /*
It is assumed that we will read trough the whole key range and that all It is assumed that we will read trough the whole key range and that all
...@@ -7008,10 +7011,10 @@ double ha_tokudb::keyread_time(uint index, uint ranges, ha_rows rows) ...@@ -7008,10 +7011,10 @@ double ha_tokudb::keyread_time(uint index, uint ranges, ha_rows rows)
double keys_per_block= (stats.block_size/2.0/ double keys_per_block= (stats.block_size/2.0/
(table->key_info[index].key_length + (table->key_info[index].key_length +
ref_length) + 1); ref_length) + 1);
return (rows + keys_per_block - 1)/ keys_per_block; ret_val = (rows + keys_per_block - 1)/ keys_per_block;
DBUG_RETURN(ret_val);
} }
// //
// Calculate the time it takes to read a set of ranges through an index // Calculate the time it takes to read a set of ranges through an index
// This enables us to optimize reads for clustered indexes. // This enables us to optimize reads for clustered indexes.
...@@ -7029,6 +7032,7 @@ double ha_tokudb::read_time( ...@@ -7029,6 +7032,7 @@ double ha_tokudb::read_time(
ha_rows rows ha_rows rows
) )
{ {
TOKUDB_DBUG_ENTER("ha_tokudb::read_time");
double total_scan; double total_scan;
double ret_val; double ret_val;
bool is_primary = (index == primary_key); bool is_primary = (index == primary_key);
...@@ -7070,9 +7074,14 @@ double ha_tokudb::read_time( ...@@ -7070,9 +7074,14 @@ double ha_tokudb::read_time(
ret_val = is_clustering ? ret_val + 0.00001 : ret_val; ret_val = is_clustering ? ret_val + 0.00001 : ret_val;
cleanup: cleanup:
return ret_val; DBUG_RETURN(ret_val);
} }
double ha_tokudb::index_only_read_time(uint keynr, double records) {
TOKUDB_DBUG_ENTER("ha_tokudb::index_only_read_time");
double ret_val = keyread_time(keynr, 1, records);
DBUG_RETURN(ret_val);
}
// //
// Estimates the number of index records in a range. In case of errors, return // Estimates the number of index records in a range. In case of errors, return
......
...@@ -438,9 +438,15 @@ public: ...@@ -438,9 +438,15 @@ public:
} }
double scan_time(); double scan_time();
double keyread_time(uint index, uint ranges, ha_rows rows);
double read_time(uint index, uint ranges, ha_rows rows); double read_time(uint index, uint ranges, ha_rows rows);
// Defined in mariadb
double keyread_time(uint index, uint ranges, ha_rows rows);
// Defined in mysql 5.6
double index_only_read_time(uint keynr, double records);
int open(const char *name, int mode, uint test_if_locked); int open(const char *name, int mode, uint test_if_locked);
int close(void); int close(void);
void update_create_info(HA_CREATE_INFO* create_info); void update_create_info(HA_CREATE_INFO* create_info);
......
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