Cassandra Data Model

I'm working on a POC to showcase how Cassandra works. I took Digg as an example. I wanted to create a data model that'll let me:

1) Add links 2) Add a link to a user favorite list. 3) Attached predetermined tags to links

I came up with two Column Families:

<ol> <li>


    <li>url is the key
      <li>id (a generated uuid)</li> <li>user (who added it)</li> <li>favCount (no of users who favorited the link)</li> <li>upCount (no of users who liked it)</li> <li>downCount (no of users who disliked it)</li> </ul></li> </ul></li> <li>


        <li>user is the key
          <li>id (as many ids as the user has favorited)</li> </ul></li> </ul></li> </ol>

          This works fine for requirements #1 and #2 above, but when I come to #3 it gets trickier. I can add tags like 'java', 'languages', 'architecture' as column names with empty values in the Links column family. But querying will take a long time, let's say if I were to find out all the links that were tagged under 'java'.

          Can anyone throw some ideas of how this can be implemented.

          If I'm not clear with the question, please let me know.

          Thanks, Kumar


          You could create a secondary index, i.e. a column family keyed on tag. Each row contains all the links for that particular tag. Note that this may result in very wide rows (i.e. with many columns) each of which will be stored on a single cassandra node. You might want a scheme to split these up if they get very large.

          See http://www.datastax.com/docs/0.7/data_model/cfs_as_indexes

          or http://pkghosh.wordpress.com/2011/03/02/cassandra-secondary-index-patterns/

          or google cassandra secondary index


  • Retweet using Oauth+MGTwitterEngine …not getting update response
  • How would I return the order of MongoDB Posts by time Favourited by user?
  • .NET Core 2.1 Apple Push Notifications
  • Javascript animated gif forwarding
  • X509 Certificate multi-passwords?
  • Pass Dictionary to Javascript array
  • MYSQ & MVC3 SQL connection error \\ ProviderManifestToken but I am using MySQL
  • How do I display a dialog that asks the user multi-choice questıon using tkInter?
  • How do I include a SWC in an AS2 Flash project?
  • Jquery popup on mouse over of calendar control
  • Web.config system.webserver errors
  • RxJava debounce by arbitrary value
  • ListItem.Attributes.Add not working
  • WPF ICommand CanExecute(): RaiseCanExecuteChanged() or automatic handling via DispatchTimer?
  • Problem while Building a Setup Project for a windows Service?
  • why xml file does not aligned properly after append the string in beginning and end of the file usin
  • MVC3 Razor - ListBox pre-select not working
  • C++ Partial template specialization - design simplification
  • All Classes Conforming to Protocol Inherit Default Implementation
  • Using variable in a value field in jMeter
  • Why is an OPTIONS request sent to the server?
  • Adding a button at the bottom of a table view
  • Deleting and Updating values from a cusrsor adapter
  • How to make a tree having multiple type of nodes and each node can have multiple child nodes in java
  • Is possible to count alias result on mysql
  • How to set/get protobuf's extension field in Go?
  • Trying to switch camera back to front but getting exception
  • Importing jscolor library in angular 2
  • To display the title for the current loaction in map in iphone
  • Properly structure and highlight a GtkPopoverMenu using PyGObject
  • php design question - will a Helper help here?
  • KeystoneJS: Relationships in Admin UI not updating
  • Codeigniter doesn't let me update entry, because some fields must be unique
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • JTable with a ScrollPane misbehaving
  • Angular 2 constructor injection vs direct access
  • Java static initializers and reflection
  • Android Google Maps API OnLocationChanged only called once
  • How to get NHibernate ISession to cache entity not retrieved by primary key
  • UserPrincipal.Current returns apppool on IIS