JanusGraph / JanusGraph/janusgraph

(Missing) Index Usage Analytics

Open
#105 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/enhancement
Dominant language
Java
Stars
5.8k
Forks
1.2k
Avg merge
13h 53m
Merged PRs (30d)
6

Description

This warning:

```
75604240 [gremlin-server-exec-4] WARN
com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx -
Query requires iterating over all vertices [(~label = Person AND id = 123)].
For better performance, use indexes
```

I believe is generated by [this line](https://github.com/JanusGraph/janusgraph/blob/ec441ac6d87f3359c9740075786ec6de3651745e/janusgraph-core/src/main/java/org/janusgraph/graphdb/transaction/StandardJanusGraphTx.java#L1276).

I am thinking about modifying that section of code to try and collect stats that will aggregate missing index information to provide value/cost data in adding indexes to a graph.

e.g. it would collect the data and then summarize like this:

```
Over X days missed indexes resulted in:

[(~label = Person AND id = 123)] - 3,500 queries
[(~label = Person AND name = 'aaa')] - 320 queries
[(~label = Person AND profession = 'developer')] - 2 queries
```

The idea is to discover which missing indexes would be more used than others and are worth considering for addition.

There is also the consideration in adding analytics logging to the other side of the `if...else` which records indexes being used to discover existing indexes that are under-utilized and might be removed to reduce their maintenance cost.

Questions:

1. Would this sort of thing be useful for others and should I consider a PR if I am successful in conditionally adding this?
2. Where would you store and analyze this information? (Sending external keeps the footprint of Janus Graph small but requires users to add an external "receiving" end-point etc. so more difficult to use. Keeping in memory would require more code in the code base to maintain but could be configured to only run when the user wants the analytics.)
3. Does something like this already exist? Or how do you currently analyze and optimize indexes in your installation?

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

Start in janusgraph-core/src/main/java/org/janusgraph/graphdb/transaction/StandardJanusGraphTx.java at the referenced warning near line 1276. Review both sides of the index decision and determine what analytics data would be collected and where it could be stored. The issue has no defined acceptance criteria, so the storage, configuration, aggregation, and completion conditions need maintainer agreement first.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.