Engine Variables
On this page
Engine variables are configuration settings that control various aspects of the database's behavior.
SingleStoreDB defines engine variables as either sync or non-sync.
Non-sync variables can be persisted in the engine via the memsql.
file which is a part of the SingleStoreDB Toolbox.
Engine variables can be set globally or per session in scope.SET GLOBAL
command, client connection pools should be flushed to make the new value effective throughout a cluster.Description
column of the list of variables table by the verbiage This is a session variable that can also be set globally
.
Sync |
Non-Sync |
|
Global |
Sync global variables are cluster-wide engine variables that are set on the master aggregator and their values are propagated across the cluster to all relevant nodes. |
Non-sync global engine variables are set locally and independently on each node. |
Session |
Sync session variables are cluster-wide engine variables that are set on the master aggregator and their values are propagated across the cluster to all relevant nodes if set with |
Non-sync session engine variables are set locally and independently on each node. |
The following sections discuss these variables and how to set them.
Sync Variables
Sync variables are cluster-wide variables that you set on the master aggregator.Session that can also be set globally
) and persists if the affected nodes are restarted.
Types of Sync Variables
There are three types of sync variables:
-
Variables that can sync to all aggregators.
-
Variables that can sync to all leaves.
-
Variables that can sync to all nodes (leaves and aggregators).
The last sentence of the Description
column in the list of sync variables specifies each variable’s type.
Sync Variable Scopes
Every variable has one of the following scopes.
-
Global.
When you set a global variable, its value is effective for your current connection to the node and any other existing or subsequent connections, initiated by any user. -
Session that can also be set globally.
When set for the session, the variable’s value is effective for your current connection to the node. When set globally, this variable’s value is NOT effective for your current connection to the node but is effective for any other existing or subsequent connections to the node, initiated by any user.
Important
SingleStore recommends using a global setting for session variables whose values must be propagated to leaf nodes from the aggregator nodes on which the variable is set.
Most sync variables have global scope.session that can also be set globally
are indicated in the Description
column in the list of sync variables.
Note: Use the @@
selector to read the value of a variable.
Setting Sync Variables
Sync variables with global or session scope can be set globally in the following ways.
-
Using a SingleStoreDB client, run one of the following three commands: run SET CLUSTER (the equivalent of SET GLOBAL) to sync a variable to all nodes or to all aggregators; run SET AGGREGATOR to sync a variable to all aggregators; run SET LEAF to sync a variable to all leaves.
Connecting to SingleStore Important
When you set a session variable using SET CLUSTER (or its equivalent SET GLOBAL) or SET AGGREGATOR, you need to additionally run FLUSH CONNECTION POOLS on every aggregator node in the cluster.
This will clear the session variable value saved earlier in the connection pools and enable the aggregator and leaf nodes to use the new value. -
To set the variable’s value to take effect when the node starts, run the following command at the Linux command line to update the node’s configuration.
-
For SingleStoreDB Toolbox: Run sdb-admin update-config.
-
Include the --set-global
flag.-memsql-id
parameter, specify the master aggregator node.
Caution
You can set a sync variable on the Master Aggregator only.
You should not set a sync variable by editing the memsql.
file.
Non-Sync Variables
Non-sync variables are set to take effect on individual nodes.
-
Settable to take effect when a node starts
-
Settable to take effect while a node is running
-
Settable to take effect both when a node starts and while the node is running
-
Read-only (not settable)
Most non-sync variables are settable to take effect both when a node starts and while the node is running.Exceptions to When Variable can be Set
column in the list of non-sync variables.
Non-Sync Variable Scopes
Every non-sync variable has one of the following scopes.
-
Global.
When you set a global variable, its value is effective for your current connection to the node and any other existing or subsequent connections, initiated by any user. -
Session that can also be set globally.
When set for the session, the variable’s value is effective for your current connection to the node. When set globally, this variable’s value is NOT effective for your current connection to the node but is effective for any other existing or subsequent connections to the node, initiated by any user.
Important
SingleStore recommends using a global setting for session variables whose values must be propagated to leaf nodes from the aggregator nodes on which the variable is set.
For session variables that are only referenced by the aggregator nodes, the SET SESSION statement can be used instead.
Most non-sync variables have global scope.session that can also be set globally
are indicated in the Description
column in the list of non-sync variables.
Note: Use the @@
selector to read the value of a variable.
Setting Non-Sync Variables
Non-sync variables with global or session scope can be set globally in the following ways.
-
SET GLOBAL sets a non-sync variable globally and the variable’s value will not persist if the node is restarted.
Important
When you set a session variable using the SET GLOBAL command, you need to additionally run FLUSH CONNECTION POOLS on every aggregator node in the cluster.
This will clear the session variable value saved earlier in the connection pools and enable the aggregator and leaf nodes to use the new value. -
To set the variable’s value to take effect when the node starts, run the following command to update the node’s configuration.
-
For SingleStoreDB Toolbox: Run sdb-admin update-config at the Linux command line.
-
Specify the --all
flag if you want to propagate the non-sync variable’s value to all nodes.--set-global
flag to have the variable’s value take effect immediately (assuming the node is running and the variable can be set at runtime) in addition to when the node restarts.
Caution
When you add new nodes to a cluster, non-sync variables that you set previously are not automatically applied to the new nodes.
Last modified: October 24, 2023