Lilouuw_19
Lilouuw_19

Reputation: 23

Cassandra read performance

I want to know how to configure Cassandra to get better READ performances, because when I try to do a SELECT query on a table which has 1M rows I get the timedoutexception.

I've already change the request_timeout_in_ms, add more nodes but still got the same error.

Upvotes: 0

Views: 393

Answers (3)

Zanson
Zanson

Reputation: 4031

You are querying too many rows at once. You need to query less rows at a time and page through them.

Update:

First query:

select <KEY>,p0001 from eExtension limit 1000;

Repeat: take the last result from that query:

select <KEY>,p0001 from eExtension where token(<KEY>) > token(<LAST KEY RETURNED FROM PREVIOUS>) limit 1000;

repeat that pattern until done.

Upvotes: 2

Easility
Easility

Reputation: 716

One way to do pagination is to use Cassandra's clients app like Playorm. PlayOrm returns a cursor when you query and as your first page reads in the first 100 results and displays it, the next page can just use the same cursor in your session and it picks up right where it left off without rescanning the first 100 rows again. Visit this to see the example for cursor and this for all features and more details about playorm

Upvotes: 0

jbellis
jbellis

Reputation: 19377

Sounds like you're trying to read all 1M rows at once. Don't.

Upvotes: 0

Related Questions