Hello! ================PROPOSAL v.3=================== GOALS ====== 1) Extend the current limits on database size 2) Keep non active parts of a database on slow disks (having big volume) 3) Split indices from the database etc
SYNTAX ======= Note: MAIN - is a name of the basic database file. 1. CREATE TABLESPACE <TS NAME> FILE '/path/to/file' 2. ALTER TABLESPACE <TS NAME> SET FILE TO '/path/to/file' FILE can contain either an absolute path or a path relative to the primary database file. 3. DROP TABLESPACE <TS NAME> [INCLUDING CONTENTS] If the tablespace contains some database objects the behaviour depends on INCLUDING CONTENTS clause. if it is specified all database objects in the tablespace will be dropped as well. Otherwise there will be an error. 4. CREATE TABLE ... ( ... FIELD TYPE CONSTRAINT ... USING INDEX ... [ [IN] TABLESPACE {<TS NAME> | PRIMARY} ] -- field constraint tablespace ... CONSTRAINT ... USING INDEX ... [ [IN] TABLESPACE {<TS NAME> | PRIMARY} ] -- table constraint tablespace ... ) [ [IN] TABLESPACE <TS NAME> ] if the tablespace name is not specified PRIMARY will be used as default tablespace for the table data. A constraint index will use the tablespace of the table if TABLESPACE is omitted. 5. ALTER TABLE <TABLE NAME> SET TABLESPACE [TO] {<TS NAME> | PRIMARY} Data of the table will be moved to the specified tablespace or the primary database. The indices of the table without explicit TABLESPACE will be moved as well (as if they were created now). (And I cannot think up a good option for it) 6. CREATE INDEX … [ [IN] TABLESPACE {<TS NAME> | PRIMARY} ] The index will be created in the specified tablespace or the primary database. If tablespace is omitted the index will be created in the tablespace of the table. 7. ALTER INDEX <INDEX NAME> SET TABLESPACE [TO] {<TS NAME> | PRIMARY} Data of the index will be moved to the specified tablespace or the primary database. ODS CHANGES ============= A new table RDB$TABLESPACES: RDB$TABLESPACE_ID - SMALLINT RDB$TABLESPACE_NAME - CHAR (63) RDB$SECURITY_CLASS - CHAR (63) RDB$DESCRIPTION - BLOB SUBTYPE TEXT SEGMENT SIZE 80 RDB$OWNER_NAME - CHAR (63) RDB$FILE_NAME - VARCHAR (255) A new field in RDB$INDICES: RDB$TABLESPACE_NAME - CHAR (63) A new field in RDB$RELATION_FIELDS: RDB$TABLESPACE_NAME - CHAR (63) New fields in RDB$RELATIONS: RDB$TABLESPACE_NAME - CHAR (63) RDB$POINTER_PAGE - INTEGER RDB$ROOT_PAGE - INTEGER Add page space id to page number in ods.h:index_root_page. Data type of PageSpaceID changes from USHORT to ULONG. UTILITIES ======== Logical backup -------------------- gbak -b works as usual for now. It gets data from a database transparently working with tablespaces. Logical restore -------------------- gbak -c -TABLESPACE_MAP(PING_FILE) /path/to/file/map/tablespaces The option TABLESPACE_MAP(PING_FILE) specifies a path to the file which maps tablespace names on file names. For example, TS1 /path/to/tablespace1 TS2 /path/to/tablespace2 or directly in the command line gbak -c -ts <TSNAME1>=/path/to/tablespace1 -ts <TSNAME2>=... It allows you to restore tablespace contents to new places. If the option is not specified gbak will use old locations for every tablespace. The initial implementation requires explicitly specifying all tablespace files. Later we can add merging tablespaces or default original paths. SOME DETAILS ============= pag_header in every tablespace is reserved and may be replaced by a new page type. pag_scns and pag_pip are located in every tablespace pag_root is located in the tablespace where a table is located It's possible to create up to 253 tablespaces. nbackup support is postponed. Location of BLOB fields is postponed. Page size is identical for every tablespace and the primary database. Tablespaces are excluded from replication because it's physical layout of a database and a replica may have another one. ==================END========================= -- Roman Simakov Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel