2013-01-08 28 views
-1

問題是如何構建一個巨大的MySQL數據庫與例如10.000配置文件。如何構建一個龐大的MySQL數據庫與多個配置文件

例1

1數據庫

3數據庫字段(field_profile,field_images,field_posts等)

field_profile 10.000型材具有id和的信息的其餘部分。

field_images 150.000與database_profile中的id相關的圖像。

field_images 350.000與database_profile中的id相關的帖子。

緩慢的搜索,但當我想改變一件非常簡單的事情。

例2

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配置文件與信息。

field_images_profile1 50

field_posts_profile1 3500

快速搜索,但當我想改變一些真正困難的事情?!

哪個例子最好還是有更好的選擇?

+4

難道是這樣,而不是「場」你的意思是「表」?否則它沒有多大意義。但是,例2在這兩種情況下都沒有多大意義。而你提供的號碼不是「巨大的」;) – KingCrunch

+0

對不起,我的意思是一張桌子!也許在未來,這些數字是數以萬計的,所以我必須知道這一點。 –

+0

10k行不是很多,索引你的密鑰,你應該很好 –

回答

1

我會去的正常化,根據你的記錄數量甚至沒有接近巨大的:

[table_profile] 
profile_id 

[table_image] 
image_id 
profile_id 

[table_post] 
post_id 
profile_id 
+0

謝謝你的迴應。 –

0

您應該簡單地拿出表,如果場分佈和場圖像是相同的不同崗位然後

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的任何需要的時候,它會降低你的數據存儲和提高數據庫訪問速度。

相關問題