Low Performance Creating EDGE

52 views
Skip to first unread message

Maxim Nikolaev

unread,
Oct 1, 2017, 6:18:34 PM10/1/17
to OrientDB
Have two classes:
Person
Address.
I want create Edge where Person.AddressId  =  Address,Id 
Person - 20 million Vertex
Address - 40 million Vertex

Person have sub-classes as people, phone and another

Code :

allrecord = client.command("select count(*) from Person")
for i in range(0,count-1):
start_v = ''
result_v = ''
start_v = '#731:' + str(i)
Start_SysId_object = client.command("select AddressId from Person where @rid=%s" % start_v)
try:
Start_SysId_object_str = str(Start_SysId_object[0].oRecordData['AddressSysId'])
except:
continue
if Start_SysId_object_str != '':
Found_objects = client.command("select @rid from Address_Larix where SysId=%s" % Start_SysId_object_str)
else:
continue
res_len = len(Found_objects)
if (res_len >= 1):
for j in range(res_len):
result_v = str(Found_objects[j].oRecordData['rid'])
z = client.command("create EDGE LiveIn FROM %s TO %s " % (start_v, result_v))
else:

It work very slowly , 1 -2 edge per second. 
Also I try create Link , but it creating 2 days and not success.

How to fast create EDGE ? 

Luigi Dell'Aquila

unread,
Oct 2, 2017, 3:58:35 AM10/2/17
to orient-...@googlegroups.com
Hi Maxim,

First advice: replace

select AddressId from Person where @rid=%s

with
select AddressId from %s
it will be faster.
Then make sure you have an index on Address_Larix. SysId. To make sure it's correctly used, try to execute from Studio

EXPLAIN select @rid from Address_Larix where SysId=%s

Thanks

Luigi


--

---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-database+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Maxim Nikolaev

unread,
Oct 2, 2017, 6:10:23 AM10/2/17
to OrientDB
Thank you!  After implementing your recomendation now script creates 450 + Edges per sec. 

May be another API ( JAVA or Gremlin ) will be faster than python pyorient ? What about threading ? 

понедельник, 2 октября 2017 г., 1:18:34 UTC+3 пользователь Maxim Nikolaev написал:

Luca Garulli

unread,
Oct 2, 2017, 11:46:40 AM10/2/17
to OrientDB
Yes, if you can use Java with plocal connection (avoiding tcp/ip) it would be much faster.

Best Regards,

Luca Garulli

--
Reply all
Reply to author
Forward
0 new messages