Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
718 B
7
Indexable
Never
drop table if exists [MY].members;

create table [MY].members
(
    id int PRIMARY KEY,
    age int,
    gender varchar(8),
    email varchar(256)
)
order by id 
	/* Joined by, referenced by other tables, no time axis */
segmented by hash(id) all nodes;

drop table if exists [MY].dialogs;

create table [MY].dialogs
(
    message_id   int PRIMARY KEY,
    message_ts   timestamp(6),
    message_from int REFERENCES members(id),
    message_to   int REFERENCES members(id),
    message varchar(1000),
    message_group int
)
order by message_from, message_ts
		/* 
			 message_from is FK and is inside JOIN statement.
       message_ts is a time axis - used for filtering
	  */
segmented by hash(message_id) all nodes;
Leave a Comment