关于hql语句中的not in和not exists

MJaney 2013-08-15 02:05:03
原sql语句为:v_user中的数据有6万多条
select * from v_user where usertype not in (1,2,3);
编写hql
from VUser where usertype not in (1,2,3); ————数据只有9条
结果在数据库里查询很快,但是在程序里执行很慢,前台页面卡死,相反若果是
from VUser where usertype in (1,2,3);————数据有3万多条
结果查询速度就很快,前台页面也不卡。
所以我采取用not exists查询方式
hql语句为
select t1 from VUser where not exists (select t2 from VUser where t2.usertype in (1,2,3));
结果前台页面还是卡死,请问哪位高手有其他的解决办法吗?
...全文
453 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

17,086

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧