-->
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.  [ 11 posts ] 
Author Message
 Post subject: What is Oracle ANALYZE command used for during db import?
PostPosted: Thu Jul 06, 2006 10:42 am 
Beginner
Beginner

Joined: Mon Jan 23, 2006 12:01 pm
Posts: 46
Hi,

It looks like Hibernate is calling ANALYZE command on Oracle db (through Oracle jdbc drivers) to get some kind of table info during db schema import. Does anyone know what kind of information (as reflected in hbm mapping files) is being brought back from db by this command?
Currently my hbm files contain all columns and correct types, composite ids are also created properly, I just can't see sequence names for primary keys (all keys are declared as 'assigned'). Is that what ANALYZE command is used for? Is there some other data it brings back?

Any help on this subject would be appreciated. Thanks,

Bratek


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 06, 2006 10:19 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Oracle's analyze command rebuilds the statistics on the tables. This is required by the Cost based analyser to help query performance (index choices) when significant changes have occured to you database (both tables and data).


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 07, 2006 3:18 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
...and we are not doing that - the jdbc driver is doing that when I ask for indexinfo to detect the unique ones.

Note, that I actually tell them to just approximate (instead of being strict) about the index numbers but for some reason some drivers think it should call analyze resulting in huge performance impact.

So how do we solve it ? We (as in someone ;) implement a custom OracleMetaDataDialect that will do it in a more optimized fashion!

Let me know if someone is fresh to implement that and i'll point you in the right direction.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 09, 2006 8:36 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Send me a note about it. It sounds like I should be able to fit it in. If someelse wants to do it I will step aside.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 10, 2006 2:12 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Heya David,

Don't step aside ;)

ok, so what needs to be done is to create a impl of MetaDataDialect.
Currently we "only" have a JDBCMetaDataDialect which uses the standard JDBC API to do its thing.

MetaDataDialect is very simplified wrapper upon the jdbc metadialect
but it does not need *all* information in the spec to be usefull.

See http://www.hibernate.org/hib_docs/tools ... e/#d0e1565 which describes (shortly) how to register your custom metadatadialect.

The idea with oracle is to write optimized versions of the introspection queries the drivers needs to do. Apparently the getIndexInfo is the heaviest, but i also expect getExportedKeys to be heavy.

It should be possible to simply extend the default one and only implement those two methods; not requiring you to do all the things.

Let me know if that is enough to get you started (and do remember that you don't need to run/develop this in eclipse; just use the hibernate tools core unit tests setup to verify the inner workings.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 10, 2006 7:52 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
OK - Not stepping aside. I have enough information so I will get onto it.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 18, 2006 8:01 am 
Newbie

Joined: Tue Jul 18, 2006 7:59 am
Posts: 2
Location: Hannover, Germany
Hi,

"analyze table" is depricated. Oracle recommends to use the pl/sql package dbms_stats instead, and not to mix these methods. We use dbms_stats. Is there a way to turn off the analyze table?

Andreas


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 18, 2006 10:28 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
as said here and many times before ;) ...it is the *driver* that is doing this not us.

Three solutions
1) write a specialized oraclemetadatadialect (david said he would look into this)

2) get a driver that doesn't do it (I don't know which ones that does and which ones that don't; so if anyone knows please speak up)

3) ask Oracle support.

Feel free to provide feedback for any of the 3 possibilities you choose to do.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 19, 2006 3:53 am 
Newbie

Joined: Tue Jul 18, 2006 7:59 am
Posts: 2
Location: Hannover, Germany
Hi,

that is strange. We have several application servers, but only one uses hibernate (version 2). And the "analyze table" happens only in this application server and only on the tables managed by hibernate (there are a lot of other tables in this database).

(Sorry for babbling about hibernate - I'm database adminstrator, not a programmer ;-))

Andreas


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 19, 2006 4:00 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Could it be because your other apps does not call the same metadata calls on the driver ?

Hibernate core *does* not do this btw., the only parts that could/will do this is:

1) schemaupdate - which never should be used in production anyhow!

2) hibernate tools - which is not used at "runtime" so again not hibernate.

Again, please go back to your programmers and tell them to fix the driver ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 19, 2006 4:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
(of course there could be some weird bug here, but I seriously doubt it!)

I would in any case look into *what* is calling that analyze table ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 11 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.