Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

neerajk22 avatar image
neerajk22 asked neerajk22 commented

Does the C# driver support navigating to previous results page?

I have gone through the forward paging way as mentioned here - DataStax C# Driver - Result paging

It explains how we can get to next page. But is there any way or support in driver as well to navigate to any specific page or how to go to backward/previous page ?

Also how to get the total no of records for example when we are querying with page size 10 then only 10 records are returned to how UI will come to know the total no of records available so that pagination can be enabled on UI.

csharp driver
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered neerajk22 commented

If you save the paging state within your application, you can load the previous page of results but you it is not possible to jump to a random page.

You can get a count of the rows by running a SELECT COUNT(*) FROM ... WHERE pk = ? but it's very important that you restrict the count to a single partition. Otherwise, it will cause performance issues in your cluster as I've explained in Why COUNT() is bad in Cassandra. Cheers!

1 comment Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Thanks got it, so just wondering how fully featured grid with different pagination options can be implemented with cassandra as backend , we are looking for similar kind of functionalities for filtering , sorting as well with Cassandra - https://www.c-sharpcorner.com/article/effective-paging-sorting-and-filtering-using-sql-server-stored-procedure/

0 Likes 0 ·