Vinod Jayachandran
Vinod Jayachandran

Reputation: 3898

Datastax Cassandra Java Driver @QueryParameters fetchSize

With reference to http://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/mapping/annotations/QueryParameters.html#fetchSize--

What does a default value of -1 mean for fetchSize in datastax query params for cassandra. I would assume there is no pagination.

Does it mean it tries to fetch all records at one shot ? Tried to search quite a bit for documentation but couldn't affirm this theory.

Upvotes: 1

Views: 558

Answers (1)

pinkpanther
pinkpanther

Reputation: 4798

A fetchSize of -1 is only to indicate that the value is not set. For example, fetchSize can be set at statement level or Cluster instance(Java object) level.

For example, if you have not set any fetch size for an individual statement, the implementation will check if it's -1 and use the Cluster level fetch size and so on.

If no value is set it defaults to 5000.

https://docs.datastax.com/en/developer/java-driver/2.1/manual/paging/

If the fetch size is set on a statement, it will take precedence; otherwise, the cluster-wide value (which defaults to 5000) will be used.

Also note:

Note that setting a fetch size doesn’t mean that Cassandra will always return the exact number of rows, it is possible that it returns slightly more or less results.

Upvotes: 1

Related Questions