I have a table in my database which stores logs. The log files are timestamped with second accuracy and store the values of various sensors and their source:
log_id, log_date, primary_system_source, sub_system_source, values
Where log_id, primary_source and sub_source are integers and values is a variable length byte array (datatype: bytea).
In most cases a combination of log_id, log_date, primary_system_source and sub_system_source fields would be sufficient as the primary key. Unfortunately, as a result of the resolution of the timestamping in the logging system in some rows the only factor differentiating rows is if the sensor values are also added to the primary key.
It appears I have a choice between having no primary key (bad?), and including the values field in the primary key. I am concerned at the second choice as I understand it could be seriously detrimental to performance (the table will have hundreds of millions of rows).
Any hints as to which is the best solution?