System Variables
What is a System Variable?
System variables are server-side key-value pairs. These variables have lifecycles between server restarts (PERSIST), between sessions within a single server lifetime (GLOBAL), and within a single client session (SESSION). Variables for narrowing scopes are initialized hierarchically: PERSIST -> GLOBAL -> SESSION.
How to use System Variables
System variables are most often managed through the SQL shell, although server-startup defaults can be manually set and persisted between server restarts.
For example, @@max_connections has a system default value of 155. We can use the shell to persist a new default for future server startups, immediately materialize a new global default for this and other sessions, change the value only for this session, or some combination of the above.
Difference between MySQL and Dolt System Variables
Dolt only supports a subset of MySQL's system variables at the moment. The ones we do support should have the same lifecycle behavior as MySQL. One exception is that we do not currently support deleting persisted variables.
We also have Dolt-specific system variables, which can be found here. Most dolt specific variables are prefixed with either dolt_... or the database's name (ex: mydb_...). These can be listed in the MySQL shell with show queries: show variables like 'dolt_%'; (see below for output).
Interaction with Dolt Version Control
System variables are maintained outside of version control. Different clones of the same database can have different system variables.
Some system variables impact transaction, merge, and conflict resolution behavior. For example, @@dolt_force_transaction_commit both creates a new Dolt commit for every SQL transaction, and dismisses merge conflicts in the process of auto-executing these commits.
A full list of Dolt system variables and descriptions can be found here.
Example
Reading System Variables
Writing System Variables
Persisting System Variables
Show Dolt Variables
Show Database Variables
Last updated
Was this helpful?