dtt3399 2015-08-29 14:44
浏览 44
已采纳

很多小的个体参数或一个大的参数

I want to create a table where each entry, aside from other things, stores lots (30~) of different numerical values. These values can, in theory, be grouped into one big string parameter. With performance in mind, what is better? I will need to be able to make queries that can access each numerical value individually, but not necessarily in pure SQL: if I go for one big parameter, I will need to use php to parse out what I need.

  • 写回答

1条回答 默认 最新

  • douguanya4248 2015-08-29 14:49
    关注

    The question of how to store such data depends basically on how it is being used.

    If there is ever the remotest possibility that you will be using the database to access a single parameter value, then store the values in separate columns. This would occur in many situations, such as:

    • You select the value.
    • You want to filter on a particular value.
    • You want to join to another table on the value.
    • You want to count the number of values in a row.
    • You want to order by the value.

    If the "numbers" are really just a big blob that are used by some other process, then storing them as a blob is fine. But, from the database perspective, that is how you should think of them -- a big black box with no internal structure.

    Also note: 30 values in a single row may not be the best storage mechanism. Often, it is best to have a table with one value per row.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 这种微信登录授权 谁可以做啊
  • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
  • ¥15 网络设备配置与管理这个该怎么弄
  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来