3

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.

Jk1
  • 11,233
  • 9
  • 54
  • 64

1 Answers1

2

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.

Tyler Hobbs
  • 6,872
  • 24
  • 31
  • Thanks Tyler. I've looked at your phpcassa and it's looks pretty cool. I still may implement it. CQL is not on my radar yet. However at this stage I'm working with raw Thrift. There's not much in the way of documentation or example usage for secondary indexing using raw thrift but that's what I was fishing for. – Joey Perroni Oct 04 '11 at 21:06
  • I'll give you a tick for your answer on performance though. Cheers. – Joey Perroni Oct 04 '11 at 21:11
  • I very strongly recommend *not* using raw Thrift in any language. With that said, if you want the gory details, look here: https://github.com/thobbs/phpcassa/blob/master/sysmanager.php#L411 and here: https://github.com/thobbs/phpcassa/blob/master/columnfamily.php#L84 – Tyler Hobbs Oct 05 '11 at 01:40
  • Yeh, I can see why you don't recommend it. It's a bit daunting. I think I'll discuss installing phpcassa with the boss. Thanks mate. – Joey Perroni Oct 05 '11 at 04:14