dse图-gremlin-cql查询未使用分区键

时间:2018-09-25 18:42:14

标签: datastax-enterprise datastax-enterprise-graph

我注意到在gremlin查询后面的cql查询未使用分区键。而是查询使用允许过滤器进行全表扫描。这会导致大图上的性能问题。

这是一个错误吗?我正在使用DSE 6.0.1图形。

$ bin/dse gremlin-console

         \,,,/
         (o o)
-----oOOo-(3)-oOOo-----
plugin activated: tinkerpop.tinkergraph
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
gremlin> system.graph('friends').option("graph.schema_mode").set("Production").option("graph.allow_scan").set("true").option("graph.default_property_key_cardinality").set("single").create()
==>null
gremlin> system.graphs()
==>idg
==>friends
gremlin> :remote config alias g friends.g
==>g=friends.g
gremlin> g.V()
gremlin> schema.propertyKey("id_tx").Text().single().create()
==>null
gremlin> schema.propertyKey("type").Text().single().create()
==>null
gremlin> schema.propertyKey("nm").Text().single().create()
==>null
gremlin> schema.vertexLabel("person").partitionKey("id_tx").clusteringKey("type").properties("nm").create()
==>null
gremlin> graph.addVertex(label, "person", "id_tx","p10001", "type", "person", "nm","Moses")
==>v[{~label=person, id_tx="p10001", type="person"}]
gremlin> g.V()
==>v[{~label=person, id_tx="p10001", type="person"}]
gremlin> g.V().hasLabel("person").has("id_tx","p10001").has("type","person")
==>v[{~label=person, id_tx="p10001", type="person"}]
gremlin> g.V().hasLabel("person").has("id_tx","p10001").has("type","person").profile()
==>Traversal Metrics
Step                                                               Count  Traversers       Time (ms)    % Dur
=============================================================================================================
DsegGraphStep(vertex,[],(id_tx = p10001 & label...                     1           1           5.953    84.58
  query-optimizer                                                                              0.227
    \_condition=((id_tx = p10001 & label = person & type = person) & (true))
  query-setup                                                                                  0.031
    \_isFitted=true
    \_isSorted=false
    \_isScan=false
  query-optimizer                                                                              0.084
    \_condition=((label = ~~vertex_exists) & (true))
  query-setup                                                                                  0.005
    \_isFitted=true
    \_isSorted=false
    \_isScan=false
  vertex-query                                                                                 0.322
    \_usesCache=false
    \_statement=SELECT * FROM "friends"."person_p" WHERE "id_tx" = ? AND "type" = ? LIMIT ? ALLOW FILTERING; 
                with params (java.lang.String) p10001, (java.lang.String) person, (java.lang.Integer) 50000
    \_options=Options{consistency=Optional[ONE], serialConsistency=Optional.empty, fallbackConsistency=Option
              al.empty, pagingState=null, pageSize=-1, user=Optional[dse_admin], waitForSchemaAgreement=true,
               async=true}
    \_usesIndex=false
DsegPropertyLoadStep                                                   1           1           1.085    15.42
                                            >TOTAL                     -           -           7.039        -
gremlin> g.V().hasLabel("person").has("id_tx","p10001")
==>v[{~label=person, id_tx="p10001", type="person"}]
gremlin> g.V().hasLabel("person").has("id_tx","p10001").profile()
==>Traversal Metrics
Step                                                               Count  Traversers       Time (ms)    % Dur
=============================================================================================================
DsegGraphStep(vertex,[],(id_tx = p10001 & label...                     1           1           2.020    83.65
  query-optimizer                                                                              0.239
    \_condition=((id_tx = p10001 & label = person) & (true))
  query-setup                                                                                  0.009
    \_isFitted=false
    \_isSorted=false
    \_isScan=true
  index-query                                                                                  0.417
    \_usesCache=false
    \_statement=SELECT "id_tx", "type" FROM "friends"."person_p" WHERE "~~vertex_exists" = ? LIMIT ? ALLOW FI
                LTERING; with params (java.lang.Boolean) true, (java.lang.Integer) 50000
    \_options=Options{consistency=Optional[ONE], serialConsistency=Optional.empty, fallbackConsistency=Option
              al.empty, pagingState=null, pageSize=-1, user=Optional[dse_admin], waitForSchemaAgreement=true,
               async=true}
DsegPropertyLoadStep                                                   1           1           0.394    16.35
                                            >TOTAL                     -           -           2.415        -
gremlin> 

这是我用来重新创建的架构和命令。

system.graph('friends').option("graph.schema_mode").set("Production").option("graph.allow_scan").set("true").option("graph.default_property_key_cardinality").set("single").create()

schema.propertyKey("id_tx").Text().single().create()
schema.propertyKey("type").Text().single().create()
schema.propertyKey("nm").Text().single().create()

schema.vertexLabel("person").partitionKey("id_tx").clusteringKey("type").properties("nm").create()

graph.addVertex(label, "person", "id_tx","p10001", "type", "person", "nm","Moses")

通知执行计划

\_statement=SELECT "id_tx", "type" FROM "friends"."person_p" WHERE "~~vertex_exists" = ? LIMIT ? ALLOW FI
                    LTERING; 

0 个答案:

没有答案