SQL or/with Nosql
Mystic last edited by
I am designing a mobile app with basic functionality such as sign-up, Auth, posts, real time messages etc. I think for this kind of work Nosql should work better. But over a long period of time I want to introduce payment transaction as well. Due to eventual consistency NoSql should be a problem here (I may be wrong). So can I use SQL only for transactions with userid field from Nosql user data. Is it a good practice to mix both.
I know I could use SQL database from start but I think NoSql will be a good fit based on factors such as scaling, distributied database etc.
PS: I am also a software developer but worked mostly on Machine Learning and computer vision. Didn't work much on databases.
So can I use SQL only for transactions with userid field from Nosql user data. Is it a good practice to mix both.
I don't believe it's a good idea to couple two different database systems, especially different types of database systems (RDBMS and NoSQL) so closely together for related use cases. It'll prove difficult to manage, and be hard to maintain consistency across the database systems (especially with a NoSQL system that is likely not ACID compliant).
I think NoSql will be a good fit based on factors such as scaling, distributied database etc.
RDMBS can scale just as well as NoSQL databases. Typically, from a hardware perspective, RDBMS scale vertically whereas NoSQL databases scale horizontally, but there's no inherent benefit of one methodology over the other. There's also RDBMS that scale horizontally, just as well as NoSQL database systems being able to scale vertically.
From a software perspective, the performance of scaling as the data grows depends mostly on how one architects their database and negligibly on the actual database system chosen, since most modern database systems can handle trillions of records over petabytes of data in a single logical storage unit (e.g. a table or document).
I am designing a mobile app with basic functionality such as sign-up, Auth, posts, real time messages etc.
When to choose a NoSQL database system over a RDBMS depends on a number of factors, none of which I would say primarily involve performance. But one of the main factors that is useful for determining when to choose which type of database system is based on the fact of if you have a well defined schema.
NoSQL databases are great for storing data that doesn't have a concrete schema, are liable to change in structure at free will / outside of your control, or where the rate at which the structure will change exceeds your tolerance as a developer to maintain the structure in the data layer. It sounds like you have some level of a concrete schema, so a RDBMS could work for your use cases, but you should also think about if the structure of your models are liable to change frequently or outside of your control, and if you as a developer don't want to manage maintaining those changes in the data layer.
In short, NoSQL databases are great for deferring when you need to concretely define the structure of your data until it is consumed in the application layer. But they are not necessarily inherently better at scaling, distributing, or performance. Unfortunately there's a lot of misconception on the internet regarding that.