关于oralce大批量查询语句速度慢,IO占用高的问题
今天项目中遇到一条sql语句,其中t_userdownreslog表数据4千万条,t_userinfo 数据2千万条.
修改前
select t.user_account username, t.mobile usermobile, t.user_id userid, u.down_type downtype, u.resourceid appid, u.resourcename appname, u.package_id jarid from t_userdownreslog u,t_userinfo t where u.transaction_id = '10111902201098785862' and t.user_id = u.user_id and u.down_status=2 and u.tran_type=2;
修改后
select /*+FIRST_ROWS*/ t.user_account username, t.mobile usermobile, t.user_id userid, u.down_type downtype, u.resourceid appid, u.resourcename appname, u.package_id jarid from t_userdownreslog u,t_userinfo t where u.transaction_id = '10111902201098785862' and t.user_id = u.user_id and u.down_status=2 and u.tran_type=2;
多了个,/*+FIRST_ROWS*/