Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Archana S
Custom SQL vs Dynamic SQL: is there any performance differences?
March 6, 2013 3:34 AM
Answer

Archana S

Rank: Junior Member

Posts: 45

Join Date: January 30, 2013

Recent Posts

Hi Everyone,

Just wondering: is there any significant performance difference between Custom SQL and Dynamic SQL?

Let's assume the following scenario:
- the target database is an MySQL
- the adapter will be called by a real time interface;
- the interface will be called by multiple clients concurrently - let's stick with 10 at a given moment;
- the interface needs to query the database to check if the value is valid, and return the result.

Given the following SQL (Custom SQL):

select colA, colB
from aSchema.aTable
where colA = ?
and colB = ?

and (Dynamic SQL):

select colA, colB
from ${schema}.aTable
where colA = ${paramA}
and colB = ${paramB}

and a third case (Dynamic SQL):

select colA, colB
from ${schema}.aTable
where colA = ?
and colB = ?


Analyzing just only the JDBC adapter service portion: is there any significant performance difference between Custom SQL and Dynamic SQL?
David H Nebinger
RE: Custom SQL vs Dynamic SQL: is there any performance differences?
March 6, 2013 5:37 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 13108

Join Date: September 1, 2006

Recent Posts

This is not a Liferay question. It is more appropriate to post to the MySQL forums instead.
Hitoshi Ozawa
RE: Custom SQL vs Dynamic SQL: is there any performance differences?
March 6, 2013 3:51 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

I think what you really want to know is about caching.
Dynamic SQL is just dynamic sql in hibernate.