spring+hibernate3查询速度

系统 struts + spring + hibernate3,数据库mysql5.0

机器2G内存,cpu双核(具体的没见)

表结构:
[code="sql"]received_message(//接受短信表
id int not null autoincrement,
action varchar(255),
....
game_code_int bigint,//代表游戏
party_code_int bigint,//代表渠道
status_int bigint,//表示计费成功状态
rece_date datetime,//接受时间
money float default 0//短信价格
)

party(//渠道商的表
id int not null auto_increment,
....
party_code_int bigint,//和上面的party_code_int一样
)

game(//游戏所对应
id int not null auto_increment,
....
game_code_int bigint,//和上面的game_code_int对应
)[/code]

现在received_message表里面有30多万条数据
查询变的很慢,有的时候要等1分钟,甚至更长

BOSS要求在查询时候必须是即时信息,所以我自己也没有办法去缓存received_message表里面的数据
查询的时候经常出现select count(party_code_int),sum(money) from received_message where party_code_int=?
或者select count(game_code_int),sum(money) from received_message where game_code_int=? and rece_date > ?
这样类似的查询语句

具体还需要什么办法,请帮忙解答下,我现在很郁闷,小弟是java刚刚入门!

JDBC 直连查询,30W条数据 不算多,不应该1分多种,建议增加索引,看你这条语句 慢也就慢在count sum 上,这个没办法了。

对数据库做优化,对game_code_int和rece_date做联合索引.尽量对where后条件字段设置索引。