diff options
author | Igor Babaev <igor@askmonty.org> | 2010-05-26 13:18:18 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2010-05-26 13:18:18 -0700 |
commit | 709a0a131021135e9fb7a2095fcfcbc223dfb126 (patch) | |
tree | 9f8143ae3fa17bac5ab74140da692228d73c283f /sql/field.cc | |
parent | cb325eb2b2f738b63d162fb0d46cf335e4ae84a4 (diff) | |
download | mariadb-git-709a0a131021135e9fb7a2095fcfcbc223dfb126.tar.gz |
MWL#106: Backport optimizations for derived tables and views.
The main consolidated patch.
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sql/field.cc b/sql/field.cc index 80f138c53f6..8f24bd37e30 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -10458,3 +10458,27 @@ Field::set_datetime_warning(MYSQL_ERROR::enum_warning_level level, uint code, field_name); } } + + +/* + @brief + Return possible keys for a field + + @details + Return bit map of keys over this field which can be used by the range + optimizer. For a field of a generic table such keys are all keys that starts + from this field. For a field of a materialized derived table/view such keys + are all keys in which this field takes a part. This is less restrictive as + keys for a materialized derived table/view are generated on the fly from + present fields, thus the case when a field for the beginning of a key is + absent is impossible. + + @return map of possible keys +*/ + +key_map Field::get_possible_keys() +{ + DBUG_ASSERT(table->pos_in_table_list); + return (table->pos_in_table_list->is_materialized_derived() ? + part_of_key : key_start); +} |