How to create pseudo document oriented model?

356 views Asked by At

Currently, I am using Rails with Mysql as the backend. Unfortunately, my application has scaled in data which was not expected or foreseen when it started. Now, I am facing a lot of performance issues with increasing entries in the database and ActiveRecord is taking hit due to in-numerous queries that are fired as a result of enjoying the Relational logic.

I have come to a point where I feel like paying penalty for enjoying the advantages of a proper Relational model. Since speed has come under the hammer, I had to do research on Document-Oriented Models like Mongo DB and found that they offer speed compensating the Relational features.

My question here is, how to slowly migrate from Relational model to document model. Perhaps, I will store my temporary schemas or the tables returned and dump them as a bulk document on the fly instead of setting up a proper document-oriented DB (at least during the initial phase). Space is not an issue for me. All I care now is time. But then, I cannot do that in one single sweep. I would like to know how to approach this problem, any links/references where this kind of problem has been solved before would be much appreciated.

1

There are 1 answers

2
thomasfedb On BEST ANSWER

I would highly recommend against migrating to a document db unless your data is better suited to such a database.

Migrating for speed reasons would generally be a bad idea, and you should instead look for slow queries in your existing AR based system and optimise them.