我的数据库是否过度设计? [英] is my database overdesigned?
问题描述
确定新数据库设计,
请给我关于这个的建议。
我不知道索引是什么,但
i知道我们应该把它当
将被重装载像WHERE
verified = 1和搜索像
company.name = something。我是对的吗?
?
3 数据库规范化
是否正确?
alt text http://i28.tinypic.com/awp2cz.png
谢谢。
编辑*
/ p>
- 每个用户(公司成员或所有者)可以是
公司的成员
- 每个公司都有一些用户成员。
- 有公司管理员(ceo,管理员),有公司会员
(插入产品)
- 每个公司都可以拥有产品。
3号我将添加一些users_company
- 1是为admin
- 0是为成员
p>看起来好,规范化,至少对我来说
我注意到每个产品只能属于一家公司。如果这是你想要的那样好,否则你可以有产品有自己的PID,并有一个product_company关系表,这将让多个公司销售一个特定的产品。我确实注意到用户表被称为用户(复数),其他的是单数('公司','产品') ')。这只是一件小事情。
ok im new to database design, please give me advices about this.
1 When should I use a composite index?
im not sure what does index does, but i do know we should put it when it will be heavly loaded like for WHERE verified = 1 and in search like company.name = something. am i right ?
2 MySQL indexes - how many are enough?
is it just enough ?
is it just right?
alt text http://i28.tinypic.com/awp2cz.png
Thanks.
edit*
rules.
- each users( company member or owners ) could be a member of a company
- each company have some member of users.
- there are company admins ( ceo, admins) and there are company members ( inserts the products )
- each company can have products.
for the number 3 i will add a bit at users_company - 1 is for admin - 0 is for members
Looks good, well normalised, to me at least.
I notice that each product can only belong to one company. If that's what you intended that's fine, otherwise you could have product have its own PID and have a product_company relation table, which would let more than one company sell a particular product. Depends who administers the products I guess.
I did notice that the user table is called 'users' (plural) and the others are singular ('company', 'product'). That's only a minor thing though.
这篇关于我的数据库是否过度设计?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!