HOBALL 筆記簿

July 15, 2009

MySQL Database 設計

Filed under: SQL — Tags: , , — hoball @ 10:54 pm

1月時我在HKEPC的發問得到回應,現記錄如下:

無忌 發表於 2009-1-13 17:38

– 唔好放D同個table本身無關既野, column應該盡可能少
– 將兩個相關table既primary key放在另一個table, 唔好因為唔想咁多table而將好多Id放入同一個table之中, 咁會破壞大家既relationship, 增加存取時既難度, 通常兩三個已足夠.
– 唔好因為速度而放棄架構. 速度可以用唔同方法改善.

最基本設計例如:

Entries
——–
entry_id
title
content

Domains
——–
domain_id
url

DomainsEntries
—————
domain_id
(many) entry_id

如果怕Entries table變得大, 你可以用hashtable將佢既分成多個.

不過有樣野要講你知….我Database差D肥佬, 亦無database相關工作經驗, 意見只作參考😉

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: