I am currently working on a evolutionary algorithm which will try to find an optimum configuration of parameters for a given problem.
I'm trying to create records in a MySQL table which will store a configuration where each parameter will be represented as a table column. If a configuration has already been attempted then I would like to prevent it from being duplicated.
Is there a mechanism to do this at the database/ORM level or should I create programmatic logic to prevent duplicate entries?
Yes, declare or define the
Configurationcolumn asPrimary KeyorUnique Keywhile you are creating your table to avoid duplication.I mentioned
configurationcolumn cause I am not sure about your table structure but if it involves multiple column then you can make it a composite key always. Why you are worried about key lookup. if you design your table properly with proper index then you shouldn't worries about that.Say your
col1, col2, col3, col4is part of configuration and you want them to be unique. Then make them as composite primary key saying