Home » Performance » MySQL » Sporadically slow MyISAM inserts
Sporadically slow MyISAM inserts [message #1572] Sat, 04 August 2007 16:40 Go to next message
gjuk  is currently offline gjuk
Messages: 2
Registered: August 2007
Junior Member
I have a simple MyISAM table (8 fields; 22 bytes per row plus c. 40 bytes of index per row). Currently, the table has several million rows - and I run frequent bulk inserts, each of a few few hundred thousand rows. Typically, it inserts c. 5000 rows per second, but occasionally a row takes 5-60 seconds to insert. This happens perhaps every 2,000-20,000 rows or so. I notice that the IO wait in Linux 'top' command can go as high as 90% during the insert process, so guess it's to do with disk writing. Is there any buffer which could help?
Thanks!

[Updated on: Sat, 04 August 2007 16:41]

Re: Sporadically slow MyISAM inserts [message #1595 is a reply to message #1572 ] Thu, 16 August 2007 08:13 Go to previous messageGo to next message
Peter  is currently offline Peter
Messages: 405
Registered: August 2006
Senior Member
Super Guru
It could be flushing key buffer or simply dirty pages from MYD file.


Peter Zaitsev, MySQL Performance Expert
MySQL Performance Blog - http://www.mysqlperformanceblog.com
MySQL Consulting http://www.mysqlperformanceblog.com/mysql-consulting/
Re: Sporadically slow MyISAM inserts [message #1609 is a reply to message #1595 ] Thu, 16 August 2007 09:31 Go to previous messageGo to next message
gjuk  is currently offline gjuk
Messages: 2
Registered: August 2007
Junior Member
Thanks Peter

Would there be anything which would identify which of these it was, or how would you fix it?

Alternatively - someone at Rackspace suggested that it might be rebuilding the indexes. Would that sound likely?

Many thanks again!
Re: Sporadically slow MyISAM inserts [message #1610 is a reply to message #1609 ] Thu, 16 August 2007 10:39 Go to previous message
Peter  is currently offline Peter
Messages: 405
Registered: August 2006
Senior Member
Super Guru
Rebuilding indexes can be happen only when you insert to empty table otherwise it does not work

there is index merge which is done with bulk inserts (controlled by bulk_insert_tree_size variable) but it happens on each insert.

I'd probably strace MySQL at the time therer is active disk activity.

Also you can look how your Key% variables are changes if there are a lot of key blocks being written you should see it


Peter Zaitsev, MySQL Performance Expert
MySQL Performance Blog - http://www.mysqlperformanceblog.com
MySQL Consulting http://www.mysqlperformanceblog.com/mysql-consulting/
Previous Topic:Optimizing a search query
Next Topic:Restore of Database Backup
Goto Forum:
  


Current Time: Sun Jul 5 17:33:14 EDT 2009

Total time taken to generate the page: 0.01460 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 2.7.7.
Copyright ©2001-2007 FUD Forum Bulletin Board Software

MySQL is a trademark of Sun Microsystems.
InnoDB is a trademark of Oracle Corp.

Percona Performance Forums are a service of Percona, Inc.
Not affiliated with Sun Microsystems or Oracle Corp.