Fireship · @fireship

7 Database Paradigms

Uploaded September 3, 2020 · Length 9:53

7 Database Paradigms

Summary

This video explains the 7 main database paradigms, including key-value, wide-column, document-oriented, relational, graph, time-series, and multi-model databases, and their use cases.

  • database paradigms
  • key value database
  • wide column database
  • document oriented database
  • relational database
  • graph database
  • time series database
  • database design

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    My dad used to tell me, use the right tool for the job, and not vice versa.

  2. 0:03

    When it comes to app development, choosing the right database is one of the single most important decisions that you'll ever make.

  3. 0:08

    In today's video, we'll look at 7 different database paradigms, along with some databases you've probably heard of and some others that you haven't.

  4. 0:15

    We'll look at how they work from a technical perspective, but most importantly, we'll try to understand what they're best used for,

  5. 0:20

    because my dad also used to tell me, don't bring a knife to a gunfight.

  6. 0:23

    If you're new here, like and subscribe, and also check out my new top 7 playlist for more videos like this.

  7. 0:28

    Our list will start from the most simple type of database and gradually become more complex

  8. 0:32

    as we get to number 7.

  9. 0:34

    And that brings us to our first paradigm, the key value database.

  10. 0:37

    Popular databases in this space include Redis, Memcached, and Etcd.

  11. 0:41

    The database itself is structured almost like a JavaScript object or Python dictionary.

  12. 0:46

    You have a set of keys where every key is unique and points to some value.

  13. 0:49

    In Redis, for example, we can read and write data using commands.

  14. 0:52

    We use the set command followed by a key and a value to write data,

  15. 0:56

    than the git command to retrieve that data in the future. In the case of Redis and Memcached,

  16. 1:00

    all of the data is held in the machine's memory, as opposed to most other databases that keep all

  17. 1:05

    their data on the disk. This limits the amount of data you can store, however it makes the database

  18. 1:09

    extremely fast because it doesn't require a round trip to the disk for every operation.

  19. 1:13

    In addition, it doesn't perform queries, joins, or anything like that, so your data modeling options

  20. 1:18

    are very limited, but again it's extremely fast, like sub-millisecond fast. You wouldn't want to

  21. 1:22

    to use a key value store for your main app data. Most often, they're used as a cache to reduce data

  22. 1:27

    latency. Apps like Twitter, GitHub, and Snapchat all use Redis for real-time delivery of their data.

  23. 1:33

    There are other use cases beyond caching, like message queues, PubSub, and gaming leaderboards,

  24. 1:38

    but more often than not, key value databases are used as a cache on top of some other persistent

  25. 1:43

    data layer. Now, a database that only supports key value pairs is obviously pretty limited,

  26. 1:47

    and that brings us to the wide column database. Popular options in this family include Cassandra

  27. 1:52

    and HBase. A wide column database is like you took a key value database and added a second dimension

  28. 1:57

    to it. At the outer layer, you have a key space, which holds one or more column families, and each