diff options
author | unknown <dlenev@brandersnatch.localdomain> | 2004-03-28 04:11:54 +0400 |
---|---|---|
committer | unknown <dlenev@brandersnatch.localdomain> | 2004-03-28 04:11:54 +0400 |
commit | 12dd500819acfd901be02bdef4c4499e0e2ddb5e (patch) | |
tree | c5035ed539732100b50eb469c056b49a572c70d4 /sql/sql_acl.cc | |
parent | 26ab52c1c9c49277eba82f94aad633199f6588ef (diff) | |
download | mariadb-git-12dd500819acfd901be02bdef4c4499e0e2ddb5e.tar.gz |
"Fix" for BUG #2050 "10 to 1 performance drop with server 4.1.1".
Actually it is not a bug but right behavior observed as pefomance
degradation after we have forced Item_field::fix_fields() to
re-execute each time when we are executing prep stmt.
This patch implements small optimization which heals this bad
behavior. We are caching field position in TABLE::field array in
Item's member and are using this position for speeding up field
lookups in fix_fields() in case of its re-execution.
sql/item.cc:
Added cached_field_index member to Item_ident for caching field
position in TABLE::field array for quicker field lookup in case
fix_fields() is executed twice.
sql/item.h:
Added cached_field_index member to Item_ident for caching field
position in TABLE::field array for quicker field lookup in case
fix_fields() is executed twice.
sql/mysql_priv.h:
Now find_field_in_table has one more in-out parameter which is used
for caching field index in TABLE::field array stored for quicker
field look up.
sql/sql_acl.cc:
Now find_field_in_table has one more in-out parameter which is used
for caching field index in TABLE::field array stored for quicker
field look up.
sql/sql_base.cc:
Optimization: Now when we are looking up Field by its name we are
caching its position in TABLE::field array in Item_ident::cached_field_index,
so when we will call fix_fields() second time for this item (e.g.
when we are re-executing prep statement) we can reuse this index
to speed up this lookup.
sql/table.cc:
Now we storing in TABLE::name_hash pointers to elements of
TABLE::field array, because this allows easily retrieve index
of field in this array when it is looked up by its name.
sql/table.h:
Added comment claryfying what we store in TABLE::name_hash.
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r-- | sql/sql_acl.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 9284b1cd574..86a535ba493 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2194,8 +2194,10 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, DBUG_RETURN(-1); while ((column = column_iter++)) { + int unused_field_idx= -1; if (!find_field_in_table(thd,table,column->column.ptr(), - column->column.length(),0,0)) + column->column.length(),0,0, + &unused_field_idx)) { my_error(ER_BAD_FIELD_ERROR, MYF(0), column->column.c_ptr(), table_list->alias); |