SqlSession SqlSession=mySqlSessionFactory (.) openSession ();
.//the statement for the mapper XML only a select node id
//¶s is introduced into the map data in SQL object
List
Eventually executed SQL very simple
select * from sys_user su where su. Usrid='sa'
So every time after receipt of the HTTP request execution will create a sqlsession, but each time all around 400 ms, sometimes even longer, the same statements in PLSQL performed only need less than 100 milliseconds,
If you use ServiceImpl
question 1: how to use the sqlSession selectList when can query speed and PLSQL performance consistent?
Tried to cache a sqlsession, do speed, but mybatis clearly don't put the sqlsession in static in the official document scope, must be a HTTP request to create a sqlsession, so this method is not feasible,
problem two: this kind of writing mybatis mapper mapping relationship is how to optimize the sqlsession?
CodePudding user response:
Sys_user table according to the total amount is not big, only about tenCodePudding user response:
Do you want with the code to see what kind of actuators, it is simple or reuse. The amount of data is too small, you is not good, had better have a millions of data