Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combination of postgresql and neo4j for networking site

We are designing a networking site where data would be connected to each other in complex way. We plan to use Neo4j so that we could escape costly join otherwise required. Since neo4j is specifically designed for graph like data so it seems suitable.

however we have realized that although neo4j is fast in some aspect but the representation of Relational data is best done through relational database. So its like we plan to use neo4j at some of the functionality and postgresql at other functionality.

For example-- We would use neo4j for finding relevant feeds to user by searching through different nodes which he follows. While for other activities like updating profile information etc we would like to use postgresql. We did some performance testing for profile information updation and found that postgresql is faster than neo4j. While analyzing feed data, neo4j is much much faster.

Now my question is have anyone used combination of databases like this before. Specifically neo4j with postgresql. We do find some problems while integrating different databases but we find it worth it.

Please share your experience and feedback. Thanks

like image 689
tibet_lama Avatar asked Nov 14 '13 04:11

tibet_lama


1 Answers

Being that Neo4j is a graph database and PostgreSQL is a relational database, you are headed in the correct direction. Many applications have been developed that used a NoSQL database (including Neo4j) because of their strengths in specific application areas. Other places I have worked used PostgreSQL or Oracle to store relational data and Lucene/Solr for text data as well as MongoDB for documents.

You need to separate out the responsibilities of each type of database in terms of types of data clearly.

If you make copies of data from one of them into the other (e.g. Neo4j data is copied to PostgreSQL for reporting purposes), make sure that you have data expiration policies in place or have some sort of refresh of that data happening in a reliable and predictable fashion.

Finally, you may or may not want some sort of "transaction" concept that will cross databases in that if one transaction includes two parts of data, one stored in Neo4J and the other in PostgreSQL, that the system guarantees that if you can find it in PostgreSQL, you MUST be able to find the other part in Neo4J and vice versa.

like image 174
4wardobserver Avatar answered Sep 28 '22 18:09

4wardobserver