On Thu, Feb 24, 2011 at 3:55 PM, mcasandra <mohitanch...@gmail.com> wrote: > > Either I am not explaning properly or I don't understand the data model just > yet. Please check again: > > In below example this is what I understand: > > 1) UserProfile is a CF > 2) 1111 is a row key > 3) username is a column. Each row (eg 1111) has username column > > My understanding is that secondary indexes can be created only on column > value. Which means I can create secondary index only on username, email etc. > not on 1111. 1111 is the row key, but you keep saying that I need secondary > index, but I am actually asking about index on the row key. > > Is my understanding incorrect about this? > >> UserProfile = { // this is a ColumnFamily >> 1111 { // this is the key to this Row inside the CF >> // now we have an infinite # of columns in this row >> username: "phatduckk", >> email: "[hidden email]", >> phone: "(900) 976-6666" >> }, // end row >> 2222 { // this is the key to another row in the CF >> // now we have another infinite # of columns in this row >> username: "ieure", >> email: "[hidden email]", >> phone: "(888) 555-1212" >> age: "66", >> gender: "undecided" >> }, >> } > > -- > View this message in context: > http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Understanding-Indexes-tp6058238p6061959.html > Sent from the cassandra-u...@incubator.apache.org mailing list archive at > Nabble.com. >
You do not need secondary indexes to search on the RowKey. The Row Key is used by the partitioner to locate your data across the cluster. The Row Key is also used as the primary sort of the SSTables. Thus the row key is naturally indexed.