Data Type
Following documentation is quite good explanation about Data Type.
uuid
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
Example
Create table members ( uid uuid primary key, name varchar ); INSERT INTO members(uid, name) VALUES (uuid(), 'Ore');
uuid() : UUID Type 4, generate uuid
timestamp
This is same meaning as MySQL.
Example
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
コメント