How to Install Postgresql Sample Database

 

In Postgresql, sometimes we need a sample database when we test. We can use pagila in postgresql.org for this.

You can follow the steps below to install Pagilla.

We’re running the following command to load Pagila’s files.

 

As you can see above, pagila files were created. Let’s see where it is now.

First, we execute the following command.

 

Then we are looking for the package with the help of the following command.

 

We saw the path where the files of pagila are found. Now let’s install them. We’re connecting to postgres for this.

 

We are connected with the Postgres user and now we create a pagila database and upload the files in the directories.

 

After our Pagila database has been created, we connect to the pagila database by typing "\c pagila" and do the following operations respectively.

Objects like scheme, table, type, domain, function are created below.

 

We are loading the data with the help of the insert script to the tables created above.

 

Running the alter command in the tables and loading the data with the copy command.

 

We have created database and insert data into it. You can check the size of the database with the "\l+" command by connecting to psql.

Faruk Erdem
Author: Faruk Erdem

Leave a Reply

Your email address will not be published. Required fields are marked *