quartz/content/BigData/RDBMS.md
2025-07-23 20:36:04 +03:00

1.7 KiB
Raw Blame History

Database Overview

What is an RDBMS?

Relational Database Management System:

  • Data is stored in tables:

    • Rows = records
    • Columns = fields
  • Each table has:

    • Indexes for fast searching
    • Relationships with other tables (via keys)
Relational model - Keys and Indexes

Ability to find record(s) quickly

  • Operations become efficient:
    • Find by key → O(log n)
    • Fetch record by ID → O(1)

Indexes = sorted references to data locations → like a book index.

Relational model - Operations

Relational databases support CRUD:

  • Create
  • Read
  • Update
  • Delete

Each operation uses both:

  • The index (to locate data)
  • The data itself (to read/write)
Relational model - Transactional

Relational databases guarantee transaction safety with ACID:

  • Atomicity all or nothing
  • Consistency valid data only
  • Isolation no interference from other transactions
  • Durability survives crashes
  • Examples:
    • Transferring money, Posting a tweet
    • Both must either succeed completely or fail completely.

Transactions guarantee data validity despite errors & failures

Relational model - SQL

SQL is the language used to talk to relational databases.

  • Standard

  • Query

  • Language

  • All RDBMSs use it (MySQL, PostgreSQL, Oracle, etc.)

 Pros and Cons of RDBMS

Pros:

  • Structured data
  • ACID transactions
  • Powerful SQL
  • Fast (for small/medium size)

Cons:

  • Doesnt scale well (single machine or SPOF = Single Point of Failure)
  • Becomes slow with big data
  • Less fault tolerant
  • Not designed for massive, distributed systems