crc64
NAME
crc64(): Return a 64 bit CRC of given input, as unsigned big integer.TYPE
FunctionDESCRIPTION
This function complements MySQL's crc32() function, which results with poor distribution on large number of values. The crc64() algorithm relies on MD5 as underlying mechanism.
While input data is textual, any type can be passed in, due to SQL's implicit casting nature.
This code is based on the idea presented in the book High Performance MySQL, 2nd Edition, By Baron Schwartz et al., published by O'REILLY
SYNOPSIS
crc64(data LONGTEXT CHARSET utf8) RETURNS BIGINT UNSIGNED
Input:
- data: data to run CRC on. This can be textual, numeric, temporal, or any other type that can be implicitly converted to TEXT.
EXAMPLES
Calculate 64 bit CRC for some text:
mysql> SELECT common_schema.crc64('mysql') AS crc64; +---------------------+ | crc64 | +---------------------+ | 9350511318824990686 | +---------------------+