Re: index not used for query


Anatoly Belikov <awbe...@...>
 

 Index still doesn't work somehow:

gremlin> g = graph.traversal().withRemote('conf/remote-graph.properties')
==>graphtraversalsource[standardjanusgraph[berkeleyje:/home/noskill/projects/janusgraph-0.4.0-hadoop2/conf/gremlin-server/db/berkeley], standard]
gremlin
> g.V().has('atomhash', '-9032656531829342390').profile()
==>Traversal Metrics                                                                  
Step                                                               Count  Traversers       Time (ms)    % Dur
=============================================================================================================
JanusGraphStep([],[atomhash.eq(-903265653182934...                     1           1         104.252   100.00
   
\_condition=(atomhash = -9032656531829342390)                                                  
   
\_isFitted=false                                                                              
   
\_query=[]                                                                                                
   
\_orders=[]                                                                                                
   
\_isOrdered=true                                                                                          
  optimization                                                                                
0.002                          
  optimization                                                                                
0.022                          
  scan                                                                                        
0.000                          
   
\_condition=VERTEX                                                                                                                
   
\_query=[]                                                                                                                        
   
\_fullscan=true                                                                                                                              
                                           
>TOTAL                     -           -         104.252        -                                    


I created index with:

gremlin> vid = mgmt.getOrCreatePropertyKey('atomhash')
gremlin
> mgmt.buildIndex('byId', Vertex.class).addKey(vid).buildCompositeIndex()
gremlin
> mgmt.commit()

index keys:
gremlin> vindex = mgmt.getGraphIndex("byId")
==>byId
gremlin
> vindex.fieldKeys
==>atomhash
gremlin
> mgmt.awaitGraphIndexStatus(graph, vindex.name()).status(SchemaStatus.ENABLED).call()
==>GraphIndexStatusReport[success=true, indexName='byId', targetStatus=[ENABLED], notConverged={}, converged={atomhash=ENABLED}, elapsed=PT0S]

Just in case: i am using janusgraph with default settings, from this zip file https://github.com/JanusGraph/janusgraph/releases/download/v0.4.0/janusgraph-0.4.0-hadoop2.zip


On Wednesday, 25 September 2019 16:51:56 UTC+3, Abhay Pandit wrote:
Hi Anatoly,

"id" is the internal key used by janusgraph to represent vertex id.
So I would suggest you to add a different key for your use case and build index on it it will work for sure .

Hope this helps :) .

Regards,
Abhay

On Wed, 25 Sep 2019 at 13:26, Anatoly Belikov <aw...@...> wrote:
 The index was created with these commands:

gremlin> vid = mgmt.getPropertyKey('id')
==>id
gremlin
> mgmt.buildIndex('byId', Vertex.class).addKey(vid).buildCompositeIndex()

gremlin
> mgmt.commit()

One sets label constraint with indexOnly, right? I didn't use it.

On Tuesday, 24 September 2019 21:04:04 UTC+3, Kevin Schmidt wrote:
Hi,

How was your index defined?  You've shown that it exists and is enabled but not the creation.  Specifically, did you create it with a label constraint?   If so, your traversal is not including the label and that would be why it isn't used.

Kevin

On Tue, Sep 24, 2019 at 6:56 AM <aw...@...> wrote:
Hello

I have made an index for vertex property "id", the index is enabled, but still it is not used for the query according to the profiler. Please, give me advice on how to make index work.

gremlin> vindex = mgmt.getGraphIndex("byId")
gremlin
> vindex.fieldKeys
==>id

mgmt
.awaitGraphIndexStatus(graph, vindex.name()).status(SchemaStatus.ENABLED).call()
==>GraphIndexStatusReport[success=true, indexName='byId', targetStatus=[ENABLED], notConverged={}, converged={id=ENABLED}, elapsed=PT0.001S]

gremlin
> g.V().has('id', '-9032656531829342390').profile()
==>Traversal Metrics
Step                                                               Count  Traversers       Time (ms)    % Dur
=============================================================================================================
JanusGraphStep([],[id.eq(-9032656531829342390)])                       1           1        2230.851   100.00
   
\_condition=(id = -9032656531829342390)
   
\_isFitted=false
   
\_query=[]
   
\_orders=[]
   
\_isOrdered=true
  optimization                                                                                
0.005
  optimization                                                                                
0.026
  scan                                                                                        
0.000
   
\_condition=VERTEX
   
\_query=[]
   
\_fullscan=true
                                           
>TOTAL                     -           -        2230.851  


--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janu...@....
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/b2f4dd40-1f24-4e9d-944c-f3c8b9b29979%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/a43d10a7-931a-4c28-b196-3947b01aae04%40googlegroups.com.

Join {janusgraph-users@lists.lfaidata.foundation to automatically receive all group messages.