Database

  • first SQL Database - 1975 by IBM System R

Topics

  • N+1 query problem
  • Datatypes
  • Pagination
  • Sharding real implementation
  • Replication

Data Model

  • The Data model is specified as a collection of conceptual tools for describing data, data relationships, data semantics and constraints.
  • There are number of data models:
    • Hierarchical data model
      • Represent Data as Tree of records with nesting similar to JSON
      • developed for IBM IMS (information Management System)
      • worked well for one to many relationships
    • Network model
      • aka CODASYL model
      • standardized by CODASYL (Conference on Data Systems Languages)
      • similar to Hierarchical model tree but each record can have multiple parents
      • need to remember the access path to each record from the root record
      • manual navigation using cursor was possible but query language was complicated
    • Relational model
      • No need to remember access path
      • Query optimizer automatically figure out the efficient access path
    • Entity-Relationship model and so on.

Abstraction

Physical Level

  • It is the lowest level and is managed by DBMS.
  • This level consists of data storage descriptions and the details of this level are typically hidden from system admins, developers, and users.

Conceptual or Logical level

  • It is the level on which developers and system admins work and it determines what data is stored in the database and what is the relationship between the data points.

External or View level

  • It is the level that describes only part of the database and hides the details of the table schema and its physical storage from the users.
  • The result of a query is an example of View level data abstraction.
  • A view is a virtual table created by selecting fields from one or more tables present in the database.