-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Automagically apply some functions to columns in WHERE, if func(column) present in PK #10685
Description
Use case
We have some column with very long values in it, but we want to use that column in PRIMARY KEY for faster query lookup (WHERE column = 'long_string' or WHERE column IN ('long_string1','long_string2')).
We dont want to load all this long values in ram, so we can use some deterministic function(hash, startsWith, slice) to reduce key size.
Describe the solution you'd like
Add some setting and optimization which would replace WHERE column = 'long_row' with
WHERE cityHash64(column) = cityHash64('long_string') AND column = 'long_string' (if table definition contains ORDER BY (cityHash64(column))
Describe alternatives you've considered
Sometimes we can write that optimization by yourselfs, but sometimes cant.
For example if we run queries from software with query builder.