In this section, we will start by creating our first database, then we will learn how to delete a database and, finally, how to create a new database from an existing one. We will also analyze the point of view of the DBA. We will see what happens behind the scenes when we create a new database and learn some basic functions useful to the DBA to get an idea of ​​the real size of the databases.
Let's see how to create a database from scratch and what happens behind the scenes when a database is created.
Creating a database
To create the forumdb database from scratch, you will need to execute this simple statement:
CREATE DATABASE databasename
SQL is a case insensitive language, so we can write all the commands with uppercase or lowercase letters.
Now, let's see what happens behind the scenes when we create a new database. PostgreSQL performs the following steps:
- Makes a physical copy of the template database, template1.
- Assigns...