Orientdb: MATCH doesn't work with record id

Created on 6 Sep 2017  Â·  3Comments  Â·  Source: orientechnologies/orientdb

OrientDB Version: 2.2.26

Java Version: 7

OS: WINDOWS

Actual behavior

We have this model :
Unit <- Person(pds) -> profession
(246515 vertex) <- (661491 V) -> (68 V)
A Unit is linked to less than 5 person.

We want to find the person for a specialty and a profession. For both, we have the id.

This request is very slow (7 seconds) :
MATCH
{class:pds, as:pds}.out('has_punit'){class:unit, where : (@rid = #104:11482)},
{as:pds}.out('has_pprofession'){class:profession, where : (@rid = #81:0)}
RETURN pds

In the documentation : change this: select from Profile where @rid = #10:44 with this: select from #10:44

Question

Is it possible to use record ID as target in a Match query ?

question

Most helpful comment

Hi @bbourgois

Yes, instead of

MATCH {class:pds, as:pds, where:(@Rid = #104:11482)}...

you can use

MATCH {rid:#104:11482, as:pds}...

We introduced it as an experimental feature, so it's not documented yet, but it works definitely fine

Thanks

Luigi

All 3 comments

Hi @bbourgois

Yes, instead of

MATCH {class:pds, as:pds, where:(@Rid = #104:11482)}...

you can use

MATCH {rid:#104:11482, as:pds}...

We introduced it as an experimental feature, so it's not documented yet, but it works definitely fine

Thanks

Luigi

Hi @luigidellaquila
The feature is so cool.
Is it more faster than query by where condition?

It's much faster. It's O(1), no matter the database size.

Was this page helpful?
0 / 5 - 0 ratings