YMatrix
Quick Start
Simulate Time Series Scenarios
Standard Cluster Deployment
Data Modeling
Connecting to The database
Data Writing
Data Migration
Data Query
Scene Application Examples
Federal Query
Maintenance and Monitoring
Global Maintenance
Partition Maintenance
Backup and Restore
Cluster Expansion
Monitoring
Performance Tuning
Troubleshooting
Reference Guide
Tool Guide
Data Type
Storage Engine
Execution Engine
Configuration Parameters
SQL Reference
FAQ
Define a new tablespace.
CREATE TABLESPACE tablespace_name [OWNER username] LOCATION '/path/to/dir'
[WITH (contentID_1='/path/to/dir1'[, contentID_2='/path/to/dir2' ... ], storage_degradation_parameter)]
CREATE TABLESPACE Register and configure a new tablespace for the YMatrix database system. The tablespace name must be different from the name of any existing tablespace in the system. Tablespaces are YMatrix database system objects (global objects) and you can use tablespaces in any database if you have the appropriate privileges.
Tablespaces allow superusers to define the alternate host file system location where the data files containing database objects such as tables and indexes reside.
Users with appropriate privileges can pass tablespace names to CREATE DATABASE, CREATE DATABASE, or CREATE INDEX to store data files for these objects in the specified tablespace.
In the YMatrix database, file system locations must exist on all hosts, including hosts running Master, Standby, each Primary, and each Mirror.
tablespacename
OWNER username
LOCATION '/path/to/dir'
contentID_i='/path/to/dir_i'
storage_degradation_parameter
Tablespaces are supported only on systems that support symbolic links.
CREATE TABLESPACE cannot be executed within a transaction block.
When creating tablespaces, make sure that the file system location has sufficient I/O speed and available disk space.
CREATE TABLESPACE Creates a symbolic link from the pg_tblspc directory in the Master and Segment instance data directory to the directory specified in the command.
The system catalog table pg_tablespace stores tablespace information. This command displays the OID value, name, and owner of the tablespace.
SELECT oid, spcname, spcowner FROM pg_tablespace ;
YMatrix database built-in function gp_tablespace_location(tablespace_oid) displays the tablespace host system file locations for all Segment instances. This command lists the Segment database ID and host system file locations for tablespaces with OID 16385.
SELECT * FROM gp_tablespace_location(16385)
The downgrade storage parameters are described as follows:
| Field name | Unit | Default value | Value range | Description |
|--|--|--|--|--|--|
| oss_accessid | | | 0 ~ 2048 | Access Key |
| oss_secretkey | | | 0 ~ 2048 | Private access key. This field will be encrypted by default, and the ciphertext is saved. The encryption function can be closed through the parameter mx_enable_oss_secretkey_encrypt |
| oss_sessiontoken | | | | 0 ~ 2048 | STS mechanism token. This field will be encrypted by default, and the ciphertext is saved. The encryption function can be closed through the parameter mx_enable_oss_sessiontoken_encrypt |
| oss_region | | cn-north-1 | 0 ~ 2048 | Object service area (no need to fill in the local environment) |
| oss_endpoint | | | 0 ~ 2048 | Object service address |
| oss_bucket | | | 0 ~ 2048 | Object bucket name |
| oss_keyprefix | | | 0 ~ 2048 | Object bucket prefix. Object prefix is similar to a subdirectory and requires that it must end with /
|
| oss_cache_size | MB | 2048 | 1 ~ INT_MAX | Specify the maximum file space that can be occupied in the table space when using file cache object storage |
Create a new tablespace and specify the file system location for Master and all Segment instances:
CREATE TABLESPACE mytblspace LOCATION '/gpdbtspc/mytestspace' ;
Create a new tablespace and specify a location for the Segment instance with content IDs 0 and 1. For Master and Segment instances not listed in the WITH clause, specify the file system location for the tablespace in the LOCATION clause.
CREATE TABLESPACE mytblspace LOCATION '/gpdbtspc/mytestspace' WITH (content0='/temp/mytest', content1='/temp/mytest');
This example specifies the same location for both Segment instances. You can specify a different location for each segment.
Create a tablespace in the cluster for accessing the downgrade storage function:
CREATE TABLESPACE tbs LOCATION '/temp/mytest'
WITH(
oss_accessid='XYwJgHLTWGlk2KmP9Ruc',
oss_secretkey='fk160295luHpQsq2DiaIYaTBAzNCkjgoIMr1OHIT',
oss_endpoint='http://localhost:9000',
oss_bucket='test'
);
CREATE TABLESPACE is a YMatrix database extension.