Hello All,
I am new to OrientDB and we want to move from MongoDB to OrientDB. Because at this stage we have very complex requirements of joins between tables(means our modules) and also we are facing huge problem of memory consumption.
We have a different modules into our system like persons, leads, support_cases. And these all modules are internally connected. So in MongoDB we can not perform a join between them to retrieve data with some complex relationships. So we want to give a try to OrientDB, if its fit well to our requirements.
We have one person module and we are storing full object of person into MongoDB. Person can have multiple phones, emails & addresses and other custom fields.
Here is the structure that we have currently in MongoDB:
{
personId: 'personId1',
fname: 'Mitul',
lname: 'Golakiya',
phnoes: [
{ phoneId: 'phoneId1', phone: '9999999999' },
{ phoneId: 'phoneId2', phone: '9999999900' }],
emails: [
],
addresses: []
}
We have embedded array for all because we want to retrieve all the fields when we want person object and also whole person object is passed via services while insertion of person.
And also we have a requirement like, we have to update single phone, email & address object.
So to update single object in OrientDB we have to take separate tables for email, phone & address.
So now my problem is, I have to insert all the things separately and create a links between them.
Here is my schema:
In person I am creating three fields emails, phones & addresses with LINKSET (@rid) type with its relevant linked classes.
And in email, phone & address table, I am saving LINK type field which contains personId (@rid).
So I am performing following sequence for insertion of person.
1. First I have to insert person.
2. Then insert email with person.@rid.
3. Insert phones with person.@rid.
4. Insert address with person.@rid.
5. Now update person's table and insert a @rids of email, phone & address in LINKSET field.
So it is taking too much time in insert as compared to mongo.
Mongo is taking only 140-150 millisecond. And in OrientDB these five operations are taking more than 1 second.
So is there any way by which I can make it fast or I can insert it in a single query with all LINKs ??
Or any other way by which I can optimize the time by schema change or anything else.
Thanks in advance.