We are using COSMOS DB Gremlin API for Graph DB. We are storing contact information between two people (vertices) along with some metadata of interaction saved as edge property. A person can connect with any number of people ranging from few to 1000s of people. We are also interested in getting the second level connect of the first connect. So overall interaction may easily involve 5000 - 10000 edges. When we try to query this data using repeat query upto 2 level. It takes aroun 15 seconds to fetch this data even when we increase the allocated RU or if we select Auto scale. The production will have heavier load than this, somewhere 100,000 vertex and 900,000 edges. Any idea how the query can be improved or is there is guidance on optimized performance.
Basic query to get this data:
g.V({id of a person).repeat(inE().has({filter for edge})).outV().dedup()).times(2).emit().tree()