Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9019979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:53:53+00:00 2026-06-16T04:53:53+00:00

I am creating a modular system where each module is separated from others. I

  • 0

I am creating a modular system where each module is separated from others.
I want to store the module configuration data in database, but I don’t know best structure for this.

I have some variants:

1st:

key_____|______value (primary key is `key`)
option1 | 1
option2 | abcd
option3 | bla-bla-bla

I can easy get settings, but if I want to update some settings I’ll need to build hard (?) SQL query with CASE:

UPDATE settings SET value = CASE
WHEN key = option1 THEN 1;
WHEN key = option2 THEN abcd;
…
END
WHERE key IN (option1, option2, …)

If there is a better variant for update many rows in one query (I’ll use MySQLi and InnoDB only) this will be great.

2nd:

module_____|_____settings
news       | a:3:{s:7:"option1";i:1;s:7:"option2";s:4:"abcd";s:7:"option3";s:11:"bla-bla-bla";}

This way, I’ll serialize an array with settings and put it in database. I want to cache unserialized data in .php files.
But if I’ll have large settings array, my serialized string will be very very big.

3rd:

option1 | option2 | option3
   1    |   abcd  |bla-bla-bla

I’ll have one column for one option key, but I think that create one table to store one row is unnecessarily.


Which variant is the best?
Can you suggest your own methods to store configs?
Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T04:53:54+00:00Added an answer on June 16, 2026 at 4:53 am

    If you’re set on storing configuration data in the database, I would always go with option number one.

    It allows you to easily add and update configuration values without affecting too many other pieces of the system. You’re just slightly over thinking the complexity of updating values. Rather than try to wrap everything in a single update, write separate updates for each key:

    update settings set value = 1 where key = option1;
    update settings set value = 'abcd' where key = option2;
    

    Option two might be a close second, but I really hate storing one large string of serialized data in the database. If that’s the way you’re going to go, considering just storing it in a configuration file instead.

    I’ve worked on projects that have used the third option as well and it is by far my least favorite. Having to add/remove columns any time you add/remove a configuration value is a royal pain.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a table to summarize data that is gathered from about 8
After creating a modular structure for a single module would prevent the url appears
Creating a relatively simple data entry form, and just want to separate certain sections
I'm creating a modular desktop application with agile licensing in a database. I have
I'm working on a modular project consisting of multiple sensors, each inheriting from an
Creating a button in Titanium it gets a 100% width from the system if
Just wondering what the opposing framework in Java would be for creating modular GUI
Creating an a app, where I store bunch of photos in the drawable folder,
Creating a google map with store locations within 50 miles of user entered address.
I am creating a modular ASP.NET MVC application using areas. In short, I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.