Thanks! So assuming C* 3.0 and that my table stores only one collection, using clustering keys will be more performant?
Extending this to sets - would doing something like this make sense? ( id UUID PRIMARY KEY, val text, PRIMARY KEY (id, val)) ); SELECT count(*) FROM TABLE WHERE id = 123 AND val = "test" // Key exists if count != 0 On Wed, Nov 15, 2017 at 12:48 PM, Jon Haddad <j...@jonhaddad.com> wrote: > In 3.0, clustering columns are not actually part of the column name > anymore. Yay. Aaron Morton wrote a detailed analysis of the 3.x storage > engine here: http://thelastpickle.com/blog/2016/03/04/ > introductiont-to-the-apache-cassandra-3-storage-engine.html > > The advantage of maps is a single table that can contain a very flexible > data model, of maps and sets all in the same table. Fun times. > > The advantage of using clustering keys is performance and you can use WAY > more K/V pairs. > > Jon > > > On Nov 15, 2017, at 8:12 AM, eugene miretsky <eugene.miret...@gmail.com> > wrote: > > Hi, > > What would be the tradeoffs between using > > 1) Map > > ( > > id UUID PRIMARY KEY, > > myMap map<int,text> > > ); > > 2) Clustering key > > ( > > id UUID PRIMARY KEY, > > key int, > > val text, > > PRIMARY KEY (id, key)) > > ); > > My understanding is that maps are stored very similarly to clustering > columns, where the map key is part of the SSTable's column name. The main > difference seems to be that with maps all the key/value pairs get retrieved > together, while with clustering keys we can retrieve individual rows, or a > range of keys. > > Cheers, > Eugene > > >