[CDO] [DB] Optimization [message #486835] |
Sat, 19 September 2009 17:45 |
Simon Mc Duff Messages: 596 Registered: July 2009 |
Senior Member |
|
|
I'm starting to use DB and I found that the following is VERY VERY SLOW
If I'm adding 20000 thousand at the end of a list...I look at the code and it will do the following for each entry.
NonAuditListTableMapping
move1up(accessor, id, index, UNBOUNDED_MOVE);
insertValue(accessor, id, index, value);
move1up is EXTREMELY slow to run....
My Question... when we add at the end of the list... why
move1up(accessor, id, index, UNBOUNDED_MOVE);
need to be executed for ALL elements ???
(I'm using H2)
|
|
|
|
Re: [CDO] [DB] Optimization [message #486874 is a reply to message #486836] |
Sun, 20 September 2009 14:56 |
|
Hi Simon,
That really sounds like something we should optimize. Can you file a
bugzilla against DBStore?
Cheers
/Eike
----
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Simon Mc Duff schrieb:
> I did a test to see if it was really the problem by adding a lookup if
> the previous size in bigger then the new one...
>
> private void move1up(IDBStoreAccessor accessor, CDOID id, int index,
> int upperIndex)
> {
> PreparedStatement stmt = null;
> CDORevision readRevision =
> accessor.getStore().getRepository().getRevisionManager().get
> Revision(id, -1);
> int size = readRevision.data().size(getFeature());
> if (size > index)
> {
> ...NORMAL CODE
> }
> }
>
> and now it is 10000 times faster.
> it need probably to be smarter than that... but still !
> So this is a problem in there !! :)
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO] [DB] Optimization [message #486955 is a reply to message #486836] |
Mon, 21 September 2009 09:51 |
Stefan Winkler Messages: 307 Registered: July 2009 Location: Germany |
Senior Member |
|
|
Hi Simon,
nice one. I was aware of the problem, but I did not know about a way to
get hold of the revision and -- hence -- the size of the list to
implement the condition.
With your way, I can even simplify the whole thing, because if I know
the size of the list, I don't need to make a difference between move1up
w/ or w/o upper bound.
Cheers,
Stefan
Simon Mc Duff schrieb:
> I did a test to see if it was really the problem by adding a lookup if
> the previous size in bigger then the new one...
>
> private void move1up(IDBStoreAccessor accessor, CDOID id, int index,
> int upperIndex)
> {
> PreparedStatement stmt = null;
> CDORevision readRevision =
> accessor.getStore().getRepository().getRevisionManager().get
> Revision(id, -1);
> int size = readRevision.data().size(getFeature());
> if (size > index)
> {
> ...NORMAL CODE
> }
> }
>
> and now it is 10000 times faster.
> it need probably to be smarter than that... but still !
> So this is a problem in there !! :)
>
|
|
|
Re: [CDO] [DB] Optimization [message #486957 is a reply to message #486955] |
Mon, 21 September 2009 10:01 |
|
Guys,
Do we have a bugzilla for this?
Cheers
/Eike
----
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Stefan Winkler schrieb:
> Hi Simon,
>
> nice one. I was aware of the problem, but I did not know about a way to
> get hold of the revision and -- hence -- the size of the list to
> implement the condition.
> With your way, I can even simplify the whole thing, because if I know
> the size of the list, I don't need to make a difference between move1up
> w/ or w/o upper bound.
>
> Cheers,
> Stefan
>
>
> Simon Mc Duff schrieb:
>
>> I did a test to see if it was really the problem by adding a lookup if
>> the previous size in bigger then the new one...
>>
>> private void move1up(IDBStoreAccessor accessor, CDOID id, int index,
>> int upperIndex)
>> {
>> PreparedStatement stmt = null;
>> CDORevision readRevision =
>> accessor.getStore().getRepository().getRevisionManager().get
>> Revision(id, -1);
>> int size = readRevision.data().size(getFeature());
>> if (size > index)
>> {
>> ...NORMAL CODE
>> }
>> }
>>
>> and now it is 10000 times faster.
>> it need probably to be smarter than that... but still !
>> So this is a problem in there !! :)
>>
>>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
Powered by
FUDForum. Page generated in 5.04933 seconds