Skip to content

Commit

Permalink
optimize in-expressions for single values
Browse files Browse the repository at this point in the history
  • Loading branch information
jyrimatti committed Feb 4, 2015
1 parent f4d1b72 commit cf76da8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/fi/solita/utils/query/QueryUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,11 @@ public static <E> CriteriaQuery<E> applyOrder(CriteriaQuery<E> query, final Sele

public static final Predicate inExpr(CriteriaQuery<?> q, Expression<?> path, Iterable<?> values, CriteriaBuilder cb) {
List<?> vals = newList(values);
if (vals.size() == 1) {
return cb.equal(path, head(values));
}
// keep default in-expressions for small sets since oracle performs waaaaaaay better...
if (vals.size() > 5 && Table.isSupported(vals)) {
else if (vals.size() > 5 && Table.isSupported(vals)) {
Subquery<Long> tableselect = q.subquery(Long.class);
Root<Table> root = tableselect.from(Table.class);
tableselect.select(cb.function("dynamic_sampling", Long.class));
Expand Down

0 comments on commit cf76da8

Please sign in to comment.