I have a time-series simulation model which has more than 10 input variables. The number of distinct simulation instances would be more than 1 million, and each simulation instance generates a few output rows every day.
To save the simulation result in a relational database, i designed tables like this.
create table SimulationModel (
simul_id integer primary key,
input0 string/numeric,
input1 string/numeric,
...)
create table SimulationOutput (
dt DateTime primary key,
simul_id integer primary key,
output0 numeric,
...)
To make each model be unique, i'm considering some ways like below.
put an unique constraint on all of the input columns of the SimulationModel table
redesign SimulationModel table to group input columns into 2~3 columns and put an unique constraint on these grouped columns. (By making a long string value like "input0_input1_input2")
forget about the server side constraint and do the job in the application side.
How do you think about these options?
Is there no problem to use an unique index on more than 10 columns with millions rows?
Is there some other way to recommend?
(I may use postgresql)