RDBMS - rFronteddu/general_wiki GitHub Wiki
Relational Databases (RDBMS)
Best Use Cases:
- Structured Data: Ideal for applications with highly structured data and well-defined relationships.
- Example: Financial Systems: A banking application needs to store and manage account balances, transactions, and customer details. The structured nature of this data, along with the need for complex queries and strong consistency, makes a relational database a good fit.
- ACID Transactions: Essential for applications requiring reliable and consistent transactions.
- Example: E-commerce Platforms: An online store needs to ensure that inventory levels, order placements, and payments are handled correctly and consistently. ACID transactions are crucial to prevent issues such as double-charging or selling out-of-stock items.
- Complex Queries: Suitable for applications needing complex queries and joins across multiple tables.
- Example: Reporting Tools: A business intelligence system generates reports that aggregate and analyze data from multiple sources, such as sales, marketing, and finance. Relational databases excel in handling the complex joins and aggregations required for these reports.
Limitations
- Scalability: Vertical scaling can be expensive and limited by hardware constraints. Horizontal scaling is more complex. Maintaining ACID properties in a distributed environment requires complex coordination and can significantly impact performance and scalability.
- Example: Large-scale Social Networks: Handling the vast amount of user data and interactions on a social network like Facebook would be challenging with a relational database due to scalability issues.
- Flexibility: The rigid schema makes it difficult to adapt to changes.
- Example: Rapidly Evolving Applications: Startups often iterate quickly on their product features and data models. Making frequent schema changes in a relational database can be cumbersome and time-consuming.
- Handling Unstructured Data: Not ideal for unstructured or semi-structured data without significant overhead.
- Example: Log Management: Storing and querying logs, which can have varied and evolving structures, would be inefficient in a relational database.
Why Another Might Be Better:
- Document Databases: Offer greater flexibility and ease of handling unstructured data. The schema-less nature allows for rapid changes and iteration.
- Example: Content Management Systems (CMS): A CMS needs to handle various content types, from articles to multimedia, each with different structures. Document databases are more suited to this flexibility.
- Graph Databases: Provide superior performance for querying complex and deeply interconnected data.
- Example: Recommendation Engines: Services like Netflix or Amazon use recommendation engines to suggest content or products based on user preferences and behaviors. Graph databases efficiently handle the complex relationships in these datasets.
DBMSs are harder to scale due to their strict adherence to ACID properties, fixed schema, data normalization (minimize redundancy to increase data integrity and reduce storage cost), and reliance on complex join operations (which can require lots of data shuffling, especially in distributed setup). These systems prioritize strong consistency (ensure that all user have the same view of the data typically requires complex consensus algorithms (2-phase commit, raft..)) and transaction integrity, which complicates horizontal scaling and distributed processing. Techniques like replication and sharding add complexity and potential performance issues. In contrast, NoSQL databases, with more flexible schemas and relaxed consistency models, are designed to scale more easily and handle large volumes of data across distributed systems.