JanusGraph / JanusGraph/janusgraph

Index by label

Open
#283 8 comments 47 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/index kind/enhancement kind/performance
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.