Lesson 2 of 5 · Database Administration Fundamentals

Database Systems

What databases and DBMSs are, how data management evolved from flat files to relational and NoSQL, the major relational platforms, OLTP and OLAP workloads, and data warehouses versus data lakes.

Beginner 7 sections 14 min read

What's a database

A database is an organized collection of data, stored so it can be found, updated, and protected easily. Almost every app and service you use runs on one.

In the modern world, data is one of the most valuable things a business owns. Customer accounts, orders, payments, medical records, and flight bookings all live in databases. If the database is slow, the app is slow. If it's down, the business stops. If it's lost, the business may never recover.

Databases Banking balances and payments Online shopping products and orders Social media posts, likes, messages Streaming what to watch next Healthcare patient records Maps & rides places, routes, trips

A few moments from an ordinary day, each one a database at work:

  • Paying with a card. The bank's database checks your balance, records the payment, and updates your account in a fraction of a second.
  • Shopping online. The store's database holds every product, price, and stock count, plus your cart and order history.
  • Streaming a show. The service remembers where you stopped watching and uses your history to recommend what's next.
  • Visiting a doctor. Your medical history, prescriptions, and test results come from the clinic's database.
  • Booking a ride. The app stores drivers' locations, your trip, the route, and the fare.

From data to information

Data is raw facts: one row per order, payment, or click. On its own, a single row says very little. Information is what you get when you ask the data a question and get a useful answer, such as "Which product sold the most this month?"

A database stores data in a structured way so it can be queried later: searched, filtered, grouped, and totaled in seconds, even when there are millions of rows.

orders iditemamount 1001Coffee4.50 1002Bagel3.00 1003Coffee4.50 1004Tea3.50 1005Coffee4.50 Data: raw facts, row by row QUERY total sales by item Sales by item Coffee 13.50 Tea 3.50 Bagel 3.00 COFFEE IS THE TOP SELLER Information: an answer you can act on

What's a DBMS

A database management system (DBMS) is the software that creates and manages databases. People and applications never read the data files directly; they send requests to the DBMS, and it does the work.

Users & apps send requests DBMS stores and retrieves data runs queries controls access keeps data consistent backs up and recovers Database the stored data
The DBMS sits between people and the data. The DBA's job is to keep that layer healthy.

"Database" and "DBMS" are often used interchangeably in conversation. Strictly speaking, the database is the data, and the DBMS is the software that manages it. Oracle, SQL Server, PostgreSQL, MySQL, and MongoDB are all DBMSs.

From flat files to relational to NoSQL

There are several approaches to storing and managing data. Each one appeared to solve the biggest problem of the approach before it.

1960s 1970s–80s LATE 2000s Flat files Relational NoSQL SOLVED Kept records on disk instead of on paper LIMITS Duplicate data, no safe shared access SOLVED Linked tables, SQL, and safe transactions LIMITS Fixed schemas, hard to spread across servers SOLVED Flexible data that scales out across many servers LIMITS Fewer joins, and often looser consistency
Flat files
Data is kept in plain files, such as text or CSV files, with one record per line. Each program reads and writes its own files. This was a big step up from paper, but the same data (a customer's name and address, for example) gets copied into many files, the copies drift out of sync, and two people updating the same file at once can corrupt it.
Relational databases
In 1970, IBM researcher Edgar F. Codd proposed storing data in tables (relations) made of rows and columns, linked to each other by shared keys. Each fact is stored once, and SQL (Structured Query Language) became the standard way to query it. A relational DBMS (RDBMS) also guarantees safe transactions: a bank transfer either fully happens or doesn't happen at all, even if the server crashes halfway through.
NoSQL databases
As web companies grew to millions of users in the 2000s, they needed to store huge amounts of fast-changing data across many cheap servers. NoSQL ("not only SQL") databases relax the strict table structure: they store documents (MongoDB), key-value pairs (Redis), wide columns (Cassandra), or graphs (Neo4j). They scale out easily and handle data whose shape changes often, but usually give up some of the joins and strict consistency that relational databases offer.

Here's the same customer and their orders stored each way:

Flat file Relational NoSQL document orders.txt Kofi,Accra,Coffee Kofi,Accra,Tea Kofi,Accra,Bagel customers 1111 KofiAccra orders Coffee Tea Bagel { "name": "Kofi", "city": "Accra", "orders": [ "Coffee", "Tea", "Bagel" ] } Customer repeated on every line Stored once, linked by id Orders nested inside

The major relational platforms

Today, when people say "database", they usually mean a relational database (RDBMS). Four platforms dominate the market:

Oracle Database SQL Server PostgreSQL MySQL Oracle Corporation Microsoft PostgreSQL community Oracle Corporation since 1979 since 1989 since 1996 since 1995 Commercial Commercial Open source Open source + paid
PlatformOwnerLicenseGood to know
Oracle DatabaseOracle CorporationCommercial (proprietary). A free, limited edition, Oracle Database Free, is available for learning and small projects.The first commercial SQL database, released in 1979. Widely used by large enterprises, banks, and governments.
Microsoft SQL ServerMicrosoftCommercial (proprietary). The free Express edition is limited in size, and the free Developer edition is for development and testing only.Popular with companies that run Microsoft technologies. Runs on Windows and, since 2017, on Linux. Its cloud version is Azure SQL Database.
PostgreSQLThe PostgreSQL Global Development Group, a volunteer community; no single company owns itOpen source and free, under the permissive PostgreSQL License.Grew out of the POSTGRES project at the University of California, Berkeley, which started in 1986. Known for its standards support and extensions, and used by many cloud database services.
MySQLOracle Corporation (it bought Sun Microsystems, which had bought MySQL AB, in 2010)Open source: the free Community Edition is under the GPL, and Oracle also sells a paid Enterprise Edition.A long-time favorite for websites and web apps. MariaDB is a popular open source fork created by MySQL's original developers.

All four speak SQL, so the core skills carry over. Each has its own tools, features, and SQL extensions, and DBAs often specialize in one or two.

OLTP vs OLAP workloads

Databases do two very different kinds of work, called workloads:

OLTP (online transaction processing)
Runs the business. It handles a constant stream of small, fast operations: insert an order, update a balance, look up one customer. Thousands of users can be doing this at the same time, and each operation must finish in milliseconds.
OLAP (online analytical processing)
Studies the business. It runs fewer but much larger queries that scan and summarize millions of rows, often across years of history, to answer questions such as "How did sales change this quarter in each region?"

A real-life example

Kofi orders a coffee in a coffee chain's app. In well under a second, the app's OLTP database records the order, charges the card, adds loyalty points, and reduces the store's stock. Thousands of customers are doing the same thing at the same moment.

The company also wants to know which drinks sell best, in which stores, at what time of day. Running those big questions on the OLTP database would slow down the app for customers, so the company copies the data into a separate analytical database called a data warehouse, using a process called ETL.

Extract
Pull the new data out of the source systems: orders, payments, the loyalty program, and store lists.
Transform
Clean and reshape it: fix errors, remove duplicates, convert currencies, and combine data from different systems into a consistent format.
Load
Write the result into the data warehouse, often on a schedule such as every night.
Customers buy, pay, book OLTP orders, payments ETL Extract Transform Load OLAP data warehouse Analysts reports, dashboards Many small, fast writes, all day Runs on a schedule, often nightly Big reads across years of history RUN THE BUSINESS STUDY THE BUSINESS
OLTPOLAP
PurposeRun day-to-day operationsAnalyze trends and support decisions
Typical operationInsert, update, or look up a few rowsScan and summarize millions of rows
UsersCustomers and employees, through applicationsAnalysts, managers, and data scientists
Speed that mattersMilliseconds per transactionSeconds to minutes per query is normal
DataCurrent, constantly changingHistorical, loaded in batches and rarely changed
DesignNormalized: each fact stored once, to keep writes fast and safeDenormalized, such as a star schema, to make big reads fast

How analytics evolved: warehouses and lakes

OLTP is still almost always handled by a relational database, because it's built for fast, safe transactions. The analytical side has changed much more:

  1. Reports on the live database. Early on, companies ran reports directly against their OLTP systems, and slowed them down for everyone.
  2. Data warehouses (1990s onward). A separate database, designed for analysis, holds cleaned and structured history from across the business.
  3. Data lakes (2010s onward). As companies collected huge amounts of logs, clickstreams, images, and sensor data that didn't fit neatly into tables, they started storing it all in cheap storage in its raw form, first on Hadoop clusters and now mostly in cloud object storage.
  4. Lakehouses (2020s). Newer platforms combine the two, adding warehouse-style tables and SQL on top of data lake storage.
Business apps sales, CRM, finance, HR ETL clean and shape Data warehouse structured tables BI reports business analysts SCHEMA ON WRITE: SHAPE THE DATA, THEN STORE IT Everything else logs, clicks, images, sensors, JSON files Ingest store as-is Data lake raw files, any format Data science ML and exploration SCHEMA ON READ: STORE THE DATA, SHAPE IT WHEN USED
Data warehouseData lake
What it storesStructured, cleaned data in tablesAny data in its raw form: tables, JSON, logs, images, video
SchemaSchema on write: data is shaped before it's loadedSchema on read: data is shaped when someone queries it
Main usersBusiness analysts and managersData scientists and data engineers
Typical useReports, dashboards, and business intelligence (BI)Machine learning, exploration, and keeping everything for later
Storage costHigher per gigabyteLow, using cloud object storage
ExamplesSnowflake, Amazon Redshift, Google BigQuery, Azure Synapse AnalyticsAmazon S3, Azure Data Lake Storage, Google Cloud Storage

Popular data warehouse platforms

Most new data warehouses run in the cloud, where storage and computing power can grow as needed. A few long-standing platforms still run in companies' own data centers:

Snowflake Amazon Redshift BigQuery Azure Synapse Snowflake Inc. Amazon Web Services Google Microsoft since 2014 since 2013 since 2011 since 2019 Multi-cloud Cloud service Cloud service Cloud service
PlatformOwnerLicenseGood to know
SnowflakeSnowflake Inc.Commercial cloud service; storage and computing are billed separately.Runs on AWS, Azure, and Google Cloud. Keeps storage and computing separate, so each can scale on its own.
Amazon RedshiftAmazon Web Services (AWS)Commercial cloud service.AWS's data warehouse, with a SQL dialect based on PostgreSQL. Redshift Spectrum can query files directly in Amazon S3.
Google BigQueryGoogleCommercial cloud service; pay for the data each query scans, or reserve capacity.Serverless: there are no servers to size or manage. Can query files in Google Cloud Storage without loading them first.
Azure Synapse AnalyticsMicrosoftCommercial cloud service.Combines a SQL data warehouse with Apache Spark. Microsoft is steering new analytics projects toward Microsoft Fabric, launched in 2023, which includes its own warehouse.
TeradataTeradata CorporationCommercial (proprietary).One of the original enterprise data warehouses, sold since the 1980s. Still common in large banks, retailers, and telecom companies, and now also offered in the cloud.

The line between warehouses and lakes is blurring. Snowflake, BigQuery, and Redshift can all query files stored in a data lake, and lake platforms keep adding warehouse features.

Popular data lake platforms

Most data lakes today are built on cloud object storage, the same low-cost storage used for backups and files. Each major cloud has its own, and platforms such as Databricks add tools on top for processing and querying the data:

Amazon S3 Azure Data Lake Cloud Storage Databricks Amazon Web Services Microsoft Google Databricks, Inc. since 2006 since 2016 since 2010 since 2013 Cloud storage Cloud storage Cloud storage Lakehouse
PlatformOwnerLicenseGood to know
Amazon S3Amazon Web Services (AWS)Commercial cloud service; you pay for what you store and read.The most widely used storage for data lakes. AWS Lake Formation adds a catalog and access controls, and Amazon Athena queries the files with SQL.
Azure Data Lake StorageMicrosoftCommercial cloud service.Built on Azure Blob Storage, with real folders for organizing data. Used with Azure Synapse Analytics, Azure Databricks, and Microsoft Fabric.
Google Cloud StorageGoogleCommercial cloud service.Google Cloud's object storage. BigQuery can query lake files in place, and Dataproc runs Spark and Hadoop jobs on them.
DatabricksDatabricks, Inc., founded by the creators of Apache SparkCommercial platform, built on open source projects such as Apache Spark and Delta Lake.Runs on top of the storage of AWS, Azure, or Google Cloud. Popularized the lakehouse approach, combining lake storage with warehouse-style tables and SQL.
Apache Hadoop (HDFS)The Apache Software FoundationOpen source and free, under the Apache License 2.0.The original data lake technology, run on a company's own servers. Many companies have since moved their lakes to cloud storage.

One company, both tools

An online retailer uses its data warehouse for the weekly sales report: revenue by region, top products, and returns, built from clean order data that ETL loads every night. The same retailer keeps every website click, search, and product image in its data lake, where data scientists use it to train the model that recommends products to each shopper.

Lakehouse platforms, such as Databricks and open table formats like Apache Iceberg and Delta Lake, aim to give you a warehouse's reliable tables and SQL on top of a lake's cheap, flexible storage.

Where the DBA fits

Analytics is often owned by data engineers and analysts, but DBAs play a key part in keeping it safe and reliable:

  • Protect the source systems. Schedule and tune ETL jobs so pulling data out doesn't slow down the OLTP databases customers depend on. Running extracts against a replica, instead of the main database, is a common approach.
  • Control access. Decide who can read which data in the warehouse and the lake, and apply the same security rules there as in production.
  • Protect sensitive data. Make sure personal and financial data is masked or removed before it's copied into analytical systems, to stay compliant with laws such as GDPR and HIPAA.
  • Manage retention and cost. Decide how long data is kept, and clean up what's no longer needed, since cloud warehouses and lakes are billed for every gigabyte stored and every query run.

Key takeaways

  • A database is an organized collection of data. Querying it turns raw data into useful information.
  • A DBMS is the software that manages databases. Data management moved from flat files to relational databases to NoSQL, each solving the previous approach's biggest problem.
  • Oracle Database and SQL Server are commercial; PostgreSQL and MySQL are open source. All four are relational and use SQL.
  • OLTP runs the business with many small, fast transactions. OLAP studies the business with large analytical queries, fed by ETL.
  • Data warehouses hold structured, cleaned data for reporting; data lakes hold raw data of any kind for data science. Lakehouses combine the two.
  • DBAs keep analytics safe: protecting source systems from ETL load, controlling access, masking sensitive data, and managing retention and cost.