Index not being use


Rohit Jain <rohit.j...@...>
 

Hi folks,

So I created an index like so:

gremlin> graph.tx().rollback()
==>null
gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@6843fdc4
gremlin> personid = mgmt.getPropertyKey('personid')
==>personid
gremlin> mgmt.buildIndex('personid', Vertex.class).addKey(personid).unique().buildCompositeIndex()
==>personid
gremlin> mgmt.commit()
==>null

Then I do a query like so, and it gives me a warning that I should use indexes.  Isn't the index use not implicit?  Do I have to do anything specific for it to use the index I just created?

gremlin> g.V().has('personid','640').out('role').inE('role').has('roletype',eq("director")).outV().values('personid')
13:14:45 WARN  org.janusgraph.graphdb.transaction.StandardJanusGraphTx  - Query requires iterating over all vertices [(personid = 640)]. For better performance, use indexes
==>7735

Rohit


Chin Huang <chinhu...@...>
 

Please note "Graph indexes built against newly defined property keys, i.e. property keys that are defined in the same management transaction as the index, are immediately available. Graph indexes built against property keys that are already in use require the execution of a reindex procedure to ensure that the index contains all previously added elements. Until the reindex procedure has completed, the index will not be available." from http://docs.janusgraph.org/latest/indexes.html

You might want to go through the reindex procedure.

On Fri, Aug 11, 2017 at 1:24 PM, Rohit Jain <rohit.j...@...> wrote:
Hi folks,

So I created an index like so:

gremlin> graph.tx().rollback()
==>null
gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@6843fdc4
gremlin> personid = mgmt.getPropertyKey('personid')
==>personid
gremlin> mgmt.buildIndex('personid', Vertex.class).addKey(personid).unique().buildCompositeIndex()
==>personid
gremlin> mgmt.commit()
==>null

Then I do a query like so, and it gives me a warning that I should use indexes.  Isn't the index use not implicit?  Do I have to do anything specific for it to use the index I just created?

gremlin> g.V().has('personid','640').out('role').inE('role').has('roletype',eq("director")).outV().values('personid')
13:14:45 WARN  org.janusgraph.graphdb.transaction.StandardJanusGraphTx  - Query requires iterating over all vertices [(personid = 640)]. For better performance, use indexes
==>7735

Rohit

--
You received this message because you are subscribed to the Google Groups "JanusGraph users list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Rohit Jain <rohit.j...@...>
 

Thanks a lot for the clarification.  However, here is what is happening:

gremlin> mgmt.awaitGraphIndexStatus(graph, 'movieid').call()
==>GraphIndexStatusReport[success=false, indexName='movieid', targetStatus=REGISTERED, notConverged={movieid=INSTALLED}, converged={}, elapsed=PT1M0.094S]

In this state neither can I remove the index or reindex it.

gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@2d2b6960
gremlin> mgmt.updateIndex(mgmt.getGraphIndex('movieid'), SchemaAction.REINDEX).get()
Update action [REINDEX] cannot be invoked for index with status [INSTALLED]
Type ':help' or ':h' for help.
Display stack trace? [yN]N
gremlin> mgmt.updateIndex(mgmt.getGraphIndex('movieid'), SchemaAction.REMOVE_INDEX).get()
Update action [REMOVE_INDEX] cannot be invoked for index with status [INSTALLED]
Type ':help' or ':h' for help.
Display stack trace? [yN]N

Firstly, there is nowhere that I can find where the different states indexes have is discussed or how they get from one state to another.  Then, it is hard for me to know what one can do with an index in a specific state.  Right now, I don't know how this index got in this state but I cannot build this index of course since it already exists, I cannot remove it, and I cannot reindex it.  It does not seem to be used since it is not enabled.  Very frustrating!

Also, I created another index that I misspelled.  I just want to remove it.  But it won't even remove this index since it is in INSTALLED state and not REGISTERED state.  Similar to the one above I guess.  So what am I supposed to do then?

Rohit


Robert Dale <rob...@...>
 

Feel free to add to this issue - https://github.com/JanusGraph/janusgraph/issues/460

Robert Dale

On Sat, Aug 12, 2017 at 5:59 PM, Rohit Jain <rohit.j...@...> wrote:
Thanks a lot for the clarification.  However, here is what is happening:

gremlin> mgmt.awaitGraphIndexStatus(graph, 'movieid').call()
==>GraphIndexStatusReport[success=false, indexName='movieid', targetStatus=REGISTERED, notConverged={movieid=INSTALLED}, converged={}, elapsed=PT1M0.094S]

In this state neither can I remove the index or reindex it.

gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@2d2b6960
gremlin> mgmt.updateIndex(mgmt.getGraphIndex('movieid'), SchemaAction.REINDEX).get()
Update action [REINDEX] cannot be invoked for index with status [INSTALLED]
Type ':help' or ':h' for help.
Display stack trace? [yN]N
gremlin> mgmt.updateIndex(mgmt.getGraphIndex('movieid'), SchemaAction.REMOVE_INDEX).get()
Update action [REMOVE_INDEX] cannot be invoked for index with status [INSTALLED]
Type ':help' or ':h' for help.
Display stack trace? [yN]N

Firstly, there is nowhere that I can find where the different states indexes have is discussed or how they get from one state to another.  Then, it is hard for me to know what one can do with an index in a specific state.  Right now, I don't know how this index got in this state but I cannot build this index of course since it already exists, I cannot remove it, and I cannot reindex it.  It does not seem to be used since it is not enabled.  Very frustrating!

Also, I created another index that I misspelled.  I just want to remove it.  But it won't even remove this index since it is in INSTALLED state and not REGISTERED state.  Similar to the one above I guess.  So what am I supposed to do then?

Rohit

--
You received this message because you are subscribed to the Google Groups "JanusGraph users list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Robert Dale <rob...@...>
 

I created a separate issue to track index tool improvement - https://github.com/JanusGraph/janusgraph/issues/461

Robert Dale

On Sun, Aug 13, 2017 at 8:49 AM, Robert Dale <rob...@...> wrote:
Feel free to add to this issue - https://github.com/JanusGraph/janusgraph/issues/460

Robert Dale

On Sat, Aug 12, 2017 at 5:59 PM, Rohit Jain <rohit.j...@...> wrote:
Thanks a lot for the clarification.  However, here is what is happening:

gremlin> mgmt.awaitGraphIndexStatus(graph, 'movieid').call()
==>GraphIndexStatusReport[success=false, indexName='movieid', targetStatus=REGISTERED, notConverged={movieid=INSTALLED}, converged={}, elapsed=PT1M0.094S]

In this state neither can I remove the index or reindex it.

gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@2d2b6960
gremlin> mgmt.updateIndex(mgmt.getGraphIndex('movieid'), SchemaAction.REINDEX).get()
Update action [REINDEX] cannot be invoked for index with status [INSTALLED]
Type ':help' or ':h' for help.
Display stack trace? [yN]N
gremlin> mgmt.updateIndex(mgmt.getGraphIndex('movieid'), SchemaAction.REMOVE_INDEX).get()
Update action [REMOVE_INDEX] cannot be invoked for index with status [INSTALLED]
Type ':help' or ':h' for help.
Display stack trace? [yN]N

Firstly, there is nowhere that I can find where the different states indexes have is discussed or how they get from one state to another.  Then, it is hard for me to know what one can do with an index in a specific state.  Right now, I don't know how this index got in this state but I cannot build this index of course since it already exists, I cannot remove it, and I cannot reindex it.  It does not seem to be used since it is not enabled.  Very frustrating!

Also, I created another index that I misspelled.  I just want to remove it.  But it won't even remove this index since it is in INSTALLED state and not REGISTERED state.  Similar to the one above I guess.  So what am I supposed to do then?

Rohit

--
You received this message because you are subscribed to the Google Groups "JanusGraph users list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.