fastapijanusgraphgremlinpython

Why do I get 'Query requires iterating over all vertices' warning when checking for a connection


We are using JanusGraph (1.0.0) with a python fastAPI-based API, on kubernetes, to maintain and query our gremlin graph. Using gremlinpython, we periodically send this query for the sole purpose of checking the connection between API and DB server:

result = graph.inject(1).next(), where graph is our graph traversal object.

Our understanding is that this query is equivalent to sending something like SELECT 1; to a Postgres (other RDBMS exist) server. It creates a traversal with a single value, then collects that value.

When we issue this query, we get a warning from the JanusGraph server, like this:

10:18:49 WARN org.janusgraph.graphdb.transaction.StandardJanusGraphTx$3.execute - Query requires iterating over all vertices [[]]. For better performance, use indexes

Is our understanding wrong? Does this query actually iterate over our graph (which is not even referenced in this query)? Or is this warning a bug?

The problem we have with this warning is that we may well be committing this crime (not using indexes) elsewhere in the code, but there are so many spurious warnings that we will never be able to recognise a real one.


Solution

  • I agree with your assesment. This warning apparently assumes that all queries start with graph.V(), which is not the case for your example. It would be best to report the issue here.

    Issuing a query that causes a full graph scan is not a fatal error. The gremlin VM running in JanusGraph will simply time out if your graph is large and server resources will become available again for more sensible queries.