美文网首页
Clickhouse分布式表按照offfset分区

Clickhouse分布式表按照offfset分区

作者: 和平菌 | 来源:发表于2023-04-18 15:23 被阅读0次

    bitShiftRight(offset, 20)

    public static long getShardNumByOffset(long offset) {
            long shardKey = offset >> 20;
            int totalWeight = 20;
            long divider = Integer.toUnsignedLong(totalWeight);
            long shardNum = (long) shardKey - (long) shardKey / divider * totalWeight + 1;
            return shardNum;
        }
    

    相关文章

      网友评论

          本文标题:Clickhouse分布式表按照offfset分区

          本文链接:https://www.haomeiwen.com/subject/dinhjdtx.html