Search Postgresql Archives

timestamp as primary key?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux