Clickhouse: [Question] different sorting keys on a replicated table

Created on 4 Feb 2019  路  3Comments  路  Source: ClickHouse/ClickHouse

Can the ORDER BY columns be in different order on two different replicas ?

say I want to have sorting key for a replicated table on server 1 as :

ORDER BY (CounterID, EventDate)

while on server 2 as
ORDER BY (EventDate, CounterID)

rest of the schema is same.

question

Most helpful comment

You can create a materialized view with a different sorting/primary key if that is required.

All 3 comments

Replicated*MergeTree -- No.

You can use smaller partitions (partition by daily). In this case [where EventDate = ] will scan only one partition.

You can create a materialized view with a different sorting/primary key if that is required.

It is possible if you use independent MergeTree tables and Distributed table just looks at them as replicas. For data replication, you can INSERT into Distributed table (cluster should has internal_replication set to false) or INSERT data to both replicas directly. Data consistency between replicas will not be maintained.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

innerr picture innerr  路  3Comments

hatarist picture hatarist  路  3Comments

vvp83 picture vvp83  路  3Comments

lttPo picture lttPo  路  3Comments

goranc picture goranc  路  3Comments