Unix Technical Forum

Why is my MySQL database so slow

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 ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #21 (permalink)  
Old 02-28-2008, 07:11 AM
Heikki Tuuri
 
Posts: n/a
Default Re: Why is my MySQL database so slow

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
>
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #22 (permalink)  
Old 02-28-2008, 07:11 AM
Heikki Tuuri
 
Posts: n/a
Default Re: Why is my MySQL database so slow

Stefan,

ok, now I read more carefully . You were able to insert 20 rows per second
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 . I personally
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
>>
>>

>
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #23 (permalink)  
Old 02-28-2008, 07:11 AM
Christian Kirsch
 
Posts: n/a
Default Re: Why is my MySQL database so slow

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'.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:27 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com