Is there a way to get “updated_at” timestamps from YCQL without additional columns?

[Question posted by a user on YugabyteDB Community Slack ]

Is there a way to get “updated_at” timestamps from YCQL without additional columns?

On each INSERT/UPDATE/DELETE YugabyteDB also stores by default the timestamp when the operation occurred. This can be easily looked up by using the WriteTime function. WriteTime returns the timestamp in microseconds when the value was written:

ycqlsh:yb_demo> create table users(id bigint PRIMARY KEY, name TEXT);
ycqlsh:yb_demo> INSERT INTO users(id,name) VALUES (1, 'Billy Johnes');
ycqlsh:yb_demo> SELECT id,name,writetime(name) from users;

 id | name     	| writetime(name)
----+--------------+------------------
  1 | Billy Johnes | 1596097449565229

(1 rows)
1 Like