Question

First of all, I'm not an expert regarding titan and graph databases, so any comment will be appreciated.

Currently I have around 12.000.000 vertex and 16.000.000 edges. I've created 2 indexes, index "fbid" for Vertex, and Index "dateInMs" for edges.

graph.makeKey("fbid").dataType(String.class).single().indexed(Vertex.class).unique().make();
graph.makeKey("dateInMs").dataType(Long.class).indexed(Edge.class).make();

Then, I ran the following query.

g.query().interval("dateInMs",1394247600000,1394420400000).edges()

where the numbers represent two dates in ms(2014-03-08 and 2014-03-10)

Since I'm querying based on the indexed field, I was expecting a fast response, however the query is sooo slow, so I don't know if its the expected result or I did something wrong.

Note: When I ran the query I get the following message: com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx - Query requires iterating over all vertices [(dateInMs >= 1394247600000 AND dateInMs < 1394420400000)]. For better performance, use indexes,

However I'm using the index dateInMs.

Any clues?

Était-ce utile?

La solution

please see: Titan Limitations

Edge Retrievals are not O(1)

Retrieving an edge by id, e.g tx.getEdge(edge.getId()), is not a constant time operation. Titan will retrieve an adjacent vertex of the edge to be retrieved and then execute a vertex query to identify the edge. The former is constant time but the latter is potentially linear in the number of edges incident on the vertex with the same edge label.

This also applies to index retrievals for edges via a standard or external index.

The reason for this behaviour is the way in which Titan stores vertices and edges (see Data Model). Only vertices can be accessed directly (O(1)).

Bottom line: Even if you have an Edge index for properties, Titan still has to iterate over all adjacent vertices to identify the edges by id.

Try to change your schema, so that you can query vertices from where you can continue the traversal.

Cheers, Daniel

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top