Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2204

slow select in (...) (springdata jpa in mysql )

$
0
0

I have a table "A", "A" has a Column AreaId, When I select * from "A", I wanna show results where AreaId in my account.Other, I hava a table "B",it means I hava some AreaIds, It possible thousands or hundreds.So, When I select from A , I will select * from A where areaId in (1,2,3,4,5,6,7.....1000),it is too slowHow can I solve this, Thank you

Now I use in(.....) and redis, but it too slow


public class UserArea    @Id    @GeneratedValue(strategy = GenerationType.IDENTITY)    @Column(name = "id")    private Integer id;    @Column(name = "userId")    private Integer uid;    @Column(name = "areaId")    private Integer aid;public class PotentialUser implements AbstractBas {    @Id    @GeneratedValue(strategy = GenerationType.IDENTITY)    @Column(name = "id")    private Integer id;    @Column(name = "areaId")    protected Integer aid;}

this is my A and B Table , one user possible hava 1000+ areas


Viewing all articles
Browse latest Browse all 2204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>