Creating a TABLESPACE

From: Amn Ojee Uw <amnojeeuw(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Creating a TABLESPACE
Date: 2023-08-16 10:10:30
Message-ID: b099918b-aeb5-397b-b22b-f08a27c61198@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello children!

I am learning how to create a tablespace, and AFAIK this are the steps
to follow.

First step is to create the directory where the database files will be
created, for that I am using the root directory '/database'. This
directory is be owned by the postgres group.

Example :
sudo mkdir /database
sudo chown postgres:postgres /database

I read the following documentation
1.) TABLESPACE
<https://www.postgresql.org/docs/current/sql-createtablespace.html>

2.) seq_page_cost
<https://www.postgresql.org/docs/current/runtime-config-query.html#GUC-SEQ-PAGE-COST>

3.) effective_io_concurrency
<https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-EFFECTIVE-IO-CONCURRENCY>

4.) maintenance_io_concurrency
<https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-MAINTENANCE-IO-CONCURRENCY>

5.) Tablespaces
<https://www.postgresql.org/docs/current/manage-ag-tablespaces.html>

x.) effective_io_concurrency
<https://manpages.debian.org/testing/manpages-dev/posix_fadvise.2.en.html>

I then login PostgreSQL as so : sudo -u postgres psql.

Note : _/*jamiil*/_ is an actual account, it does exist!

I proceed to create the 'TABLESPACE' using the default values in PostgreSQL

CREATE TABLESPACE jme_tablespace OWNER jamiil LOCATION '/database' WITH
tablespace_option = seq_page_cost(1.0), random_page_cost (4.0),
effective_io_concurrency (1), maintenance_io_concurrency (10);

But then I get this error message:
*ERROR:  syntax error at or near "tablespace_option"**
**LINE 1: ...tablespace OWNER jamiil LOCATION '/database' WITH
tablespace...*

What did I go wrong?

This exercise is not imperative, but as a student of PostgreSQL I'd like
to try all there is to learn about PostgreSQL.

Thanks in advance for your time and interest.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ashok Patil 2023-08-16 10:18:00 Re: Query regarding managing Replication
Previous Message Amn Ojee Uw 2023-08-16 09:32:28 Re: A Good Beginner's Book