Trying to get the last 20 edges from a vertex

94 views
Skip to first unread message

André Marques

unread,
Jul 7, 2015, 6:45:09 PM7/7/15
to orient-...@googlegroups.com
Hi,

When I execute this query: select from (select expand(outE('InCompliment')) from #27:3590) order by @rid desc limit 20

It always evaluates all the 'InCompliment' edges before return the last 20 records.

When the vertex have a lot of edges, the query slows down a lot.

I also tried select from InCompliment where out = #27:3590 order by @rid desc limit 20 using a notunique_hash_index on InCompliment(out), but it also didn't work.

Anyone knows how to do a faster 'order by desc'?

Using OrientDB Community 2.0.12.

 


SavioL

unread,
Jul 8, 2015, 4:15:20 AM7/8/15
to orient-...@googlegroups.com
Hi,
maybe this link may help you:

ORDER BY performance - best practice

regards,
Savio L.

André Marques

unread,
Jul 8, 2015, 10:31:35 AM7/8/15
to orient-...@googlegroups.com
Hi,

Thanks for your reply, but I've already tried that.
Is the a way to iterate over only the last edges from a vertex?
Any other suggestions?

Luca Garulli

unread,
Jul 8, 2015, 10:44:27 AM7/8/15
to orient-...@googlegroups.com
Hi,
Take a look at: http://orientdb.com/docs/last/Graph-Database-Tinkerpop.html#ordered-edges. Once they are ordered hey could be managed as a list.

Best Regards,

Founder & CEO


--

---
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.

André Marques

unread,
Jul 9, 2015, 1:35:56 AM7/9/15
to orient-...@googlegroups.com
Hi Luca,

Thanks, ordered edges does the job.

Is it possible to create an ordered list property using only SQL?

Luca Garulli

unread,
Jul 9, 2015, 2:55:09 AM7/9/15
to orient-...@googlegroups.com
Hi,
Right now you can do that only by setting it in the schema. However, this could be an enhancement. Would you like to open a new issue for that?

Best Regards,

Founder & CEO


André Marques

unread,
Jul 9, 2015, 1:43:16 PM7/9/15
to orient-...@googlegroups.com

Luca Garulli

unread,
Jul 12, 2015, 6:14:56 PM7/12/15
to orient-...@googlegroups.com
Resolved by executing these SQL commands:

create property out_Photos LINKLIST
alter property User.out_Photos custom ordered=true

Best Regards,

Founder & CEO


Reply all
Reply to author
Forward
0 new messages