dimanche 1 juillet 2018

Using MySQL JSON-field for a lot of attributes or switch to MongoDB

In my web-application I have vehicles and each vehicle can have a lot of attributes (like color, power, doors etc). Some of these attributes are required by the system (e.g. color and power), others are optional or can be added dynamically by the user (e.g. has_tow_coupling).

Now I wonder wether to use a nosql-solution (in my case mongodb) or stick to mysql and make use of the json-field-type as it can be extended with new attributes easily. I use Laravel, so I can make where queries on those json-fields.

One approach would be to define the required attributes as columns and put all this dynamic stuff in a json-field called attributes. Another try would be, to switch to MongoDB.

On the one hand I worry about performance issues using mysql. On the other hand I don't now, if it would be good to use MongoDB for the whole application as thr rest of the database is not as complex as the vehicles-aspects.

So I have these options:

  1. Stick to MySQL using JSON-field-type
  2. Switch the complete application to MongoDB
  3. Swap vehicles to MongoDB and use MySQL for the rest of the application

My concerns are:

  1. Loss of performance when querying a table with a lot of entries
  2. Ease of learning/learning curve as I have never worked with NoSQL before
  3. Maintainability as parts of the application use mysql while others use mongodb

What would be the best approach to handle my problem?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire