Here is the second version of the proposal. It's taken into account all agreements we made during discussion and we'll do it in this way if there are no objections.
================PROPOSAL====================== 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> FILE '/path/to/file'* FILE can contain either an absolute path or a relative to the main 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 ... *TABLESPACE {<TS NAME> | MAIN}* -- field constraint tablespace ... CONSTRAINT ... USING INDEX ... *TABLESPACE {<TS NAME> | MAIN}* -- table constraint tablespace ... ) *TABLESPACE <TS NAME>* if the tablespace name is not specified *MAIN* will be used as default tablespace for the table data. A constraint will use the tablespace of the table if *TABLESPACE* is omitted. 5. ALTER TABLE <TABLE NAME> *ALTER TABLESPACE {<TS NAME> | MAIN}* Data of the table will be moved to the specified tablespace or the main database. 6. CREATE INDEX … *TABLESPACE {<TS NAME> | MAIN}* The index will be created in the specified tablespace or the main database. If tablespace is omitted the index will be created in the tablespace of the table. 7. ALTER INDEX <INDEX NAME>* ALTER TABLESPACE {<TS NAME> | MAIN}* Data of the index will be moved to the specified tablespace or the main 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. 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 main database. ==================END========================= -- Roman Simakov
Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel