In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Batch deletion of mybatis multi-parameter efficiency example analysis, I believe that many inexperienced people do not know what to do, so this paper summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
Recently, I have encountered the problem of deleting table data in batches and based on multiple parameters. In my case, I have a special parameter that is the same value, but I still use it as a general case. An experimental test has been done.
The code test is as follows:
Map param = new HashMap (); param.put ("userId", userId); List listJobIds = sysUserJobdel.stream (). Map (SysUserJob::getJobId). Distinct (). Collect (Collectors.toList ()); param.put ("jobIds", listJobIds); for (int I = 0; I < 10000; iTunes +) {SysUserJob userJob = new SysUserJob (); userJob.setJobId (String.valueOf (SystemUtils.nextId (); userJob.setUserId (userId); sysUserJobdel.add (userJob) ListJobIds.add (String.valueOf (SystemUtils.nextId ();} param.put ("jobIds", listJobIds); long begintime1 = System.currentTimeMillis (); sysUserMapper.deleteUserJobs (param); long endtime1 = System.currentTimeMillis (); long costTime1= (endtime1-begintime1); System.err.println ("costTime1====" + costTime1); long begintime2 = System.currentTimeMillis (); sysUserMapper.deleteUserJob (sysUserJobdel); long endtime2 = System.currentTimeMillis (); long costTime2= (endtime2-begintime2); System.err.println ("costTime2====" + costTime2) Long begintime3 = System.currentTimeMillis (); sysUserMapper.deletesUsersJobs (sysUserJobdel); long endtime3 = System.currentTimeMillis (); long costTime3= (endtime3-begintime3); System.err.println ("costTime3====" + costTime3) Delete from sys_user_job where user_id = # {userId} and job_id in# {item} delete from sys_user_job where (user_id = # {item.userId} and job_id= # {item.jobId}) delete from sys_user_job where (user_id,job_id) in (# {item.userId}, # {item.jobId})
Three result outputs:
CostTime1====173
CostTime2====1673
CostTime3====414
CostTime1====115
CostTime2====1523
CostTime3====391
CostTime1====105
CostTime2====1501
CostTime3====417
After reading the above, have you mastered the method of batch deletion of mybatis multi-parameter efficiency case analysis? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.