bits and pieces

March 5, 2011

Cassandra Tip: How much time did that query take?

Filed under: Uncategorized — Tags: , — roshandawrani @ 12:12 pm

If you are using Hector library to access Cassandra DB, it’s really easy to find out how much time a mutation or read query took to get executed.

All mutation operations made through Mutator – whether single or batched – return a MutationResult object, that can provide you with the following information after the query is executed:

  • getExecutionTimeMicro() – time in microseconds it took to execute the query.
  • getHostUsed() – on which host in the Cassandra ring, the query was executed

Similary for read operations, all flavors of Query return a QueryResult object that again provides the same info as above.

Useful and consistent, isn’t it?

The Silver is the New Black Theme. Blog at


Get every new post delivered to your Inbox.

%d bloggers like this: