Best table design for application configuration or application option settings?

后端 未结 12 2528
说谎
说谎 2020-12-25 10:01

I need to store a series of configuration values in a database. A couple ways I thought of to store them are: a table with 2 colums(name,value) and a row for each pair, or

12条回答
  •  执念已碎
    2020-12-25 10:54

    You can save configuration efficiently using XML. Some Database support Pure XML feature in which you can save value as xml data type and you can run XQUERY on that particular column.

    Create a table with two column name and configuration. name with string datatype and configuration with xml data type so no need to worry about insertion and deletion of new configuration parameters, you will just a new tag in xml. And if database does not support XML then just save it as a string but in XML format so you can parse that configuration manually or using some API efficiently.

    I think this would be better way instead of storing complete configuration as a string.

提交回复
热议问题