Skip to main content
Version: 1.0.16

Database Clusters

In the Halo database architecture, a database cluster is similar to a container within which multiple independent databases can be created, each corresponding to a different system — this is known as multi-tenancy. After the database cluster is initialized, three default databases are created: halo0root, template1, and template0.

  • halo0root: The management database, used for cluster management. Do not delete it.

  • template1: As the name suggests, this is a template database. Databases created later using the CREATE DATABASE command are created using it as the template by default.

  • template0: Also a template database. The difference from template1 is that certain database attributes, such as the character set, cannot be changed for databases created from template1, whereas they can be changed for databases created from template0.

Database

In Halo, a database is where data is actually stored. You can use the CREATE DATABASE command to create a database.

A database typically contains multiple different types of objects:

  • Tables

  • Indexes

  • Views

  • Functions

  • Stored procedures

  • Triggers

  • Sequences

  • Constraints

Among these, tables are usually the most fundamental objects. In addition to the above types of objects, there may also be user-defined types, foreign tables, user-defined operators, foreign keys, and so on.

Data Storage Structure

In the Halo database, a database cluster is a collection of databases. Each database is in turn a collection of objects.

Figure 1-2 Database Storage Structure

Figure 1-2 illustrates this relationship. Within a table's data file, the data is internally divided into fixed-length pages, typically 8KB. Pages in each file are sequentially numbered starting from 0, and this number is the page number. A page is typically divided into a page header and data, i.e., the contents of the Page Layout. Data is stored in rows, and each row is further divided into a row header and actual data, i.e., the contents of the Row Layout. The layout of indexes is similar to that of tables.