thread_cache_size – responsible for caching client threads after they are disconnected so that they can be reused, for example, when hundreds of connections are made to the server per second, this parameter can greatly improve performance.
Continue reading “Changing thread_cache_size in MySQL”Category Archives: MySQL
Changing innodb_flush_log_at_trx_commit in MySQL
Default value is 1, possible values are 0-2.
0 – Logs are written and flushed to disk once per second. Transactions that have not been flushed out can be lost as a result of a crash.
1 – Logs are written and flushed to disk every time a transaction is committed.
2 – Logs are written after each commit of a transaction and flushed to disk once per second. Transactions that have not been flushed out can be lost in the event of a failure.
How to change innodb_read_io_threads in MySQL
I will give an example of changing innodb_read_io_threads in MySQL.
The innodb_read_io_threads value determines the number of I/O threads for read operations in InnoDB. The default is 4, the minimum possible is 1, the maximum is 64.
How to change innodb_write_io_threads in MySQL
The innodb_write_io_threads value determines the number of I/O threads for writing to InnoDB. The default is 4, the minimum possible is 1, the maximum is 64.
Continue reading “How to change innodb_write_io_threads in MySQL”How to change innodb_thread_concurrency in MySQL
I will give an example of changing innodb_thread_concurrency in MySQL.
Since InnoDB uses operating system threads to process user transactions, the innodb_thread_concurrency parameter allows you to limit them. By default in new MySQL versions the value is 0, which means that there is no limit on the number of simultaneously executed threads and this is correct for modern servers. If you want to limit, then when the limit is reached, the extra threads will wait a certain number of microseconds specified in the innodb_thread_sleep_delay parameter, and then try to get into the queue. Also in MySQL 5.6.3 and higher, the innodb_adaptive_max_sleep_delay parameter was added which allows you to specify the maximum number of microseconds for the innodb_thread_sleep_delay parameter and then InnoDB automatically adjusts innodb_thread_sleep_delay.
Changing max_allowed_packet in MySQL
max_allowed_packet is the maximum size of data that can be transferred in one request. Increase the value when the “Packet too large” error occurs so that the connection is not interrupted.
The default value for MySQL client is 16 MB, for MySQL server 64 MB.
Moving the MySQL data directory to a new location
In this article I will describe the process of moving the MySQL data directory to a separate location, namely on a level 10 raid with 4 disks, this will increase performance.
Continue reading “Moving the MySQL data directory to a new location”Solution “InnoDB Error ib_logfile0 is of different size”
Once increasing the size of “innodb_log_file_size”, I noticed an error in the /var/log/mysql/error.log file:
Continue reading “Solution “InnoDB Error ib_logfile0 is of different size””How to convert MySQL tables from MyISAM to InnoDB
Since InnoDB is more reliable for storing important data and is more efficient with frequent write requests, I will convert MyISAM tables to InnoDB, in old databases, in one of the companies.
Continue reading “How to convert MySQL tables from MyISAM to InnoDB”MySQL Error Solution: Can’t create table ‘tablename’ (errno: 150)
MySQL error: Can’t create table ‘tablename’ (errno: 150) can occur when you, for example, upload a backup and MySQL is powered to create table 1 which refers to table 2, which essentially does not exist yet. You can solve by inserting the lines at the beginning in the backup:
Continue reading “MySQL Error Solution: Can’t create table ‘tablename’ (errno: 150)”