How to move Tablespces to another directory in PostgreSQL

Опубликовано: 19 Октябрь 2024
на канале: IT-INZHENER
6
0

Tablespaces are designed to distribute Postgres clusters across multiple storage devices. Create Tablespace creates a symbolic link in the pg_tblspc directory in the cluster data directory pointing to the newly created tablespace directory.
Unfortunately, there is no command to move tablespaces to different directories.
Therefore, today we will look at how you can very easily and quickly move table spaces from one directory to another

0:00 Start
0:11 Create two directories for table spaces for database files
0:45 Create a table space in the database
1:42 We create a database in our just created tablespace tb_it_inzhener
2:12 We create a table in the tb_it_inzhener tablespace
3:05 We look at the oim of all table spaces
4:05 We look at the path to the directory where the tb_it_inzhener table space is located
4:17 Be sure to stop the database
4:32 Moving the tb_it_inzhener tablespace from directory u01 to u02
5:17 Removing the old tablespace reference
5:20 Create a link to a new directory
5:35 Launching the database
5:47 Checking the result
6:22 The end

#postgres #postgresql #tablespace