XXHASH_64
xxhash_64β
descriptionβ
Syntaxβ
BIGINT XXHASH_64(VARCHAR input, ...)
Return the 64 bits xxhash of input string.
Note: When calculating hash values, it is more recommended to use xxhash_64
instead of murmur_hash3_64
.
exampleβ
mysql> select xxhash_64(NULL);
+-----------------+
| xxhash_64(NULL) |
+-----------------+
| NULL |
+-----------------+
mysql> select xxhash_64("hello");
+----------------------+
| xxhash_64('hello') |
+----------------------+
| -7685981735718036227 |
+----------------------+
mysql> select xxhash_64("hello", "world");
+-----------------------------+
| xxhash_64('hello', 'world') |
+-----------------------------+
| 7001965798170371843 |
+-----------------------------+
benchmarkβ
Through TPCH Benchmark testing, it was found that xxhash_64
has significantly improved performance compared to murmur_hash3_64
. Therefore, in scenarios where hash values need to be calculated, it is more recommended to use xxhash_64
.
mysql> select count(murmur_hash3_64(l_comment)) from lineitem;
+-----------------------------------+
| count(murmur_hash3_64(l_comment)) |
+-----------------------------------+
| 600037902 |
+-----------------------------------+
1 row in set (17.18 sec)
mysql> select count(xxhash_64(l_comment)) from lineitem;
+-----------------------------+
| count(xxhash_64(l_comment)) |
+-----------------------------+
| 600037902 |
+-----------------------------+
1 row in set (8.41 sec)
keywordsβ
XXHASH_64,HASH