This is related to this question. It does help to get better performance for InnoDB tables.
According to MySQL manual, innodb_flush_log_at_trx_commit is a global dynamic variable. Thus, I can change it using SET GLOBAL command and it seems to be working.
mysql> SET GLOBAL innodb_flush_log_at_trx_commit=2;
Query OK, 0 rows affected
mysql> SHOW VARIABLES LIKE 'innodb_flush_log_at_trx_commit';
+--------------------------------+-------+
| Variable_name | Value |
+--------------------------------+-------+
| innodb_flush_log_at_trx_commit | 2 |
+--------------------------------+-------+
1 row in set
But, it did not make the actual MySQL setting changed. When I updated my.cnf and restarted the MySQL server, it did work. So, I cannot change the global variable at run time?
I prefer the default value innodb_flush_log_at_trx_commit=1, but I need to change it to 2 before I run a restore process for a large database to get faster.
But when the process done, I want to change the value back to 1.
Is it possible to do this at run time?
I don't have access to my.cnf on my shared hosting server.
SET GLOBAL max_connections = 1000;and when I runSHOW VARIABLES LIKE 'max_connections';to see the old value would drive mean nuts until I log out and back in. +1 for this viewpoint that is taken-for-granted and often-forgotten. – RolandoMySQLDBA Dec 07 '12 at 16:51connectis actually new to me in MySQL. I have done that a million times in PostgreSQL and Oracle. I never once thought of MySQL allowing that – RolandoMySQLDBA Dec 07 '12 at 18:15connect). With the value 2, importing 2,241,319 records took 27 mins 43 secs, whereas it took about 1 days with the value 1. The setting seems to be working in the current session but it restored the original setting (frommy.cnf) after restart. – Sithu Dec 11 '12 at 05:02innodb_flush_log_at_trx_commit? Or is it that for all settings, setting theglobalwouldn't affect the current session? – Pacerier Apr 09 '15 at 11:54GLOBAL dynamic variable that has a correspondingSESSIONvariable won't affect currently connected sessions. – Derek Downey Apr 10 '15 at 02:00