[jbosstools-dev] RE: JBIDE-2173 & JBIDE-2162 - performance improvement (for MySQL?)

Vitali Yemialyanchyk vyemialyanchyk at exadel.com
Wed Jul 23 12:41:41 EDT 2008


Max, hi.

I was on vacations. 

>> Did you create a patch for this ? Does all unittests passes ? I assume
alot of logic
>> has to change now that foreignkeys are in "reverse" order ?

Yes I have created patch for this ->
https://jira.jboss.org/jira/browse/JBIDE-2173 -> JBIDE-2173_20080630.zip.
I added some info about process time before and after the patch.
I compare unittests before patch and after - it had the same number of
Runs/Errors/Failures in both cases.
You could check the patch to find possible problems - as I expect it should
work - 
may be it's logic not so smooth - we could discuss it to find better
solution.
I'll compare all unittests once more for better confidence and report you
about all problems.

>> sorry, but I don't see what is obvious in that ?

You could see this changes in JBIDE-2173_20080630.zip ->
org.hibernate.cfg.reveng_patch.txt -> 
>>
-				Table fkTable = dbs.getTable(fkSchema,
fkCatalog, fkTableName);
+				Table fkTable =
dbs.getTable(quote(fkSchema), quote(fkCatalog), quote(fkTableName));
>>
I find this error in some unittest for quotes (when I tested
JBIDE-2173_20080630 patch with unittestes) ->
This is a way to add table into dbs:

Table table = dbs.addTable(quote(getSchemaForModel(schemaName)),
getCatalogForModel(catalogName), quote(tableName));

You see - we add quotes for schema & table (if it's necessary to have quotes
added),
but then we try to get table -> dbs.getTable we have fkSchema without quotes
- and get an error.
In the case without my patch this situation was no reproducible.

>> > I think the better way incorporate quotes process into
DatabaseCollector.
>> Why ?
>> Please explain.

My statement is disputable - " incorporate quotes process into
DatabaseCollector " means 
We can use 

 Table fkTable = dbs.getTable(fkSchema, fkCatalog, fkTableName);
&
 Table table = dbs.addTable(getSchemaForModel(schemaName),
getCatalogForModel(catalogName), tableName);

And forget about quotes outside DatabaseCollector,
But seems we can't easy and beautiful transfer the function quote() from
JDBCReader to DatabaseCollector offsprings.
So statement is just disputable.

Vitali


-----Original Message-----
From: Max Rydahl Andersen [mailto:max.andersen at redhat.com] 
Sent: Monday, July 14, 2008 11:39 AM
To: Vitali Yemialyanchyk
Cc: jbosstools-dev at lists.jboss.org
Subject: Re: JBIDE-2173 & JBIDE-2162 - performance improvement (for MySQL?)

Hi Vitali,

> "I try debug DatabaseMetaData code and seems I find the reason. The main
> problem here - for each table extracted all foreing keys for all tables:"
>
> This is of course JBIDE-2173 and it seems here are the problems only with
> MySQL - I have check Postrgre and got better performance (Postrgre has no
> problems with performance).

ok.

> Also I try to study the problem to find common workaround for it - and
seems
> it exist!
>
> Now to get foreing keys we are using
>
> getMetaDataDialect().getExportedKeys
>
> but it possible to use
>
> getMetaDataDialect().getImportedKeys
>
> and we will get much better performance - I have check it - it possible
and
> we will get performance O(n) instead of O(n^2) for MySQL.
>
> Seems this have a sense, isn't it?

Did you create a patch for this ? Does all unittests passes ? I assume alot
of logic
has to change now that foreignkeys are in "reverse" order ?

> About JDBCReader - when I try to modify it I saw some potential problem
here
> -
>
> This is code to add table into dbs:
>
> Table table = dbs.addTable(quote(getSchemaForModel(schemaName)),
> getCatalogForModel(catalogName), quote(tableName));
>
> This is code to get table from dbs:
>
> dbs.getTable(schemaName, catalogName, tableName)
>
> obvious that here will be a problem with quotes.

sorry, but I don't see what is obvious in that ?

> I think the better way incorporate quotes process into DatabaseCollector.

Why ?

Please explain.

-max




More information about the jbosstools-dev mailing list