Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

neo4j - graph database along with a relational database?

this is a question on best practice, i understand that there are a lot of different options for doing this, but i would like your opinions as to how you would approach solving this problem. Please take it as though performance is critical in this system, in other words scalable.

I have recently found the wonders of graph database, so i came up with a theoretical situation where a company wants to manage it's customers relationships, and in order to do so they are going to use neo4j which is great, and allows for really great management of the customers, different staff members and their relationships, which is all great, however the company now wants to create a web based interface which will need authentication, and anyone in the neo4j database should be able to login to the system in order to see how they are related to other people in the company's database, so each user must have a password/email/id associated with their name.

So my question is, in this case scenario, is it best to store the password_hash/password_salt/id/email in a mysql database and then based on the node look it up on the mysql database. Or is it better to store the password_hash/password_salt/id/email in the hash tables inside the nodes.

Also each store has 1000s of products, and they can be stored in the graph database or i can store the products in the mysql database and then look up the product there, and do the changes there, because the products are not related to each other, so no point in storing them in the graph database, so should they be not stored there to improve performance?

So my question boils down to this: is it best for large projects to use a graph database along with the more common rdms database such as mysql? if not, then what is the point at which you start to use these two database systems?

apologies in advance for my lack of knowledge regarding database terminology.

like image 881
mur Avatar asked Jul 03 '12 11:07

mur


People also ask

Is Neo4j relational database?

Neo4j is a property graph, and has the following characteristics: It contains nodes and relationships. Nodes contain properties (key-value pairs) Relationships are named and directed, and always have a start and end node.

Is a graph database a relational database?

relational database. The most notable difference between the two is that graph databases store the relationships between data as data. Relational databases infer a focus on relationships between data but in a different way.

How is graph database different from relational database?

The main difference between these two types of databases is in the way relationships between entities are stored. In a graph database, relationships are stored at the individual record level, while a relational database uses predefined structures, a.k.a. table definitions.

Can you store data as nodes and relationships in Neo4j?

Neo4j is often described as schema optional, meaning that it is not necessary to create indexes and constraints. You can create data — nodes, relationships and properties — without defining a schema up front.


1 Answers

Graph DB is mainly used for maintaining relations. If app has a graph DB that does not mean that app needs to store everything in Graph DB.

Every node request on Graph is in memory and thus if you have unnecessary properties in your node it will be bloated and may make things slower and take more memory.I usually decide what needs to go in graph and what needs to go in DB by very simple rule.

High level property (that defines the relation and other important properties that defines the node) goes in graph whereas additional information goes in RDMS.

For example in FB may be FBID, Name goes in Graph as it defines the relationship of one node with another. But when user clicks on someones facebook ID, he/she gets to see other users DOB, Age , College .All these can go in RDBMS.

PS: RDMS has another advantage, it can be used for quick analytics. I know with graph also you can do that but i am not sure if its as scalable and easy as RDBMS.

Downside to this approach is : You need to maintain two DBS.

like image 62
user2756260 Avatar answered Oct 04 '22 01:10

user2756260