Hello, team!

As you might know Red Soft has implemented Tablespace support for
RedDatabase 4 which is based on Firebird 4 code base.
I hope we start working on a merge request for Firebird 5 or later but
previously I would like to get agreement about basic user visible
things like the syntax and ODS.

================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
=======

1. CREATE TABLESPACE <TS NAME> FILE '/path/to/file'

2. ALTER TABLESPACE <TS NAME> FILE '/path/to/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 …
TABLESPACE <TS NAME>

5. ALTER TABLE <TABLE NAME> ALTER TABLESPACE <TS NAME>

Data of the table will be moved to the specified tablespace.

6. ALTER TABLE <TABLE NAME> DROP TABLESPACE

Data of the table will be moved to the main database.

7. CREATE INDEX … TABLESPACE {<TS NAME> | DEFAULT}

The index will be created:
  - in the main database file if TABLESPACE is omitted.
  - in the table tablespace for TABLESPACE DEFAULT.
  - or in the specified tablespace.

8. ALTER INDEX <INDEX NAME> ALTER TABLESPACE <TS NAME>

Data of the index will be moved to the specified tablespace.

9. ALTER INDEX <INDEX NAME> DROP TABLESPACE

Data of the index will be moved to 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$SYSTEM_FLAG - SMALLINT
  RDB$DESCRIPTION - BLOB SUBTYPE TEXT SEGMENT SIZE 80
  RDB$OWNER_NAME - CHAR (63)
  RDB$FILE_NAME - VARCHAR (255)
  RDB$OFFLINE - SMALLINT
  RDB$READ_ONLY - SMALLINT

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

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.dat
    TS2 /path/to/tablespace2.dat

It allows you to restore tablespace contents to new places.
If the option is not specified gbak will use old locations for every tablespace.

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.
==================END=========================

First of all, please let me know whether you agree or not with SYNTAX
and ODS parts. Other opinions and suggestions are welcome as well.

-- 
Roman Simakov
https://reddatabase.ru


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to