DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
Issue Details (XML | Word | Printable)

Key: NUCCORE-815
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Andy Jefferson
Reporter: Balázs Lécz
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
DataNucleus Core

PM.getObjectsById() should do bulk loading from datastore

Created: 01/Mar/12 03:11 PM   Updated: 30/Mar/12 09:25 AM   Resolved: 05/Mar/12 05:35 PM
Component/s: None
Affects Version/s: None
Fix Version/s: 3.0.10, 3.1.0.m1

File Attachments: 1. Zip Archive (5 kB)

 Description  « Hide
PM.getObjectsById() retrieves objects from the datastore on-by-one.
It should attempt to load them in bulk, whenever possible.

Balázs Lécz added a comment - 01/Mar/12 03:20 PM
After executing this test, look at the datanucleus.log file and check the datastore access pattern.
In the case of MySQL, 2 individual SELECTs are generated, instead of a signle one using an IN-list.

Balázs Lécz made changes - 01/Mar/12 03:20 PM
Field Original Value New Value
Attachment [ 11604 ]
Andy Jefferson added a comment - 05/Mar/12 05:35 PM
SVN trunk and branches/3.0 change the findObjects process to do bulk validation of object existence where possible (one SQL per inheritance tree).

Andy Jefferson made changes - 05/Mar/12 05:35 PM
Status Open [ 1 ] Resolved [ 5 ]
Assignee Andy Jefferson [ andy ]
Fix Version/s 3.0.10 [ 11501 ]
Fix Version/s 3.1.0.m1 [ 11450 ]
Resolution Fixed [ 1 ]
Chris Colman added a comment - 07/Mar/12 09:09 AM - edited
In general, when performing a query over all classes on a particular branch of a class hierarchy I seem to recall, historically at least, seeing SQL where clauses like:

where (classid=discrim1 or classid=discrim2 or classid=discrim3)

Using an IN statement for the query might have a moderate impact on query size but it would likely have a bigger impact on readability.

For example the following is more concise and readable and has less repetition:

where classid in (discrim1,discrim2,discrim3)

This is especially so for very large and deep class hierarchies (like we have in some places in our code base).

Andy Jefferson made changes - 30/Mar/12 09:25 AM
Status Resolved [ 5 ] Closed [ 6 ]