Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Phase 2: migrate recent content

START WITH performance?

Node Link

I am designing the graph model at the moment.
I was wondering what is the performance expected for a START WITH query on a indexed String field when there will be a lot of nodes to look in?
Will it be fast enough and use a tree to find the find node I am looking for?

Here is my use-case:
I am trying to model a Folder, File structure system.
I am wondering if I could keep the whole "path" for a File and just drop the Folder entity all-together
That way, I could query all File inside a folder with
Match File Where path Start With "/root/folder"



STARTS WITH will use existing indexes. Those indexes are implemented as trees.

I can't comment on "will it be fast enough" since I don't know your requirements 😉

Maintaining the full path as a property seems like a redundancy since you (well I assume this) have Folder nodes containing other Folder nodes recursively and you have File residing in a Folder. To find anything below a given folder you can use a query like
MATCH (:Folder{name:<whatever>})-[:HAS_CHILD_FOLDER*0..]->(:Folder)-[:CONTAINS_FILE]->(f:File) RETURN f

Node Link

Thanks @stefan.armbruster!

The folder node/entity will be dropped then. It was just storing a set of File, and is not used except for grouping Files together.
I prefer to have less entities and code to maintain, so to find a set of File under a certain path, I could do:
Match (file:File) Where file.path start with "fullPathNameOfFolder"

Thanks for you input and help with this!