问题是如何构建一个巨大的mysql数据库,例如10000个配置文件。
例二
1数据库3数据库字段(field_profile, field_images, field_posts等)
field_profile 10.000个配置文件,包含id和其他信息。
field_images与database_profile中id相关的150.000张图片。
field_images 350.000个与database_profile中id相关的帖子
搜索缓慢,但当我想改变一些非常简单的东西。
Example2
1数据库30.000数据库字段(field_profile_profile1, field_images_profile1, field_posts_profile1, field_profile_profile2, field_images_profile2, field_posts_profile2等)
field_profile_profile1 1 profile with information.
field_images_profile1 50
field_posts_profile1 3500
快速搜索,但当我想改变一些真的很难?!
哪个例子是最好的,或者有更好的选择?
我会选择规范化,根据您的记录数量甚至不接近巨大:
[table_profile]
profile_id
[table_image]
image_id
profile_id
[table_post]
post_id
profile_id
如果字段配置文件和字段图像在不同的帖子中是相同的,那么
table profile
field_id field_profile field_image
table post
field_id field_post
第二个选项,如果field_profile, field_image每次都不相同,那么就会出现单个表。
table field
field profile field_image field_post
尝试在不同的表中存储重复的数据,并在需要时使用id,这将减少数据存储并提高数据库访问速度。