1

This question is performance related. I'm working on a project where I have a lot of tables with very few columns but multiple rows for one object.

For example a table "person_data" where I only have the columns "personID", "field" and "value". For one person I have 20 records like someID, "name", "someName" ; someID, "surname", "someSurName", etc ...

When reading or writing data we always write or read ALL values for 1 person. From a performance point of view would it be better to have just 20 columns in the table "name", "surname", etc ...

Thanks for your advice.

1 Answers1

0

If attributes number for some object isn't chenging frequently you should store that attributes in same table. Selecting data from one table is faster than from many tables at same time using joins and foreign keys.

piotrekkr
  • 2,785
  • 2
  • 21
  • 35