ArangoDB-Community / arangodb-tinkerpop-provider

An implementation of the Tinkerpop OLTP Provider for ArangoDB
Apache License 2.0
84 stars 16 forks source link

Index questions of GraphCollections #39

Closed a-marcel closed 5 years ago

a-marcel commented 5 years ago

Hello,

i used your configuration from the readme:

ArangoDBConfigurationBuilder builder = new ArangoDBConfigurationBuilder();
builder.graph("modern")
    .withVertexCollection("software")
    .withVertexCollection("person")
    .withEdgeCollection("knows")
    .withEdgeCollection("created")
    .configureEdge("knows", "person", "person")
    .configureEdge("created", "person", "software");

and i try to understand how i can create an index for some properties of an collection - or even do i need one ?

When i use this:

Vertex v1 = g.addV("person").property("key", "123").property("age", 29).next();
Vertex rv = g.V().has("key","123").next();

It works but will this be performant if the collection contains thousand of entries. And the same question vice versa. Does it mean, that every property i add to a vertex is searchable ?

Thanks for your help

Marcel

arcanefoam commented 5 years ago

Hi,

Indeed having properties as nodes can be less performant than having them in the vertex document. Further, as you mentioned, with this design it is not possible to add indices for certain properties. I need to add this to the documentation as Tinkerpop does support the notion of indices and currently we do not. However, the indexing is related to #38 and hence they wont happen until we solve that one.

Does it mean, that every property i add to a vertex is searchable ?

If you are referring to v g.V().has(...) method, then yes, the Tinkerpop API allows to search by any property. There are some specific graph traversal and query methods that would benefit from the index though.

a-marcel commented 5 years ago

Mhh ok. So it's better to use elementIds in the way you mentioned in the Readme:

https://github.com/ArangoDB-Community/arangodb-tinkerpop-provider#a-note-on-element-ids

I guess this id's are using the arangodb index then ?

Marcel

arcanefoam commented 5 years ago

Yes, currently if you want an indexed search ids are the way to go, as you are right, the Tinkerpop id is stored in the document id and hence indexed by Arango.

a-marcel commented 5 years ago

Ok, thanks. This answers my question and i'll switch to this elementIds.

Thanks a lot.

Btw: arangoDb is not mentioned on the tinkerpop site: http://tinkerpop.apache.org/providers.html

arcanefoam commented 5 years ago

Thanks for the last piece of info, I will look into this.