Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yii Using mongo DB and MySQL at the same time

I'm staring to build a system for working with native languages, tags and such data in Yii Framework.

I already choose MongoDB for storing my data as I think it feets nicelly and will get better performance with less costs (the database will have huge amounts of data).

My question regards user authentication, payments, etc... This are sensitive bits of information and areas where I think the data is relational.

So: 1. Would you use two different db systems? Should I need them or I'm I complicating this? 2. If you recommend the two db approach how would I achieve that in Yii?

Thanks for your time!

PS: I do not intend this question to be another endless discussion between the relational vs non-relational folks. Having said that I think that my data feets mongo but if you have something to say about that go ahead ;)

like image 682
jribeiro Avatar asked May 18 '12 17:05

jribeiro


1 Answers

You might be interested in this presentation on OpenSky's infrastructure, where MongoDB is used alongside MySQL. Mongo was utilized mainly for CMS-type data where a flexible schema was useful, and they relied upon MySQL for transactions (e.g. customer orders, payments). If you end up using the Doctrine library, you'll find that the ORM (for SQL databases) and MongoDB ODM share a similar API, which should make the experimentation process easier.

I wouldn't shy away from using MongoDB to store user data, though, as that's often a record that can benefit from embedded document storage (e.g. storing multiple billing/shipping addresses within a single user document). If anything, Mongo should be flexible enough to enable you to develop your application without worrying about schema changes due to evolving product requirements. As those requirements become more clear, you'll be able to make a decision based on the app's performance needs and types of database queries you end up needing.

like image 146
jmikola Avatar answered Oct 12 '22 01:10

jmikola