メインコンテンツまでスキップ
に最終更新

XXHASH_64

説明​

入力した文字列またはバイナリ値の 64 ビット xxHash 値を計算します。

  • 注: テストでは xxhash_64 は murmur_hash3_64 の約二倍の性能を示しました。ハッシュ値の計算には xxhash_64 を murmur_hash3_64 の代わりに使用することを推奨します。

構文​

XXHASH_64( <input> [ , <input> ... ] )

パラメータ​

パラメータ説明
<input>64 ビットの xxHash 値を計算する対象。文字列型とバイナリ型を受け付けます

戻り値​

入力値の 64 ビット xxHash 値を返します。

使用例​

select xxhash_64(NULL), xxhash_64("hello"), xxhash_64("hello", "world");
+-----------------+----------------------+-----------------------------+
| xxhash_64(NULL) | xxhash_64('hello') | xxhash_64('hello', 'world') |
+-----------------+----------------------+-----------------------------+
| NULL | -7685981735718036227 | 7001965798170371843 |
+-----------------+----------------------+-----------------------------+
-- vb (VarBinary) and vc (VarChar) used the same string during insertion.
SELECT * FROM mysql_catalog.binary_test.binary_test;
+------+------------+------+
| id | vb | vc |
+------+------------+------+
| 1 | 0x616263 | abc |
| 2 | 0x78797A | xyz |
| 3 | NULL | NULL |
+------+------------+------+
SELECT XXHASH_64(vb), XXHASH_64(vc) FROM mysql_catalog.binary_test.binary_test;
+---------------------+---------------------+
| XXHASH_64(vb) | XXHASH_64(vc) |
+---------------------+---------------------+
| 8696274497037089104 | 8696274497037089104 |
| 7095089596068863775 | 7095089596068863775 |
| NULL | NULL |
+---------------------+---------------------+