diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2014-03-06 16:19:12 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2014-03-06 16:19:12 +0400 |
commit | b95c8ce530cbbd92b232324dc2c4376615bd1b5d (patch) | |
tree | 60222ef1542c97949e24dcbc4474f5484b86119b /sql/table_cache.h | |
parent | ae87e63184a451cd0c9cf95f11f51b78bb40fbc3 (diff) | |
download | mariadb-git-b95c8ce530cbbd92b232324dc2c4376615bd1b5d.tar.gz |
MDEV-5675 - Performance: my_hash_sort_bin is called too often
Reduced number of my_hash_sort_bin() calls from 4 to 1 per query.
Reduced number of memory accesses done by my_hash_sort_bin().
Details:
- let MDL subsystem use pre-calculated hash value for hash
inserts and deletes
- let table cache use pre-calculated MDL hash value
- MDL namespace is excluded from hash value calculation, so that
hash value can be used by table cache as is
- hash value for MDL is calculated as resulting hash value + MDL
namespace
- extended hash implementation to accept user defined hash function
Diffstat (limited to 'sql/table_cache.h')
-rw-r--r-- | sql/table_cache.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sql/table_cache.h b/sql/table_cache.h index a30a07b8357..6da6a667792 100644 --- a/sql/table_cache.h +++ b/sql/table_cache.h @@ -40,6 +40,7 @@ extern void tdc_unlock_share(TABLE_SHARE *share); extern TABLE_SHARE *tdc_acquire_share(THD *thd, const char *db, const char *table_name, const char *key, uint key_length, + my_hash_value_type hash_value, uint flags, TABLE **out_table); extern void tdc_release_share(TABLE_SHARE *share); extern bool tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type, @@ -88,7 +89,9 @@ static inline TABLE_SHARE *tdc_acquire_share(THD *thd, const char *db, const char *key, uint key_length, uint flags) { - return tdc_acquire_share(thd, db, table_name, key, key_length, flags, 0); + return tdc_acquire_share(thd, db, table_name, key, key_length, + my_hash_sort(&my_charset_bin, (uchar*) key, + key_length), flags, 0); } @@ -120,7 +123,8 @@ static inline TABLE_SHARE *tdc_acquire_share_shortlived(THD *thd, TABLE_LIST *tl { const char *key; uint key_length= get_table_def_key(tl, &key); - return tdc_acquire_share(thd, tl->db, tl->table_name, key, key_length, flags); + return tdc_acquire_share(thd, tl->db, tl->table_name, key, key_length, + tl->mdl_request.key.tc_hash_value(), flags, 0); } |