liveBook · Manning

USING TIMESTAMP clause

As explained in ScyllaDB in Action

The USING TIMESTAMP clause is a CQL write clause that specifies the timestamp assigned to an operation.

USING TIMESTAMP is a CQL write clause that sets the write timestamp for an insert, update, or delete. Scylla uses that timestamp to reconcile concurrent writes. section 6.1.2 section 6.6

Use the clause with these behaviors in mind:

  • A write with a newer timestamp replaces an older value; a write with an older timestamp is not saved. section 6.1.2
  • One timestamp applies to every cell changed by a query; different cells cannot receive different timestamps in the same query. section 6.1.2
  • The default query timestamp is normally preferred; explicitly setting one is especially useful during data migrations. section 6.1.2 section 12.2.4

Rejecting an obsolete update

UPDATE authors USING TIMESTAMP 1 SET bio = 'This bio is obsolete' WHERE id = eff9bd01-4a73-11ee-8863-c02b3f99d2b2; leaves Alice’s newer bio unchanged. INSERT statements can use the same clause after their VALUES expression.

How ScyllaDB in Action covers it

How deep it goes
Explains timestamp ordering, per-query scope, INSERT syntax, and migration timing, but defers broader coordination techniques.
Examples
Demonstrates Alice Author’s write times, an obsolete UPDATE and INSERT, and the resulting unchanged bio.
What it assumes
Assumes basic CQL INSERT and UPDATE operations, while introducing write timestamps and their role in reconciling concurrent writes.
What you can do after
Operate/configure CQL writes with explicit timestamps when coordinating data migrations or testing timestamp precedence.
How it connects
Connects write timestamps with last-write-wins, WRITETIME, atomicity, concurrent updates, and data migration.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ScyllaDB in Action. The section links point to the parts of the book it draws on.