我正在使用具有以下简单结构的 MySql 表:
ID_A : 整数 8
ID_B:整数 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?映射减少数据库?
谢谢你的帮助