Mysql - Table structure to hold history log without any primary key
2
votes
1
answer
831
views
I have mysql table that holds log data for some products, this data are deleted and inserted by a service every 5 minutes.
This is the table:
| id | product_id | dev_stage_id | production_order | log | log_type | date
Right now
id
is the auto-increment primary key but is in fact useless as we never use it. Every other column is not unique, so we cannot have a different composite primary key.
As I said before a service delete all rows by product_id
and dev_stage_id
every 5 minutes and then new data is created. This means id
gets very big very quickly.
The data are later used for display using a simple query like:
SELECT * FROM table where product_id = 1231 and dev_stage_id = 233
Is it ok in our case to just remove the id
column and have no primary key or should we have a different structure ?
Asked by SilentRage47
(121 rep)
May 26, 2022, 09:54 AM
Last activity: May 7, 2025, 12:08 AM
Last activity: May 7, 2025, 12:08 AM