【发布时间】:2011-10-04 07:00:05
【问题描述】:
-
我正在使用具有以下简单结构的 MySql 表:
ID_A : int 8
ID_B : int 8
主键:ID_A、ID_B 索引:ID_B
这个 MySQL 表包含超过 5 亿行,权重为 20Go。
-
我需要能够执行这类查询:
select *,count(*) as cpt from table group by ID_A order by cpt DESC select *,count(*) as cpt from table group by ID_B order by cpt DESC select * from table where ID_A in (1,2,3,4,5,5) select * from table where ID_B in (1,2,3,4,5,5) select *,count(*) as cpt from table where ID_B in (1,2,3,4,5) group by ID_A order by cpt DESC select *,count(*) as cpt from table where ID_A in (1,2,3,4,5) group by ID_B order by cpt DESC 我试过innodb和MyIsam,但即使配置服务器很大,mysql也无法回答Group By查询。我什至不能从脚本方面做到这一点,因为它会消耗很多内存。
所有数据都无法放入 RAM(今天 20Go,但不久的将来 60Go)。
我们应该使用 NoSql 数据库吗? MongoDB?映射减少数据库?
感谢您的帮助
【问题讨论】: