1. Membuat Tablespace
Format :
CREATE TABLESPACE tablespace_name
ADD DATAFILE 'file_name'
USE LOGFILE GROUP logfile_group
[EXTENT_SIZE [=] extent_size]
[INITIAL_SIZE [=] initial_size]
[AUTOEXTEND_SIZE [=] autoextend_size]
[MAX_SIZE [=] max_size]
[NODEGROUP [=] nodegroup_id]
[WAIT]
[COMMENT [=] comment_text]
ENGINE [=] engine_name
Contoh :
CREATE TABLESPACE tsData;
2. Mengubah Tablespace
Format :
ALTER TABLESPACE tablespace_name
{ADD|DROP} DATAFILE 'file_name'
[INITIAL_SIZE [=] size]
[WAIT]
ENGINE [=] engine_name
Contoh :
ALTER TABLESPACE tsData RENAME TO tsDataNew;
3. Menghapus Tablespace
Format :
DROP TABLESPACE tablespace_name
ENGINE [=] engine_name
Contoh :
DROP TABLESPACE tsDataNew;
4. Melihat list datafile pada tablespace
SELECT LOGFILE_GROUP_NAME, FILE_NAME, EXTRA
FROM INFORMATION_SCHEMA.FILES
WHERE TABLESPACE_NAME = 'tsData' AND FILE_TYPE = 'DATAFILE';
5. Membuat table pada tablespace
CREATE TABLE t1 (
c1 INT STORAGE DISK,
c2 INT STORAGE MEMORY
) TABLESPACE tsData ENGINE NDB;