This is a discussion on Why is my MySQL database so slow within the MySQL forums, part of the Database Server Software category; --> Stefan, please post your my.cnf and the printout of: SHOW INNODB STATUS\G during the very slow insert operation. A ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Stefan, please post your my.cnf and the printout of: SHOW INNODB STATUS\G during the very slow insert operation. A commit cannot explain a delay of several seconds unless there is an extremely high concurrent disk workload on your computer. What does the Task Manager say about the CPU usage? Best regards, Heikki Oracle Corp./Innobase Oy InnoDB - transactions, row level locking, and foreign keys for MySQL InnoDB Hot Backup - a hot backup tool for InnoDB which also backs up MyISAM tables http://www.innodb.com/order.php "Stefan Mueller" <seekware-remove-@yahoo.com> kirjoitti viestissä:dmo5tr$1b21$1@news.imp.ch... > Many thanks for your help and all your explanations. > Stefan > > |
| |||
| Stefan, ok, now I read more carefully with the autocommit on. That kind of performance is normal for a slow disk subsystem. The good news about a slow commit time is that it shows that your computer is really flushing something to disk when InnoDB calls the file flush operation on ib_logfile. Many disk subsystems lie to the OS and do not really flush, which can cause even corruption in a power outage. And switching the autocommit off solved your problem recommend using the explicit MySQL command: SET AUTOCOMMIT=0 to swictch it off. Special functions to set the autocommit state in different programming language APIs are often buggy. Please ignore my previous posting! Best regards, Heikki "Heikki Tuuri" <Heikki.Tuuri@innodb.com> kirjoitti viestissä:qWkkf.385$aX.279@read3.inet.fi... > Stefan, > > please post your my.cnf and the printout of: > > SHOW INNODB STATUS\G > > during the very slow insert operation. > > A commit cannot explain a delay of several seconds unless there is an > extremely high concurrent disk workload on your computer. What does the > Task Manager say about the CPU usage? > > Best regards, > > Heikki > > Oracle Corp./Innobase Oy > InnoDB - transactions, row level locking, and foreign keys for MySQL > > InnoDB Hot Backup - a hot backup tool for InnoDB which also backs up > MyISAM tables > http://www.innodb.com/order.php > > > "Stefan Mueller" <seekware-remove-@yahoo.com> kirjoitti > viestissä:dmo5tr$1b21$1@news.imp.ch... >> Many thanks for your help and all your explanations. >> Stefan >> >> > > |
| ||||
| Kai Ruhnau wrote: > Christian Kirsch wrote: > >>Stefan Mueller wrote: >> >>>Hello guys, you are great! >>>Now it takes less than 1 second to add 2000 entries to my MySQL database. I >>>just had to add mysqli_autocommit and mysqli_commit. >>> >>> mysqli_autocommit($link, false); >>> >>> for ($i = 1; $i <= 2000; $i++) { >>> echo $i . "<br>"; >>> mysqli_query($link, "INSERT INTO anmeldungscode (key_anmeldungscode, >>>code) VALUES ($i, 'test')"); >>> } >>> >>> mysqli_commit($link); >>> >> >>The last line is superfluous, unless PHP is even weirder than I think. > > > I don't think so. > mysqli_autocommit($link,false); > switches off MySQLs autocommit (START TRANSACTION). > Without a COMMIT aka mysqli_commit($link) the data would be dropped at > the end of the current connection. You're right of course. I just jumped on the 'autocommit' thingy and did overlook the 'false'. |