当前位置: 移动技术网 > IT编程>数据库>MSSQL > Javaweb开发后台使用sql查询效率问题

Javaweb开发后台使用sql查询效率问题

2018年10月25日  | 移动技术网IT编程  | 我要评论

李秀成简介,人生哲理文章,飞跃死城攻略

javaweb开发后台使用sql查询效率问题。今天在项目中遇到了一个不算是问题的问题 后台查询地区时sql是这样的

string sql="select * from area_info_table where id in ("
+ "select area_id from showroom_info_table where id in("
+ "select showroom_id from release_showroom_table where content_id="+ids
+ ")"
+ ")";

由于地区表数据量较大查询要花费很长时间后来经理把sql优化了一下写成这样子

select t.* from area_info_table t ,showroom_info_table tt,release_showroom_table ttt where t.id=tt.area_id and tt.id =ttt.showroom_id and ttt.content_id="+ids+";

查询效率明显提高了 涨姿势了!!!

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网