From b95c8ce530cbbd92b232324dc2c4376615bd1b5d Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Thu, 6 Mar 2014 16:19:12 +0400 Subject: 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 --- sql/table_cache.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sql/table_cache.cc') diff --git a/sql/table_cache.cc b/sql/table_cache.cc index ac6621226ef..fbafd8e0c9f 100644 --- a/sql/table_cache.cc +++ b/sql/table_cache.cc @@ -664,16 +664,14 @@ void tdc_unlock_share(TABLE_SHARE *share) */ TABLE_SHARE *tdc_acquire_share(THD *thd, const char *db, const char *table_name, - const char *key, uint key_length, uint flags, + const char *key, uint key_length, + my_hash_value_type hash_value, uint flags, TABLE **out_table) { TABLE_SHARE *share; bool was_unused; - my_hash_value_type hash_value; DBUG_ENTER("tdc_acquire_share"); - hash_value= my_calc_hash(&tdc_hash, (uchar*) key, key_length); - mysql_rwlock_rdlock(&LOCK_tdc); share= (TABLE_SHARE*) my_hash_search_using_hash_value(&tdc_hash, hash_value, (uchar*) key, -- cgit v1.2.1