Intro to databases

What is a database? Why are they necessary? How do they work?

A database efficiently stores data on a computer. If all your content was stored in regular files, their content would be read and written the same as if you were to open the file and edit it. This works fine when there is one person editing the file, with limited changes happening to the disk at once. However, databases are designed to handle many concurrent users, and has many strategies to store information on disk to reduce size and increase performance.

CRUD

Create, Reuse, Update, Delete. These are the primary things you will need to do with database records or content in your application. Databases are built to manage this process on your disk, and handle requests from your applications.

SQL

Relational databases use Structured Query Language (SQL) to fetch data. SQL queries allow you to specify which fields to return from which tables, and any additional logic like joining tables, filtering, or sorting.

https://www.digitalocean.com/community/tutorials/a-comparison-of-nosql-database-management-systems-and-models

NoSQL

Databases that are not based on SQL. Mongo is a document database.

https://www.digitalocean.com/community/tutorials/a-comparison-of-nosql-database-management-systems-and-models

Application Database

Most applications need a database to store their content. Mongo is a popular database for Node applications. You may also connect to remote databases you have access to, to fetch content.

Common Databases

Mongo is a popular database for node applications.

Sqlite is a file based database.

Postgres is an open source database.

MySQL is one of the most commonly used databases.

* MySQL is owned by Oracle; MariaDB is an available community fork.

Scaling

When your database holds millions of records, or you have thousands of simultaneous connections, you need to think about scaling your system. This will often require changes across your network infrastructure not just your database.

Sharding means splitting the database into sections so different parts of the data can be stored on separate systems.

Mirroring copies the database to another location, like another region or server to reduce load or allow faster retrieval.

Level
Topics