我的数据库是否过度设计? [英] is my database overdesigned?

查看:106
本文介绍了我的数据库是否过度设计?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

确定新数据库设计,
请给我关于这个的建议。



1 何时应该使用组合索引?


我不知道索引是什么,但
i知道我们应该把它当
将被重装载像WHERE
verified = 1和搜索像
company.name = something。我是对的吗?


2 MySQL索引 - 有多少是足够的?



3 数据库规范化


是否正确?


alt text http://i28.tinypic.com/awp2cz.png



谢谢。



编辑*



/ p>



  1. 每个用户(公司成员或所有者)可以是
    公司的成员

  2. 每个公司都有一些用户成员。

  3. 有公司管理员(ceo,管理员),有公司会员
    (插入产品)

  4. 每个公司都可以拥有产品。


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 ?

3 Database Normalization

is it just right?

alt text http://i28.tinypic.com/awp2cz.png

Thanks.

edit*

rules.

  1. each users( company member or owners ) could be a member of a company
  2. each company have some member of users.
  3. there are company admins ( ceo, admins) and there are company members ( inserts the products )
  4. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆