説明
この構成パラメータは、V4.3.5 BP1バージョンから導入されました。
機能の概要
default_table_organization パラメーターは、新しいテーブルを作成する際のデフォルトのテーブル組織モードを設定します。
説明
現在のバージョンでは、default_table_organization パラメーターはOceanBaseデータベースのMySQLモードのユーザーテナントでのみ適用されます。sys(システム)テナントとOracleモードのユーザーテナントはサポートされていません。
権限要件
パラメーターの確認
sysテナントとすべてのユーザーテナントはSHOW PARAMETERSステートメント、またはGV$OB_PARAMETERSビューを使用してこのパラメーターを確認できます。パラメーターの変更
sysテナントとユーザーテナントはこの構成パラメーターを変更できます。
プロパティの説明
プロパティ |
説明 |
|---|---|
| パラメータタイプ | String |
| デフォルト値 | INDEX |
| 値の範囲 |
|
| 変更は可能か | はい。ALTER SYSTEM SETステートメントを使用して変更できます。 |
| OBServerノードの再起動が必要か | 不要です。設定は即時に反映されます。 |
使用方法
default_table_organization パラメーターを使用することで、デフォルトで作成されるテーブルのテーブル組織モードを柔軟に制御できます。このパラメーターは以下の2つの値に設定できます:
HEAP(ヒープ組織テーブル):- このモードで主キーを持つテーブルを作成する場合、データは主キー列の順序に従ってソートされません。
- このモードは、大量のデータを処理し、複雑なクエリ分析を実行するシナリオに適しています。
INDEX(インデックス組織テーブル):- このモードで主キーを持つテーブルを作成する場合、データは主キー列の順序に従ってソートされます。
- このモードは、高速なクエリと頻繁な更新が必要なトランザクション処理シナリオに適しています。
default_table_organization を設定することで、具体的なニーズに応じて適切なテーブル組織モードを選択し、システムのパフォーマンスを最適化し、データ管理の効率を向上させることができます。
設定例
パラメータ
default_table_organizationの現在の情報を確認します。SHOW PARAMETERS LIKE 'default_table_organization';実行結果は次のとおりです:
+-------+----------+----------------+----------+----------------------------+-----------+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+---------+-------------------+---------------+-----------+ | zone | svr_type | svr_ip | svr_port | name | data_type | value | info | section | scope | source | edit_level | default_value | isdefault | +-------+----------+----------------+----------+----------------------------+-----------+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+---------+-------------------+---------------+-----------+ | zone1 | observer | 100.10.100.100 | 2882 | default_table_organization | STRING | INDEX | The default_organization configuration option allows you to set the default table organization mode to either HEAP (unordered data storage) or INDEX (the data rows are held in an index defined on the primary key for the table) when creating new tables. | TENANT | TENANT | DEFAULT | DYNAMIC_EFFECTIVE | INDEX | 1 | +-------+----------+----------------+----------+----------------------------+-----------+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+---------+-------------------+---------------+-----------+ 1 row in setパラメータ
default_table_organizationの値をHEAPに設定します。ALTER SYSTEM SET default_table_organization = 'HEAP';再度、パラメータ
default_table_organizationの現在の情報を確認します。SHOW PARAMETERS LIKE 'default_table_organization';実行結果は次のとおりです:
+-------+----------+----------------+----------+----------------------------+-----------+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+---------+-------------------+---------------+-----------+ | zone | svr_type | svr_ip | svr_port | name | data_type | value | info | section | scope | source | edit_level | default_value | isdefault | +-------+----------+----------------+----------+----------------------------+-----------+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+---------+-------------------+---------------+-----------+ | zone1 | observer | 100.10.100.100 | 2882 | default_table_organization | STRING | HEAP | The default_organization configuration option allows you to set the default table organization mode to either HEAP (unordered data storage) or INDEX (the data rows are held in an index defined on the primary key for the table) when creating new tables. | TENANT | TENANT | DEFAULT | DYNAMIC_EFFECTIVE | INDEX | 0 | +-------+----------+----------------+----------+----------------------------+-----------+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+---------+-------------------+---------------+-----------+ 1 row in setテストテーブル
test_tbl1を作成します。CREATE TABLE test_tbl1(col1 INT);テーブル
test_tbl1の定義を確認します。SHOW CREATE TABLE test_tbl1;実行結果は次のとおりです:
+-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | test_tbl1 | CREATE TABLE `test_tbl1` ( `col1` int(11) DEFAULT NULL ) ORGANIZATION HEAP DEFAULT CHARSET = utf8mb4 ROW_FORMAT = DYNAMIC COMPRESSION = 'zstd_1.3.8' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE ENABLE_MACRO_BLOCK_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 0 | +-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set