When to use unlogged batches

As we saw earlier, logged batches or atomic batches can be used to keep multiple tables in sync. Unlogged batches can be used when you are making updates to the same partition. For example, you are trying to add multiple status update replies to the status_update_replies table for a user on a particular status_update_id:

BEGIN UNLOGGED BATCH INSERT INTO "status_update_replies" ("status_update_username", "status_update_id", "id", "author_username", "body")VALUES ('alice',  76e7a4d0-e796-11e3-90ce-5f98e903bf02, NOW(), 'bob','Bob Reply1');INSERT INTO "status_update_replies" ("status_update_username", "status_update_id", "id", "author_username", "body")VALUES ('alice', 76e7a4d0-e796-11e3-90ce-5f98e903bf02, NOW(), ...

Get Learning Apache Cassandra - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.