Hi,
You're retrieving 33M of rows as result in this way + the order by consumes
a lot of RAM:

select *, *in()*.size() as size from FamilyMember ORDER_BY size DESC

Do you need 33M of results or can you se a limit? Furthermore please can
you add the PARALLEL keyword at the end of the select?

This is the query:

select *, *in()*.size() as size from FamilyMember ORDER_BY size DESC LIMIT
1000 PARALLEL


Best Regards,

Luca Garulli
Founder & CEO
OrientDB LTD <http://orientdb.com/>


On 1 July 2016 at 04:59, Ronnie <[email protected]> wrote:

> Hi,
>
> I tried to use the below query to get the count of vertices with most
> edges:
>
> select *, *in()*.size() as size from FamilyMember ORDER_BY size DESC
>
> I have about 33 million vertices and the query seems to be taking ages.
> Please suggest how i can improve the query or suggest possible cause for
> such a long execution time...
>
> I am using 2.2.0 community edition on a stable dedicated machine with
> decent configuration (xeon e5 with 28G RAM)
>
> Ron
>
>
> On Friday, 26 April 2013 08:47:34 UTC+2, Lvc@ wrote:
>>
>> Hi,
>> Topping says well. However you can do something similar to what you did
>> with 1.3.0 by using the new in() function:
>>
>> select url, *in()*.size() as in_size from Links ORDER_BY in_size DESC
>>
>> To count only the edges of type "linked" (label = linked) you can do:
>>
>> select url, *in('linked')*.size() as in_size from Links ORDER_BY in_size
>> DESC
>>
>> or again:
>>
>> select url, *edges('in', 'linked')*.size() as in_size from Links
>> ORDER_BY in_size DESC
>>
>> Lvc@
>>
>>
>> On 25 April 2013 18:20, Yingshou Guo <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> Thanks and I'll try it in my usecase.
>>>
>>> Best,
>>>
>>> Guo Yingshou
>>>
>>>
>>>
>>> On Fri, Apr 26, 2013 at 12:13 AM, Topping Bowers <
>>> [email protected]> wrote:
>>>
>>>> I think this:
>>>>
>>>> select *, in_linked.size() AS out_size from V ORDER BY out_size DESC
>>>>
>>>> That's because I have an edge type "linked" - so it's
>>>> in_#{edge.className}.size()
>>>>
>>>>
>>>> On Thu, Apr 25, 2013 at 11:54 AM, Yingshou Guo <[email protected]>
>>>> wrote:
>>>>
>>>>> Hi Luca,
>>>>>
>>>>> The problem with me using count() is that I don't know how to use it
>>>>> together with order by clause.
>>>>>
>>>>> In the following example, Would you please tell me how should I order
>>>>> by the number of in_ edge?
>>>>>
>>>>> orientdb> select in_ from V
>>>>>
>>>>> ---+---------
>>>>>   #| RID     |
>>>>> ---+---------
>>>>>   0|    #-2:1
>>>>>   1|    #-2:2
>>>>>   2|    #-2:3
>>>>>   3|    #-2:4
>>>>>   4|    #-2:5
>>>>>   5|    #-2:6
>>>>>   6|    #-2:7
>>>>>   7|    #-2:8
>>>>>   8|    #-2:9
>>>>>   9|   #-2:10|#38:0
>>>>>  10|   #-2:11|[3]
>>>>>  11|   #-2:12|#38:2
>>>>>  12|   #-2:13|#38:3
>>>>>  13|   #-2:14|#38:4
>>>>>  14|   #-2:15|#38:5
>>>>>  15|   #-2:16|[2]
>>>>>  16|   #-2:17|#38:7
>>>>>  17|   #-2:18|[6]
>>>>>  18|   #-2:19|#37:0
>>>>>  19|   #-2:20|#37:1
>>>>>
>>>>> My Query does not work:
>>>>>
>>>>> orientdb> select from V order by count(in_) desc
>>>>>
>>>>> Error:
>>>>> com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error 
>>>>> on
>>>>> parsing command at position #0: Error on parsing command at position #28:
>>>>> Ordering mode 'IN_' not supported. Valid is 'ASC', 'DESC' or nothing 
>>>>> ('ASC'
>>>>> by default)
>>>>> Command: select from V order by count(in_)
>>>>>
>>>>>
>>>>> On Thu, Apr 25, 2013 at 11:40 PM, Luca Garulli <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> Hi,
>>>>>> count() against edges is very cheap operation (OrientDB keeps track
>>>>>> of such counter like you would do).
>>>>>>
>>>>>> Lvc@
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 25 April 2013 17:34, Yingshou Guo <[email protected]> wrote:
>>>>>>
>>>>>>> I'm doing something similar. IMHO the simplest and most scalable
>>>>>>> solution is add a count property to the vertex and increment it each 
>>>>>>> time a
>>>>>>> new edge is added.
>>>>>>>
>>>>>>>
>>>>>>> On Thu, Apr 25, 2013 at 9:35 PM, Marko Rodriguez <[email protected]
>>>>>>> > wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> graph.v("@class" =>
>>>>>>>> "User").out_e(:mentioned).in_v.groupCount(:url).sort {|a,b| a[1] <=> 
>>>>>>>> b[1] }
>>>>>>>>
>>>>>>>> Forgive the weird syntax... we're using Pacer in Jruby, but i'm
>>>>>>>> more interested in the philosophy of tinkerpop/gremlin rather than 
>>>>>>>> actual
>>>>>>>> syntax.
>>>>>>>>
>>>>>>>> So to sum it up:
>>>>>>>>
>>>>>>>> "find the top 10 link vertexes with the highest count of in_edges,
>>>>>>>> using Tinkerpop and/or gremlin"
>>>>>>>>
>>>>>>>>
>>>>>>>> g.V('@class','User').transform{[it, it.inE.count()]}.order{it.b[1]
>>>>>>>> <=> it.a[1]}.next(10)
>>>>>>>>
>>>>>>>>
>>>>>>>> Here is your answer using the toy TinkerGraph deployed with
>>>>>>>> Gremlin. --- note I don't do @class='User' as that doesn't exist in the
>>>>>>>> dataset.
>>>>>>>>
>>>>>>>> gremlin> g = TinkerGraphFactory.createTinkerGraph()
>>>>>>>> ==>tinkergraph[vertices:6 edges:6]
>>>>>>>> gremlin> g.V.transform{[it,it.inE.count()]}
>>>>>>>> ==>[v[3], 3]
>>>>>>>> ==>[v[2], 1]
>>>>>>>> ==>[v[1], 0]
>>>>>>>> ==>[v[6], 0]
>>>>>>>> ==>[v[5], 1]
>>>>>>>> ==>[v[4], 1]
>>>>>>>> gremlin> g.V.transform{[it,it.inE.count()]}.order{it.b[1] <=>
>>>>>>>> it.a[1]}
>>>>>>>> ==>[v[3], 3]
>>>>>>>> ==>[v[2], 1]
>>>>>>>> ==>[v[5], 1]
>>>>>>>> ==>[v[4], 1]
>>>>>>>> ==>[v[1], 0]
>>>>>>>> ==>[v[6], 0]
>>>>>>>> gremlin> g.V.transform{[it,it.inE.count()]}.order{it.b[1] <=>
>>>>>>>> it.a[1]}.next(3)
>>>>>>>> ==>[v[3], 3]
>>>>>>>> ==>[v[2], 1]
>>>>>>>> ==>[v[5], 1]
>>>>>>>>
>>>>>>>>
>>>>>>>> I believe this is trivial to map over to Pacer syntax.
>>>>>>>>
>>>>>>>> HTH,
>>>>>>>> Marko.
>>>>>>>>
>>>>>>>> http://markorodriguez.com
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> ---
>>>>>>>> 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 [email protected].
>>>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> ---
>>>>>>> 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 [email protected].
>>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>>
>>>>>> ---
>>>>>> 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 [email protected].
>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> ---
>>>>> 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/0RgCgSE0yuQ/unsubscribe?hl=en
>>>>> .
>>>>> To unsubscribe from this group and all its topics, send an email to
>>>>> [email protected].
>>>>>
>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Topper Bowers
>>>>
>>>> [email protected]
>>>> http://amicushq.com
>>>> http://blog.toppingdesign.com
>>>>
>>>> --
>>>>
>>>> ---
>>>> 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 [email protected].
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>>
>>>
>>> --
>>>
>>> ---
>>> 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 [email protected].
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>> --
>
> ---
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to