Which of the following HQL queries is faster to compute, i.e., more efficient?
from Cat as cat
left join cat.kittens as kitten
with kitten.bodyWeight > 10.0
or
from Cat as cat
left join cat.kittens as kitten
where
kitten.bodyWeight > 10.0
Which of the following HQL queries is faster to compute, i.e., more efficient?
from Cat as cat
left join cat.kittens as kitten
with kitten.bodyWeight > 10.0
or
from Cat as cat
left join cat.kittens as kitten
where
kitten.bodyWeight > 10.0
Performance of HQL queries depend on the underlying database. HQL is translated to SQL by hibernate. SQL is translated to an execution plan and optimized by the DBMS. Optimization and performance depends also on the data in your database.
Take a look at the generated SQL and analyze it. You may take a look at the execution plan generated by the DBMS. This is all independent from hibernate.
Your queries can't be compared, they do not produce the same results. Generally, left outer joins are slower than inner joins.