When I try to get vertex count in DSE Graph using
g.V().count()
in Production mode below error is displaying.
Could not find a suitable index to answer graph query and graph scans are disabled
But the same is working in Development mode. Am I doing something wrong.
I am trying quick start link but created my own schema
https://docs.datastax.com/en/latest-dse/datastax_enterprise/graph/QuickStartStudio.html
Schema:
schema.propertyKey("id").Int().single().create() schema.propertyKey("name").Text().single().create()
schema.edgeLabel("created").multiple().create()
schema.vertexLabel("feed").properties("id").create() schema.vertexLabel("user").properties("id", "name").create()
schema.vertexLabel("feed").index("byFeedId").materialized().by("id").add() schema.vertexLabel("user").index("byUser").materialized().by("id").add()
Counting across your vertexes is an expensive query that is not expected to be done in production in an OLTP use case.
Vertices are stored in an adjacency list by vertex type in DSE Graph and to get a count of all the vertices you would have to do a full table scan for each of these which is impractical in a distributed transactional system (you'd have to hit an entire replica set which could be a lot of nodes).
If this is a real use case, it is probably an analytical use case in which case you should be leveraging the spark graph computer by running the query in analytics mode. Note: the full table scan may still take time but it will be executed in massively distributed fashion via DSE Analytics.