3

I am trying to build vertex centric Index in Janusgraph.

foo = mgmt.makePropertyKey('foo').dataType(String.class).cardinality(org.janusgraph.core.Cardinality.SINGLE).make();
foo_bar = mgmt.makeEdgeLabel('foo_bar').make();
byfoo_bar = mgmt.buildEdgeIndex(foo_bar, 'byfoo_bar', Direction.BOTH, Order.desc, foo)

on doing mgmt.printSchema()

gremlin> mgmt = graph.openManagement();mgmt.printSchema();
==>------------------------------------------------------------------------------------------------
Vertex Label Name              | Partitioned | Static                                             |
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
Edge Label Name                | Directed    | Unidirected | Multiplicity                         |
---------------------------------------------------------------------------------------------------
foo_bar                        | true        | false       | MULTI                                |
---------------------------------------------------------------------------------------------------
Property Key Name              | Cardinality | Data Type                                          |
---------------------------------------------------------------------------------------------------
foo                            | SINGLE      | class java.lang.String                             |
---------------------------------------------------------------------------------------------------
Vertex Index Name              | Type        | Unique    | Backing        | Key:           Status |
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
Edge Index (VCI) Name          | Type        | Unique    | Backing        | Key:           Status |
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
Relation Index                 | Type        | Direction | Sort Key       | Order    |     Status |
---------------------------------------------------------------------------------------------------
byfoo_bar           | Account_AwsEC2Instance | BOTH      | foo            | desc     |    ENABLED |
---------------------------------------------------------------------------------------------------

The strange thing is this index shows up in Relation index instead of EdgeIndex(VCI).

On doing a sample query:

gremlin> g.V().outE("foo_bar").has("foo","foo").profile()
14:34:42 WARN  org.janusgraph.graphdb.transaction.StandardJanusGraphTx  - Query requires iterating over all vertices [()]. For better performance, use indexes
==>Traversal Metrics
Step                                                               Count  Traversers       Time (ms)    % Dur
=============================================================================================================
JanusGraphStep(vertex,[])                                           7271        7271          87.027     3.16
    \_condition=()
    \_orders=[]
    \_isFitted=false
    \_isOrdered=true
    \_query=[]
  optimization                                                                                 0.023
  optimization                                                                                 0.008
  scan                                                                                         0.000
    \_query=[]
    \_fullscan=true
    \_condition=VERTEX
JanusGraphVertexStep([foo.eq(foo)])                                                           2666.037    96.84
    \_condition=(foo = foo AND type[foo_bar])
    \_orders=[]
    \_isFitted=true
    \_isOrdered=true
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@3b00ddb7
    \_multi=true
    \_vertices=7271
  optimization                                                                                 0.412
  backend-query                                                        0                    2611.443
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@3b00ddb7
                                            >TOTAL                     -           -        2753.064        -

Now I have couple of questions.

  1. What are the differences between vertex-centric index and relational index?
  2. How do I create vertex-centric index? I followed official documentation to create them but it creates relational index instead.
  3. Is my relationIndex even used to answer the query?
Nischal Kumar
  • 492
  • 7
  • 15

0 Answers0