PGSQL Tablespace
时间:2010-07-22 来源:prefect
PostgreSQL Tablespaces
使用 tablespaces, at least two ways:
First, if the partition or volume on which the cluster was initialized runs out of space and cannot be extended, a tablespace can be created on a different partition and used until the system can be reconfigured.
Second, tablespaces allow an administrator to use knowledge of the usage pattern of database objects to optimize performance.
定义一个 tablespace, use the CREATE TABLESPACE command, for example:
CREATE TABLESPACE fastspace LOCATION '/mnt/sda1/postgresql/data';
NOTE:The location must be an existing, empty directory that is owned by the PostgreSQL system user. All objects subsequently created within the tablespace will be stored in files underneath this directory.
Creates a table in the tablespace space1:
CREATE TABLE foo(i int) TABLESPACE space1;
use the default_tablespace parameter:
SET default_tablespace = space1; CREATE TABLE foo(i int);
There is also a temp_tablespaces parameter, which determines the placement of temporary tables and indexes, as well as temporary files that are used for purposes such as sorting large data sets. This can be a list of tablespace names, rather than only one, so that the load associated with temporary objects can be spread over multiple tablespaces. A random member of the list is picked each time a temporary object is to be created.
相关阅读 更多 +