这个和postgresql的statement_timeout类似。
如果花费的时间超过 x 秒,我希望出现查询错误。
我知道 SET MAX_EXECUTION_TIME,但这仅影响选择查询,而不影响更新/插入查询。
这个和postgresql的statement_timeout类似。
如果花费的时间超过 x 秒,我希望出现查询错误。
我知道 SET MAX_EXECUTION_TIME,但这仅影响选择查询,而不影响更新/插入查询。
我们最近将一台数据库服务器从Ubuntu 14.04升级到Ubuntu 18.04,同时将MySQL从5.6升级到5.7。
自升级以来,内存使用量增加了一倍以上,从 ~10GB 到 ~23GB(比服务器多)。我们试图保持配置基本相同。我们一直在研究为什么这可能已经有一段时间了,但无济于事。从升级前到升级后,工作负载根本没有变化。
以下是“显示变量”中可能影响内存使用的一些信息:
binlog_stmt_cache_size 32768
binlog_transaction_dependency_history_size 25000
bulk_insert_buffer_size 8388608
ft_max_word_len 84
ft_min_word_len 4
ft_query_expansion_limit 20
ft_stopword_file (built-in)
group_concat_max_len 65535
gtid_executed_compression_period 1000
innodb_buffer_pool_chunk_size 134217728
innodb_buffer_pool_dump_at_shutdown ON
innodb_buffer_pool_instances 4
innodb_buffer_pool_load_at_startup ON
innodb_buffer_pool_size 8589934592
innodb_change_buffer_max_size 25
innodb_ft_cache_size 8000000
innodb_ft_result_cache_limit 2000000000
innodb_ft_total_cache_size 640000000
innodb_log_buffer_size 16777216
innodb_log_file_size 50331648
innodb_max_undo_log_size 1073741824
innodb_online_alter_log_max_size 134217728
join_buffer_size 262144
key_buffer_size 536870912
key_cache_age_threshold 300
key_cache_block_size 1024
key_cache_division_limit 100
max_allowed_packet 134217728
max_binlog_cache_size 18446744073709547520
max_binlog_size 104857600
max_binlog_stmt_cache_size 18446744073709547520
max_connect_errors 100
max_connections 151
max_delayed_threads 20
max_digest_length 1024
max_heap_table_size 1073741824
max_insert_delayed_threads 20
max_join_size 18446744073709551615
max_length_for_sort_data 1024
max_points_in_geometry 65536
max_prepared_stmt_count 16382
max_seeks_for_key 18446744073709551615
max_sort_length 1024
max_tmp_tables 32
max_write_lock_count 18446744073709551615
metadata_locks_cache_size 1024
metadata_locks_hash_instances 8
myisam_max_sort_file_size 9223372036853727232
myisam_mmap_size 18446744073709551615
myisam_sort_buffer_size 8388608
net_buffer_length 16384
parser_max_mem_size 18446744073709551615
query_alloc_block_size 8192
query_cache_limit 1048576
query_cache_min_res_unit 4096
query_cache_size 1048576
query_prealloc_size 8192
range_alloc_block_size 4096
range_optimizer_max_mem_size 8388608
read_buffer_size 131072
read_rnd_buffer_size 262144
sort_buffer_size 262144
sql_select_limit 18446744073709551615
stored_program_cache 256
thread_stack 262144
tmp_table_size 1073741824
不过,大部分还是和以前一样。我们有旧服务器的旧映像(仅使用 10GB RAM),并在该服务器和新服务器上运行 show variables,并使用 pt-config-diff 来确定差异。这是那些(删除主机名和我认为不可能影响内存的东西,例如默认字符集):
55 config differences
Variable showVariablesOutOld.txt showVariablesOutNew.txt
========================= ========================= =========================
eq_range_index_dive_limit 10 200
expire_logs_days 10 5
innodb_checksum_algorithm innodb crc32
innodb_file_format Antelope Barracuda
innodb_file_format_max Antelope Barracuda
innodb_large_prefix OFF ON
innodb_log_buffer_size 8388608 16777216
innodb_max_dirty_pages... 75 75.000000
innodb_max_dirty_pages... 0 0.000000
innodb_purge_threads 1 4
innodb_version 5.6.33 5.7.26
max_allowed_packet 16777216 134217728
myisam_recover_options BACKUP OFF
optimizer_switch index_merge=on,index_m... index_merge=on,index_m...
performance_schema_acc... 100 -1
performance_schema_hos... 100 -1
performance_schema_max... 3504 -1
performance_schema_max... 50 80
performance_schema_max... 7693 -1
performance_schema_max... 200 210
performance_schema_max... 15906 -1
performance_schema_max... 40 50
performance_schema_max... 9102 -1
performance_schema_max... 322 -1
performance_schema_max... 168 193
performance_schema_max... 4000 -1
performance_schema_max... 12500 -1
performance_schema_max... 402 -1
performance_schema_set... 100 -1
performance_schema_set... 100 -1
performance_schema_use... 100 -1
query_cache_size 16777216 1048576
slave_net_timeout 3600 60
slow_query_log_file /var/lib/mysql/ip-172-... /var/lib/mysql/dataver...
sql_mode NO_ENGINE_SUBSTITUTION NO_AUTO_CREATE_USER,NO...
table_open_cache_insta... 1 16
thread_cache_size 8 9
thread_stack 524288 262144
version 5.6.33-0ubuntu0.14.04.... 5.7.26-0ubuntu0.18.04....
version_compile_os debian-linux-gnu Linux
关于可能是什么原因的任何想法?