Re: index not used for query


Abhay Pandit <abha...@...>
 

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 <awbe...@...> 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...@....
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.