Cassandra pagination with c#

1k Views Asked by At

when I do pagination for MS SQL Server to be used with jquery datatable I write a simple sp like this

create PROCEDURE [dbo].[Get_SomeData] (
@startRowIndex BIGINT, @maximumRows BIGINT ,@sSearch VARCHAR(MAX),@total INT OUTPUT
) 
AS 


DECLARE @temp TABLE(RowRank BIGINT,custid BIGINT,names VARCHAR(500))

INSERT INTO @temp
   SELECT ROW_NUMBER() OVER (ORDER BY custid) AS 
  RowRank,custid,names FROM dbo.SomeTable WHERE   (names LIKE '%'+@sSearch+'%'   )

   SELECT @total=COUNT(custid) FROM @temp

 SELECT *  FROM @temp  WHERE  RowRank > @startRowIndex 
 AND RowRank <= (@startRowIndex + @maximumRows)

This makes it easy to page through the data by incrementing @startRowIndex. But how to achieve the same pagination thing with a Cassandra database and a c# client like fluentcassandra (or any c# client library)

1

There are 1 best solutions below

0
jbellis On

Cassandra pagination is done by saying "start my next resultset with the last-seen value," which is more efficient than numeric offset/limit. See http://blog.dynatrace.com/2011/12/05/pagination-with-cassandra-and-what-we-can-learn-from-it/.