Skip to content

Instantly share code, notes, and snippets.

@joepie91
Created March 25, 2017 22:51
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save joepie91/f9df0b96c600b4fb3946e68a3a3344af to your computer and use it in GitHub Desktop.
Save joepie91/f9df0b96c600b4fb3946e68a3a3344af to your computer and use it in GitHub Desktop.
Database characteristics

NOTE: This is simplified. However, it's a useful high-level model for determining what kind of database you need for your project.

Data models

  • Documents: Single type of thing, no relations
  • Relational: Multiple types of things, relations between different types of things
  • Graph: Single or multiple types of things, relations between different things of the same type

Consistency models

  • Strong consistency: There is a single canonical view of the database, and everything connecting to any node in the database cluster is guaranteed to see the same data at the same moment in time.
  • Eventual consistency: There can be multiple different views of the database (eg. different nodes in the cluster may have a different idea of what the current state of the data is), but once you stop changing stuff, they will eventually converge into a single view.
  • No consistency: There's no guarantee that all nodes in the cluster will ever converge to the same view, whatsoever.

Schemafulness

  • Schemaful: You know the format (fields, types, etc.) of the data upfront. Fields may be optional, but every field you use is defined in the schema upfront.
  • Schemaless: You have no idea what the format is going to be. This is rarely applicable, and only really applies when dealing with storing data from a source that doesn't produce data in a reliable format.
@alextes
Copy link

alextes commented Jul 10, 2017

I struggled to understand the difference between Relational and Graph. In other words, how can you have relations between different things of the same type? Two examples I came up with are for relationships between people. Namely familial relationships and debt. Answering questions like 'how many children does each person with at least one uncle and at most two sisters have?' is maybe hard if we have to store our data the Relational way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment