1

Can somebody help me understand the use and benefits of these three functions that Percona suggests right after installation?

* Percona XtraDB Cluster is distributed with several useful UDF (User Defined Function) from Percona Toolkit.
 * Run the following commands to create these functions:

        mysql -e "CREATE FUNCTION fnv1a_64 RETURNS INTEGER SONAME 'libfnv1a_udf.so'"
        mysql -e "CREATE FUNCTION fnv_64 RETURNS INTEGER SONAME 'libfnv_udf.so'"
        mysql -e "CREATE FUNCTION murmur_hash RETURNS INTEGER SONAME 'libmurmur_udf.so'"

 * See http://www.percona.com/doc/percona-server/5.7/management/udf_percona_toolkit.html for more details

I have never been able to find documentation that clearly explains these function, and what benefits/advantages you get from them.

The Georgia
  • 1,005
  • 7
  • 23
  • 59

1 Answers1

2

The benefit of these functions are "faster checksums"...i.e. more efficient implementations of a couple of hash functions.

But that's only a benefit if you have a need (requirement) generate values provided by these hash functions.

If you don't have any need to generate hash values, then these functions don't provide any benefit.

References:

http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function

http://en.wikipedia.org/wiki/MurmurHash

http://en.wikipedia.org/wiki/Hash_function

spencer7593
  • 106,611
  • 15
  • 112
  • 140
  • Say i have a need to generate hash functions, what benefit still does this give me? Fast inserts, selects etc? – The Georgia May 15 '17 at 07:54
  • MySQL provides a few builtin hash functions: MD5, SHA1, SHA2. The algorithms for these hash functions are more complex, requiring more operations to compute, which makes them slow. And "slower" is a feature we want in cryptographic hashes, because that makes it more expensive to use "brute force" to break the cryptography (though MD5 and SHA1 are no longer considered to be secure, due to known exploits.) If we set aside security/cryptography, and we need a hash value for something else, then a "slow" hash is probably not a benefit. So we could use a faster, less expensive, hash function. – spencer7593 May 15 '17 at 14:25
  • Any SQL statement (INSERT, SELECT) that invokes a hash function is going to incur the cost (time) for executing that function. If we are consuming a lot of cycles computing hashes, that's going to have an impact on performance and scalability. We probably aren't going to notice the difference for calculating a single hash value. But when we're doing a large volume of hash calculations, that's when we are really going to notice a difference. – spencer7593 May 15 '17 at 14:33
  • Thanks @spencer7593 for elaborating on this. I will accept this explanation. – The Georgia May 16 '17 at 03:41