Hello,
I have table for online chat system that keep messages sent between users.
CREATE TABLE chat_message
(
message_time timestamp without time zone NOT NULL DEFAULT now(),
message_body text,
user_id_from bigint,
user_id_to bigint,
CONSTRAINT chat_message_pkey PRIMARY KEY (message_time)
)
WITHOUT OIDS;
I don't want to add int primary key because I don't ever need to find
messages by unique id.
Question: is it okay to use timestamp as primary key, or there is
possibility of collision? (Meaning two processes may INSERT into table
within same millisecond.) It is a web application.
Thanks.