PostgreSQL- temporary table space with a configuration table

Although I created a table space to the database, but the operation is still experiencing some problems, we need to create a temporary table space.

 

Configuration Table

Under postgres first understand the configuration table, manually modify various configurations.

Open to see a variety of configurations, including temporary table space.

 

Temporary table space

1. postgres have default temporary table space, may be manually modified

2. postgres temporary table or index table space for temporarily storing a temporary table, but also have some temporary files sql statement, such as sorting, polymerization, etc., also need temporary table space

3. Even if set up table space, temporary tables and temporary files are not automatically stored in the table space, still stored in the default temporary table space

4. Modify the temporary table space required configuration parameters temp_tablespaces, Postgres allow multiple temporary table spaces, separated by commas

5. To improve performance, the temporary table space ships or on the SSD IOPS, and higher throughput partition

 

Modify the temporary table space must first create a table space method [method is to create a simple table space]

$ mkdir -p /data/pg_data/temp_tsp
$ chown -R postgres:postgres /data/pg_data/temp_tsp
postgres=# CREATE TABLESPACE temp01 LOCATION '/data/pg_data/temp_tsp';
CREATE TABLESPACE

 

Set up a temporary table space - level session to take effect

[root@localhost ~]# su postgres
bash-4.2$ psql
could not change directory to "/root"
psql (9.2.24)
Type "help" for help.

postgres=# set temp_tablespaces = 'zns_road';
SET

 

View the temporary table space

postgres=# show temp_tablespaces ;
 temp_tablespaces 
------------------
 zns_road
(1 row)

Setting successful;

 

After the session is closed and re-view

postgres=# show temp_tablespaces;
 temp_tablespaces 
------------------
 
(1 row)

It does not exist.

 

Modify the configuration file - permanent

After modification, execute the following command changes to take effect.

pg_ctl reload

If errors are reported, try the following

bash-4.2$ ./pg_ctl -D /var/lib/pgsql/data reload
server signaled

For details, please refer to the following link.

 

 

References:

https://blog.csdn.net/pg_hgdb/article/details/78712694 start a database error when using pg_ctl

https://blog.csdn.net/jinshi366/article/details/80017541  pg_ctl: no database directory specified and environment variable PGDATA unset , centos 7 postgreSQL

https://blog.csdn.net/dracotianlong/article/details/7828515 pg_ctl - start, stop, restart PostgreSQL

 

Guess you like

Origin www.cnblogs.com/yanshw/p/11387939.html