Skip to content

Automagically apply some functions to columns in WHERE, if func(column) present in PK #10685

@UnamedRus

Description

@UnamedRus

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.

Metadata

Metadata

Assignees

Labels

comp-query-optimizerQuery plan optimization: physical plan steps, plan-level rewrites and optimizations (QueryPlan pa...feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions