diff options
author | unknown <marko@hundin.mysql.fi> | 2005-07-04 16:12:08 +0300 |
---|---|---|
committer | unknown <marko@hundin.mysql.fi> | 2005-07-04 16:12:08 +0300 |
commit | a1da992f4f3da5a5c84a819c80dd5d09db9c66d8 (patch) | |
tree | 29e8f1f9ee7807b8870a57f344abc3178c977c92 /sql | |
parent | 5d82b41e3adccc566b68542bf5be097ed45f5390 (diff) | |
parent | da83833964d877cacdb4e432522d171b3260e06a (diff) | |
download | mariadb-git-a1da992f4f3da5a5c84a819c80dd5d09db9c66d8.tar.gz |
Merge marko@bk-internal.mysql.com:/home/bk/mysql-5.0
into hundin.mysql.fi:/home/marko/mysql-5.0-current
sql/ha_innodb.cc:
Auto merged
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_innodb.cc | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 8b12b43d3d9..8218e4fecc0 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -2955,21 +2955,44 @@ build_template( templ = prebuilt->mysql_template + n_requested_fields; field = table->field[i]; - ibool index_contains_field= - dict_index_contains_col_or_prefix(index, i); + if (UNIV_LIKELY(templ_type == ROW_MYSQL_REC_FIELDS)) { + /* Decide which columns we should fetch + and which we can skip. */ + register const ibool index_contains_field = + dict_index_contains_col_or_prefix(index, i); - if (templ_type == ROW_MYSQL_REC_FIELDS && - ((prebuilt->read_just_key && !index_contains_field) || - (!(fetch_all_in_key && index_contains_field) && - !(fetch_primary_key_cols && - dict_table_col_in_clustered_key(index->table, i)) && - thd->query_id != field->query_id))) { + if (!index_contains_field && prebuilt->read_just_key) { + /* If this is a 'key read', we do not need + columns that are not in the key */ + + goto skip_field; + } + + if (index_contains_field && fetch_all_in_key) { + /* This field is needed in the query */ + + goto include_field; + } + + if (thd->query_id == field->query_id) { + /* This field is needed in the query */ + + goto include_field; + } + + if (fetch_primary_key_cols + && dict_table_col_in_clustered_key(index->table, + i)) { + /* This field is needed in the query */ + + goto include_field; + } /* This field is not needed in the query, skip it */ goto skip_field; } - +include_field: n_requested_fields++; templ->col_no = i; |