Search code examples
phpmysqlarraysmultidimensional-arraydatabase-performance

Performance mySQL: Long string in one column in database table or add extra columns?


if I have a muli-dimensional array like that I take from a form submit:

$participants = array(

    'participant1'=> array(
        'name'=>'jim',
        'age' => '15',
        'grade' => '8th'),

    'participant2'=> array(
        'name'=>'tom',
        'age' => '17',
        'grade' => '9th'),
....
);

Is it better two store whole array into one db column named "Participants" or create a separate column in the row for each participant PERFORMANCE wise if i have a maximum number of participants?


Solution

  • using separate column would be better at the point of normalization also if you need only name or age than it would be better you dont need to fetch all