【发布时间】:2013-10-14 09:00:18
【问题描述】:
我有一个日期维度表,其中包含一个名为 year_month_number 的 char(7) 字段,其索引如下:
ALTER TABLE `dim_date` add INDEX `year_month_number` (`year_month_number` ASC);
其中包含“2013-06”或“2013-07”等数据。
我遇到了性能问题,所以解释一下,
'1', 'SIMPLE', 'effective_date', 'ref', 'PRIMARY,year_month_number', 'year_month_number', '22', 'const', '29', 'Using where'
看起来像key_len = 22,谁能解释为什么它不是7(如this post 中所建议的那样)?我已经尝试删除并重新创建索引,
【问题讨论】:
-
是
VARCHAR(7)还是CHAR(7)?