Reputation: 2581
I'm currently working on project which uses queryDsl, jpa and hibernate with mysql as database. One of the generated queries took 625 seconds to execute. Since i do not have the freedom to change the indexes on the table itself but i can use force index on the actual query, which drops the query time to 0.62 seconds during testing, how do i do it in QueryDSL?
Upvotes: 4
Views: 3585
Reputation: 22200
You can't use force index directly in Querydsl JPA, since such syntax is not supported. It is possible to customize the Hibernate SQL rendering, but it is not trivial http://www.znetdevelopment.com/blogs/2009/10/07/using-use-index-with-hibernatemysql/
I'd recommend to use SQL in this case. You can use SQL with Querydsl JPA using JPASQLQuery
and HibernateSQLQuery
.
Upvotes: 1