-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Shadow tables and query tuning
PostPosted: Fri Feb 27, 2004 10:07 am 
Newbie

Joined: Mon Jan 26, 2004 8:01 pm
Posts: 2
We are currently looking at Hibernate and I have a few questions regarding it,

1) How to fine tune the queries which Hibernate generates? Our DBA needs to fine tune the query which hibernate generates for loading saving etc. Is that possible?
2) We have shadow tables for each table for audit purpose, Can somebody suggest a corect procedure to insert into that shadow table when the main table is updated; I was thinking of using interceptors.
Thanks in advace for your help.
Puru


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 10:22 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
What do you mean exactly by "fine tune"? You can within some bounds manipulate the way Hibernate loads objects by using outer-join, lazy, etc.

Why don't you simply use a database trigger for that shadow tables?


Top
 Profile  
 
 Post subject: Shadow tables and query tuning
PostPosted: Fri Feb 27, 2004 3:07 pm 
Newbie

Joined: Mon Jan 26, 2004 8:01 pm
Posts: 2
gloeglm wrote:
What do you mean exactly by "fine tune"? You can within some bounds manipulate the way Hibernate loads objects by using outer-join, lazy, etc.

DBA wants to change the query for efficient retrival/storage. e.g. optimize joins etc

Why don't you simply use a database trigger for that shadow tables?


Shadow table/s has extra information than the actual table/s like the user information etc


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 5:11 pm 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
gloeglm wrote:
What do you mean exactly by "fine tune"?


This kind of tuning is very trivial, SQL query is used in "EXPLAIN PLAN FROR " to eleminate table scans (create index).

It is possible to log dynamic queries in JDBC Driver wrapper and to collect statistics about expensive queries, there is nothing hibernate specific.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 5:21 pm 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
BTW "EXPLAIN" is a good thing for development, I use it to validate query on app startup in debug mode, It can be usefull for named queries in hibernate too.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 6:43 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
I do something very similiar in a custom interceptor.

Take a look at http://hibernate.org/156.html

My Interceptor actually not only coordinates the validation shown there, but also does some pushing of domain events (that code is not shown in the link above). However, it'd be pretty easy to get the code show to populate a shadow table.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.