0

I have a question regarding the table structure of my settings table. I've taken a look at this question: How should I structure my settings table with mysql? and I see that a lot of CMS systems and forums use this kind of structure for their settings. Selecting settings is very easy then, but how would I update the settings?

Say I have a page with a form with all the settings to change. In the DB, each setting is on an individual row , so if I have 40 settings I would need 40 update queries? If I would use the first approach (all settings in one row) I would only need 1 update query.

Is there something I'm missing here?

Thanks!

Community
  • 1
  • 1
EsTeGe
  • 2,613
  • 5
  • 26
  • 41

1 Answers1

1

You would need 40 updates, but in reality this is not a problem. How often do people change settings? It's not a high-transactional-rate operation, so it doesn't matter. You can even check in your code if a value has changed and only update if it has, if you really care.

What it comes down to is not whether you want one update or 40, but if you want strongly-typed values in pre-defined columns, or a (possibly) more flexible approach of one-row-per-value.

Cylindric
  • 5,662
  • 3
  • 38
  • 67