When I find myself trying to dynamically create tables during runtime, it usually means I need another table to resolve a relationship between entities. In short, I would recommend treating your input parameters as a separate entity and store them in a separate table.
It sounds like your entities are:
- experiment
- runs of an experiment, which consist of a response and one or more:
The relationships between entities is:
- One experiment to zero or more runs
- One run to one or more input parameter values (one to many)
This last relationship will require an additional table to resolve. You can have a separate table that stores your input parameters, and associate the input parameters with a run_id
. This table could look like:
run_parameter_id ... run_id_fk ... parameter_keyword ... parameter_value
Where run_id_fk
is a foreign key to the appropriate row in the Runs table (described in your question). The parameter_keyword
is just used to keep track of the name of the parameter (parameter_1_exp1
, parameter_2_exp1
, etc).
Your queries to read/write from the database now become a bit more complicated (needing a join), but no longer reliant on creating tables on the fly.
Let me know if this is unclear and I can provide a potential database diagram.