Primary Key unique

1,024 views
Skip to first unread message

Lucas Felipe

unread,
Apr 27, 2018, 8:02:30 AM4/27/18
to click...@googlegroups.com
I am testing clickhouse for an production env which really needs unique primary keys or some unique constraint. Is there some engine that provides it?

Att,

Lucas

Родион Горбачев

unread,
May 4, 2018, 5:32:18 AM5/4/18
to ClickHouse
May be ReplacingMergeTree engine or AggregatingMergeTree engine with aggregating by primary key column - you way.

пятница, 27 апреля 2018 г., 15:02:30 UTC+3 пользователь Lucas Felipe написал:

Lucas Felipe

unread,
May 4, 2018, 6:12:38 AM5/4/18
to Родион Горбачев, ClickHouse
Thanks,

Do you know if I can use this engines with aggregating by primary key column in a cluster?

Att,

--
You received this message because you are subscribed to the Google Groups "ClickHouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clickhouse+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/clickhouse/a40c95e5-96d1-4af9-8f51-6798f92b2d24%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Denis Zhuravlev

unread,
May 4, 2018, 4:56:21 PM5/4/18
to ClickHouse
It's a big data so you should avoid any constraints because you could not stop data load process.

ReplacingMergeTree and AggregatingMergeTree do not guarantee aggregating even through one partition (it depends of merge processes and parts size).
And CH will not replace/aggregate across several partitions because replacing is a part of merge process so it works only inside a partition.
And CH nodes completely independent so they don't care about even other nodes existence moreover they don't care about data on other nodes.


On Friday, 4 May 2018 07:12:38 UTC-3, Lucas Felipe wrote:
Thanks,

Do you know if I can use this engines with aggregating by primary key column in a cluster?

Att,
2018-05-04 6:32 GMT-03:00 Родион Горбачев <rady...@gmail.com>:
May be ReplacingMergeTree engine or AggregatingMergeTree engine with aggregating by primary key column - you way.

пятница, 27 апреля 2018 г., 15:02:30 UTC+3 пользователь Lucas Felipe написал:
I am testing clickhouse for an production env which really needs unique primary keys or some unique constraint. Is there some engine that provides it?

Att,

Lucas

--
You received this message because you are subscribed to the Google Groups "ClickHouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clickhouse+...@googlegroups.com.

Itai Shirav

unread,
May 7, 2018, 2:35:42 AM5/7/18
to ClickHouse
One option is to use a UUID column, but it's somewhat cumbersome.

A solution that I've implemented - usually next to ClickHouse we keep a PostgreSQL instance, for storing metadata / mutable data. So we create a Sequence in PostgreSQL, and whenever we insert a record to ClickHouse we get its unique id from the sequence, and then insert it into ClickHouse.
Reply all
Reply to author
Forward
0 new messages