Using SQL hint to Force Index using querydsl

瀏覽次數:248 次
跳到第一則未讀訊息

Vijay Makhija

未讀,
2016年10月13日 凌晨3:12:252016/10/13
收件者:Querydsl
Hi,

We are using querydsl with JPA in our application. Below is how my repository implementation:

public interface TestRepository  extends JpaRepository<Test, Long>, QueryDslPredicateExecutor<Test> {   }

I am calling default findAll method using predicate builder and pageable object:

testRepository.findAll(booleanBuilder.getValue(), pageable);


In order to address performance issues, we need to force index on the specific tables. Right now derivative query looks as below:

SELECT tab1_.id AS id_20_, tab1_.user_type AS user_type2_20_ FROM table1 tab1_

And we want our query to look as this:

SELECT /*+ INDEX(tab1_ MGS_KG1) */ tab1_.id AS id_20_, tab1_.user_type AS user_type2_20_ FROM table1 tab1_


How can I achieve the same? (we are using querydsl-jpa 3.6.7)

Thanks!
回覆所有人
回覆作者
轉寄
0 則新訊息