Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-20-2019 07:45 AM
Hi all!
I have a database with 34 labels and i'm using that labels to add properties based on groups.
i.e:
MATCH (x:FST) set x:GRPONE;
MATCH (x:SND) set x:GRPONE;
...
MATCH (x:TRD) set x:GRPTWO;
...
MATCH (x:FRD) set x:GRPTHREE;
...
MATCH (x:GRPONE)-[*]->(:GROUPTWO)<--(:GRPTHREE) SET x.importantPropertie=1;
(the match to set properties sometimes involves counting other properties, relation properties, and more)
Is there any way to create index based on labels (and not properties) to prevent NodeByLabel on matches?
I'm trying another version of my script using a property instead of labels but I can't create (and remove) an index on ALL labels. Is that possible?
Thanks in advance
Regards Juan Pablo
03-20-2019 03:25 PM
I'm not entirely clear on what you're asking.
Indexes are based on label + property, you need both.
And if you want to look up a node by its label and you don't have a property to use for lookup, then it will do a NodeByLabelScan, looking at all nodes for the given label, there's literally no better option, it's literally an index based on labels as you requested.
03-21-2019 08:57 AM
That's exactly what I was asking.
Thanks for the answer and sorry about my English.
All the sessions of the conference are now available online