Database Schema Design

数据库架构

Database <wbr>Schema <wbr>Design

数据字典定义

 

1.数据库开发和设计工具:

MySQL workbench

http://www.mysql.com/products/workbench/

  • install
  • click DataModel

Database <wbr>Schema <wbr>Design

你可以点击add EER diagram创建ER图或者导入ER图

点击AddTable添加table

 

2.用户行为数据库如何构建

  • 分析服务器消息日志
  • 用户行为属性的确定
  • 使用动态建表技术建立数据仓库

解决方案:现在把每条消息进行解析,然后存入数据库作为rawdata,然后对这种数据进行数据挖掘,建立数据仓库

 

3.数据类型

varchar vs char

相同点:

  • InnoDB or MyISAM
  • comparison by padding values with spaces as needed

不同点:

varchar

  • variable-length(UTF-8, variable length)
  • varchar use extra bytes to store the length(1-2 bytes)
  • varchar cause extra work when you update the row
  • preserve any trailing spaces

char

  • fixed-length
  • remove any trailing spaces
  • MD5 for password

Blob vs TEXT(SMALLTEXT)

分别存binary和大字符串

  • sort需设置max_sort_length或者order by substring(column,length)
  • InnoDB external storage area
  • avoid using

Whole number

tinyint(8) smallint(16) mediumint(32) bigint(64)

 

DateTime vs TimeStamp

DateTime

  • 8 bytes text representation

Timestamp

  • 4 bytes number of seconds representation
  • multiple zones access
  • 为了精确到ms,可以再加一个smallint字段timestampms

 

4.密码存储

MD5 char(32)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值