Search code examples
datastax-enterprisedatastax-enterprise-graph

DSE Graph - How to see the underlying Cassandra queries from Gremlin queries?


If I execute a gremlin query in the gremlin-console, is there a way to see the Cassandra queries DSE Graph generates?


Solution

  • DSE Graph provides an extended set of attributes to the results of TinkerPop's profile() step - here is an example of the output:

    gremlin> g.V().has('recipe','name','spaghetti').profile()
    ==>Traversal Metrics
    Step                                                               Count  Traversers       Time (ms)    % Dur
    =============================================================================================================
    DsegGraphStep([~label.=(recipe), name.=(spaghet...                     1           1          97.087    81.00
      query-optimizer                                                                             22.802
        \_condition=(((label = recipe) & (true)) & name = spaghetti)
      query-setup                                                                                  1.134
        \_isFitted=true
        \_isSorted=false
        \_isScan=false
      index-query                                                                                 19.838
        \_indexType=Secondary
        \_usesCache=false
        \_statement=SELECT "community_id", "member_id" FROM "junk"."recipe_p" WHERE "name" = ? LIMIT ?; with para
                    ms (java.lang.String) spaghetti, (java.lang.Integer) 50000
        \_options=Options{consistency=Optional[ONE], serialConsistency=Optional.empty, fallbackConsistency=Option
                  al.empty, pagingState=null, pageSize=-1, user=Optional.empty, waitForSchemaAgreement=true, asyn
                  c=true}
    DsegPropertyLoadStep                                                   1           1          22.772    19.00
                                                >TOTAL                     -           -         119.860        -