【发布时间】:2012-06-23 09:50:04
【问题描述】:
我有一个数据透视表,当然每一行都会包含在查询中:
mysql> select * from blog_posts as bp
join blog_joins as bj
on bj.post_id=1
and bj.taxonomy_id=10
and bj.type = 1;
这是我的表结构:
是否建议为每一列建立索引?如果不是,为什么以及您会推荐什么?
mysql > alter table blog_joins add index pid (post_id);
mysql > alter table blog_joins add index tid (taxonomy_id);
mysql > alter table blog_joins add index tp (type);
【问题讨论】:
-
预计有多少种类型?最多 10 个 - 或更多?