1

I have a decently big ecommerce project with MySQL as DB Server at present. Due to increasing complexity of catalog architecture, I am evaluating MongoDB as DB Server choice for managing products and other catalog data. Rest of data like orders will be managed through MySQL only.

Now, if customer place an order. Then order will contain information of both products bought and order info. In MySQL it is simple as making a join. But what if catalog and orders are managed in different DB, how can I store and pull this data together to show on view?

One solution that I thought of is to create one table in MySQL, which holds basic info of a product and unique id of document of same product in MongoDB. But this will result in data duplication and also another challenge to keeping consistency will emerge.

Is there any better solution for this?

2

1 Answer 1

1

I don't think it'll be very efficient as it'll make your application very chatty. Assuming your data is shared among both mongo and mysql, every time a request is initiated, you need to send two queries (one to mongo and one to mysql). Then your program has to do all the validation and merge the data from two databases and then report it to customer. This will only increase the latency and you'll not be able to utilize the full performance of both databases. I would suggest, better maintain your data in any one of the database

Sign up to request clarification or add additional context in comments.

1 Comment

I can not maintain orders data in MongoDb due to critical writes and transactions involved in its procedure. Hence order management system data should reside in MySQL

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.