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.
1 |
yum install pagila |
As you can see above, pagila files were created. Let’s see where it is now.
First, we execute the following command.
1 |
cd / |
Then we are looking for the package with the help of the following command.
1 |
find / -name 'pagila*'; |
We saw the path where the files of pagila are found. Now let’s install them. We’re connecting to postgres for this.
1 |
psql -U postgres |
We are connected with the Postgres user and now we create a pagila database and upload the files in the directories.
1 |
create database pagila; |
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.
1 |
\i /usr/share/pagila/pagila-schema.sql |
We are loading the data with the help of the insert script to the tables created above.
1 |
\i /usr/share/pagila/pagila-insert-data.sql |
Running the alter command in the tables and loading the data with the copy command.
1 |
\i /usr/share/pagila/pagila-data.sql |
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.