开发者

System variables in database: One row per variable or one row with pickled dictionary per module?

I am开发者_开发知识库 designing a blog/news website with a number of modules.

These modules need some settings saved in the database. Which of these two options is better:

  1. Each variable gets saved in a single row. When they are needed, the row gets queried.

  2. Variables of a single module get pickled on submitting the settings form (only the user can change these variables, not the system), and saved to a row in the variables table. When needed, the row is queried and the dictionary is unpickled.

I am using MySQL.


I think you want to put one variable per row. This gives you an ability to read the variables in SQL queries/reports. Picking works if you know you never ever need to access the data except from the application but otherwise it will break down quickly.

In LedgerSMB we use one variable per row and are happy with this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜