Hibernate Vs native Sql execution time (profoling)

I am sharing some profiling data of a story implemented with both HQL and SQL approach.

It takes about 5 seconds for about 2500 records.
There is no sense in displaying more than 1000 records in a single web page, hence this page with current object oriented approach should work within acceptable time limit.
However native Sql will be really good if you are planning to display more than 2500 records in a single page, since its execution time is less.

HQL :
100 – 423 ms(less than second)
200 – 737 ms (less than second)
400 – 892 ms (less than second) – 500 – 1137 ms
700 – 2201 ms
2500 – 5021 ms (about 5 seconds)
3000 – 6347 ms
5000 – 15150 ms

SQL
Records DBTime
100 – 42 ms
200 – 50 ms
400 – 68 ms
500 – 103 ms
700 – 273s
3000 – 372 ms
5000 – 497 ms

Dis-advantage to pick HQL :
Hibernate is a little bit resource extensive. Native sql wins over it here.

Advantages to pick HQL:
Database independent:
less maintainance of query with changes in table structure or object
Easy to modify and change
No DBA is required.
At times more optimized when application has to run on multiple databases.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s