Cassandra Data Type 1 – uuid, timestamp

Data Type

Following documentation is quite good explanation about Data Type.


I’m using MySQL. I use bigint unsigned autoincrement setting for count primary key.

For cassandra, there is no exact equivalent. Cassandra is distributed use, so autoincrement is not exactly same use case.

uuid becomes a kind of unique key for this role. of course uuid does not have order like incremental key


Create table members (
  uid uuid primary key,
  name varchar
INSERT INTO members(uid, name) VALUES (uuid(), 'Ore');

uuid()  :   UUID Type 4, generate uuid


This is same meaning as MySQL.


Create table entry(
  uid uuid primary key,
  name varchar,
  time timestamp

INSERT INTO entry (uid, name, time) VALUES (uuid(), 'Taro', toTimestamp(now()));

toTimestamp(now()) generates current time

You can see data like

SELECT * FROM entry;
uid                                  | name | time
 400aa338-41bb-42a7-a5b4-15e380f666a5 | Taro | 2019-10-13 02:41:19.450000+0000
Professional Programmer2