© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Apache TinkerPopAT
Apache TinkerPop•2y ago•
5 replies
b4lls4ck

How to speed up gremlin query

Hi, I am working with Janusgraph and my query is taking a while to execute (around 2.8 seconds), but I would like it to be faster. I read that I should create a composite index to improve speed and performance or something of that sort, but I am unfamiliar with how to do that in Python.

Here is my query: g.V().has("person", "name", "Bob").outE("knows").has("weight", P.gte(0.5)).inV().values("name").toList()

What my query does is it finds all the nodes that Bob has relationship "knows" with, as long as the weight of the edge to those nodes are >=0.5. Bob has around ~600 nodes that it's connected to with the "knows" relationship. It's fairly slow and takes 2.5-2.8 secs to complete.

I would like to speed this up greatly, any ideas?
Solution
I read that I should create a composite index to improve speed and performance or something of that sort, but I am unfamiliar with how to do that in Python.
as a point of clarification around indices, you wouldn't likely do that step with python. you typically use gremlinpython just to write Gremlin. For index management, you need to use JanusGraph's APIs directly. often those are just commands you would execute directly in Gremlin Console against a JanusGraph instance.
Jump to solution
Apache TinkerPop banner
Apache TinkerPopJoin
Apache TinkerPop is an open source graph computing framework and the home of the Gremlin graph query language.
1,376Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Gremlin Query timeout issue
Apache TinkerPopATApache TinkerPop / questions
12mo ago
Help with a gremlin query..
Apache TinkerPopATApache TinkerPop / questions
6mo ago
Query if else in gremlin
Apache TinkerPopATApache TinkerPop / questions
3y ago
Neo4j Chypre convention in to gremlin query
Apache TinkerPopATApache TinkerPop / questions
15mo ago