最近购买了腾讯云的TDSQL-C云数据库,对于我这种小破站来说,价格划算,完全够用,并且不用再在服务器安装Mysql和phpmyadmin,省出了一大堆内存和空间,加快网站访问速度。
但是如何能够将云数据库的性能最大化呢?或者有时候想要更改数据库的某一项配置。如果原本在服务器安装本地数据库,配置想怎么调就怎么调,只要内存够用就行。现在云数据库只给了我们一个参数面板。我就好好地整理一下这些参数到底是什么意思

我从上往下,整理所有参数的含义
1.auto_increment_increment
//auto_increment_increment
//Controls the interval between successive column values.
//auto_increment_increment控制列中的值的增量值,也就是步长。
2.auto_increment_offset
//auto_increment_offset
//Determines the starting point for the AUTO_INCREMENT column value.
//auto_increment_offset确定AUTO_INCREMENT列值的起点,也就是初始值。
3.back_log
//back_log
//The number of outstanding connection requests MySQL can have.
//
back_log值指出在MySQL暂时停止回答新请求之前的短时间内多少个请求可以被存在堆栈中。也就是说,如果MySql的连接数达到max_connections时,新来的请求将会被存在堆栈中,以等待某一连接释放资源,该堆栈的数量即back_log,如果等待连接的数量超过back_log,将不被授予连接资源。
//可以适当增大该值
4.binlog_checksum
//binlog_checksum
//Include checksum for log events in the binary log. None indicates only check length.
//启用二进制日志中包括日志事件的校验。"无"仅表示检查长度。
//如果需要启用,注意控制大小,以防影响性能
5.binlog_format
//binlog_format
//What form of binary logging the master will use.
//二进制日志的格式,可选:Mixed,Statement,Row,默认格式是 Statement
6.binlog_row_image
//binlog_row_image
//Controls what formats that rows should be logged in.
//控制日志应记录行的格式。
7.character_set_server
//character_set_server
//Specify default server character set
//数据库编码调整
8.connect_timeout
//connect_timeout
//The number of seconds that the mysqld server waits for a connect packet before responding with Bad handshake
//设置连接等待超时的时间,适当调大哦
9.default_week_format
//default_week_format
//The default mode value to use for the WEEK() function
//WEEK()函数使用
10.delayed_insert_limit
//delayed_insert_limit
//After inserting delayed_insert_limit rows, the INSERT DELAYED handler will check if there are any SELECT statements pending. If so, it allows these to execute before continuing.
//插入delayed_insert_limit行后,INSERT DELAYED 处理程序将检查是否有任何挂起的 SELECT 语句。如果是这样,它允许在继续之前执行这些操作
11.delayed_insert_timeout
//delayed_insert_timeout
//How long a INSERT DELAYED thread should wait for INSERT statements before terminating.
//INSERT 延迟线程在终止之前应等待 INSERT 语句多长时间
12.delayed_queue_size
//delayed_queue_size
//What size queue (in rows) should be allocated for handling INSERT DELAYED. If the queue becomes full, any client that does INSERT DELAYED will wait until there is room in the queue again.
//应分配多大的队列(以行为单位)来处理 INSERT DELAYED。如果队列已满,则执行 INSERT DELAYED 的任何客户端都将等待,直到队列中再次有空间
//可适当调整
13.div_precision_increment
//div_precision_increment
//This variable indicates the number of digits by which to increase the scale of the result of division operations performed with the operator
//div_precision_increment 用于设置除法结果精度在被除数精度基础上的增量
14.eq_range_index_dive_limit
//eq_range_index_dive_limit
//The optimizer will use existing index statistics instead of doing index dives for equality ranges if the number of equality ranges for the index is larger than or equal to this number. If set to 0, index dives are always used.
//MySQL在执行等值范围查询例如select … from xxx where xxx in(…)时,优化器在计算执行计划成本时会根据条件个数采用不同的方式以减小选择执行计划的开销。
当条件数N小于eq_range_index_dive_limit时,优化器认为此时条件个数尚可,可以采用成本较高但更为精确的index dive方式来计算执行成本;当N大于或等于eq_range_index_dive_limit时,优化器会认为此时使用index dive的方式计算成本带来的开销过大,此时MySQL优化器会根据index statistics直接估算成本。
15.event_scheduler
//event_scheduler
//This variable indicates the status of the Event Scheduler
//事件调度器是定时触发执行的,在这个角度上也可以称作是"临时的触发器"。触发器只是针对某个表产生的事件执行一些语句,而事件调度器则是在某一个(间隔)时间执行一些语句。事件是由一个特定的线程来管理的,也就是所谓的"事件调度器"。启用事件调度器后,拥有 SUPER 权限的账户执行 SHOW PROCESSLIST 就可以看到这个线程了。通过设定全局变量event_scheduler 的值即可动态的控制事件调度器是否启用。
16.explicit_defaults_for_timestamp
//explicit_defaults_for_timestamp
//This option causes CREATE TABLE to create all TIMESTAMP columns as NULL with DEFAULT NULL attribute, Without this option, TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses.
//决定 MySQL 服务端对timestamp列中的默认值和 NULL 值的不同处理方法
17.ft_min_word_len
//ft_min_word_len
//The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.
//全文索引,默认最小是4
18.ft_query_expansion_limit
//ft_query_expansion_limit
//Number of best matches to use for query expansion
//MyISAM引擎表使用 with query expansion 进行全文搜索的最大匹配数
19.group_concat_max_len
//group_concat_max_len
//The maximum permitted result length in bytes for the GROUP_CONCAT() function
//GROUP_CONCAT()函数允许的最大结果长度(以字节为单位)
20.init_connect
//init_connect
//Set what to be executed by the server for each client that connects. The string consists of one or more SQL statements, separated by semicolon characters
//表示非super用户下在客户端连接上MySQL时隐式执行的一条自定义的SQL语句,所以在使用init_connect功能时常常用于记录一些关键信息在数据库中,然后根据这些相应的关键信息去查找MySQL的binlog日志,所以在使用init_connect的功能时也要确保MySQL的binlog日志记录功能开启。
21.innodb_autoinc_lock_mode
//innodb_autoinc_lock_mode
//The lock mode to use for generating auto-increment values.
//innodb_autoinc_lock_mode这个参数控制着在向有auto_increment 列的表插入数据时,相关锁的行为;
通过对它的设置可以达到性能与安全(主从的数据一致性)的平衡
22.innodb_concurrency_tickets
//innodb_concurrency_tickets
//Determines the number of threads that can enter InnoDB concurrently
//并发控制
23.innodb_ft_enable_stopword
//innodb_ft_enable_stopword
//Create FTS index with stopword.
//指定在创建索引时将一组非索引与索引相关联。如果设置了innodb_ft_user_stopword_table选项,则从该表中获取非索引字。否则,如果设置了innodb_ft_server_stopword_table选项,则从该表中获取非索引字。否则,将使用一组内置的默认非索引字。InnoDBFULLTEXT
24.innodb_ft_max_token_size
//innodb_ft_max_token_size
//Maximum character length of words that are stored in an InnoDB FULLTEXT index.
//默认84,表示最大84个字符作为一个关键词,限制该值可减少全文索引的大小
25.innodb_ft_min_token_size
//innodb_ft_min_token_size
//Minimum length of words that are stored in an InnoDB FULLTEXT index.
存储在 InnoDB 全文索引中的单词的最小长度
26.innodb_ft_server_stopword_table
//innodb_ft_server_stopword_table
//The user supplied stopword table name.
//指定停止词的 innodb 表
27.innodb_ft_user_stopword_table
//innodb_ft_user_stopword_table
//User supplied stopword table name, effective in the session level.
//指定停止词的 innodb 表,innodb_ft_user_stopword_table 的优先级更高
28.innodb_large_prefix
//innodb_large_prefix
//Enable this option to allow index key prefixes longer than 767 bytes (up to 3072 bytes) for InnoDB tables that use the DYNAMIC and COMPRESSED row formats.
//索引长度限制
29.innodb_lock_wait_timeout
//innodb_lock_wait_timeout
//The length of time in seconds an InnoDB transaction waits for a row lock before giving up
//事务等待获取资源等待的最长时间,超过这个时间还未分配到资源则会返回应用失败;
参数的时间单位是秒,最小可设置为1s(一般不会设置得这么小),最大可设置1073741824秒(34年,一条语句锁等待超过30分钟估计业务该有反馈了)
30.innodb_max_dirty_pages_pct
//innodb_max_dirty_pages_pct
//InnoDB tries to flush data from the buffer pool so that the percentage of dirty pages does not exceed this value
//控制buffer pool中脏页的百分比,当脏页数量占比超过这个参数设置的值时,InnoDB会启动刷脏页的操作。
31.innodb_old_blocks_pct
//innodb_old_blocks_pct
//Specifies the approximate percentage of the InnoDB buffer pool used for the old block sublist
//控制进入到sublist of old blocks区域的数量,初始化默认是37
32.innodb_old_blocks_time
//innodb_old_blocks_time
//Specifies the approximate percentage of the InnoDB buffer pool used for the old block sublist
//在访问到sublist of old blocks里面数据的时候控制数据不立即转移到sublist of new blocks区域,而是在多少微秒之后才会真正进入到new区域,这也是防止new区域里面的数据不会立即被踢出
33.innodb_online_alter_log_max_size
//innodb_online_alter_log_max_size
//Maximum modification log file size for online index creation
//在做DDL操作期间,产生的insert,update,delete操作都会记录在一个临时日志文件中,而此临时文件存放在临时排序区(innodb_sort_buffer_size),innodb_sort_buffer_size参数上限由innodb_online_alter_log_max_size参数决定,当修改表数据量过大时,需要几个小时,那么临时日志就需要记录这几个小时的产生的日志,业务量大时,就会将此临时排序区撑爆,此时mysql就会回滚此ddl操作,类似的操作有创建索引,主键等
34.innodb_print_all_deadlocks
//innodb_print_all_deadlocks
//When this option is enabled, information about all deadlocks in InnoDB user transactions is recorded in the mysqld error log.
//当mysql 数据库发生死锁时, innodb status 里面会记录最后一次死锁的相关信息,但mysql 错误日志里面
不会记录死锁相关信息,要想记录,启动 innodb_print_all_deadlocks 参数
35.innodb_purge_batch_size
//innodb_purge_batch_size
//The granularity of changes, expressed in units of redo log records, that trigger a purge operation, flushing the changed buffer pool blocks to disk.
//用来设置每次purge操作需要清理的undo log page的数量
36.innodb_purge_threads
//innodb_purge_threads
//The number of background threads devoted to the InnoDB purge operation.
//purge线程,后台线程,致力于innodb清理,资源回收操作
37.innodb_read_ahead_threshold
//innodb_read_ahead_threshold
//Controls the sensitivity of linear read-ahead that InnoDB uses to prefetch pages into the buffer pool
//控制InnoDB在检测顺序页面访问模式时的灵敏度
38.innodb_read_io_threads
//innodb_read_io_threads
//The number of I/O threads for read operations in InnoDB.
//调整innodb_read_io_threads和innodb_write_io_threads参数来充分利用CPU多核的处理能力
39.innodb_rollback_on_timeout
//innodb_rollback_on_timeout
//InnoDB rolls back only the last statement on a transaction timeout by default. If innodb_rollback_on_timeout is specified, a transaction timeout causes InnoDB to abort and roll back the entire transaction.
//innodb_rollback_on_timeout变量 innodb_rollback_on_timeout是mysql锁超时后的回滚机制
40.innodb_stats_method
//无法理解
41.innodb_stats_on_metadata
//innodb_stats_on_metadata
//When this variable is enabled, InnoDB updates statistics when metadata statements such as SHOW TABLE STATUS or SHOW INDEX are run, or when accessing the INFORMATION_SCHEMA tables TABLES or STATISTICS
//是否自动更新统计信息
42.innodb_stats_transient_sample_pages
//innodb_stats_transient_sample_pages
//The number of leaf index pages to sample when calculating transient statistics
//临时性更新统计信息时候索引页的取样页数,默认值是8
43.innodb_strict_mode
//innodb_strict_mode
//When innodb_strict_mode is ON, InnoDB returns errors rather than warnings for certain conditions
//InnoDB严格模式类似于SQL严格模式。启用后,某些InnoDB警告将变为错误。
44.innodb_table_locks
//innodb_table_locks
//If autocommit = 0, InnoDB honors LOCK TABLES; MySQL does not return from LOCK TABLES ... WRITE until all other threads have released all their locks to the table. The default value of innodb_table_locks is 1, which means that LOCK TABLES causes InnoDB to lock a table internally if autocommit = 0.
//数据库引擎表锁
45.innodb_thread_concurrency
//innodb_thread_concurrency
//InnoDB tries to keep the number of operating system threads concurrently inside InnoDB less than or equal to the limit given by this variable.
//限制线程的数量
46.innodb_thread_sleep_delay
//innodb_thread_sleep_delay
//How long InnoDB threads sleep before joining the InnoDB queue, in microseconds.
//InnoDB 线程在加入 InnoDB 队列之前休眠多长时间(以微秒为单位)。
47.innodb_write_io_threads
//innodb_write_io_threads
//The number of I/O threads for write operations in InnoDB.
//可调整写请求的后台线程数
48.interactive_timeout
//interactive_timeout
//The number of seconds the server waits for activity on an interactive connection before closing it
//服务器关闭交互式连接前等待活动的秒数。交互式客户端定义为在mysql_real_connect()中使用CLIENT_INTERACTIVE选项的客户端
49.key_cache_age_threshold
//key_cache_age_threshold
//This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in key cache.
//控制是否将缓存区从索引缓存的hot sublist中降级到warm list中
50.key_cache_block_size
//key_cache_block_size
//The default size of key cache blocks
//设置内存中存放索引的块大小
51.key_cache_division_limit
//key_cache_division_limit
//The minimum percentage of warm blocks in key cache
//密钥缓存中热块的最小百分比
52.lock_wait_timeout
//lock_wait_timeout
//his variable specifies the timeout in seconds for attempts to acquire metadata locks.
//事务等待获取资源等待的最长时间,超过这个时间还未分配到资源则会返回应用失败
53.log_queries_not_using_indexes
//log_queries_not_using_indexes
//Whether queries that do not use indexes are logged to the slow query log
//不使用索引的查询是否记录到慢速查询日志中
54.log_timestamps
//log_timestamps
//This variable controls the time zone of timestamps in messages written to the error log, and in general query log and slow query log messages written to files.
//此变量控制写入错误日志的消息中的时间戳的时区,以及写入文件的查询日志和慢速查询日志消息中的时间区。
55.long_query_time
//long_query_time
//If a query takes longer than this many seconds, the server increments the Slow_queries status variable
//如果查询时间超过此秒数,服务器将递增Slow_queries状态变量
56.low_priority_updates
//low_priority_updates
//If set to true, all INSERT, UPDATE, DELETE, and LOCK TABLE WRITE statements wait until there is no pending SELECT or LOCK TABLE READ on the affected table
//通过执行命令SET LOW_PRIORITY_UPDATES=1,使该连接发出的更新请求优先级降低
57.lower_case_table_names
//lower_case_table_names
//If set to 0, table names are stored as specified and comparisons are case sensitive. If set to 1, they are stored in lowercase on disk and comparisons are not case sensitive.
//大小写是否敏感
58.max_allowed_packet
//max_allowed_packet
//The maximum size of one packet or any generated/intermediate string.
//限制Server接受的数据包大小
59.max_connect_errors
//max_connect_errors
//If more than this many successive connection requests from a host are interrupted without a successful connection, the server blocks that host from further connections.
//阻止过多尝试失败的客户端以防止暴力破解密码的情况
60.max_connections
//max_connections
//The maximum permitted number of simultaneous client connections.
//设置最大连接(用户)数
61.max_length_for_sort_data
//max_length_for_sort_data
//The cutoff on the size of index values that determines which filesort algorithm to use.
//如果各列长度之和 (包括选择列、排序列)超过了max_length_for_sort_data字节,那么就使用two-pass算法
62.max_prepared_stmt_count
//max_prepared_stmt_count
//This variable limits the total number of prepared statements in the server.
//限制了同一时间在mysqld上所有session中prepared 语句的上限
63.max_user_connections
//max_user_connections
//The maximum permitted number of simultaneous client connections per user.
//对于单个数据库用户允许的最大同时连接数
64.net_read_timeout
//net_read_timeout
//The number of seconds to wait for more data from a connection before aborting the read.
//在终止读之前,从一个连接获得数据而等待的时间秒数;当服务正在从客户端读取数据时,net_read_timeout控制何时超时。
65.net_retry_count
//net_retry_count
//If a read or write on a communication port is interrupted, retry this many times before giving up.
//如果通信端口上的读取或写入中断,在放弃之前重试多次。
66.net_write_timeout
//net_write_timeout
//The number of seconds to wait for a block to be written to a connection before aborting the write.
//在中止写入之前等待块写入连接的秒数。
67.ngram_token_size
//ngram_token_size
//ngram_token_size is set to the size of the largest token that you want to search for.
//要查询的单词的最小字数
68.optimizer_switch
//optimizer_switch
//Control optimizer behavior. Must configed refer to official documentation
//控制优化程序行为。必须配置,请参阅官方文档
69.performance_schema
//performance_schema
//Whether enable the performance schema.
//用于监控MySQL server在一个较低级别的运行过程中的资源消耗、资源等待等情况
70.query_alloc_block_size
//query_alloc_block_size
//The allocation size of memory blocks that are allocated for objects created during statement parsing and execution.
//为查询分析和执行过程中创建的对象分配的内存块大小
71.query_prealloc_size
//query_prealloc_size
//The size of the persistent buffer used for statement parsing and execution. This buffer is not freed between statements.
//用于MySQL对SQL语句进行分析和执行的内存空间设定
72.slow_launch_time
//slow_launch_time
//If creating a thread takes longer than this many seconds, the server increments the Slow_launch_threads status variable
//如果创建线程所需的时间超过此秒数,则服务器将递增Slow_launch_threads状态变量
73.sql_auto_is_null
//sql_auto_is_null
//If this variable is set to 1, then you can find the value of an automatically generated AUTO_INCREMENT value
// 参数默认值为OFF 关闭 0 某些ODBC程序(例如Access)使用通过比较来 检索 AUTO_INCREMENT 值 的行为 [ IS NULL] 在参数值为ON的情况下,可执行 select * from table where id is null
74.sql_mode
//sql_mode
//The current server SQL mode.
//当前服务器 SQL 模式
75.sql_safe_updates
//sql_safe_updates
//Attention please, your setting is the session level, you would better set it by init_connect. Set to 1 to restrict UPDATE or DELETE statements must include the WHERE clause or LIMIT clause
//如果这个系统变量设置为1的话,意味着update与delete将会受到限制
76.table_definition_cache
//table_definition_cache
//The number of table definitions (from .frm files) that can be stored in the definition cache.
//可以存储在定义缓存中的表定义(来自 .frm 文件)的数量。
77.table_open_cache
//table_open_cache
//The number of open tables for all threads. Increasing this value increases the number of file descriptors that mysqld requires.
//打开后在缓存中的表数量
78.table_open_cache_instances
//table_open_cache_instances
//The number of table cache instances
//表缓存实例数
79.thread_cache_size
//thread_cache_size
//How many threads we should keep in a cache for reuse
//在缓存中保留多少个线程以供重用
80.time_zone
//time_zone
//Set the global server time zone, default follow the SYSTEM, and it's values can be set in several formats, such as SYSTEM, +8:00, -6:00, Europe/Helsinki etc, For more information, please consult mysql documents
//时区
81.tmp_table_size
//tmp_table_size
//The maximum size of internal in-memory temporary tables. This variable does not apply to user-created MEMORY tables.
//内部内存临时表的最大值,每个线程都要分配
82.tx_isolation
//tx_isolation
//Default transaction isolation level
//默认事务隔离级别
83.wait_timeout
//wait_timeout
//The number of seconds the server waits for activity on a noninteractive connection before closing it
//MySQL服务器关闭非交互连接之前等待的秒数
原创文章,作者:Rosmontics,如若转载,请注明出处:https://rosmontis.com/archives/166