Note
This parameter was introduced in V4.3.5 BP1.
Description
The default_table_organization parameter allows you to set the default table organization method for tables created in a tenant.
Note
Currently, the default_table_organization parameter is supported only in MySQL-compatible mode of OceanBase Database. It is not supported in sys (system) tenants or in Oracle-compatible mode.
Privilege requirements
Query the parameter
You can use the
SHOW PARAMETERSstatement or theGV$OB_PARAMETERSview to query the parameter in thesystenant or any user tenant.Modify the parameter
You can modify the parameter in the
systenant or any user tenant.
Attributes
| Attribute | Description |
|---|---|
| Parameter type | String |
| Default value | INDEX |
| Valid values |
|
| Modifiable | Yes. You can execute the ALTER SYSTEM SET statement to modify it. |
| Effective upon OBServer node restart | No. The setting takes effect immediately. |
Considerations
You can use the default_table_organization parameter to flexibly control the default table organization method for tables created in a tenant. This parameter can be set to either of the following values:
HEAP(heap-organized table):- When this method is used to create a table with a primary key, the data is not stored in order by the primary key column.
- This method is suitable for scenarios that involve handling large amounts of data and performing complex query analysis.
INDEX(index-organized table):- When this method is used to create a table with a primary key, the data is stored in order by the primary key column.
- This method is suitable for transaction processing scenarios that require quick queries and frequent updates.
You can set the default_table_organization parameter to a suitable table organization mode based on your business needs, to optimize system performance and improve data management efficiency.
Examples
Query the current information about the
default_table_organizationparameter.SHOW PARAMETERS LIKE 'default_table_organization';The return result is as follows:
+-------+----------+----------------+----------+----------------------------+-----------+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+---------+-------------------+---------------+-----------+ | 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 setSet the value of the
default_table_organizationparameter toHEAP.ALTER SYSTEM SET default_table_organization = 'HEAP';Query the current information about the
default_table_organizationparameter.SHOW PARAMETERS LIKE 'default_table_organization';The return result is as follows:
+-------+----------+----------------+----------+----------------------------+-----------+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+---------+-------------------+---------------+-----------+ | 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 setCreate a test table named
test_tbl1.CREATE TABLE test_tbl1(col1 INT);Query the definition of the
test_tbl1table.SHOW CREATE TABLE test_tbl1;The return result is as follows:
+-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | 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