目前是这样的需求,就是类似日志的功能,每天一条记录,但是不同类型的对象都有一条记录。
比如
id type content date
1 1 success 20130705
2 2 success 20130705
3 1 success 20130706
4 2 failed 20130706
5 1 success 20130707
id type content year month day
1 1 success 2013 7 5
2 2 success 2013 7 5
3 1 success 2013 7 6
4 2 failed 2013 7 6
5 1 success 2013 7 7这两种方式:1.那种查询效率比较高?经常查询type等于某个值在某个时间段的值
(我经常做的查询就是 SELECT * FROM table_name WHERE tpye='1' AND date>'201307'这样的)
2.哪种比较省空间?
最佳答案