ClickHouse / ClickHouse

ClickHouse® is a real-time analytics DBMS
https://clickhouse.com
Apache License 2.0
37.07k stars 6.84k forks source link

PROJECTION Compression (skip indexes and settings ?) #28932

Open UnamedRus opened 3 years ago

UnamedRus commented 3 years ago

Use case

Allow users to set Compression, index and settings for projections.

Describe the solution you'd like

CREATE TABLE xxx_proj
(
    `key` UInt32,
    `value` UInt64,
    PROJECTION proj
    (key UInt32 CODEC (T64,LZ4),
     value UInt64 CODEC(T64,LZ4),
    INDEX idx_mm value TYPE minmax GRANULARITY 1000
    )
    (
        SELECT
            key,
            sum(value)
        GROUP BY key
    ) SETTINGS index_granularity = 1024
)
ENGINE = MergeTree
ORDER BY key

CREATE TABLE xxx_proj
(
    `key` UInt32,
    `value` UInt64,
    PROJECTION proj
    (key UInt32 CODEC (T64,LZ4),
     value UInt64 CODEC(T64,LZ4),
    INDEX idx_mm value TYPE minmax GRANULARITY 1000
    ) AS
        SELECT
            key,
            sum(value)
        GROUP BY key
    SETTINGS index_granularity = 1024
)
ENGINE = MergeTree
ORDER BY key
alexey-milovidov commented 3 years ago

Yes, why not... CC @amosbird

amosbird commented 3 years ago

Not sure what's the proper grammar for this. But yes, it's already in plan.

orloffv commented 10 months ago

@amosbird do you have any updates?