JanusGraph / JanusGraph/janusgraph
Index by label
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 5.8k
- Forks
- 1.2k
- Avg merge
- 13h 53m
- Merged PRs (30d)
- 6
Description
In Janus I can create a composite index for a single property. Why then can I not create a composite index for a vertex label without a property?
My use case is that we're using vertex labels to identify the type of the vertex (as suggested in Janus docs). We have a CRUD UI that allows users to browse objects of a given type, so we now want to show a paged list of people:
```
g.V().hasLabel("person").range(0, 10)
```
This results in a 5 second long query, because it's doing a full graph scan. If I introduce a redundant property "mytype"="person", I can place an index on "mytype" only for label "person", write a query like this:
```
g.V().has(Key[String]("mytype"), "person").hasLabel("person").range(0, 10)
```
And it no longer performs a full graph scan: ~100ms.
Is it possible to trick Janus into using an existing index I have on property "name" for label "person" by changing the query? Both these queries still result in a full graph scan:
```
g.V().has(Key[String]("name")).hasLabel("person").range(0, 10)
g.V().has(Key[String]("mytype")).hasLabel("person").range(0, 10)
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Start by reproducing the three Gremlin queries and reading the indexing and label-filtering behavior described in the issue; done means determining whether label-only indexing is supported or defining the required change and its performance behavior.
Written by the indexing model from the issue text.
Assessment
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100