Datastax Cassandra Java 驱动程序 @QueryParameters fetchSize

Datastax Cassandra Java Driver @QueryParameters fetchSize

参照http://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/mapping/annotations/QueryParameters.html#fetchSize--

对于 cassandra 的 datastax 查询参数中的 fetchSize,默认值 -1 意味着什么。我会假设没有分页。

这是否意味着它试图一次获取所有记录?试图搜索大量文档,但无法证实这一理论。

一个-1的fetchSize只是表示没有设置值。例如,fetchSize可以在语句级别或Cluster实例(Java对象)级别设置。

例如,如果您没有为单个语句设置任何提取大小,该实现将检查它是否为 -1 并使用 Cluster 级别的提取大小等。

如果未设置值,则默认为 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.

另请注意:

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.