Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-20-2020 09:07 PM
Greetings,
How to decide between Node or a property on a node for performance.
I have a label called : Customer and there will be about 80 million are so nodes of this type. They all have the properties called Country, State and City along with other properties like firstname, lastname, contact_phone etc. My request for information about customer and other related data about this customer starts with either passing Country + State or they can start with supplying Country + State + City. Should I create these as nodes and connect them with customer nodes or should I just leave them as properties on customer node and use them in where clause where I am retrieving customers with where clause using those properties. What is best for performance ? Planning on creating indexes on these three properties to make it faster. Is there a downside to this?
Thanks a bunch.
04-21-2020 07:18 AM
Hi there, if you plan on grouping Customers by Country, City or State I would certainly model these concepts as separate nodes and connect Customers to them. This would enable you to make matches more elegantly and also avoid issues where spelling of city/country names are inconsistent due to bad input. Just use the data from Country in the UI where customers can select the correct node and connect them to it.
04-21-2020 06:03 PM
Also consider if you want these nodes to be standalone, or if you want them linked (city in a state in a country). If linked, be aware that you will need multiple city nodes of the same name to represent cities with the same name that are in different states (Springfield, for example). In a hierarchical structure you do not want to represent these with a single node for all Springfields.
You will have to be careful in how you MERGE and MATCH entries here, as that will have to be in a pattern including the state and/or country, otherwise you end up pulling in unrelated cities in different states or countries
04-23-2020 03:35 PM
Good point, had that challenge in one of my earlier projects and fixing it afterwards is no fun.
All the sessions of the conference are now available online