在我的数据库中,有些表内部有超过150,000条记录,并且总是得到警告,指出查询速度慢。
仅在运行MySQL的情况下将自己安装在Windows服务器中。该服务器具有24个线程和32 GB的Ram。使用SSD。
这是my.ini设置:
[mysqld]
port=3306
datadir=C:/ProgramData/MySQL/MySQL Server 8.0/Data
default_authentication_plugin=mysql_native_password
default-storage-engine=INNODB
sql-mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"
log-output=FILE
general-log=0
general_log_file="SERVER1.log"
slow-query-log=1
slow_query_log_file="SERVER1-slow.log"
long_query_time=10
log-error="SERVER1.err"
log-bin="SERVER1-bin"
server-id=1
report_port=3306
lower_case_table_names=1
secure-file-priv="C:/ProgramData/MySQL/MySQL Server 8.0/Uploads"
max_connections=5000
table_open_cache=10000
tmp_table_size=16G
thread_cache_size=10
myisam_max_sort_file_size=100G
myisam_sort_buffer_size=6G
key_buffer_size=4G
read_buffer_size=2G
read_rnd_buffer_size=2G
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1M
innodb_buffer_pool_size=25G
innodb_log_file_size=512M
innodb_thread_concurrency=65
innodb_autoextend_increment=64
innodb_buffer_pool_instances=24
innodb_concurrency_tickets=5000
innodb_old_blocks_time=1000
innodb_open_files=300
innodb_stats_on_metadata=0
innodb_file_per_table=1
innodb_checksum_algorithm=0
back_log=80
flush_time=0
join_buffer_size=1G
max_allowed_packet=1G
max_connect_errors=100
open_files_limit=60000
sort_buffer_size=1G
table_definition_cache=10000
binlog_row_event_max_size=256K
sync_master_info=10000
sync_relay_log=10000
sync_relay_log_info=10000
答案 0 :(得分:0)
您应该在用于连接的列上创建索引,并且可以扩展innodb_max_buffer_size参数值
谢谢