I often hear remarks such as “god forbid” when people talk about NoSQL solutions like MongoDB. Honestly I don’t understand why. Is it so much likely to shoot a leg using dynamic schema, rather then using complex migrations?
It is my understanding that SQL was designed to optimise computation usage. Well, present time brought us new conjuncture—computer resources are cheaper then human resources. And if you prefer strictly structured models over flexible schema, in my opinion you are gonna waste your people on:
- Carefully design models and relations (which are still going to change over time)
- Fight migration complexity at build-time
- Explaining interns (one of which I am) such terms as ‘normalisation’ and ‘relates-trough-resource’
And most importantly, from my point of view, you are going to lose that development rapidness that noSQL adopters have with their data.
Explain me why I am wrong?
The main benefit of NoSQL is not its rapidness or schema-less approach rather its horizontal scale-ability . When you have a huge data its hard to maintain a database in multiple server. But in NoSQL because of its design its easier.
If you use something like activerecords for a small to medium scale databse NoSQL has no advantage.
Sharding strategies, clustering, memcache, table partitioning are all ways to solve scaling problems at a point in time that you might need it.
As an application developer the schema is always “fixed” regardless of what backs it up. I don’t gain a lot of benefits of NoSQL in 99% of my application space because my application code has to have a concrete implementation to base my logic on. Or it seems I have to always be considerate of property checks between versions of “schemas” in the NoSQL database. Does this entity have this property? If so do A, else do B. That seems like a bigger headache to me as a developer than any migration I have run.
- Whether you define it at the database level or the code level, it seems you still have to define it somewhere?
- Maybe you could explain the migration complexity issues you are seeing so I can understand that point explicitly and maybe address it.
- As an intern understanding the basics of SQL is probably something you should be aware of and IMO is an important step to you becoming an effective developer as you continue your journey. I would guess that a great majority of applications use relational databases and you will have to interface with them in some way or another along your way. They are not going away any time soon
There are definite appropriate uses for NoSQL databases. With the addition of indexable JSONB columns in PostgreSQL, I have all but eliminated the use cases I have run across where I thought, “oh this would be nice if I could store arbitrary data here and query it”.