Hibernate HQL vs. SOLoist OQL

It is well known that Hibernate HQL may perform poorly in case of very complex object queries over a number of classes in a class hierarchy and for large databases. SOLoist OQL outperforms it and scales much better with the complexity of object queries and especially with the size of the database.

The point is in the complexity of SQL queries produced by HQL that can literally kill the database. See why:

We have made a very comprehensive benchmarking experiment and compared the two. In summary, the conclusions are the following.

In most cases, SOLoist OQL produces SQL queries with several times fewer joins than Hibernate HQL. In very rare cases of simple queries, the numbers of joins are comparable, while SOLoist is never worse than Hibernate. The more complex the queries, the bigger the difference in favor of SOLoist. For example:

In almost all cases, SOLoist OQL outperforms Hibernate HQL from a few times to a few orders of magnitude. It scales better with the complexity of the object query, especially for large databases. In very rare cases of simple queries, the performance is comparable, while SOLoist is never worse than Hibernate. The more complex the queries, the bigger the difference in SOLoist‘s favor. For example:

SOLoist OQL scales better than Hibernate HQL with the size of the database, for all kinds of queries. The more complex the queries, the bigger the difference in SOLoist‘s favor. For example:

See the detailed report.

Online analytical processing - OLAP

We gave only a small subset of many possible views of the results. If you want to see the same results from a different perspective you can slice our OLAP cube using Mondrian here.

Downloads

Queries - HQL and OQL alongside SQL translations.

Raw Results - Results for all executions of all queries are available.

1K Objects, 10K Objects, 100K Objects, 1M Objects, 10M Objects - Database dump (csv files). 10 million objects archive is quite large, just below 1GB.

Interactive Charts (Excel)

SQLLoader Control Files for Oracle Database

Benchmark Source Code

Additional information