🌍 SQL & Databases · subject

SQL & Databases Modern Data Platforms and Scaling Syllabus

The Modern Data Platforms and Scaling syllabus for SQL & Databases in full: 5 chapters and 20 topics, every one listed below, plus 61 Modern Data Platforms and Scaling flashcards with answers.

5Chapters
20Topics
61Flashcards

Modern Data Platforms and Scaling syllabus: all 5 chapters

Expand any chapter to see its topics and sub-topics.

  1. SQL vs NoSQL

    4 topics
    • Relational vs Non-Relational Models
    • NoSQL Categories
    • CAP Theorem and Trade-offs
    • Polyglot Persistence
  2. Scaling Relational Databases

    4 topics
    • Vertical vs Horizontal Scaling
    • Read Replicas and Load Balancing
    • Sharding Strategies
    • Caching Layers (Redis, Memcached)
  3. Data Warehousing and Analytics

    5 topics
    • OLTP vs OLAP
    • Dimensional Modeling
    • Columnar Storage
    • Cloud Data Warehouses
    • ETL vs ELT Pipelines
  4. SQL in the Data Engineering Workflow

    4 topics
    • Analytical SQL Patterns
    • Data Quality and Validation
    • Working with Semi-Structured Data
    • Query Engines (Trino, Spark SQL, DuckDB)
  5. Cloud and Managed Databases

    3 topics
    • Managed Services
    • Serverless Databases
    • Cost and Performance in the Cloud

SQL & Databases Modern Data Platforms and Scaling flashcards — 61 questions with answers

  1. What is the fundamental difference between relational and non-relational (NoSQL) data models?

    Relational models store data in tables (rows/columns) with a fixed schema, enforce relationships via foreign keys, and use SQL. Non-relational models store data in flexible, schema-less structures (documents, key-value, columns, graphs) optimized for scale and varied data shapes rather than strict normalized relations.

  2. What guarantees does the relational model enforce for transactions?

    ACID: Atomicity (all-or-nothing), Consistency (valid state transitions preserving constraints), Isolation (concurrent transactions don't interfere), and Durability (committed data survives crashes).

  3. Name the four main categories of NoSQL databases.

    1) Key-Value stores (e.g., Redis, DynamoDB), 2) Document stores (e.g., MongoDB, Couchbase), 3) Wide-column / column-family stores (e.g., Cassandra, HBase), 4) Graph databases (e.g., Neo4j).

  4. What kind of NoSQL database is best suited for highly connected data with many relationships (e.g., social networks)?

    A graph database (e.g., Neo4j), which stores data as nodes and edges and makes traversing relationships efficient.

  5. State the CAP theorem.

    In a distributed data store, you can simultaneously guarantee at most two of three properties: Consistency (every read sees the latest write), Availability (every request gets a non-error response), and Partition tolerance (the system continues despite network partitions).

  6. When a network partition occurs, which two design choices does CAP force, and what do they mean?

    You must choose CP or AP. CP (consistency + partition tolerance) rejects/blocks requests to avoid stale data. AP (availability + partition tolerance) keeps serving requests but may return stale/inconsistent data.

  7. Why is partition tolerance (P) generally non-negotiable in distributed systems, making CAP a real choice between C and A?

    Network partitions are inevitable in any distributed system, so P must be tolerated. The practical trade-off is therefore between Consistency and Availability during a partition.

  8. What does the BASE model stand for, and how does it contrast with ACID?

    BASE = Basically Available, Soft state, Eventual consistency. Unlike ACID's strict immediate consistency, BASE favors availability and allows data to converge to consistency over time, common in AP NoSQL systems.

  9. Define polyglot persistence.

    An architectural approach of using multiple different database technologies within one application, choosing the best-fit data store for each specific data type or workload (e.g., relational for transactions, a graph DB for relationships, Redis for caching).

  10. What is the difference between vertical and horizontal scaling?

    Vertical scaling (scale up) adds more power (CPU, RAM, disk) to a single machine. Horizontal scaling (scale out) adds more machines/nodes and distributes load across them.

  11. What is a key limitation of vertical scaling and a key advantage of horizontal scaling?

    Vertical scaling has a hard hardware ceiling and a single point of failure. Horizontal scaling can grow near-linearly and adds redundancy, but introduces complexity (data distribution, consistency, coordination).

  12. What is a read replica and what problem does it solve?

    A read replica is a copy of a primary database that asynchronously receives its changes and serves read-only queries. It offloads read traffic from the primary, improving read scalability and availability.

  13. In a primary/replica setup, why can read replicas return stale data?

    Because replication is typically asynchronous, there is replication lag: a replica may not yet have applied the latest writes committed on the primary, so reads can be slightly out of date (eventual consistency).

  14. What is the role of a load balancer in a scaled database/application tier?

    It distributes incoming requests across multiple servers/replicas to prevent any single node from being overloaded, improving throughput, latency, and availability. Common strategies include round-robin, least-connections, and hashing.

  15. Define sharding (horizontal partitioning) in databases.

    Splitting a large dataset horizontally across multiple database nodes (shards), where each shard holds a distinct subset of rows, so the total data and load are distributed across machines.

  16. Compare range-based, hash-based, and directory-based (lookup) sharding strategies.

    Range-based: rows assigned by key ranges (good for range scans, risk of hotspots). Hash-based: shard = hash(key) mod N, giving even distribution but poor range queries and hard resharding. Directory-based: a lookup table maps keys to shards, offering flexibility at the cost of an extra lookup and a potential bottleneck.

  17. What is a 'hotspot' in a sharded system and how is it caused?

    A hotspot is a single shard receiving a disproportionate share of traffic or data, causing uneven load. It arises from a poorly chosen shard key (e.g., monotonically increasing keys or skewed access patterns).

  18. What is consistent hashing and why is it used in sharding/distributed caches?

    A hashing scheme that maps both keys and nodes onto a ring; each key belongs to the next node clockwise. Adding or removing a node only remaps a small fraction (about $\frac{K}{N}$ of keys) rather than nearly all keys, minimizing data movement during rebalancing.

  19. What is a caching layer and why is it added in front of a database?

    An in-memory store (e.g., Redis, Memcached) that holds frequently accessed data to serve reads with very low latency, reducing load on the backing database and improving throughput and response time.

  20. Compare Redis and Memcached.

    Memcached is a simple, multithreaded in-memory key-value cache for strings/objects with no persistence. Redis is single-threaded (per shard) but supports rich data structures (lists, sets, sorted sets, hashes), persistence (RDB/AOF), replication, pub/sub, and Lua scripting.

Show the other 41 Modern Data Platforms and Scaling flashcards
  1. Describe the cache-aside (lazy loading) pattern.

    The application first checks the cache; on a hit it returns the cached value; on a miss it reads from the database, writes the result into the cache, then returns it. The cache is populated only on demand.

  2. Contrast write-through and write-back (write-behind) caching.

    Write-through: writes go to cache and database synchronously, keeping them consistent but adding write latency. Write-back: writes go to cache first and are flushed to the database asynchronously, giving fast writes but risking data loss if the cache fails before flushing.

  3. What is a TTL in the context of caching?

    Time-To-Live: an expiration duration set on a cached entry after which it is automatically evicted/invalidated, ensuring stale data is eventually refreshed from the source.

  4. What is the difference between OLTP and OLAP systems?

    OLTP (Online Transaction Processing) handles many short, frequent read/write transactions (e.g., orders, payments) on current, normalized operational data. OLAP (Online Analytical Processing) handles complex, read-heavy analytical queries aggregating large volumes of historical data for reporting and analysis.

  5. Give three contrasting characteristics of OLTP vs OLAP workloads.

    OLTP: row-oriented storage, highly normalized, many small transactions, low latency per query. OLAP: columnar storage, denormalized/dimensional, few large aggregating queries, high throughput over big scans.

  6. What is dimensional modeling and its core building blocks?

    A data warehouse design technique optimized for analytics, organizing data into fact tables (measurable business events/metrics) and dimension tables (descriptive context like time, product, customer) connected by keys.

  7. Compare the star schema and the snowflake schema.

    Star schema: a central fact table joined directly to denormalized dimension tables (simple, fast joins). Snowflake schema: dimension tables are normalized into sub-dimensions (less redundancy, more joins, slightly more complex).

  8. What is the difference between a fact table and a dimension table?

    A fact table stores quantitative measures (e.g., sales_amount, quantity) plus foreign keys to dimensions, usually many rows. A dimension table stores descriptive attributes used to filter/group facts (e.g., date, product name, region), usually fewer rows.

  9. What is a slowly changing dimension (SCD), and what does Type 2 do?

    An SCD is a dimension whose attribute values change over time. SCD Type 2 preserves history by adding a new row (with effective/expiry dates or a version flag) for each change, keeping old rows intact so historical facts map to the correct attribute values.

  10. What is a grain (granularity) in dimensional modeling?

    The grain defines what a single row of a fact table represents (the level of detail), e.g., 'one row per order line item.' Declaring the grain first is a foundational step in dimensional design.

  11. What is columnar storage and why is it efficient for analytics?

    Data is stored by column rather than by row, so a query reading a few columns scans only those columns. This reduces I/O, enables high compression (similar values grouped together), and speeds up aggregations over large tables.

  12. Why does columnar storage achieve better compression than row storage?

    Values within a single column share the same data type and often have low cardinality or repetition, so encoding techniques like run-length encoding, dictionary encoding, and delta encoding compress them far more effectively than mixed-type rows.

  13. Name two widely used open columnar file formats for analytics.

    Apache Parquet and Apache ORC (Optimized Row Columnar). Both are compressed, columnar, self-describing formats used in data lakes and warehouses.

  14. What is a cloud data warehouse? Give examples.

    A fully managed, elastically scalable analytics database service in the cloud that separates storage and compute for OLAP workloads. Examples: Amazon Redshift, Google BigQuery, Snowflake, Azure Synapse.

  15. What key architectural feature lets modern cloud warehouses (e.g., Snowflake, BigQuery) scale compute and storage independently?

    Separation (decoupling) of storage and compute: data lives in cheap object storage while independent compute clusters/warehouses read it, so each can scale up or down separately and multiple compute engines can query the same data.

  16. What is the difference between ETL and ELT?

    ETL (Extract, Transform, Load) transforms data in a staging area before loading it into the target. ELT (Extract, Load, Transform) loads raw data into the target warehouse first, then transforms it there using the warehouse's compute.

  17. Why has ELT become popular with modern cloud data warehouses?

    Cloud warehouses offer cheap scalable storage and powerful elastic compute, so it is efficient to load raw data first and transform in-place with SQL. ELT preserves raw data for reprocessing and leverages the warehouse's parallelism.

  18. What is a data lake, and how does it differ from a data warehouse?

    A data lake stores raw data of any structure (structured, semi-structured, unstructured) at scale in object storage, schema-on-read. A data warehouse stores cleaned, structured, schema-on-write data optimized for SQL analytics.

  19. What is a 'lakehouse' architecture?

    An architecture combining data lake storage (cheap object storage, open formats) with data warehouse features (ACID transactions, schema enforcement, performance) via table formats like Delta Lake, Apache Iceberg, or Apache Hudi.

  20. In analytical SQL, what does a window function do and how does it differ from GROUP BY?

    A window function computes a value across a set of rows related to the current row (defined by an OVER clause) without collapsing them. Unlike GROUP BY, it returns one output row per input row while still allowing aggregate/ranking computations.

  21. What is the purpose of the OVER (PARTITION BY ... ORDER BY ...) clause in a window function?

    PARTITION BY divides rows into groups within which the function is computed independently; ORDER BY defines row ordering within each partition (needed for ranking, running totals, and offset functions like LAG/LEAD).

  22. Name three common ranking/analytic window functions and how ROW_NUMBER, RANK, and DENSE_RANK differ on ties.

    ROW_NUMBER assigns unique sequential numbers (ties broken arbitrarily). RANK gives tied rows the same rank then skips subsequent numbers (1,2,2,4). DENSE_RANK gives tied rows the same rank with no gaps (1,2,2,3).

  23. How do you compute a running (cumulative) total in analytical SQL?

    Use a window aggregate, e.g., SUM(amount) OVER (ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), which sums all rows up to and including the current one in the defined order.

  24. What are the LAG and LEAD window functions used for?

    They access a value from a previous (LAG) or following (LEAD) row within the partition without a self-join, commonly used for period-over-period comparisons like calculating change from the prior row.

  25. What is a rollup/cube in analytical SQL used for?

    GROUP BY ROLLUP and GROUP BY CUBE generate subtotal and grand-total aggregation rows across multiple grouping levels: ROLLUP produces a hierarchy of subtotals, while CUBE produces subtotals for all combinations of the grouped columns.

  26. List key dimensions of data quality.

    Accuracy, Completeness, Consistency, Timeliness, Validity (conforms to rules/formats), and Uniqueness (no unwanted duplicates).

  27. What is data validation and give examples of validation checks.

    Verifying data meets defined rules before/after loading. Examples: type checks, range/boundary checks, not-null/required checks, format checks (regex, email), referential integrity checks, uniqueness checks, and business-rule assertions.

  28. What is idempotency in a data pipeline and why does it matter?

    An idempotent pipeline produces the same result no matter how many times it runs on the same input (e.g., via upserts or partition overwrites). It matters because it makes reruns and retries after failures safe, avoiding duplicate or corrupted data.

  29. What is schema-on-read versus schema-on-write?

    Schema-on-write applies and enforces a schema when data is written (traditional databases/warehouses). Schema-on-read stores raw data as-is and applies a schema only when the data is queried (data lakes), offering flexibility at the cost of query-time enforcement.

  30. What are common formats for semi-structured data, and what defines semi-structured data?

    Semi-structured data has tags/keys giving it self-describing structure but no rigid tabular schema. Common formats: JSON, XML, Avro, and Parquet (nested). It sits between fully structured (tables) and unstructured (free text/images).

  31. How do modern SQL engines let you query nested JSON columns?

    Via JSON path / dot-and-bracket accessors and functions (e.g., BigQuery/Snowflake path syntax, Postgres ->/->> and jsonb, plus UNNEST/FLATTEN to expand arrays into rows), allowing extraction of nested fields without predefining every column.

  32. What is the difference between the JSON and JSONB types in PostgreSQL?

    JSON stores an exact text copy (preserves formatting/key order, reparsed each query). JSONB stores a decoded binary form that is faster to query, supports indexing (GIN), but does not preserve whitespace or duplicate keys.

  33. What is Trino (formerly PrestoSQL) and its primary use case?

    A distributed, massively parallel SQL query engine designed for interactive analytics that queries data where it lives via connectors (federated queries across data lakes, warehouses, and databases) without moving/copying the data.

  34. What is Spark SQL and how does it fit within Apache Spark?

    Spark SQL is Spark's module for structured data processing that lets you run SQL and DataFrame operations over distributed datasets. It uses the Catalyst optimizer and Tungsten execution engine and is suited to large-scale batch ETL and analytics.

  35. What is DuckDB and when is it a good fit?

    DuckDB is an in-process (embedded) analytical (OLAP) columnar SQL database, often called 'SQLite for analytics.' It's ideal for fast single-node analytics on local files (Parquet/CSV) without a server, embedded directly in applications or notebooks.

  36. How does a query engine like Trino differ from a data warehouse like Snowflake in terms of storage?

    Trino is a compute-only query engine with no storage of its own; it federates queries over external sources via connectors. A warehouse like Snowflake manages its own storage and compute (though decoupled) and optimizes data within its managed format.

  37. What is meant by MPP (Massively Parallel Processing) architecture?

    A shared-nothing architecture where a query is split into tasks executed in parallel across many independent nodes, each with its own CPU/memory/disk, and results are combined. It underpins engines like Redshift, Trino, and Spark for large-scale analytics.

  38. What is a managed (fully managed) database/data service?

    A cloud provider operates the infrastructure, handling provisioning, patching, backups, replication, scaling, and high availability, so users focus on data and queries rather than server administration (e.g., Amazon RDS, BigQuery, DynamoDB).

  39. What is the difference between IaaS-style self-managed databases and serverless managed databases?

    Self-managed (on VMs/IaaS) requires you to handle installation, scaling, patching, and backups. Serverless managed services (e.g., BigQuery, Aurora Serverless, DynamoDB on-demand) auto-scale compute, require no capacity planning, and bill per usage/query.

  40. What trade-off do you accept when choosing a managed cloud database service?

    You gain reduced operational burden, built-in HA/scaling, and reliability, but accept less low-level control, potential vendor lock-in, and usage-based cost that can grow with scale.

  41. Why might an application use both a relational database and a NoSQL store together (polyglot persistence example)?

    To match each workload to the best-fit engine: e.g., a relational DB for transactional order data needing ACID guarantees, a document store for flexible product catalogs, a graph DB for recommendations, and Redis for session caching, maximizing performance for each use case.

SQL & Databases Modern Data Platforms and Scaling FAQ

What is in the SQL & Databases Modern Data Platforms and Scaling syllabus?

SQL & Databases Modern Data Platforms and Scaling is split into 5 chapters: SQL vs NoSQL, Scaling Relational Databases, Data Warehousing and Analytics, SQL in the Data Engineering Workflow and Cloud and Managed Databases. Together they contain 20 topics.

How many chapters are in SQL & Databases Modern Data Platforms and Scaling?

5 chapters, containing 20 topics. The largest chapter is Data Warehousing and Analytics, with 5 topics.

Are there flashcards for SQL & Databases Modern Data Platforms and Scaling?

Yes — a 61-card Modern Data Platforms and Scaling deck, printed in full in the flashcards section of this page and available in the Examius app with spaced repetition. The free plan covers one exam of your choice, including its flashcards; Examius Pro, a one-time purchase, unlocks every other exam and deck.