HBase Data Model (Tables, Column Families, Row Keys, etc.)

Tables and Column Families

The basic unit of HBase is a table (Table), and each table can have multiple column families (Family). A table can contain multiple column families, but each column family must belong to the same table.

Table

  • A table in HBase represents a database table.
  • The attribute of a table is the number of column families in it; the size of a table is determined by these column families and the corresponding number of rows.

Column Family

Each column family in HBase can be understood as a table, and each column family corresponds to a specific data domain. Each column family has a name, which can uniquely identify it.

Column Name (Column Key)

Each column in a column family corresponds to a column name, which is the unique naming method for that column in HBase. A column name consists of two parts: the family name (Family Name) and the qualifier name (Qualifier Name).

Row Key

The row key in HBase is the key that uniquely identifies each row of data in a table. A row key is a sequence of values in bytes.

Storage Structure of Tables and Column Families

In HBase, all these components are organized through a secondary index. This index is used to quickly locate the position of data in a table, and through it, efficient range searches, prefix searches, and suffix searches can be performed.

Table Storage Structure

Each table has a primary block (Block), which divides all data in the table into different parts. Each region (Region) contains one or more primary blocks; the region is the highest level used in HBase to organize data.

Column Family Storage Structure

Column families are also organized through indexes, and each column family corresponds to a primary index. The primary index is used to quickly locate the position of each row of data in a table, and through it, efficient range searches, prefix searches, and suffix searches can be performed.

Row Key Storage Structure

In HBase, all these components are organized through a secondary index. This index is used to quickly locate the position of each row of data in a table, and through it, efficient range searches, prefix searches, and suffix searches can be performed.

Summary

HBase's data model (tables, column families, row keys, etc.) is a complex system that provides an efficient database storage structure. This system is used in HBase to organize and store large amounts of data, and through it, efficient range searches, prefix searches, and suffix searches can be performed.