Reputation: 991
I construct a select query using datastax java driver. I set the limit using limit option. But i see another property that can be set too
setFetchSize(int size)
DEFAULT_FETCH_SIZE- 5000 according to the docs.
Does this mean that if i have around 10000 columns in a row,if i have a query run with a limit of 3, it will always fetch the default value specified- 5000 rows and then limit the last 3 rows from that?
I thought the limit query fetches the last 3 values alone by default when used like this. Can someone clarify on this?
Upvotes: 2
Views: 6849
Reputation: 1192
I think the difference between the fetchsize and the limit is the same as JDBC with other databases like MySQL.
So, the LIMIT will limit your query results to those that fall within the range specified.
The fetch size is the number of rows physically retrieved from the database at one time by the driver as you scroll through a query ResultSet with next().
Upvotes: 0
Reputation: 4002
LIMIT
sets the max number of rows the engine retrieves while setFetchSize
sets the max number of rows that are returned to the client in one roundtrip.
Upvotes: 6
Reputation: 2440
in cassandra LIMIT will not work the same as mysql or any other RDBMS limit,
by default when you execute select query it will display data till 10000 columns, after that 1 message will appear that it is out of limit something like that, so let's say you have 50000 records in the database and you are executing select query then only 10000 records will appear so now you will execute query select * from table LIMIT 50000
in this case all 50000 data will display..
Upvotes: 0