Setting and Querying KOVAE Parameters and Querying Status Variables
You can configure KOVAE parameters by using the database startup command line, the configuration file, or the dynamic modification during the running of MySQL. Three status variables kovae_enter_times, kovae_execution_times, and kovae_execution_succeed_times are added to KOVAE to check KOVAE-related statistics.
Setting and Querying KOVAE Parameters
Table 1 describes the KOVAE parameters.
Parameter |
Support Startup Command Line Parameters or Not |
Support Startup Configuration Files or Not |
Support Dynamic Modification or Not |
Application Scope |
Type |
Default Value |
Value Range |
Description |
|---|---|---|---|---|---|---|---|---|
secondary_engine_cost_threshold |
Yes |
Yes |
Yes |
Global |
double |
100000 |
0-DBL_MAX (maximum double value) |
Queries the cost threshold for using the secondary engine. When the cost is greater than the cost threshold, the secondary engine will be used for the query execution. |
innodb_parallel_read_threads |
Yes |
Yes |
Yes |
Session |
unsigned long |
4 |
1–256 |
Indicates the number of threads that concurrently read a table. |
kovae_aggregator_hash_type |
Yes |
Yes |
Yes |
Session |
unsigned int |
0 |
0 and 1 |
Indicates the working mode of the Agg operator during hash grouping.
When the number of grouping records is large and the number of grouping result records is small, using mode 1 has a significant improvement effect. When the number of grouping records and the number of grouping result records are both large (the number of grouping result records is far greater than the number of parallel threads of the current query), mode 0 is recommended. |
kovae_hashjoin_batch_num |
Yes |
Yes |
Yes |
Session |
unsigned long |
1024 |
128-4096 |
Indicates the maximum number of partitions in a hash table. |
kovae_log_level |
Yes |
Yes |
Yes |
Global |
unsigned int |
2 |
1–5 |
Indicates the log output level. The log levels and their corresponding values are as follows:
After the log output level is set, logs whose levels are lower than or equal to the configured value will be generated in the error log file of MySQL. |
kovae_memory_buffer_size |
Yes |
Yes |
Yes |
Session |
unsigned longlong |
1073741824 |
268435456-264-1 (maximum unsigned long long value) |
If the memory used by the Sort, Aggregation, HashJoin, and Materialize operators exceeds the number of bytes of the configured value, the flushing process is triggered to reduce the memory usage, which may affect the performance. |
kovae_memory_control |
Yes |
Yes |
Yes |
Global |
bool |
0 |
0 and 1 |
Indicates the main switch of the memory control function. If this parameter is disabled, the memory for parallel queries tends to be requested from the OS. If this parameter is enabled, the memory that can be requested for parallel queries is controlled by the value of kovae_memory_max_size, and all the memory requests for parallel queries from the OS are counted and monitored. |
kovae_memory_max_size |
Yes |
Yes |
Yes |
Global |
longlong |
10*2^30 |
230-263-1 (maximum long long value) |
Indicates the total memory that can be requested for parallel queries. The value of kovae_memory_max_size takes effect only after kovae_memory_control is enabled. If the total number of bytes of the memory requested for all query statements exceeds the value of kovae_memory_max_size, the system cannot continue the parallel query process and memory requests may fail. In this case, the query process automatically exits. NOTE:
The memory control is not strict to single byte, and there may be certain errors. The precision of memory control is affected by the operators and number of parallel queries. The value of kovae_memory_max_size must be less than the available memory to ensure that there is reserved memory. |
kovae_memory_save_num |
Yes |
Yes |
Yes |
Global |
unsigned int |
100 |
0–1000 |
Configures the number of latest parallel query records that can be cached in the information_schema.KOVAE_MEMORY_HISTORY table. After memory control for parallel queries is enabled, you can check historical memory usage records by checking the information_schema.KOVAE_MEMORY_HISTORY table. |
kovae_serial_mode |
Yes |
Yes |
Yes |
Global |
bool |
0 |
0 and 1 |
Specifies whether to enable the serial mode. After this parameter is enabled, only one SQL statement can be executed for a query. |
kovae_threadpool_size |
Yes |
Yes |
Yes |
Global |
unsigned int |
Number of CPU cores. If the number of CPU cores fails to be obtained, the value is 1. |
1–65535 |
Indicates the maximum number of threads that can be reserved in the thread pool. All working threads for parallel queries are requested from the thread pool. When the number of threads in the thread pool is used up, new thread requests are restricted by the kovae_threadpool_stalltime parameter. When the number of requested threads reaches the value of kovae_threadpool_size, new threads can only be requested after the interval specified by kovae_threadpool_stalltime. Generally, the value of kovae_threadpool_size can be set to three to five times the number of available CPU cores. |
kovae_parallel_threads |
Yes |
Yes |
Yes |
Session |
unsigned int |
2 |
1-1000 |
Indicates the maximum number of working threads that can be requested in a single parallel query. Generally, kovae_parallel_threads can be set to the value of kovae_threadpool_size/Number of parallel queries and sessions that are simultaneously executed with a high probability. |
kovae_threadpool_stalltime |
Yes |
Yes |
Yes |
Global |
unsigned int |
1800 |
0-232-1 (maximum unsigned int value) |
When all threads in the thread pool are requested and there are no idle threads, new queries cannot obtain available worker threads. To avoid excessive thread creation and resource waste, a waiting time parameter kovae_threadpool_stalltime is set. Only when the time of two failed requests exceeds the waiting time (in seconds), a new worker thread is created for new parallel queries. Retain the default value of kovae_threadpool_stalltime. |
kovae_statement_history_schema_size |
Yes |
Yes |
No |
Global |
unsigned longlong |
10000 |
100-263-1 (maximum long long value) |
Indicates the maximum number of cached rows in the INFORMATION_SCHEMA.KOVAE_STATEMENT_HISTORY table. The recorded cache is applied for allocation when KOVAE is loaded and released when KOVAE is uninstalled. |
kovae_threads_history_schema_size |
Yes |
Yes |
No |
Global |
unsigned longlong |
100000 |
10000-263-1 (maximum long long value) |
Indicates the maximum number of cached rows in the INFORMATION_SCHEMA.KOVAE_THREADS_HISTORY table. The recorded cache is applied for allocation when KOVAE is loaded and released when KOVAE is uninstalled. |
kovae_memory_detail_history_schema_size |
Yes |
Yes |
No |
Global |
unsigned longlong |
1000000 |
10000-263-1 (maximum long long value) |
Indicates the maximum number of cached rows in the INFORMATION_SCHEMA.KOVAE_MEMORY_DETAIL_HISTORY table. The recorded cache is applied for allocation when KOVAE is loaded and released when KOVAE is uninstalled. |
kovae_buffer_detail_history_schema_size |
Yes |
Yes |
No |
Global |
unsigned longlong |
1000000 |
10000-263-1 (maximum long long value) |
Indicates the maximum number of cached rows in the INFORMATION_SCHEMA.KOVAE_BUFFER_DETAIL_HISTORY table. The recorded cache is applied for allocation when KOVAE is loaded and released when KOVAE is uninstalled. |
kovae_memory_detail_rowadapter |
Yes |
Yes |
Yes |
Global |
bool |
false |
true and false |
Indicates whether the rowadapter operator collects statistics on memory requests and release. If this parameter is enabled, the operator performance slightly deteriorates. |
kovae_memory_detail_tablescan |
Yes |
Yes |
Yes |
Global |
bool |
false |
true and false |
Indicates whether the Tablescan operator collects statistics on memory requests and release. |
kovae_memory_detail_indexrangescan |
Yes |
Yes |
Yes |
Global |
bool |
false |
true and false |
Indicates whether the index range scan operator collects statistics on memory requests and release. |
kovae_memory_detail_indexscan |
Yes |
Yes |
Yes |
Global |
bool |
false |
true and false |
Indicates whether the index scan operator collects statistics on memory requests and release. |
kovae_memory_detail_agg |
Yes |
Yes |
Yes |
Global |
bool |
false |
true and false |
Indicates whether the Agg operator collects statistics on memory requests and release. |
kovae_memory_detail_material |
Yes |
Yes |
Yes |
Global |
bool |
false |
true and false |
Indicates whether the Materialize operator collects statistics on memory requests and release. |
kovae_memory_detail_sort |
Yes |
Yes |
Yes |
Global |
bool |
false |
true and false |
Indicates whether the Sort operator collects statistics on memory requests and release. |
kovae_memory_detail_hashjoin |
Yes |
Yes |
Yes |
Global |
bool |
false |
true and false |
Indicates whether the HashJoin operator collects statistics on memory requests and release. |
kovae_memory_detail_limit |
Yes |
Yes |
Yes |
Global |
bool |
false |
true and false |
Indicates whether the Limit operator collects statistics on memory requests and release. |
kovae_memory_detail_nestedloopjoin |
Yes |
Yes |
Yes |
Global |
bool |
false |
true and false |
Indicates whether the NestedLoopJoin operator collects statistics on memory requests and release. |
kovae_memory_detail_streaming |
Yes |
Yes |
Yes |
Global |
bool |
false |
true and false |
Indicates whether the Streaming operator collects statistics on memory requests and release. |
kovae_buffer_view_tablescan |
Yes |
Yes |
Yes |
Global |
bool |
false |
true and false |
Indicates whether the table scan operator collects statistics on cache usage and release. |
kovae_buffer_view_agg |
Yes |
Yes |
Yes |
Global |
bool |
false |
true and false |
Indicates whether the Agg operator collects statistics on cache usage and release. |
kovae_buffer_view_sort |
Yes |
Yes |
Yes |
Global |
bool |
false |
true and false |
Indicates whether the Sort operator collects statistics on cache usage and release. |
kovae_buffer_view_hashjoin |
Yes |
Yes |
Yes |
Global |
bool |
false |
true and false |
Indicates whether the HashJoin operator collects statistics on cache usage and release. |
kovae_buffer_view_material |
Yes |
Yes |
Yes |
Global |
bool |
false |
true and false |
Indicates whether the Materialize operator collects statistics on cache usage and release. |
- Log in to the MySQL service through the MySQL client.
- Run the following command to set KOVAE parameters:
set variable Parameter_name=Parameter_value; set global variable Parameter_name=Parameter_value;
- Run the following command to check the configured KOVAE parameters:
show variables like "%Parameter_name%";
Querying Status Variables
Three status variables listed in Table 2 are added to KOVAE to check KOVAE-related statistics.
Status Variable |
Description |
|---|---|
kovae_enter_times |
Indicates the number of SQL statements that access KOVAE. |
kovae_execution_times |
Indicates the number of SQL statements filtered by the allowlist control and executed in KOVAE. |
kovae_execution_succeed_times |
Indicates the number of SQL statements that have been executed in KOVAE. |
- Log in to the MySQL service through the MySQL client.
- Run the following command to query the value of a status variable:
show status like "%Status_variable%";