简体   繁体   中英

row key in cassandra table

I am new to Cassandra, I am confused between rowkey and partition key in Cassandra.

I am creating a table like:

Create table events( day text, hour text, dip text, sip text, count counter,
primary key((day,hour), dip, sip));

As per my understanding, in the above table day and hour columns form a partition key and dip,sip columns form a clustering key.

My understanding is that row key is nothing but partition key ie day, hour columns form a row key.

Is my understanding correct? Can any one clarify this?

Is my understanding correct, Can any one clarify this?

Yes, your understanding is correct. The row key is the "old school" way of referring to a partition key. The partition key (as you probably understand) is the part of the CQL PRIMARY KEY which determines where the data is stored in the cluster. In your case, data within your partition keys will be sorted by dip and sip (your clustering keys).

You should give John Berryman's article Understanding How CQL3 Maps To Cassandra's Internal Data Structure a read. It does a great job of explaining how your table structures map "under the hood."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM