卡桑德拉与c#的分页

时间:2012-06-21 14:59:48

标签: c# pagination cassandra fluentcassandra

当我为MS SQL Server进行分页以与jquery数据表一起使用时,我写了一个像这样的简单sp

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)

这样可以通过递增@startRowIndex轻松浏览数据。但是如何使用Cassandra数据库和c#客户端(如fluentcassandra(或任何c#客户端库))实现相同的分页

1 个答案:

答案 0 :(得分:1)

Cassandra分页是通过说“以最后看到的值开始我的下一个结果集”来完成的,这比数字偏移/限制更有效。请参阅http://blog.dynatrace.com/2011/12/05/pagination-with-cassandra-and-what-we-can-learn-from-it/