GreptimeTeam / greptimedb

An open-source, cloud-native, distributed time-series database with PromQL/SQL/Python supported. Available on GreptimeCloud.
https://greptime.com/
Apache License 2.0
3.96k stars 282 forks source link

Facilitate partitioning tables with string columns #4235

Open killme2008 opened 4 days ago

killme2008 commented 4 days ago

What type of enhancement is this?

API improvement, User experience

What does the enhancement do?

It's not convenient if the users want to partition a table with string columns, because the range can't be certain in most of cases, for example, try to partition the table by idc and host:

CREATE TABLE monitor(
    idc STRING,
    host STRING,
    cpu_util DOUBLE,
    disk_util DOUBLE,
    ts TIMESTAMP TIME INDEX)
engine=mito PARTITION ON COLUMNS(idc, host) (
   ....how to write the expression?...
);

Perhaps a hash partition method would be more suitable in this scenario, just like:

PARTITION ON COLUMNS(idc, host) (
   hash(idc, host) % 10
);

Partition the table into 10 regions by the value of hash(idc, host) % 10.

Implementation challenges

No response