opearce wrote:
Before I did anything to work around this, I'd want to be really sure that this is causing a performance problem.
It definitely causes a performance problem. The database parses the SQL text and comes up with a hash value to see if that SQL has been submitted previously and if the access plan is still stored in memory. If not, then the database must recreate the access plan, which takes time and also uses more memory for the SQL cached plan (because there are now more SQL statements that are unique).
I reported a similar problem on DB2 in this thread:
http://forum.hibernate.org/viewtopic.php?t=991914
In our case, each application server creates its own column alias, so if I have 50 application servers, then I need 50 times as much memory to store the same number of cached SQL access plans (or for a given amount of memory, I will have fewer cache hits and the SQL access plan will need to determined by the database all over again).
We need Hibernate to generate the same alias on each application server, or not even use a column alias (is that an option?).