I am trying to get all the records form Cassandra table but getting 5 thousand rows only. Is there any way to get all the result form a table?
Below are the version details:
It is the driver version 3.11.0
My server version is [cqlsh 5.0.1 | Cassandra 3.11.4 | CQL spec 3.4.4 | Native protocol v4]
Below is my code
//Create a cluster instance using 3 cassandra nodes.
var cluster = Cluster.Builder()
.AddContactPoints("xx.xx.xx.xx")
.Build();
var session = cluster.Connect("keyspace");
var rs = session.Execute("select * from table ALLOW FILTERING");
ini i=0;
foreach (var row in rs)
{
i++;
}
The value of i is always 5000. I tried to implement paging to get all the data but was not able to do so.
while (!rs.IsFullyFetched)
{
rs.FetchMoreResults();
foreach (var row in rs)
{
i++;
}
}
I'm still getting the same result
Also trying to follow the URL
https://docs.datastax.com/en/developer/csharp-driver/3.13/features/paging/
but that too is not working because I am not using any filter.
But when I tried to introduce a filter the result is 0 rows.
var ps = session.Prepare("select * from table where state = ? ALLOW FILTERING");
//// Set the page size at statement level.
var statement = ps.Bind("xyz").SetPageSize(1000);
var rs = session.Execute(statement);
var i = 0;
foreach (var row in rs)
{
i++;
}
There are record for the particular state but not getting any data. The number of records is zero.
Earlier I had issue too with the driver version
Query Cassandra form C# no result is shown
by default the fetchsize is set to 5000 to shield an application against accidentally retrieving large result sets in a single response, maybe u can play with .setFetchSize(int) property