Cassandra CQL method for paging through all rows

后端 未结 2 591
心在旅途
心在旅途 2021-01-07 07:52

I want to programmatically examine all the rows in a large cassandra table, and was hoping to use CQL. I know I could do this with thrift, getting 10,000 (or so) rows at a t

2条回答
  •  一整个雨季
    2021-01-07 08:16

    Check this one: http://wiki.apache.org/cassandra/FAQ#iter_world

    You would need to program it manually, for example each following query would need to provide starting point, which was the last result from previous query. This starting port will allow you to create slice query, which returns limited amount of results.

    For example you have row with following column names:

    A1,A2,A3,B1,B2,B3,B4,B5,B6,C4,C5,D1,D2,D4,E2,E23,E4,E5,E6,E7

    Now you would like to iterate over it, where each response has 3 results

    Slice 1) Start: "", End: "", Limit: 3 -> A1,A2,A3
    Slice 2) Start: "A3", End: "", Limit: 3 -> B1,B2,B3
    Slice 3) Start: "B3", End: "", Limit: 3 -> B4,B5,B6
    Slice 4) Start: "B6", End: "", Limit: 3 -> C4,C5,D1

提交回复
热议问题