Hello,

I tried and queries worked. 
However, when I tried the 2nd query with more rows, processing time was 
longer and longer. With 20k vertex the query was running for 2 hours and I 
cancelled it (it executed on orientdb 2.1.15 using 4gb of heap and 8 gb of 
bufferdisk).
I used OrientDb Studio (with the limit of 20 rows).

I found it is faster to sort the answer by day on the client side at least 
for now. At the same time I feel that I should return both activity types 
picnic and excursion in 1 column and sort that. I suspect that operation 
will be faster. No sure if it is what I need though (the sort operation).

Each user will have less than 999 activities so still is not a big deal to 
sort the result on the client side OR insert them sorted.

Thanks all to help me querying this class.

Pablo

On Thursday, April 21, 2016 at 8:22:09 AM UTC-7, user.w...@gmail.com wrote:
>
> Hi pabloa,
>
> I've made this query that, I hope,it will satisfy your request.
>
> With this one, I'm able to select the user, the days and the 
> excursion/picnic, everything ordered from largest to smallest,based on the 
> day:
>
> select user,days,excursion,picnic from (select $b.userId as user,$b.day as 
> days,$b.excursion as excursion,$b.picnic as picnic,$a.max_day as day from 
> User
> let $a=(select userId,max(activities.day) as max_day from User where 
> userId=$parent.current.userId),
> $b=(select userId,activities.day as day,activities[type='excursion'].data 
> as excursion,activities[type='picnic'].data as picnic from User where 
> userId=$parent.current.userId)
> order by day desc
> unwind user)
>
>
> <https://lh3.googleusercontent.com/-5Il-yf5auio/VxjuwEC7OII/AAAAAAAAACc/IlaGGwZwxKQM0_K8fqgPDTf_Qg2FKnjfACLcB/s1600/max.png>
>
>
> With this one you can do the same but everything is ordered from smallest 
> to largest,based on the day:
>
> select user,days,excursion,picnic from (select $b.userId as user,$b.day as 
> days,$b.excursion as excursion,$b.picnic as picnic,$a.min_day as day from 
> User
> let $a=(select userId,min(activities.day) as min_day from User where 
> userId=$parent.current.userId),
> $b=(select userId,activities.day as day,activities[type='excursion'].data 
> as excursion,activities[type='picnic'].data as picnic from User where 
> userId=$parent.current.userId)
> order by day asc
> unwind user)
>
>
>
> <https://lh3.googleusercontent.com/-Lh3Llm3b6Lo/VxjvMZdJUsI/AAAAAAAAACg/lC6Ad7Y2KIUVTWBVbtxdAMl7LlfW4OsMQCLcB/s1600/min.png>
>
>
> Hope it helps.
>
> Regards,
> Michela
>

-- 

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

Reply via email to