|
|
1
1
Daniel's solution is likely to be the cleanest solution, but I get your point about performance. I'm not very familiar with PHP, but there should be some db abstraction library that takes care relations and multiple inserts so that you get the best performance, right? I only mention it because there may not be a real performance issue. DO you have load tests that point to an issue perhaps? Anyway, if it is between your original 2 solutions, I would have to select the first. Having a table with column names (like your solution #2) is just asking for trouble. If you add new params, you have to modify the table columns. And there is the ever present issue of " 我们用什么来表示未选中vs左空? “ 所以我不同意解决方案2更干净。 |
|
|
2
1
您可以有一个由三列组成的表:
如果你愿意,你也可以
|
|
|
3
1
Well that's completely dependent on what you want to do with the data. For the PHP part, you need to process it anyway, either on insertion or selection time. For really large number of parameters you may save some time with the 1st on the database management/maintenance, since you don't need to change anything about your database scheme. Daniel's answer is a generic solution, but if you consider performance an issue, you may end up doing too many inserts on the database side for a single search (one for each parameter). Too many inserts is a common source of performance problems. 你知道你的资源。 |
|
|
Bard.Mus · 迁移后的数据库字符集环境 1 年前 |
|
Efannnnnn · 将Id数据存储到任何页面 1 年前 |
|
|
yooooo · 用于在块中删除的存储过程-LOOP未执行 1 年前 |
|
John Beasley · 更新一定数量记录的连续日期 1 年前 |
|
|
ColinM · MySQL以前的结果查询返回不正确的值 1 年前 |
|
Sergey_Z · MySQL只需无条件连接2个表和交叉连接 1 年前 |