Search code examples
clickhouse

After insert, select count(1) from ReplicatedMergeTree engine table at once, get difference result for many times


The situation is that: I insert some data into ReplicatedMergeTree engine table, and I do this query select count(1) from table at once, and I get different results. As I know, this is caused by the Replicated mechanism, It will spend some time for Replicated shard copying data, so if the query routes to Replicated shard and will respond different result.

How can I avoid this problem if I want to use the data I insert at once?


Solution

  • For reading from Distributed table you can play with the next settings: