如何在Cassandra表中读取2亿个分区键,而不会超时请求

huangapple go评论51阅读模式
英文:

How to read 200 million partition keys in cassandra table without request being timed out

问题

我有一张包含大量唯一分区键的表,比如一张包含某国所有公民的唯一ID的表。

现在我需要进行完整表扫描并仅读取这些键。我是需要分段读取还是可以一次性读取呢?

英文:

I have a table with huge no of unique partition keys , say a table having Unique Id of all the citizens of a country

Now what i need is full table scan and read only keys . Do i need to read segment wise or i can read at once

答案1

得分: 0

每个请求都使用Cassandra驱动程序进行分页(默认页面为5000)。然后,您遍历页面(或使用resulSet中的迭代器一个接一个地获取页面)。

对于像您提到的全表扫描表,推荐的方法是使用带有令牌映射的令牌范围/令牌感知查询,请参阅文档

英文:

Each request is paged with Cassandra drivers, (default page is 5000). Then you iterate over page (or use the iterator in the resulSet to fetch pages one after this other.

For Full scan tables like you mentioned the recommended approach is to use token ranged/token aware queries with the token map see documentation

huangapple
  • 本文由 发表于 2023年3月7日 15:49:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/75659227.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定