You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by ol...@ppi.de on 2003/11/04 11:06:08 UTC
RE: Simple performance improvement Re: m:n relations mapping...
Hello Andy,
I will have a look at it when I have time.
Please post messages like this to the OJB
users' or developers' list.
Thank you,
Olli
-----Original Message-----
From: Andy Malakov [mailto:andy@transdecisions.com]
Sent: Friday, October 31, 2003 9:57 PM
To: oliver.matz@ppi.de
Subject: Re: Simple performance improvement Re: m:n relations mapping...
Excellent.
Now how about going one step further and eliminating extra SELECT ? :-)))
We do not need to retrieve link table entries in case of new objects.
Class: org.apache.ojb.broker.core.PersistenceBrokerImpl:
Method: storeCollections(Object obj, Vector vecCds, boolean insert)
Line: 789
Now:
...
if (cds.isMtoNRelation())
{
currentMtoNKeys = getMtoNImplementor(cds, obj);
// delete unused m:n implementors
if (!insert)
{
deleteMtoNImplementor(cds, obj, (Collection)col, currentMtoNKeys);
}
}
Better:
...
if (cds.isMtoNRelation())
{
if (insert) {
currentMtoNKeys = java.util.Collections.EMPTY_LIST; // assume no
link table entries exist for new objects
} else {
currentMtoNKeys = getMtoNImplementor(cds, obj);
// delete unused m:n implementors
deleteMtoNImplementor (cds, obj, (Collection) col,
currentMtoNKeys);
}
}
....
I tested it with P6SPY - the above fix makes extra SELECTs disappear.
This two fixes make batch inserts of complex object work faster :-)
Thanks a lot for you product,
Andy
----- Original Message -----
From: <ol...@ppi.de>
To: <oj...@db.apache.org>
Sent: Friday, October 31, 2003 4:41 AM
Subject: RE: Simple performance improvement Re: m:n relations mapping...
> Hello,
>
> > -----Original Message-----
> > From: oliver.matz@ppi.de [mailto:oliver.matz@ppi.de]
> >
> > I am uncertain whether we should fix it because it does
> > mean a (very minor) change of behaviour. I tend to 'yes'.
>
> I have just committed a fix.
>
> Olli
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Simple performance improvement Re: m:n relations mapping...
Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi andy, oliver,
the patch is checked in.
olli please have a look at the method _storeCollections_ when time
permits, i think it needs refactoring.
jakob
Andy Malakov wrote:
> Thanks.
>
> In my case eliminating extra SELECT and DELETE for MtoNImplementor (as described below) made batch inserts 5 times faster.
>
>
> ----- Original Message -----
> From: <ol...@ppi.de>
> To: <an...@transdecisions.com>; <oj...@db.apache.org>
> Sent: Tuesday, November 04, 2003 5:06 AM
> Subject: RE: Simple performance improvement Re: m:n relations mapping...
>
>
>
>>Hello Andy,
>>
>>I will have a look at it when I have time.
>>
>>Please post messages like this to the OJB
>>users' or developers' list.
>>
>>Thank you,
>>Olli
>>
>> -----Original Message-----
>>From: Andy Malakov [mailto:andy@transdecisions.com]
>>Sent: Friday, October 31, 2003 9:57 PM
>>To: oliver.matz@ppi.de
>>Subject: Re: Simple performance improvement Re: m:n relations mapping...
>>
>>
>>Excellent.
>>
>>Now how about going one step further and eliminating extra SELECT ? :-)))
>>
>>We do not need to retrieve link table entries in case of new objects.
>>
>>Class: org.apache.ojb.broker.core.PersistenceBrokerImpl:
>>Method: storeCollections(Object obj, Vector vecCds, boolean insert)
>>Line: 789
>>
>>Now:
>>...
>>if (cds.isMtoNRelation())
>>{
>> currentMtoNKeys = getMtoNImplementor(cds, obj);
>> // delete unused m:n implementors
>> if (!insert)
>> {
>> deleteMtoNImplementor(cds, obj, (Collection)col, currentMtoNKeys);
>> }
>>}
>>
>>Better:
>>
>>...
>>if (cds.isMtoNRelation())
>>{
>> if (insert) {
>> currentMtoNKeys = java.util.Collections.EMPTY_LIST; // assume no
>>link table entries exist for new objects
>> } else {
>> currentMtoNKeys = getMtoNImplementor(cds, obj);
>> // delete unused m:n implementors
>> deleteMtoNImplementor (cds, obj, (Collection) col,
>>currentMtoNKeys);
>> }
>>}
>>....
>>
>>
>>I tested it with P6SPY - the above fix makes extra SELECTs disappear.
>>This two fixes make batch inserts of complex object work faster :-)
>>
>>Thanks a lot for you product,
>>Andy
>>
>>
>>
>>
>>
>>----- Original Message -----
>>From: <ol...@ppi.de>
>>To: <oj...@db.apache.org>
>>Sent: Friday, October 31, 2003 4:41 AM
>>Subject: RE: Simple performance improvement Re: m:n relations mapping...
>>
>>
>>
>>>Hello,
>>>
>>>
>>>>-----Original Message-----
>>>>From: oliver.matz@ppi.de [mailto:oliver.matz@ppi.de]
>>>>
>>>>I am uncertain whether we should fix it because it does
>>>>mean a (very minor) change of behaviour. I tend to 'yes'.
>>>
>>>I have just committed a fix.
>>>
>>>Olli
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Simple performance improvement Re: m:n relations mapping...
Posted by Andy Malakov <an...@transdecisions.com>.
Thanks.
In my case eliminating extra SELECT and DELETE for MtoNImplementor (as described below) made batch inserts 5 times faster.
----- Original Message -----
From: <ol...@ppi.de>
To: <an...@transdecisions.com>; <oj...@db.apache.org>
Sent: Tuesday, November 04, 2003 5:06 AM
Subject: RE: Simple performance improvement Re: m:n relations mapping...
> Hello Andy,
>
> I will have a look at it when I have time.
>
> Please post messages like this to the OJB
> users' or developers' list.
>
> Thank you,
> Olli
>
> -----Original Message-----
> From: Andy Malakov [mailto:andy@transdecisions.com]
> Sent: Friday, October 31, 2003 9:57 PM
> To: oliver.matz@ppi.de
> Subject: Re: Simple performance improvement Re: m:n relations mapping...
>
>
> Excellent.
>
> Now how about going one step further and eliminating extra SELECT ? :-)))
>
> We do not need to retrieve link table entries in case of new objects.
>
> Class: org.apache.ojb.broker.core.PersistenceBrokerImpl:
> Method: storeCollections(Object obj, Vector vecCds, boolean insert)
> Line: 789
>
> Now:
> ...
> if (cds.isMtoNRelation())
> {
> currentMtoNKeys = getMtoNImplementor(cds, obj);
> // delete unused m:n implementors
> if (!insert)
> {
> deleteMtoNImplementor(cds, obj, (Collection)col, currentMtoNKeys);
> }
> }
>
> Better:
>
> ...
> if (cds.isMtoNRelation())
> {
> if (insert) {
> currentMtoNKeys = java.util.Collections.EMPTY_LIST; // assume no
> link table entries exist for new objects
> } else {
> currentMtoNKeys = getMtoNImplementor(cds, obj);
> // delete unused m:n implementors
> deleteMtoNImplementor (cds, obj, (Collection) col,
> currentMtoNKeys);
> }
> }
> ....
>
>
> I tested it with P6SPY - the above fix makes extra SELECTs disappear.
> This two fixes make batch inserts of complex object work faster :-)
>
> Thanks a lot for you product,
> Andy
>
>
>
>
>
> ----- Original Message -----
> From: <ol...@ppi.de>
> To: <oj...@db.apache.org>
> Sent: Friday, October 31, 2003 4:41 AM
> Subject: RE: Simple performance improvement Re: m:n relations mapping...
>
>
> > Hello,
> >
> > > -----Original Message-----
> > > From: oliver.matz@ppi.de [mailto:oliver.matz@ppi.de]
> > >
> > > I am uncertain whether we should fix it because it does
> > > mean a (very minor) change of behaviour. I tend to 'yes'.
> >
> > I have just committed a fix.
> >
> > Olli
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org