diff options
author | unknown <monty@narttu.mysql.fi> | 2003-04-24 00:36:48 +0300 |
---|---|---|
committer | unknown <monty@narttu.mysql.fi> | 2003-04-24 00:36:48 +0300 |
commit | 051859aaab7122ea8d012de2f269b67382646589 (patch) | |
tree | 1e2dbf50b719f8c4181b1e860c5432f9186545f0 /sql/ha_innodb.cc | |
parent | 4c1bdeaf928b1274d40df91072e85a35344184c0 (diff) | |
parent | 7032486889f42b3f18b4a0a5be6cb97b74790ea8 (diff) | |
download | mariadb-git-051859aaab7122ea8d012de2f269b67382646589.tar.gz |
merge
sql/ha_innodb.cc:
Auto merged
sql/ha_innodb.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_list.h:
Auto merged
support-files/my-huge.cnf.sh:
Added query_cache_size
support-files/my-large.cnf.sh:
Added query_cache_size
Diffstat (limited to 'sql/ha_innodb.cc')
-rw-r--r-- | sql/ha_innodb.cc | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index d066a00afed..5cd8a285d0c 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -3542,10 +3542,8 @@ ha_innobase::records_in_range( /************************************************************************* Gives an UPPER BOUND to the number of rows in a table. This is used in -filesort.cc and the upper bound must hold. TODO: Since the number of -rows in a table may change after this function is called, we still may -get a 'Sort aborted' error in filesort.cc of MySQL. The ultimate fix is to -improve the algorithm of filesort.cc. */ +filesort.cc and its better if the upper bound hold. +*/ ha_rows ha_innobase::estimate_number_of_rows(void) @@ -3611,6 +3609,29 @@ ha_innobase::scan_time() return((double) (prebuilt->table->stat_clustered_index_size)); } +/* + Calculate the time it takes to read a set of ranges through and index + This enables us to optimise reads for clustered indexes. +*/ + +double ha_innobase::read_time(uint index, uint ranges, ha_rows rows) +{ + ha_rows total_rows; + double time_for_scan; + if (index != table->primary_key) + return handler::read_time(index, ranges, rows); // Not clustered + if (rows <= 2) + return (double) rows; + /* + Assume that the read is proportional to scan time for all rows + one + seek per range. + */ + time_for_scan= scan_time(); + if ((total_rows= estimate_number_of_rows()) < rows) + return time_for_scan; + return (ranges + (double) rows / (double) total_rows * time_for_scan); +} + /************************************************************************* Returns statistics information of the table to the MySQL interpreter, in various fields of the handle object. */ |