Creating Secondary Indexes in Cassandra using Thrift and php
-
06-02-2021 - |
Question
I am after any examples of how to create secondary indexes on an new or existing columns in a cassandra db using the Thrift API. The documentation surrounding Thrift is very sparse. Can anyone help a brother out?
A second question that I was wondering is: are there any negatives with using phpcassa as an interface to cassandra. My understanding is that it sits on top of Thrift so are there any performance drawbacks to this scenario?
I'm using Cassandra 0.8, Thrift 2.0, and php 5.2.9.
La solution
If you're using phpcassa, you can use SystemManager.create_index().
If you're using the PHP CQL driver it will look like this: http://www.datastax.com/docs/0.8/references/cql#create-index
The performance overhead of phpcassa or the CQL driver is quite small, and is only worth worrying about in the most extreme of circumstances. Generally, the network latency and DB latency for your queries are much larger.