Lightweight vs Standard/Regular Edges

80 views
Skip to first unread message

Jeffrey Auguste

unread,
Mar 12, 2015, 11:39:04 AM3/12/15
to orient-...@googlegroups.com
My understanding so far is that OrientDB has two type of Edges. Regular and Lightweight. The regular provides more flexibility and functionality at the cost of additional storage and performance. Its also my understanding that the lightweight edge is by default turned off with orientdb which makes it seem as though regular edges is the preferred over lightweight.  

So my questions are:
1. Is the difference in performance and/or storage significant with standard edges vs lightweight? If so, is it only affected in large databases? If so, what is considered Large? 
2. The documentation states that Lightweight edges are hard to work with? If you agree, is it so difficult that you would question using them instead of regular edges?
3. Which do you prefer? In what situation would you switch to using the alternate edge to your preference?

Riccardo Tasso

unread,
Mar 12, 2015, 11:50:57 AM3/12/15
to orient-...@googlegroups.com
Hi,
 from a practical point of view to me it's pretty the same if using Regular or Lightweight edges. The important thing is to use in your queries the out() and in() functions, which works with the same semantics with both edges.

I suggest you to use Regular edges only if you need some properties other than label over them, such as weight or something like that. Otherwise there is no need.

Cheers,
   Riccardo

--

---
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-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Luigi Dell'Aquila

unread,
Mar 12, 2015, 11:52:12 AM3/12/15
to orient-...@googlegroups.com
Hi Jeffrey,

I think you looked at this:


In terms of performance lightweight edges are better, but they are harder to manage because:
- you cannot refer a lightweight edge by its RID (a lightweight edge is not a document)
- a lightweight edge can become a regular edge (when you add properties), so you never know if an edge is actually lightweight or if it's a regular one, until you read it, so writing queries becomes more difficult

More precisely:
1) a regular edge is a document, so it takes space on disk as a normal document. If you have number of edges much greater than number of vertices, it can be significant
2) you can work with lightweight edges but
- you never know if a lightweight edge is actually lightweight (until you read it), because a lightweight edge can become a regular one during its lifetime
- lightweight edges do not have a record id
3) I prefer regular edges, I consider lightweight edges an optimization

Luigi 





2015-03-12 16:32 GMT+01:00 Jeffrey Auguste <mrjau...@gmail.com>:

--

Jeffrey Auguste

unread,
Mar 12, 2015, 12:50:10 PM3/12/15
to orient-...@googlegroups.com
Ok, that is how I was understanding things. And I agree,  would prefer to build on performance verses find out later that I need the performance of the lighweight edge, especially if, as you said, I don't have a need for the benefits regular edges provide.

Jeffrey Auguste

unread,
Mar 12, 2015, 12:52:45 PM3/12/15
to orient-...@googlegroups.com
I see where your coming from, but I'm expecting a lot of data, in the hundreds of millions, and my past experience has me leaning towards starting with performance in mind. I have joined in on too many projects where the project was designed with no expectation for significant growth and then suddenly became much more than it was originally intended.

Jeffrey Auguste

unread,
Mar 12, 2015, 12:55:44 PM3/12/15
to orient-...@googlegroups.com
So it seems that both can coexist. Is that true? So as long as I turn the flag on, then unless I use a labeled edge or add a property to the edge, it should create a lightweight edge. And if I find a case where I would like a regular edge, I can just create an edge class to enforce it?

Luigi Dell'Aquila

unread,
Mar 12, 2015, 12:57:57 PM3/12/15
to orient-...@googlegroups.com
Yes, it's right, you can turn lightweight edges on in any moment. 
Actually to create a regular edge (instead of lightweight), defining a class for it is not enough, you just have to explicitly add a property to that.

Luigi

--

Jeffrey Auguste

unread,
Mar 12, 2015, 1:04:00 PM3/12/15
to orient-...@googlegroups.com
Ah, so I can create an edge class extended from E and it will still be lightweight, Its when/if I add link properties to it, that it will then become an edge document. 

--

---
You received this message because you are subscribed to a topic in the Google Groups "OrientDB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/orient-database/VyxdX6-liT8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to orient-databa...@googlegroups.com.

Luigi Dell'Aquila

unread,
Mar 12, 2015, 1:10:57 PM3/12/15
to orient-...@googlegroups.com
Exactly

Reply all
Reply to author
Forward
0 new messages