2
\$\begingroup\$

I come from MySQL type of mind frame but have worked with MongoDB and ElasticSearch type of NoSQL.

I'm using a small use case of Cassandra to able to scale a playlist format for users.

In C* Summit 2013 by Axel Liljencrantz, he states how deletions are messy - and that deletion in Cassandra are actually tombstones (hence you should not use null as a value).

Below is my keyspace / table in CQL 3.0 format - it's basic:

    CREATE TABLE music_service.my_music_song (
    member_id int,
    song_id int,
    title text,
    add_time timestamp,
    album_id int,
    PRIMARY KEY ((member_id, song_id), title)
) WITH CLUSTERING ORDER BY (title ASC)
    AND bloom_filter_fp_chance = 0.01
    AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
    AND comment = ''
    AND compaction = {'min_threshold': '4', 'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32'}
    AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99.0PERCENTILE';
CREATE INDEX my_music_song_member_id_idx ON jomedia.my_music_song (member_id);

Queries needed are:

  1. Find song_id from a member_id sorted by song title
  2. Update song title given song_id
  3. Delete a song from member_id playlist
  4. Delete an entire playlist by member_id

So far I can do both the write and the read - however I want to make sure that my delete and my schema is correct considering I am coming from a MySQL mindset.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.