0

When trying to find list of users that startsWith some text example :

g.V().hasLabel('user').has('username', startingWith('m')).limit(12).values('username'); //4 Seconds
g.V().hasLabel('user').has('username', startingWith('madyan')).limit(12).values('username'); //2 Minutes  

The more letters we are searching for the slower it gets, why is that ? And how can we optimise the query, 2 Minutes is just very high ?

Madian Malfi
  • 595
  • 1
  • 8
  • 26

1 Answers1

2

Neptune maintains multiple indices for exact match queries but does not include a native full-text search index. So any query that uses the text predicate steps (startingwith(), endingWith(), containing(), etc.) would be full or partial scans of all objects/properties that you're attempting to search for.

To make this more performant, Neptune has a Full-Text Search feature (1) that leverages an external OpenSearch cluster. You can then use the index maintained within OpenSearch through additional steps within Gremlin (or SPARQL) in Neptune to accomplish this.

(1) https://docs.aws.amazon.com/neptune/latest/userguide/full-text-search.html

Taylor Riggan
  • 1,963
  • 6
  • 12