MySQL Forums
Forum List  »  Newbie

Growing MySQL database & slower imports
Posted by: Robert Tee
Date: May 11, 2022 08:08PM

Hello - I'm running MySQL v5.7.32. I have 12 databases running on same instance on an 12-core 64gb server.

When I first started running imports from a PHPBB forum, they imported extremely fast. Now, they are getting slower and are taking almost 1 minute per post whereas it was importing around 50 a second. What can I optimize in my,cnf to improve this performance? Current my.cnf:



# MySQL config file for medium systems.
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.

# The following options will be passed to all MySQL clients
[client]
password = MAMP_root_password_MAMP
#port = 9999
socket = /Applications/MAMP/tmp/mysql/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
user = root
#port = 9999
socket = /Applications/MAMP/tmp/mysql/mysql.sock
key_buffer_size = 64M
max_allowed_packet = 500M
#innodb_force_recovery = 0


#general_log = 1
#general_log_file = '/Applications/MAMP/logs/mysql_general.log'

#slow_query_log = 1
#slow_query_log_file = '/Applications/MAMP/logs/mysql_slow_query.log'
#long_query_time = 1


log_timestamps = SYSTEM
explicit_defaults_for_timestamp = 1


table_open_cache = 500
max_connections = 300
interactive_timeout = 300
wait_timeout = 300

MAMP_bind-address_MAMP

# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
MAMP_skip-networking_MAMP

# Use the next two directives to set a specific charater set and collation.
# See https://dev.mysql.com/doc/refman/5.7/en/charset-applications.html
# for more information about character sets and collation.
#character-set-server = utf8mb4
#collation-server = utf8mb4_unicode_ci

# The directive skip-character-set-client-handshake tells the server to ignore
# character set "wishes" from clients. Be careful, with this directive.
# As an alternative you could use the directive
# default-character-set=<some_char_set>
# in the [client] and [mysql] sections of this template.
#skip-character-set-client-handshake

# To enable the server for encrypted connections, use these lines:
#ssl_ca=/path/to/some-ca.pem
#ssl_cert=/path/to/some-server-cert.pem
#ssl_key=/path/to/some-server-key.pem

# See https://dev.mysql.com/doc/refman/5.7/en/creating-ssl-rsa-files.html
# for more information

# To specify in addition that clients are required to use encrypted connections,
# enable the require_secure_transport system variable.
#require_secure_transport=ON

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# Set it to a directory to allow importing and exporting data only from that directory.
# If secure-file-priv is set to NULL operations related to importing and exporting data are disabled.
# Setting secure-file-priv to "" is insecure.
secure_file_priv=""

# lower_case_table_names are automatically set to 2 if the file system for /Library/Application Support/appsolute/MAMP PRO/db/mysql57/ is case insensitive.
#lower_case_table_names=2

# Replication Master Server (default)
# binary logging is required for replication
#log-bin=mysql-bin

# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id = 1

# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
# the syntax is:
#
# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
# where you replace <host>, <user>, <password> by quoted strings and
# <port> by the master's port number (3306 by default).
#
# Example:
#
# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
# MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
# start replication for the first time (even unsuccessfully, for example
# if you mistyped the password in master-password and the slave fails to
# connect), the slave will create a master.info file, and any later
# change in this file to the variables' values below will be ignored and
# overridden by the content of the master.info file, unless you shutdown
# the slave server, delete master.info and restart the slaver server.
# For that reason, you may want to leave the lines below untouched
# (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id = 2
#
# The replication master for this slave - required
#master-host = <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user = <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password = <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port = <port>
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin

# Point the following paths to different dedicated disks
#tmpdir = /tmp/
#log-update = /path-to-dedicated-directory/hostname

# Uncomment the following if you are using BDB tables
#bdb_cache_size = 4M
#bdb_max_lock = 10000

#innodb_data_home_dir = "/Library/Application Support/appsolute/MAMP PRO/db/mysql57"
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = "/Library/Application Support/appsolute/MAMP PRO/db/mysql57"

# Set to the amount of RAM for the most important data cache in MySQL.
# Start at 70% of total RAM for a dedicated server, else 10%.
#innodb_buffer_pool_size = 32G

#innodb_log_file_size = 5M
#innodb_log_buffer_size = 16M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50

# log_bin is a very important data integrity option: logging
# changes to the binary log between backups.
#log_bin

innodb_buffer_pool_instances = 8
innodb_flush_method = O_DIRECT
sync_binlog = 0

# Remove leading # to set the next options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M

# see https://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html for more information
#innodb_force_recovery = 2

[mysqldump]
password = MAMP_root_password_MAMP
quick
max_allowed_packet = 128M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[isamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
myisam_sort_buffer_size = 8M

[mysqlhotcopy]
interactive-timeout

# DONT REMOVE: MAMP PRO my57.cnf template compatibility version: 19

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.