timestamp as primary key?
| От | Joe Kramer |
|---|---|
| Тема | timestamp as primary key? |
| Дата | |
| Msg-id | b4c00a110610190413q1559c2ffubc90d3c5d6679021@mail.gmail.com обсуждение исходный текст |
| Ответы |
Re: timestamp as primary key?
Re: timestamp as primary key? |
| Список | pgsql-general |
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.
В списке pgsql-general по дате отправления: