summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authormonty@hundin.mysql.fi <>2002-06-19 00:22:30 +0300
committermonty@hundin.mysql.fi <>2002-06-19 00:22:30 +0300
commit0d8e13979d49b1ea775a51d1e1b465c9621ef92b (patch)
treedf0fd78ddd1c83d577e830a40da77487a62451b7 /sql/opt_range.cc
parentb1f7c1251c89cbd49fc20d244e14d07415715b71 (diff)
downloadmariadb-git-0d8e13979d49b1ea775a51d1e1b465c9621ef92b.tar.gz
Made keyread (key scanning) a key specific attribute.
This avoids using fulltext keys for table scanning. This also reverts Sinisa's original fix for this problem.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc24
1 files changed, 12 insertions, 12 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 5a359cc4239..33574a81431 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -682,27 +682,27 @@ int SQL_SELECT::test_quick_select(key_map keys_to_use, table_map prev_tables,
{
ha_rows found_records;
double found_read_time;
-
if (*key)
{
+ uint keynr= param.real_keynr[idx];
if ((*key)->type == SEL_ARG::MAYBE_KEY ||
(*key)->maybe_flag)
- needed_reg|= (key_map) 1 << param.real_keynr[idx];
+ needed_reg|= (key_map) 1 << keynr;
- found_records=check_quick_select(&param,idx, *key);
+ found_records=check_quick_select(&param, idx, *key);
if (found_records != HA_POS_ERROR && found_records > 2 &&
- head->used_keys & ((table_map) 1 << param.real_keynr[idx]) &&
- (head->file->table_flags() & HA_HAVE_KEY_READ_ONLY))
+ head->used_keys & ((table_map) 1 << keynr) &&
+ (head->file->index_flags(keynr) & HA_KEY_READ_ONLY))
{
/*
- ** We can resolve this by only reading through this key
- ** Assume that we will read trough the whole key range
- ** and that all key blocks are half full (normally things are
- ** much better)
+ We can resolve this by only reading through this key.
+ Assume that we will read trough the whole key range
+ and that all key blocks are half full (normally things are
+ much better).
*/
- uint keys_per_block= head->file->block_size/2/
- (head->key_info[param.real_keynr[idx]].key_length+
- head->file->ref_length) + 1;
+ uint keys_per_block= (head->file->block_size/2/
+ (head->key_info[keynr].key_length+
+ head->file->ref_length) + 1);
found_read_time=((double) (found_records+keys_per_block-1)/
(double) keys_per_block);
}