GitHub user byteayan added a comment to the discussion: Why is the cache not 
used when querying vertices through an index?

@xulzee your reading of the second step is right, and it has changed on master 
since you asked.

**Up to 1.7.0**, `CachedGraphTransaction.queryVerticesFromBackend` only used 
the vertex cache for a plain id query: ids present, no conditions, no 
post-filter. `g.V('1:xx')` fits that, so it hits the cache. 
`g.V().hasLabel("server")` is a `ConditionQuery`, so it went to 
`super.queryVerticesFromBackend`. That ran the index lookup and then loaded the 
vertices for the returned ids straight from the store, never going back through 
the cached override. So the id lookups after the index step skipped the cache, 
just as you described.

**On master**, #3193 (merged in September) reworked this. `GraphTransaction` 
now builds the query with `optimizeQueries(query, this::fetchVertexBatch)`, so 
every id batch the index produces goes through `fetchVertexBatch`. 
`CachedGraphTransaction` overrides that method: it serves the ids it already 
has from `verticesCache` and only fetches the misses from the backend. The 
exception is a paged backend query, which still bypasses the cache because it 
needs the backend's page state.

That change isn't in a release yet (the latest is 1.7.0), so you'd need a build 
from master, or the next release, to get the cached second step.

GitHub link: 
https://github.com/apache/hugegraph/discussions/2713#discussioncomment-19021838

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to