Database Selection

Created

Choosing between Relational Databases and Non Relational Databases.

Importance:

  • direct influence on overall system performance
  • vital for system scalability
  • ensure long-term system maintainability
  • crucial for maintaining data integrity and consistency

There are a few approaches to considering trade-offs.

Recap: Relational and Non-Relational

Relational database: structured schema, sql-based, ACID

Non-relational databases: flexible schema, variety (document, key-value, graph). The types include

  • document: hierarchical data with complex relationships (user profile, content management)
  • key-value: ideal for scenarios with simple, fast lookups (session storage, user preference)
  • graph: optimize for interconnected data with intricate relationship (social network, recommendation)
  • columnar: beset for operations involving large volumes of data across many rows (analytics, time series.)

Characteristics of Data

Volume: size or amount of data

  • Large datasets: NoSQL databases scale better (e.g., big data applications, user-generated content platforms)
  • Moderate datasets with well defined relationships: use relational. (e.g., ERP systems, centralized corporate databases)

Speed or velocity: speed of data processing and generation

  • high speed data operations: NoSQL database may have better performance (e.g., real-time analytics, IoT sensor data)
  • stable, transaction-oriented systems: relational databases are reliable (e.g., banking systems, inventory management)

Variety: captures the diverse type and sources of data

  • diverse data type: noSQL flexible schema is beneficial (e.g., social media with varied contents)
  • structured data with well defined relationship: relational databases are apt. (e.g., CRM, e-commerce systems)

Transactional vs Analytical

Transactional (OLTP): typically served by relational databases optimized for high transactional rates and real-time data processing. E.g., financial transaction systems (designed for this)

Analytical (OLAP): suited for non-relational databases designed for complex queries and deep data analysis.

CAP theory

Consider the CAP theorem, which represents the trade offs between consistency, availability, and partition tolerance. This also factors into database selection because they differ in which they prioritize, since no system can achieve all three simultaneously.

  • Prioritize consistency: served by relational databases (ACID) (e.g., financial systems (e.g., banking transaction), health care, e-commerce)
  • prioritize availability: typically served by non-relational database (eventual consistency) (e..g, social media platforms with timelines and status updates, streaming services with playback, and e-commerce with their product recommendations,)

Other Factors

Other factors include:

  • security: ensure data privacy.
    • encryption, access controls, compliance requirement
  • cost: initial setup, scaling, maintenance, licensing fee
    • open-source vs proprietary database, cloud vs on-premises
  • community: availability of support, tutorials, and a robust
    • active communities can offer quicker solutions to challenges
  • ecosystem: integration capabilities with other tools, platforms, systems.
    • think about compatibility with current and future systems.