0

Hi I have disabled scans in my schema.

I know that queries like those wouldn't be allowed:

g.V()

g.V().hasLabel("User")

org.apache.tinkerpop.gremlin.driver.exception.ResponseException: Could not find an index to answer query clause and graph.allow_scan is disabled:

I wonder why even those:

g.V().limit(2)

g.V().hasLabel("User").limit(2)

cause the same exception to be thrown! This is frustrating since they are bounded queries and they certainly don't cause full cassandra table scans..

Thanks

Michail Michailidis
  • 11,792
  • 6
  • 63
  • 106

1 Answers1

2

There's an ongoing discussion about what kind of queries (if any at all) should be allowed with scans disabled. For now the rule is simple: If the initial step is not an index lookup, then it's considered to be a full scan.

It's easy to say that:

g.V().hasLabel("user").limit(2)

...for example should be allowed, but if that is not considered to be a full scan, then what about these:

g.V().hasLabel("user").limit(10)
g.V().hasLabel("user").limit(100)
g.V().hasLabel("user").limit(1000)
g.V().hasLabel("user").limit(10000)
g.V().hasLabel("user").limit(100000)

Where do we draw the line? I'm not expecting you to answer this question, just want to show that it's not as easy as it may seem at first.

Daniel Kuppitz
  • 10,846
  • 1
  • 25
  • 34
  • I understand that and I expected this answer but people say never run with allow_scan to true in production.. but this is really hard if for example I need to take let's say the last 100 users that entered the system. what should I do..? I thought btw that at least using hasLabel("user") would use an index behind the scenes but now I understand that's a whole cassandra table. Does it make sense to throw an exception in the case of full scan .. That is the question.. there should be way to be notified by a log message and suppress the exception.. – Michail Michailidis Apr 06 '17 at 09:09