Is your feature request related to a problem? Please describe.
Compaction Algorithm in CnosDB is like a box of chocolates. You never know what you're gonna get... kidding
Nevertheless, Compaction Algorithm is still a black box to us and we would like to configure it based on our own understanding of dataset.
Describe the solution you'd like
Similar to commercial version of Cassandra here, we could have WITH compaction keyword:
- Disable compaction via CREATE SQL:
CREATE TABLE DEMO(...) WITH compaction= { 'enabled' : false };
- Enable compaction via CREATE SQL:
CREATE TABLE DEMO(...) WITH compaction= { 'class' : 'LZ4Compressor' };
- Disable compaction via ALTER TABLE SQL:
ALTER TABLE DEMO WITH compaction= { 'enabled' : false };
- Enable compaction via ALTER TABLE SQL:
ALTER TABLE DEMO WITH compaction ={ 'class' : 'LZ4Compressor' };
ALTER TABLE DEMO WITH compaction ={ 'class' : 'DeflateCompressor', 'chunk_length_in_kb' : 64 };
Or you could try MariaDB way, using COMMENT keyword here:
- Set Global Compaction Type in configuration file:
columnstore_compression_type=LZ4
- Set Table Compaction Type in SQL's COMMENT:
CREATE TABLE DEMO(...) COMMENT 'compression=3';
- Set Column Compaction Type in SQL's COMMENT:
CREATE TABLE DEMO(
invoice_id BIGINT UNSIGNED NOT NULL,
invoice_total DECIMAL(13, 2) COMMENT 'compression=3',
);
Describe alternatives you've considered
We could disable compaction once for all in the configuration instead of DDL but DDL provides more granular way.
Additional context
More granularity should be provided as well:
- Global
- Database
- Table
This feature should be integrated in the cloud version as well.
Other alternatives:
- TecentCloud's COMPRESSED keyword: https://www.tencentcloud.com/document/product/236/43480
- ClickHouse's CODEC keyword: https://clickhouse.com/docs/en/sql-reference/statements/create/table#column-compression-codecs
component/tsdb Community kv store