You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a query uses both or-step and not-step, the usage of mixed index is not expected. Specifically, the index query does not include the conditions in the or-step, when the Gremlin query uses or-step and not-step at the same time.
For example, we built the mixed index 'PersonalInfo' on properties 'name', 'age' and 'address'.
gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@4d3ce310
gremlin> mgmt.printSchema()
==>------------------------------------------------------------------------------------------------
Vertex Label Name | Partitioned | Static |
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
Edge Label Name | Directed | Unidirected | Multiplicity |
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
Property Key Name | Cardinality | Data Type |
---------------------------------------------------------------------------------------------------
name | SINGLE | class java.lang.String |
age | SINGLE | class java.lang.Integer |
address | SINGLE | class java.lang.String |
---------------------------------------------------------------------------------------------------
Graph Index (Vertex) | Type | Unique | Backing | Key: Status |
---------------------------------------------------------------------------------------------------
PersonalInfo | Mixed | false | mixedIndex | name: ENABLED |
| | | | age: ENABLED |
| | | | address: ENABLED |
---------------------------------------------------------------------------------------------------
Graph Index (Edge) | Type | Unique | Backing | Key: Status |
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
Relation Index (VCI) | Type | Direction | Sort Key | Order | Status |
---------------------------------------------------------------------------------------------------
We added three vertices to the graph as follows:
gremlin> :remote config alias g graphtest_traversal
==>g=graphtest_traversal
gremlin> g.V().valueMap()
==>{name=[Allen], age=[27], address=[China]}
==>{name=[Alice], age=[25]}
==>{name=[Bob], age=[29], address=[China]}
The underlying reason could be:
For these queries, the not-step is moved in front of or-step because of the FilterRankingStrategy. Then, in foldInHasCotainer method of HasStepFolder.java, when the current step is NotStep, it will break the traversal. This means it does not condition the steps after NotStep also might be folded in has container, which would be used for index query.
Thus, it is recommended to handle NotStep case in foldInHasCotainer method to improve Or-step support on mixed index.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When a query uses both or-step and not-step, the usage of mixed index is not expected. Specifically, the index query does not include the conditions in the or-step, when the Gremlin query uses or-step and not-step at the same time.
For example, we built the mixed index 'PersonalInfo' on properties 'name', 'age' and 'address'.
We added three vertices to the graph as follows:
The following query will result in a full scan.
The following query only leverages the mixed index on the condition (age >= 20 AND age < 30) without including the conditions on 'name'.
The underlying reason could be:
For these queries, the not-step is moved in front of or-step because of the
FilterRankingStrategy
. Then, infoldInHasCotainer
method of HasStepFolder.java, when the current step isNotStep
, it will break the traversal. This means it does not condition the steps after NotStep also might be folded in has container, which would be used for index query.Thus, it is recommended to handle
NotStep
case infoldInHasCotainer
method to improve Or-step support on mixed index.Beta Was this translation helpful? Give feedback.
All reactions